修改数据合并

This commit is contained in:
RenCheng 2025-05-07 09:02:29 +08:00
parent f2ce4bf215
commit 69133f6d97
3 changed files with 32 additions and 31 deletions

View File

@ -6,7 +6,7 @@ const deleteRules = (params)=>deleteAction("/dataMergingRules/deleteRules",param
const queryPage = (params)=>getAction("/dataMergingRules/queryPage",params); const queryPage = (params)=>getAction("/dataMergingRules/queryPage",params);
const queryById = (params)=>getAction("/dataMergingRules/queryById",params); const queryById = (params)=>getAction("/dataMergingRules/queryById",params);
const querytableColumns = (params)=>getAction("/dataMergingRules/getTableColumns",params); const querytableColumns = (params)=>getAction("/dataMergingRules/getTableColumns",params);
const queryRulesByTableName = (params)=>getAction("/dataMergingRules/queryRulesByTableName",params); const getTables = (params)=>getAction("/dataMergingRules/getTables",params);
export { export {
createRules, createRules,
@ -15,5 +15,5 @@ export {
queryPage, queryPage,
queryById, queryById,
querytableColumns, querytableColumns,
queryRulesByTableName getTables
} }

View File

@ -27,9 +27,9 @@
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<a-button type="primary" style="left: 10px" icon="search" @click="getQueryPage">查询</a-button> <a-button type="primary" style="left: 10px" icon="search" @click="getQueryPage">查询</a-button>
</a-col> </a-col>
<!-- <a-col :md="6" :sm="24" style="text-align: right;"> <a-col :md="6" :sm="24" style="text-align: right;">
<a-button type="primary" style="right: 10px" icon="plus" @click="handleAdd">新建</a-button> <a-button type="primary" style="right: 10px" icon="plus" @click="handleAdd">新建</a-button>
</a-col> --> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>

View File

@ -5,20 +5,14 @@
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form-model ref="ruleForm" :model="form" :rules="rules"> <a-form-model ref="ruleForm" :model="form" :rules="rules">
<a-form-model-item label="表名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableName"> <a-form-model-item label="表名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableName">
<a-input v-model="form.tableName" placeholder="请输入" v-decorator="['tableName',{ <a-tree-select v-model="form.tableName" style="width: 100%"
rules: [ :tree-data="treeData" :show-checked-strategy="SHOW_PARENT" search-placeholder="请选项"
{ required: true, message: '表名不能为空' }, :dropdownStyle="{ maxHeight: '400px', overflowY: 'auto'}"/>
{ min: 1, max: 60, message: '长度1-60位' },
],
validateTrigger: 'change'
}]"></a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="判定字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="mergTables"> <a-form-model-item label="合并表" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="mergTables">
<a-input v-if="form.duplicationType == 1" disabled v-model="allText" placeholder="请输入"></a-input> <a-tree-select v-model="form.mergTables" style="width: 100%"
<a-tree-select v-if="form.duplicationType == 2" v-model="checkedList" style="width: 100%"
:tree-data="treeData" multiple :show-checked-strategy="SHOW_PARENT" search-placeholder="请选项" :tree-data="treeData" multiple :show-checked-strategy="SHOW_PARENT" search-placeholder="请选项"
:dropdownStyle="{ maxHeight: '400px', overflowY: 'auto'}"/> :dropdownStyle="{ maxHeight: '400px', overflowY: 'auto'}"/>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</a-spin> </a-spin>
@ -28,7 +22,7 @@
<script> <script>
import JCron from "@/components/jeecg/JCron"; import JCron from "@/components/jeecg/JCron";
import JSelectMultiple from '@/components/jeecg/JSelectMultiple' import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
import { createRules, updateRules, queryById, querytableColumns } from '@/api/dataMergingRules' import { createRules, updateRules, queryById, getTables } from '@/api/dataMergingRules'
import { TreeSelect } from 'ant-design-vue'; import { TreeSelect } from 'ant-design-vue';
const SHOW_PARENT = TreeSelect.SHOW_PARENT; const SHOW_PARENT = TreeSelect.SHOW_PARENT;
@ -74,20 +68,31 @@ export default {
created() { created() {
}, },
methods: { methods: {
getQuerytableColumns(tableName) { getQuerytableColumns(dataType) {
getTables({dataType: dataType}).then(res => {
if (res.code == 200) {
this.treeData = []
res.result.forEach(element => {
this.treeData.push({
title: element,
value: element,
key: element,
})
});
}
})
}, },
handleChange(value) { handleChange(value) {
this.getQuerytableColumns(this.form.tableName) this.getQuerytableColumns( this.dataType )
}, },
add(dataType) { add(dataType) {
this.form = { this.form = {
tableName: null, tableName: null,
mergTables: null mergTables: []
} }
this.dataType = dataType this.dataType = dataType
this.checkedList =[]
this.visible = true; this.visible = true;
this.getQuerytableColumns(dataType)
}, },
eidt(record, dataType) { eidt(record, dataType) {
this.form = { this.form = {
@ -99,12 +104,11 @@ export default {
queryById({ id: record.id }).then(res => { queryById({ id: record.id }).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.form = res.result this.form = res.result
this.checkedList = this.form.mergTables.split(',') this.form.mergTables = this.form.mergTables.split(',')
} }
}) })
} }
this.dataType = dataType this.dataType = dataType
this.getQuerytableColumns(dataType) this.getQuerytableColumns(dataType)
this.visible = true; this.visible = true;
}, },
@ -115,14 +119,11 @@ export default {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
this.confirmLoading = true; this.confirmLoading = true;
if(this.form.duplicationType == 1){ let subdata = this.form;
this.form.judgmentField = 'ALL' subdata.mergTables = this.form.mergTables.join(',')
}else{
this.form.judgmentField = this.checkedList.join(',')
}
console.log('提交', this.form) console.log('提交', this.form)
if (!this.form.id) { if (!this.form.id) {
createRules(this.form).then(res => { createRules(subdata).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$notification.success({ this.$notification.success({
message: '系统提示', message: '系统提示',
@ -140,7 +141,7 @@ export default {
} }
}) })
} else { } else {
updateRules(this.form).then(res => { updateRules(subdata).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$notification.success({ this.$notification.success({
message: '系统提示', message: '系统提示',