|
|
|
@ -0,0 +1,418 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<a-row :gutter="24">
|
|
|
|
|
<a-col :md="24" :sm="24" style="padding: 0 0 0 0">
|
|
|
|
|
<x-card>
|
|
|
|
|
<div slot="content" class="table-page-search-wrapper">
|
|
|
|
|
<vxe-toolbar>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<a-button type="primary" icon="edit" @click="addProject">新增解析器</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-toolbar>
|
|
|
|
|
<vxe-grid
|
|
|
|
|
ref="xGrid"
|
|
|
|
|
v-bind="gridOptions"
|
|
|
|
|
@page-change="handlePageChange"
|
|
|
|
|
@resizable-change="resizableChange"
|
|
|
|
|
>
|
|
|
|
|
<template #parserName_header="{ column }">
|
|
|
|
|
<div class="column-header">
|
|
|
|
|
<span class="tit">{{ column.title }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #parserType_header="{ column }">
|
|
|
|
|
<div class="column-header">
|
|
|
|
|
<span class="tit">{{ column.title }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #processorChain_header="{ column }">
|
|
|
|
|
<div class="column-header">
|
|
|
|
|
<span class="tit">{{ column.title }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #subjectRegex_header="{ column }">
|
|
|
|
|
<div class="column-header">
|
|
|
|
|
<span class="tit">{{ column.title }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #senderRegex_header="{ column }">
|
|
|
|
|
<div class="column-header">
|
|
|
|
|
<span class="tit">{{ column.title }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #attachRegex_header="{ column }">
|
|
|
|
|
<div class="column-header">
|
|
|
|
|
<span class="tit">{{ column.title }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template #operate="{ row }">
|
|
|
|
|
<vxe-button type="text" icon="vxe-icon-edit" @click="editColumns(row)"></vxe-button>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-grid>
|
|
|
|
|
</div>
|
|
|
|
|
</x-card>
|
|
|
|
|
</a-col>
|
|
|
|
|
<add-form ref="addForm" :fromData="addFromData" :type="addFromType" @ok="handleOk" />
|
|
|
|
|
</a-row>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { XCard } from '@/components'
|
|
|
|
|
import columnSetting from '@/components/tableColumnSetting'
|
|
|
|
|
import addForm from './modules/addForm'
|
|
|
|
|
import { mailAccountList, parserList, parserRelationList, saveParserRelation, parseMail } from '@/api/parser'
|
|
|
|
|
import { addConfig } from '@/api/common'
|
|
|
|
|
import initData from './modules/initData'
|
|
|
|
|
export default {
|
|
|
|
|
name: 'ParameterAccount',
|
|
|
|
|
components: {
|
|
|
|
|
XCard,
|
|
|
|
|
columnSetting,
|
|
|
|
|
addForm,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 高级搜索 展开/关闭
|
|
|
|
|
advanced: false,
|
|
|
|
|
// 查询参数
|
|
|
|
|
form: this.$form.createForm(this),
|
|
|
|
|
// 表格
|
|
|
|
|
setVisible: false,
|
|
|
|
|
showColumns: null,
|
|
|
|
|
gridOptions: {
|
|
|
|
|
height: '650',
|
|
|
|
|
border: true,
|
|
|
|
|
resizable: true,
|
|
|
|
|
showOverflow: true,
|
|
|
|
|
// height: 530,
|
|
|
|
|
loading: true,
|
|
|
|
|
stripe: true,
|
|
|
|
|
round: true,
|
|
|
|
|
autoResize: true,
|
|
|
|
|
columnConfig: { resizable: true },
|
|
|
|
|
importConfig: {},
|
|
|
|
|
exportConfig: {},
|
|
|
|
|
pagerConfig: {
|
|
|
|
|
total: 0,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
pageSizes: [10, 20, 50, 100, 200, 500],
|
|
|
|
|
},
|
|
|
|
|
columns: JSON.parse(JSON.stringify(initData.columns)),
|
|
|
|
|
data: [],
|
|
|
|
|
},
|
|
|
|
|
addFromData: {},
|
|
|
|
|
addFromType: 'add',
|
|
|
|
|
tableSortType: '',
|
|
|
|
|
tableSortOrder: '1',
|
|
|
|
|
parserVisible: false,
|
|
|
|
|
parserTableData: [],
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.showColumns = JSON.parse(JSON.stringify(initData.columns))
|
|
|
|
|
// this.getTableList()
|
|
|
|
|
this.parserList()
|
|
|
|
|
},
|
|
|
|
|
mounted() {},
|
|
|
|
|
methods: {
|
|
|
|
|
addParams() {},
|
|
|
|
|
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,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
pageSizes: [10, 20, 50, 100, 200, 500],
|
|
|
|
|
}
|
|
|
|
|
this.gridOptions.data = []
|
|
|
|
|
this.getTableList(queryParam)
|
|
|
|
|
},
|
|
|
|
|
parserList() {
|
|
|
|
|
parserList().then((res) => {
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
this.gridOptions.pagerConfig.total = res.data.total
|
|
|
|
|
this.gridOptions.data = res.data
|
|
|
|
|
this.gridOptions.loading = false
|
|
|
|
|
}
|
|
|
|
|
// 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) => {
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
this.gridOptions.pagerConfig.total = res.data.total
|
|
|
|
|
this.gridOptions.data = res.data.mailAccount
|
|
|
|
|
this.gridOptions.loading = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handlePageChange({ currentPage, pageSize }) {
|
|
|
|
|
console.log(currentPage, pageSize)
|
|
|
|
|
const {
|
|
|
|
|
form: { validateFields },
|
|
|
|
|
} = this
|
|
|
|
|
validateFields((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
if (values.createdTime) {
|
|
|
|
|
const time = values.createdTime.map((item, index) => {
|
|
|
|
|
const str = this.dateFtt('YYYY-MM-DD', item._d)
|
|
|
|
|
return str
|
|
|
|
|
})
|
|
|
|
|
console.log(time)
|
|
|
|
|
values.createdTime = time
|
|
|
|
|
}
|
|
|
|
|
if (values.updataTime) {
|
|
|
|
|
const _time = values.updataTime.map((item, index) => {
|
|
|
|
|
const str = this.dateFtt('YYYY-MM-DD', item._d)
|
|
|
|
|
return str
|
|
|
|
|
})
|
|
|
|
|
console.log(_time)
|
|
|
|
|
values.updataTime = _time
|
|
|
|
|
}
|
|
|
|
|
if (this.gridOptions.pagerConfig.pageSize !== pageSize) {
|
|
|
|
|
console.log('pagesize变化:', pageSize)
|
|
|
|
|
this.gridOptions.pagerConfig.pageSize = pageSize
|
|
|
|
|
// this.editColumnsSave(this.gridOptions.columns, pageSize)
|
|
|
|
|
}
|
|
|
|
|
this.gridOptions.pagerConfig.currentPage = currentPage
|
|
|
|
|
this.gridOptions.pagerConfig.pageSize = pageSize
|
|
|
|
|
|
|
|
|
|
this.getTableList(values)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
toggleAdvanced() {
|
|
|
|
|
this.advanced = !this.advanced
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
tableRefresh() {
|
|
|
|
|
const {
|
|
|
|
|
form: { validateFields },
|
|
|
|
|
} = this
|
|
|
|
|
validateFields((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
this.getTableList(values)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
dateFtt(fmt, date) {
|
|
|
|
|
const o = {
|
|
|
|
|
'Y+': date.getFullYear(),
|
|
|
|
|
'M+': date.getMonth() + 1,
|
|
|
|
|
'D+': date.getDate(),
|
|
|
|
|
'h+': date.getHours(),
|
|
|
|
|
'm+': date.getMinutes(),
|
|
|
|
|
's+': date.getSeconds(),
|
|
|
|
|
}
|
|
|
|
|
for (const k in o) {
|
|
|
|
|
if (new RegExp(`(${k})`).test(fmt)) {
|
|
|
|
|
const str = o[k] + ''
|
|
|
|
|
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : this.padZero(str))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return fmt
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
padZero(num) {
|
|
|
|
|
return new RegExp(/^\d$/g).test(num) ? `0${num}` : num
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
cancelRemove(e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
this.$message.error('取消操作')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
columnChange(data) {
|
|
|
|
|
const arr = []
|
|
|
|
|
data.map((item, index) => {
|
|
|
|
|
if (item.checked) {
|
|
|
|
|
arr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.showColumns = []
|
|
|
|
|
this.showColumns = arr
|
|
|
|
|
this.gridOptions.columns = arr
|
|
|
|
|
this.editColumnsSave(this.gridOptions.columns)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
},
|
|
|
|
|
addProject() {
|
|
|
|
|
this.addFromData = {}
|
|
|
|
|
this.addFromType = 'add'
|
|
|
|
|
this.addFromId = ''
|
|
|
|
|
this.$refs.addForm.add()
|
|
|
|
|
},
|
|
|
|
|
tableReset() {
|
|
|
|
|
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)
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
tableHeaderSort(type) {
|
|
|
|
|
if (this.tableSortType === type) {
|
|
|
|
|
this.tableSortOrder = this.tableSortOrder === '0' ? '1' : '0'
|
|
|
|
|
} else {
|
|
|
|
|
this.tableSortType = type
|
|
|
|
|
this.tableSortOrder = '0'
|
|
|
|
|
}
|
|
|
|
|
this.tableRefresh()
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
resizableChange(e) {
|
|
|
|
|
this.gridOptions.columns[e.columnIndex].width = e.resizeWidth
|
|
|
|
|
this.editColumnsSave(this.gridOptions.columns)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
editColumnsSave(columns = {}, pageSize = this.gridOptions.pagerConfig.pageSize) {
|
|
|
|
|
const data = {
|
|
|
|
|
columns: columns,
|
|
|
|
|
pageSize: pageSize,
|
|
|
|
|
}
|
|
|
|
|
addConfig({
|
|
|
|
|
settingCode: 'rules_project_account',
|
|
|
|
|
settingJson: JSON.stringify(data),
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
console.log('保存成功')
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.right {
|
|
|
|
|
float: right;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
padding-top: 10px;
|
|
|
|
|
}
|
|
|
|
|
.tab-btn {
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
.table-page-search-submitButtons {
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
.ant-btn {
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
}
|
|
|
|
|
.table {
|
|
|
|
|
margin: 8px auto 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.column-header {
|
|
|
|
|
.tit {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
height: 18px;
|
|
|
|
|
line-height: 18px;
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
}
|
|
|
|
|
.icon {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
position: relative;
|
|
|
|
|
width: 20px;
|
|
|
|
|
height: 18px;
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
.icon-btn {
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: 20px;
|
|
|
|
|
height: 9px;
|
|
|
|
|
color: #ccc;
|
|
|
|
|
&.top {
|
|
|
|
|
top: -2px;
|
|
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
&.bottom {
|
|
|
|
|
bottom: 2px;
|
|
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
&.active {
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|