IDCDatasync-vue/src/views/datawashing/tempone/rulesModel.vue

166 lines
6.6 KiB
Vue
Raw Normal View History

2025-04-20 20:42:07 +08:00
<template>
<a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" @ok="handleOk"
@cancel="handleCancel" okText="保存" cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form-model ref="ruleForm" :model="form" :rules="rules">
<a-form-model-item label="表名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableName">
<a-input v-model="form.tableName" placeholder="请输入"></a-input>
</a-form-model-item>
<a-form-model-item label="字符串策略" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stringStrategy">
<a-select v-model="form.stringStrategy">
<a-select-option :value="1">直接删除</a-select-option>
<a-select-option :value="2">复制上条数据</a-select-option>
<a-select-option :value="3">复制下条数据</a-select-option>
<a-select-option :value="4"></a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="数值策略" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="digitStrategy">
<a-select v-model="form.digitStrategy">
<a-select-option :value="1">直接删除</a-select-option>
<a-select-option :value="2">复制上条数据</a-select-option>
<a-select-option :value="3">复制下条数据</a-select-option>
<a-select-option :value="4">前后均值填充</a-select-option>
<a-select-option :value="5">填0</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="时间策略" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dateTimeStrategy">
<a-select v-model="form.dateTimeStrategy">
<a-select-option :value="1">直接删除</a-select-option>
<a-select-option :value="2">前后均值填充</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import JCron from "@/components/jeecg/JCron";
import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
import { createRules, updateRules, queryById } from '@/api/missingvalueRules'
export default {
name: "rulesModal",
components: {
JCron,
JSelectMultiple
},
data() {
return {
title: "操作",
visible: false,
model: {},
confirmLoading: false,
form: {
tableName: null,
stringStrategy: null,
digitStrategy: null,
dateTimeStrategy: null
},
rules: {
tableName: [{ required: true, message: '请输入表名', trigger: 'blur' }],
stringStrategy: [{ required: true, message: '请选择字符串策略', trigger: 'change' }],
digitStrategy: [{ required: true, message: '请选择数值策略', trigger: 'change' }],
dateTimeStrategy: [{ required: true, message: '请选择时间策略', trigger: 'change' }]
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
treeData: []
}
},
created() {
},
methods: {
add() {
this.form = {
tableName: null,
stringStrategy: null,
digitStrategy: null,
2025-05-24 21:07:19 +08:00
dateTimeStrategy: null,
schemaName: null
2025-04-20 20:42:07 +08:00
}
this.visible = true;
},
eidt(record) {
if (record.id) {
queryById({ id: record.id }).then(res => {
if (res.code == 200) {
this.form = res.result
}
})
} else {
this.form = {
id: null,
tableName: record.tableName,
stringStrategy: null,
digitStrategy: null,
2025-05-24 21:07:19 +08:00
dateTimeStrategy: null,
schemaName: record.schemaName
2025-04-20 20:42:07 +08:00
}
}
this.visible = true;
},
close() {
this.visible = false;
},
handleOk() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.confirmLoading = true;
if (!this.form.id) {
createRules(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: '操作失败'
})
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: '操作失败'
})
this.confirmLoading = false
}
})
}
}
});
},
handleCancel() {
this.close()
},
}
}
</script>
<style scoped></style>