提交最新代码

This commit is contained in:
wangchengming 2025-04-20 19:52:29 +08:00
parent 7f63280582
commit 8241ccfc0a
11 changed files with 541 additions and 170 deletions

View File

@ -5,11 +5,13 @@ const updateRules = (params)=>putAction("/dataFormatRules/updateRules",params);
const deleteRules = (params)=>deleteAction("/dataFormatRules/deleteRules",params); const deleteRules = (params)=>deleteAction("/dataFormatRules/deleteRules",params);
const queryPage = (params)=>getAction("/dataFormatRules/queryPage",params); const queryPage = (params)=>getAction("/dataFormatRules/queryPage",params);
const queryById = (params)=>getAction("/dataFormatRules/queryById",params); const queryById = (params)=>getAction("/dataFormatRules/queryById",params);
const queryRulesByTableName = (params)=>getAction("dataFormatRules/queryRulesByTableName",params);
export { export {
createRules, createRules,
updateRules, updateRules,
deleteRules, deleteRules,
queryPage, queryPage,
queryById queryById,
queryRulesByTableName
} }

View File

@ -5,11 +5,13 @@ const updateRules = (params)=>putAction("/typeConversionRules/updateRules",param
const deleteRules = (params)=>deleteAction("/typeConversionRules/deleteRules",params); const deleteRules = (params)=>deleteAction("/typeConversionRules/deleteRules",params);
const queryPage = (params)=>getAction("/typeConversionRules/queryPage",params); const queryPage = (params)=>getAction("/typeConversionRules/queryPage",params);
const queryById = (params)=>getAction("/typeConversionRules/queryById",params); const queryById = (params)=>getAction("/typeConversionRules/queryById",params);
const queryRulesByTableName = (params)=>getAction("typeConversionRules/queryRulesByTableName",params);
export { export {
createRules, createRules,
updateRules, updateRules,
deleteRules, deleteRules,
queryPage, queryPage,
queryById queryById,
queryRulesByTableName
} }

View File

@ -28,9 +28,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>
@ -41,34 +41,33 @@
<!-- 表格区域 --> <!-- 表格区域 -->
<div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;"> <div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;">
<a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading" <a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading"
:pagination="pagination" :scroll="{ y: 'calc(100vh - 380px)' }" rowKey="id" :pagination="pagination" :scroll="{ y: 'calc(100vh - 380px)' }" rowKey="ROW_ID"
@change="handleTableChange"> @change="handleTableChange">
<!-- <span slot="createTime" slot-scope="text, record"> <!-- <span slot="createTime" slot-scope="text, record">
{{ moment(text).format('YYYY-MM-DD') }} {{ moment(text).format('YYYY-MM-DD') }}
</span> --> </span> -->
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record.id)">编辑</a> <a @click="handleEdit(record)">配置</a>
<a-divider type="vertical" /> <!-- <a-divider type="vertical" />
<a @click="handleRemove(record.id)">删除</a> <a @click="handleRemove(record.id)">删除</a> -->
</span> </span>
</a-table> </a-table>
</div> </div>
<div class="linese"></div> <div class="linese"></div>
</a-col> </a-col>
</a-row> </a-row>
<subPage ref="subPage" />
<rulesModel ref="modalForm" @fatherMethod="getQueryPage" />
</a-card> </a-card>
</template> </template>
<script> <script>
import moment from 'moment' import moment from 'moment'
import { deleteRules, queryPage } from '@/api/dataformatsRules' import { queryPage } from '@/api/dataformatsRules'
import { dataTypeQueryAll } from '@/api/dataType' import { dataTypeQueryAll } from '@/api/dataType'
import rulesModel from './rulesModel.vue' import subPage from './subPage.vue'
export default { export default {
name: "dataformatsRules", name: "dataformatsRules",
components: { components: {
rulesModel subPage
}, },
data() { data() {
return { return {
@ -159,41 +158,18 @@ export default {
} }
}) })
}, },
handleAdd() {
this.$refs.modalForm.add(); handleEdit(record) {
this.$refs.modalForm.title = "新增"; console.log('编辑', this.queryParam.dataType)
// this.$refs.modalForm.eidt(record, this.queryParam.dataType);
// this.$refs.modalForm.title = "";
this.$refs.subPage.queryParam.tableName = record.tableName
this.$refs.subPage.datetypeF = this.queryParam.dataType
this.$refs.subPage.title = "配置";
this.$refs.subPage.pagevisible = true
this.$refs.subPage.getTableInfo()
}, },
handleEdit(recordId) {
this.$refs.modalForm.eidt(recordId);
this.$refs.modalForm.title = "编辑";
},
handleRemove(recordId) {
console.log('dfs', recordId)
const _that = this
_that.$confirm({
title: '你确认执行删除操作吗?',
okText: '确认',
cancelText: '取消',
onOk() {
console.log('dfs', recordId)
deleteRules({ id: recordId }).then(res => {
if (res.code === 200) {
_that.$notification.success({
message: '系统提示',
description: res.message
})
_that.getQueryPage()
} else {
_that.$notification.warning({
message: '系统提示',
description: res.message
})
}
})
},
onCancel() { }
})
}
} }
} }
</script> </script>

View File

@ -7,21 +7,15 @@
<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="请输入"></a-input> <a-input v-model="form.tableName" placeholder="请输入"></a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="去重类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="transfStrategy"> <a-form-model-item label="转换字段" :labelCol="labelCol" :wrapperCol="wrapperCol" >
<a-select v-model="form.transfStrategy"> <a-tree-select v-model="checkedList" style="width: 100%"
<a-select-option value="1"> :tree-data="treeData" multiple :show-checked-strategy="SHOW_PARENT" search-placeholder="请选项" />
完全去重
</a-select-option>
<a-select-option value="2">
关键列去重
</a-select-option>
</a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="判定字段" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-model-item label="格式策略" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="transfStrategy">
<!-- <a-input v-if="form.duplicationType == 1" disabled v-model="allText" placeholder="请输入"></a-input> <a-select v-model="form.transfStrategy">
<a-tree-select v-if="form.duplicationType == 2" v-model="this.form.judgmentField" <a-select-option :value="1">转大写</a-select-option>
style="width: 100%" :tree-data="treeData" tree-checkable :show-checked-strategy="SHOW_PARENT" <a-select-option :value="2">转小写</a-select-option>
search-placeholder="请选项" /> --> </a-select>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</a-spin> </a-spin>
@ -32,7 +26,9 @@
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 } from '@/api/dataformatsRules' import { createRules, updateRules, queryById } from '@/api/dataformatsRules'
import { querytableColumns } from '@/api/deEmphasisRules'
import { TreeSelect } from 'ant-design-vue';
const SHOW_PARENT = TreeSelect.SHOW_PARENT;
export default { export default {
name: "rulesModal", name: "rulesModal",
@ -42,17 +38,19 @@ export default {
}, },
data() { data() {
return { return {
SHOW_PARENT,
title: "操作", title: "操作",
visible: false, visible: false,
model: {}, model: {},
confirmLoading: false, confirmLoading: false,
form: { form: {
tableName: null, tableName: null,
transfStrategy: null, transfFileds: null,
transfFileds: null transfStrategy: null
}, },
rules: { rules: {
tableName: [{ required: true, message: '请输入表名', trigger: 'blur' }], tableName: [{ required: true, message: '请输入表名', trigger: 'blur' }],
transfFileds: [{ required: true, message: '请选择', trigger: 'change' }],
transfStrategy: [{ required: true, message: '请选择', trigger: 'change' }] transfStrategy: [{ required: true, message: '请选择', trigger: 'change' }]
}, },
labelCol: { labelCol: {
@ -63,29 +61,65 @@ export default {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 }, sm: { span: 16 },
}, },
treeData: [] treeData: [],
checkedList: []
} }
}, },
created() { created() {
// this.loadData(); // this.loadData();
}, },
methods: { methods: {
add() { getQuerytableColumns(dataType, tableName) {
this.form = { querytableColumns({ dataType: dataType, tableName: tableName }).then(res => {
tableName: null,
transfStrategy: null,
transfFileds: null
}
this.visible = true;
},
eidt(recordId) {
queryById({ id: recordId }).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.form = res.result this.treeData = []
this.visible = true; res.result.forEach(element => {
this.treeData.push({
title: element,
value: element,
key: element,
})
});
} }
}) })
}, },
handleChange(value) {
if (value == 1) {
this.form.judgmentField = 'ALL'
} else {
}
},
add(tableName, dataType) {
this.getQuerytableColumns(dataType, tableName)
this.form = {
tableName: tableName,
transfFileds: null,
transfStrategy: null
}
this.checkedList = []
this.visible = true;
},
eidt(record, dataType1) {
console.log('sfdsafa',record, dataType1)
if (record.id) {
queryById({ id: record.id }).then(res => {
if (res.code == 200) {
this.form = res.result
this.checkedList = res.result.transfFileds.split(',')
}
})
} else {
this.form = {
id: null,
tableName: record.tableName,
transfFileds: null,
transfStrategy: null
}
}
this.getQuerytableColumns(dataType1, record.tableName)
this.visible = true;
},
close() { close() {
this.visible = false; this.visible = false;
}, },
@ -93,6 +127,7 @@ export default {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
this.confirmLoading = true; this.confirmLoading = true;
this.form.transfFileds = this.checkedList.join(',')
if (!this.form.id) { if (!this.form.id) {
createRules(this.form).then(res => { createRules(this.form).then(res => {
if (res.code === 200) { if (res.code === 200) {
@ -106,7 +141,7 @@ export default {
} else { } else {
this.$notification.error({ this.$notification.error({
message: '系统提示', message: '系统提示',
description: '操作失败' description: res.message
}) })
this.confirmLoading = false this.confirmLoading = false
} }
@ -124,7 +159,7 @@ export default {
} else { } else {
this.$notification.error({ this.$notification.error({
message: '系统提示', message: '系统提示',
description: '操作失败' description: res.message
}) })
this.confirmLoading = false this.confirmLoading = false
} }

View File

@ -0,0 +1,159 @@
<template>
<a-modal :title="title" :width="900" :visible="pagevisible" :footer="null"
@cancel="handleCancel" >
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="30">
<a-col :md="20">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
</span>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="24" :sm="24" style="text-align: right;">
<a-button type="primary" style="right: 10px" icon="plus" @click="handleAdd">新建</a-button>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域 -->
<a-row :gutter="30" style="padding: 0 10px;">
<a-col :md="24">
<div class="linese"></div>
<!-- 表格区域 -->
<div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;">
<a-table size="middle" bordered :columns="columns" :data-source="dataSource"
:pagination="false" :scroll="{ y: 'calc(100vh - 380px)' }" rowKey="id"
>
<span slot="transfStrategy" slot-scope="text, record">
<span v-if="text == 1">转大写</span>
<span v-if="text == 2">转小写</span>
</span>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a @click="handleRemove(record.id)">删除</a>
</span>
</a-table>
</div>
<div class="linese"></div>
</a-col>
</a-row>
<rulesModel ref="modalForm" @fatherMethod="getTableInfo" />
</a-card>
</a-modal>
</template>
<script>
import { deleteRules, queryRulesByTableName } from '@/api/dataformatsRules'
import rulesModel from './rulesModel.vue'
export default {
name: "subpage2",
components: {
rulesModel
},
data() {
return {
title: '',
datetypeF: '',
pagevisible: false,
queryParam: {
tableName: null
},
dataSource: [],
columns: [
{
title: '序号',
width: 70,
customRender: (text, record, index) => `${index + 1}`,
},
{
title: '表名',
align: "center",
dataIndex: 'tableName',
},
{
title: '转换字段',
align: "center",
dataIndex: 'transfFileds',
},
{
title: '格式策略',
align: "center",
dataIndex: 'transfStrategy',
scopedSlots: { customRender: 'transfStrategy' },
},
{
title: '操作',
key: 'action',
width: 130,
align: "center",
scopedSlots: { customRender: 'action' },
},
]
}
},
mounted() {
},
computed: {
},
created() { },
methods: {
getTableInfo() {
queryRulesByTableName(this.queryParam).then(res => {
if (res.code == 200) {
this.dataSource = res.result
} else {
this.$notification.error({
message: '系统提示',
description: res.message
})
}
})
},
handleAdd() {
this.$refs.modalForm.add( this.queryParam.tableName, this.datetypeF);
this.$refs.modalForm.title = "新增";
},
handleEdit(record) {
this.$refs.modalForm.eidt(record, this.datetypeF);
this.$refs.modalForm.title = "编辑";
},
handleRemove(recordId) {
console.log('dfs', recordId)
const _that = this
_that.$confirm({
title: '你确认执行删除操作吗?',
okText: '确认',
cancelText: '取消',
onOk() {
console.log('dfs', recordId)
deleteRules({ id: recordId }).then(res => {
if (res.code === 200) {
_that.$notification.success({
message: '系统提示',
description: res.message
})
_that.getTableInfo()
} else {
_that.$notification.warning({
message: '系统提示',
description: res.message
})
}
})
},
onCancel() { }
})
},
handleCancel() {
this.pagevisible = false
},
}
}
</script>

View File

@ -28,9 +28,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>
@ -47,28 +47,27 @@
{{ moment(text).format('YYYY-MM-DD') }} {{ moment(text).format('YYYY-MM-DD') }}
</span> --> </span> -->
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record.id)">编辑</a> <a @click="handleEdit(record)">配置</a>
<a-divider type="vertical" /> <!-- <a-divider type="vertical" />
<a @click="handleRemove(record.id)">删除</a> <a @click="handleRemove(record.id)">删除</a> -->
</span> </span>
</a-table> </a-table>
</div> </div>
<div class="linese"></div> <div class="linese"></div>
</a-col> </a-col>
</a-row> </a-row>
<subPage ref="subPage" />
<rulesModel ref="modalForm" @fatherMethod="getQueryPage" />
</a-card> </a-card>
</template> </template>
<script> <script>
import moment from 'moment' import moment from 'moment'
import { deleteRules, queryPage } from '@/api/datatypeConversionRules' import { queryPage } from '@/api/datatypeConversionRules'
import { dataTypeQueryAll } from '@/api/dataType' import { dataTypeQueryAll } from '@/api/dataType'
import rulesModel from './rulesModel.vue' import subPage from './subPage.vue'
export default { export default {
name: "datatypeConversionRules", name: "datatypeConversionRules",
components: { components: {
rulesModel subPage
}, },
data() { data() {
return { return {
@ -159,41 +158,18 @@ export default {
} }
}) })
}, },
handleAdd() {
this.$refs.modalForm.add(); handleEdit(record) {
this.$refs.modalForm.title = "新增"; console.log('编辑', this.queryParam.dataType)
// this.$refs.modalForm.eidt(record, this.queryParam.dataType);
// this.$refs.modalForm.title = "";
this.$refs.subPage.queryParam.tableName = record.tableName
this.$refs.subPage.datetypeF = this.queryParam.dataType
this.$refs.subPage.title = "配置";
this.$refs.subPage.pagevisible = true
this.$refs.subPage.getTableInfo()
}, },
handleEdit(recordId) {
this.$refs.modalForm.eidt(recordId);
this.$refs.modalForm.title = "编辑";
},
handleRemove(recordId) {
console.log('dfs', recordId)
const _that = this
_that.$confirm({
title: '你确认执行删除操作吗?',
okText: '确认',
cancelText: '取消',
onOk() {
console.log('dfs', recordId)
deleteRules({ id: recordId }).then(res => {
if (res.code === 200) {
_that.$notification.success({
message: '系统提示',
description: res.message
})
_that.getQueryPage()
} else {
_that.$notification.warning({
message: '系统提示',
description: res.message
})
}
})
},
onCancel() { }
})
}
} }
} }
</script> </script>

View File

@ -8,14 +8,8 @@
<a-input v-model="form.tableName" placeholder="请输入"></a-input> <a-input v-model="form.tableName" placeholder="请输入"></a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="列名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="columnName"> <a-form-model-item label="列名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="columnName">
<a-select v-model="form.columnName"> <a-tree-select v-model="form.columnName" style="width: 100%"
<a-select-option :value="1"> :tree-data="treeData" :show-checked-strategy="SHOW_PARENT" search-placeholder="请选项" />
列1
</a-select-option>
<a-select-option :value="2">
列2
</a-select-option>
</a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="数据类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dataType"> <a-form-model-item label="数据类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dataType">
<a-select v-model="form.dataType"> <a-select v-model="form.dataType">
@ -38,7 +32,9 @@
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 } from '@/api/datatypeConversionRules' import { createRules, updateRules, queryById } from '@/api/datatypeConversionRules'
import { querytableColumns } from '@/api/deEmphasisRules'
import { TreeSelect } from 'ant-design-vue';
const SHOW_PARENT = TreeSelect.SHOW_PARENT;
export default { export default {
name: "rulesModal", name: "rulesModal",
@ -48,6 +44,7 @@ export default {
}, },
data() { data() {
return { return {
SHOW_PARENT,
title: "操作", title: "操作",
visible: false, visible: false,
model: {}, model: {},
@ -78,6 +75,20 @@ export default {
// this.loadData(); // this.loadData();
}, },
methods: { methods: {
getQuerytableColumns(dataType, tableName) {
querytableColumns({ dataType: dataType, tableName: tableName }).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) {
if (value == 1) { if (value == 1) {
this.form.judgmentField = 'ALL' this.form.judgmentField = 'ALL'
@ -85,22 +96,33 @@ export default {
} }
}, },
add() { add(tableName, dataType) {
this.getQuerytableColumns(dataType, tableName)
this.form = { this.form = {
tableName: null, tableName: tableName,
columnName: null, columnName: null,
dataType: null, dataType: null,
dataPrecision: null dataPrecision: null
} }
this.visible = true; this.visible = true;
}, },
eidt(recordId) { eidt(record, dataType1) {
queryById({ id: recordId }).then(res => { console.log('sfdsafa',record, dataType1)
if (res.code == 200) { if (record.id) {
this.form = res.result queryById({ id: record.id }).then(res => {
this.visible = true; if (res.code == 200) this.form = res.result
})
} else {
this.form = {
id: null,
tableName: record.tableName,
columnName: null,
dataType: null,
dataPrecision: null
} }
}) }
this.getQuerytableColumns(dataType1, record.tableName)
this.visible = true;
}, },
close() { close() {
this.visible = false; this.visible = false;
@ -122,7 +144,7 @@ export default {
} else { } else {
this.$notification.error({ this.$notification.error({
message: '系统提示', message: '系统提示',
description: '操作失败' description: res.message
}) })
this.confirmLoading = false this.confirmLoading = false
} }
@ -140,7 +162,7 @@ export default {
} else { } else {
this.$notification.error({ this.$notification.error({
message: '系统提示', message: '系统提示',
description: '操作失败' description: res.message
}) })
this.confirmLoading = false this.confirmLoading = false
} }

View File

@ -0,0 +1,168 @@
<template>
<a-modal :title="title" :width="900" :visible="pagevisible" :footer="null"
@cancel="handleCancel" >
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="30">
<a-col :md="20">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
</span>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="24" :sm="24" style="text-align: right;">
<a-button type="primary" style="right: 10px" icon="plus" @click="handleAdd">新建</a-button>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域 -->
<a-row :gutter="30" style="padding: 0 10px;">
<a-col :md="24">
<div class="linese"></div>
<!-- 表格区域 -->
<div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;">
<a-table size="middle" bordered :columns="columns" :data-source="dataSource"
:pagination="false" :scroll="{ y: 'calc(100vh - 380px)' }" rowKey="id"
>
<span slot="dataType" slot-scope="text, record">
<span v-if="text == 1">Int</span>
<span v-if="text == 2">Bigint</span>
<span v-if="text == 3">Varchar</span>
<span v-if="text == 4">Timestamp</span>
<span v-if="text == 5">Number</span>
</span>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a @click="handleRemove(record.id)">删除</a>
</span>
</a-table>
</div>
<div class="linese"></div>
</a-col>
</a-row>
<rulesModel ref="modalForm" @fatherMethod="getTableInfo" />
</a-card>
</a-modal>
</template>
<script>
import { deleteRules, queryRulesByTableName } from '@/api/datatypeConversionRules'
import rulesModel from './rulesModel.vue'
export default {
name: "subpage1",
components: {
rulesModel
},
data() {
return {
title: '',
datetypeF: '',
pagevisible: false,
queryParam: {
tableName: null
},
dataSource: [],
columns: [
{
title: '序号',
width: 70,
customRender: (text, record, index) => `${index + 1}`,
},
{
title: '表名',
align: "center",
dataIndex: 'tableName',
},
{
title: '列名',
align: "center",
dataIndex: 'columnName',
},
{
title: '数据类型',
align: "center",
dataIndex: 'dataType',
scopedSlots: { customRender: 'dataType' },
},
{
title: '数据精度',
align: "center",
dataIndex: 'dataPrecision',
},
{
title: '操作',
key: 'action',
width: 130,
align: "center",
scopedSlots: { customRender: 'action' },
},
]
}
},
mounted() {
},
computed: {
},
created() { },
methods: {
getTableInfo() {
queryRulesByTableName(this.queryParam).then(res => {
if (res.code == 200) {
this.dataSource = res.result
} else {
this.$notification.error({
message: '系统提示',
description: res.message
})
}
})
},
handleAdd() {
this.$refs.modalForm.add( this.queryParam.tableName, this.datetypeF);
this.$refs.modalForm.title = "新增";
},
handleEdit(record) {
this.$refs.modalForm.eidt(record, this.datetypeF);
this.$refs.modalForm.title = "编辑";
},
handleRemove(recordId) {
console.log('dfs', recordId)
const _that = this
_that.$confirm({
title: '你确认执行删除操作吗?',
okText: '确认',
cancelText: '取消',
onOk() {
console.log('dfs', recordId)
deleteRules({ id: recordId }).then(res => {
if (res.code === 200) {
_that.$notification.success({
message: '系统提示',
description: res.message
})
_that.getTableInfo()
} else {
_that.$notification.warning({
message: '系统提示',
description: res.message
})
}
})
},
onCancel() { }
})
},
handleCancel() {
this.pagevisible = false
},
}
}
</script>

View File

@ -181,7 +181,7 @@ export default {
this.$refs.modalForm.dataType = this.queryParam.dataType this.$refs.modalForm.dataType = this.queryParam.dataType
}, },
handleEdit(record) { handleEdit(record) {
this.$refs.modalForm.eidt(record.tableName, this.queryParam.dataType); this.$refs.modalForm.eidt(record, this.queryParam.dataType);
this.$refs.modalForm.title = "配置"; this.$refs.modalForm.title = "配置";
}, },
handleRemove(recordId) { handleRemove(recordId) {

View File

@ -20,8 +20,7 @@
<a-form-model-item label="判定字段" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-model-item label="判定字段" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-if="form.duplicationType == 1" disabled v-model="allText" placeholder="请输入"></a-input> <a-input v-if="form.duplicationType == 1" disabled v-model="allText" placeholder="请输入"></a-input>
<a-tree-select v-if="form.duplicationType == 2" v-model="checkedList" 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" :tree-data="treeData" multiple :show-checked-strategy="SHOW_PARENT" search-placeholder="请选项" />
search-placeholder="请选项" />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
@ -104,9 +103,20 @@ export default {
} }
this.visible = true; this.visible = true;
}, },
eidt(tableName, dataType) { eidt(record, dataType) {
this.form.tableName = tableName if (record.id) {
this.getQuerytableColumns(dataType, tableName) queryById({ id: record.id }).then(res => {
if (res.code == 200) this.form = res.result
})
} else {
this.form = {
id: null,
tableName: record.tableName,
duplicationType: 1,
judgmentField: null
}
}
this.getQuerytableColumns(dataType, record.tableName)
this.visible = true; this.visible = true;
}, },
close() { close() {
@ -119,23 +129,45 @@ export default {
this.form.judgmentField = this.checkedList.join(',') this.form.judgmentField = this.checkedList.join(',')
console.log('提交', this.form) console.log('提交', this.form)
updateRules(this.form).then(res => { if (!this.form.id) {
if (res.code === 200) {
this.$notification.success({ createRules(this.form).then(res => {
message: '系统提示', if (res.code === 200) {
description: res.message this.$notification.success({
}) message: '系统提示',
this.confirmLoading = false description: res.message
this.$emit('fatherMethod') })
this.handleCancel() this.confirmLoading = false
} else { this.$emit('fatherMethod')
this.$notification.error({ this.handleCancel()
message: '系统提示', } else {
description: res.message this.$notification.error({
}) message: '系统提示',
this.confirmLoading = false description: res.message
} })
}) this.confirmLoading = false
}
})
} else {
updateRules(this.form).then(res => {
if (res.code === 200) {
this.$notification.success({
message: '系统提示',
description: res.message
})
this.confirmLoading = false
this.$emit('fatherMethod')
this.handleCancel()
} else {
this.$notification.error({
message: '系统提示',
description: res.message
})
this.confirmLoading = false
}
})
}
} }
}); });
}, },
@ -144,6 +176,4 @@ export default {
}, },
} }
} }
</script> </script>

View File

@ -97,7 +97,8 @@ export default {
}) })
} else { } else {
this.form = { this.form = {
tableName: null, id: null,
tableName: record.tableName,
stringStrategy: null, stringStrategy: null,
digitStrategy: null, digitStrategy: null,
dateTimeStrategy: null dateTimeStrategy: null