From 553107ed7f7260cf19886c4387cf55f098d8df2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=B5=B7?= <963808678@qq.com>
Date: Tue, 14 Feb 2023 15:35:14 +0800
Subject: [PATCH] 2/14
---
src/api/mail.js | 32 +++---
src/views/rulesEngine/mail/index.vue | 146 +++++++++++++++++++--------
2 files changed, 124 insertions(+), 54 deletions(-)
diff --git a/src/api/mail.js b/src/api/mail.js
index c8e140b..67ab799 100644
--- a/src/api/mail.js
+++ b/src/api/mail.js
@@ -15,26 +15,34 @@ export function mailAccountList(parameter) {
data: parameter,
})
}
-
-export function GetInfo(parameter) {
+// 获取解析器列表
+export function parserList(parameter) {
return request({
- url: RuleEngine.GetInfo + '/' + parameter,
+ url: '/api/mail/parserList',
method: 'get',
})
}
-
-export function Save(parameter) {
+// 获取解析器配置列表
+export function parserRelationList(parameter) {
return request({
- url: RuleEngine.Save,
- method: 'post',
- data: parameter,
+ url: '/api/mail/parserRelationList',
+ method: 'get',
+ params: parameter,
})
}
-
-export function Delete(parameter) {
+// 保存解析器配置(单邮箱)
+export function saveParserRelation(data) {
return request({
- url: RuleEngine.Delete,
+ url: '/api/mail/saveParserRelation',
method: 'post',
- data: parameter,
+ data: data,
+ })
+}
+// 发送解析邮件消息
+export function parseMail(parameter) {
+ return request({
+ url: '/api/mail/parseMail',
+ method: 'get',
+ params: parameter,
})
}
diff --git a/src/views/rulesEngine/mail/index.vue b/src/views/rulesEngine/mail/index.vue
index ebca709..e5aaebd 100644
--- a/src/views/rulesEngine/mail/index.vue
+++ b/src/views/rulesEngine/mail/index.vue
@@ -54,7 +54,7 @@
>
重置
查询
- 解析配置
+ 解析配置
@@ -165,7 +174,7 @@ import columnSetting from '@/components/tableColumnSetting'
import addForm from './modules/addForm'
import { GetPage, GetInfo, Save, Delete } from '@/api/rulesEngineProject'
-import { mailAccountList } from '@/api/mail'
+import { mailAccountList, parserList, parserRelationList, saveParserRelation, parseMail } from '@/api/mail'
import { addConfig } from '@/api/common'
import initData from './modules/initData'
export default {
@@ -210,6 +219,8 @@ export default {
addFromType: 'add',
tableSortType: '',
tableSortOrder: '1',
+ parserVisible: false,
+ parserTableData: [],
}
},
watch: {
@@ -223,9 +234,52 @@ export default {
created() {
this.showColumns = JSON.parse(JSON.stringify(initData.columns))
this.getTableList()
+ this.parserList()
},
mounted() {},
methods: {
+ showParserVisible() {
+ let select = this.$refs.xGrid.getCheckboxRecords()
+ if (select.length == 1) {
+ this.parserVisible = true
+ parserRelationList({ mailAccount: select[0].mailAccount }).then((res) => {
+ this.$refs.MailModal.getData().forEach((item) => {
+ item.parserMail = false
+ })
+ this.$refs.MailModal.clearCheckboxRow()
+ this.$refs.MailModal.getData().forEach((item) => {
+ res.data.forEach((item2) => {
+ if (item2.parserId == item.gid) {
+ this.$refs.MailModal.setCheckboxRow(item, true)
+ }
+ })
+ })
+ })
+ } else {
+ this.$message.warning('请仅选择一条!')
+ }
+ },
+ handleOk(e) {
+ let select = this.$refs.MailModal.getCheckboxRecords()
+ let parserIdData = []
+ select.forEach((item) => {
+ parserIdData.push(item.gid)
+ })
+ saveParserRelation({
+ parserId: parserIdData,
+ mailAccount: this.$refs.xGrid.getCheckboxRecords()[0].mailAccount,
+ }).then(() => {
+ this.$refs.MailModal.getData().forEach((item) => {
+ console.log(item)
+ if (item.parserMail) {
+ parseMail({ gid: item.gid }).then((res) => {
+ console.log(res)
+ })
+ }
+ })
+ this.parserVisible = false
+ })
+ },
init(queryParam = {}) {
this.gridOptions.pagerConfig = {
total: 0,
@@ -236,14 +290,21 @@ export default {
this.gridOptions.data = []
this.getTableList(queryParam)
},
-
+ parserList() {
+ parserList().then((res) => {
+ res.data.forEach((item) => {
+ item.parserMail = false
+ })
+ this.parserTableData = res.data
+ console.log(res)
+ })
+ },
getTableList(queryParam = {}) {
mailAccountList({
...queryParam,
page: this.gridOptions.pagerConfig.currentPage,
limit: this.gridOptions.pagerConfig.pageSize,
}).then((res) => {
- console.log(res)
if (res.statusCode == 200) {
this.gridOptions.pagerConfig.total = res.data.total
this.gridOptions.data = res.data.mailAccount
@@ -408,6 +469,7 @@ export default {
},
editColumns(data) {
+ console.log(data)
this.addFromType = 'edit'
this.addFromId = data.pkId
GetInfo(this.addFromId).then((res) => {
@@ -430,39 +492,39 @@ export default {
this.form.resetFields()
this.init()
},
- handleOk() {
- const form = this.$refs.addForm.form
- form.validateFields((errors, values) => {
- if (!errors) {
- console.log('values', values)
- Save({
- pkId: this.addFromId,
- projectCode: values.projectCode,
- projectName: values.projectName,
- projectDesp: values.projectDesp,
- genDate: this.addFromData.genDate,
- genEr: this.addFromData.genEr,
- genName: this.addFromData.genName,
- updDate: this.addFromData.updDate,
- updEr: this.addFromData.updEr,
- updName: this.addFromData.updName,
- })
- .then((res) => {
- this.$refs.addForm.$data.confirmLoading = false
- if (res.succ) {
- this.$message.success('保存成功')
- this.$refs.addForm.handleCancel()
- this.tableRefresh()
- } else {
- this.$message.error(res.msg)
- }
- })
- .catch((err) => {
- console.log(err)
- })
- }
- })
- },
+ // handleOk() {
+ // const form = this.$refs.addForm.form
+ // form.validateFields((errors, values) => {
+ // if (!errors) {
+ // console.log('values', values)
+ // Save({
+ // pkId: this.addFromId,
+ // projectCode: values.projectCode,
+ // projectName: values.projectName,
+ // projectDesp: values.projectDesp,
+ // genDate: this.addFromData.genDate,
+ // genEr: this.addFromData.genEr,
+ // genName: this.addFromData.genName,
+ // updDate: this.addFromData.updDate,
+ // updEr: this.addFromData.updEr,
+ // updName: this.addFromData.updName,
+ // })
+ // .then((res) => {
+ // this.$refs.addForm.$data.confirmLoading = false
+ // if (res.succ) {
+ // this.$message.success('保存成功')
+ // this.$refs.addForm.handleCancel()
+ // this.tableRefresh()
+ // } else {
+ // this.$message.error(res.msg)
+ // }
+ // })
+ // .catch((err) => {
+ // console.log(err)
+ // })
+ // }
+ // })
+ // },
tableHeaderSort(type) {
if (this.tableSortType === type) {