|
|
|
@ -3,7 +3,8 @@ import { Form, FormSchema } from '@/components/Form'
|
|
|
|
|
import { useForm } from '@/hooks/web/useForm'
|
|
|
|
|
import { PropType, reactive, watch } from 'vue'
|
|
|
|
|
import { useValidator } from '@/hooks/web/useValidator'
|
|
|
|
|
import { OPERATION_TYPE_LIST,RULE_TYPE_LIST } from '../constants';
|
|
|
|
|
import { OPERATION_TYPE_LIST,RULE_TYPE_LIST,getRepStoreGeyDataSource,getRepStoreGeySchema,getRepStoreGeyTables } from '../constants';
|
|
|
|
|
import {ref} from "vue"
|
|
|
|
|
|
|
|
|
|
const { required } = useValidator()
|
|
|
|
|
|
|
|
|
@ -21,124 +22,313 @@ const props = defineProps({
|
|
|
|
|
const { formRegister, formMethods } = useForm()
|
|
|
|
|
const { setValues, getFormData, getElFormExpose } = formMethods
|
|
|
|
|
|
|
|
|
|
let gradeShow = ref(true);//下面的三个高级选项是否隐藏
|
|
|
|
|
//当前选中的数据源信息
|
|
|
|
|
let dataSource = reactive({
|
|
|
|
|
dscode:'',
|
|
|
|
|
dsname:'',
|
|
|
|
|
});
|
|
|
|
|
const formSchema = reactive<FormSchema[]>([
|
|
|
|
|
{
|
|
|
|
|
field: 'modelCode',
|
|
|
|
|
label: '模型编码 ',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field: '',
|
|
|
|
|
label: '基础信息 ',
|
|
|
|
|
component: 'Divider',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'dscode',
|
|
|
|
|
label: '数据源',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
on:{
|
|
|
|
|
change:async (value)=>{
|
|
|
|
|
dataSource = value?formSchema[1].componentProps.options.find(item=>item.dscode==value):{};
|
|
|
|
|
if(dataSource.dscode){
|
|
|
|
|
formSchema[5].componentProps.options = await getRepStoreGeySchema(dataSource)?await getRepStoreGeySchema(dataSource):[];
|
|
|
|
|
formSchema[6].componentProps.options = await getRepStoreGeyTables(dataSource)?await getRepStoreGeyTables(dataSource):[];
|
|
|
|
|
}
|
|
|
|
|
// formSchema.find(item=>item.field=='schema')?.componentProps.optionsApi = async ()=>{return await getRepStoreGeySchema(dataSource);}
|
|
|
|
|
// formSchema.find(item=>item.field=='tableName')?.componentProps.optionsApi = async ()=>{return await getRepStoreGeyTables(dataSource);}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
optionApi: async ()=>{return await getRepStoreGeyDataSource()}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'redscode',
|
|
|
|
|
label: '备份数据源',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
optionApi: async ()=>{return await getRepStoreGeyDataSource()}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'storeOperateType',
|
|
|
|
|
label: '操作类型',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
options:OPERATION_TYPE_LIST,
|
|
|
|
|
style:{width:'100%'},
|
|
|
|
|
},
|
|
|
|
|
value:'1'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'storeType',
|
|
|
|
|
label: '类型',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
options:RULE_TYPE_LIST,
|
|
|
|
|
style:{width:'100%'},
|
|
|
|
|
},
|
|
|
|
|
value:'1'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'schema',
|
|
|
|
|
label: 'schema',
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
component: 'Select',
|
|
|
|
|
componentProps:{
|
|
|
|
|
options:[]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'ruleId',
|
|
|
|
|
label: '存储规则id',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"tableName",
|
|
|
|
|
label:'数据表',
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
component: 'Select',
|
|
|
|
|
componentProps:{
|
|
|
|
|
options:[]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'validateResultTable',
|
|
|
|
|
label: '校验结果表',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'beginDate',
|
|
|
|
|
label: '开始日期',
|
|
|
|
|
component: 'DatePicker',
|
|
|
|
|
field:"storeContent",
|
|
|
|
|
label:"数据集合",
|
|
|
|
|
component:"Input",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
valueFormat: 'YYYYMMDD',
|
|
|
|
|
style:{width:'100%'}
|
|
|
|
|
type:'textarea',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'endDate',
|
|
|
|
|
label: '结束日期',
|
|
|
|
|
component: 'DatePicker',
|
|
|
|
|
field:"date",
|
|
|
|
|
label:'日期',
|
|
|
|
|
component:"DatePicker",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
valueFormat: 'YYYYMMDD',
|
|
|
|
|
style:{width:'100%'}
|
|
|
|
|
type:'daterange',
|
|
|
|
|
style:{width:'100%'},
|
|
|
|
|
valueFormat:'YYYYMMDD',
|
|
|
|
|
rangeSeparator:'到',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// field: 'beginDate',
|
|
|
|
|
// label: '开始日期',
|
|
|
|
|
// component: 'DatePicker',
|
|
|
|
|
// componentProps: {
|
|
|
|
|
// valueFormat: 'YYYYMMDD',
|
|
|
|
|
// style:{width:'100%'}
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// field: 'endDate',
|
|
|
|
|
// label: '结束日期',
|
|
|
|
|
// component: 'DatePicker',
|
|
|
|
|
// componentProps: {
|
|
|
|
|
// valueFormat: 'YYYYMMDD',
|
|
|
|
|
// style:{width:'100%'}
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
field: 'dscode',
|
|
|
|
|
label: '数据源',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"controlShowGrade",
|
|
|
|
|
label: `高级(点击${gradeShow.value?'展开':'收起'})`,
|
|
|
|
|
component:"Divider",
|
|
|
|
|
componentProps:{
|
|
|
|
|
contentPosition:"center",
|
|
|
|
|
borderStyle :'dashed',
|
|
|
|
|
style:{
|
|
|
|
|
fontSize:"20px !important",
|
|
|
|
|
color:'rgb(29 127 29) !important',
|
|
|
|
|
},
|
|
|
|
|
onClick:()=>{
|
|
|
|
|
gradeShow.value = !gradeShow.value;
|
|
|
|
|
formSchema.forEach(item=>{
|
|
|
|
|
if(item.field == 'controlShowGrade'){
|
|
|
|
|
item.label = `高级(点击${gradeShow.value?'展开':'收起'})`;
|
|
|
|
|
}
|
|
|
|
|
for(let i in item){
|
|
|
|
|
if(i == 'remove' || i == 'hidden'){
|
|
|
|
|
item[i] = gradeShow.value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
class:'cursor-pointer'
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field:"",
|
|
|
|
|
label:"校验结果信息",
|
|
|
|
|
component:"Divider",
|
|
|
|
|
remove:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field:"chkDscode",
|
|
|
|
|
label:"校验结果信息数据源",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'storeType',
|
|
|
|
|
label: '规则类型',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
field:"chkSchema",
|
|
|
|
|
label:"schema",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
options:RULE_TYPE_LIST,
|
|
|
|
|
style:{width:'100%'},
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
value:'1'
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'storeContent',
|
|
|
|
|
label: '规则内容',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"chkTablename",
|
|
|
|
|
label:"物理表",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'storeOperateType',
|
|
|
|
|
label: '操作类型',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
field:"",
|
|
|
|
|
label:"日志数据",
|
|
|
|
|
component:"Divider",
|
|
|
|
|
remove:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field:"logDscode",
|
|
|
|
|
label:"校验结果信息数据源",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
options:OPERATION_TYPE_LIST,
|
|
|
|
|
style:{width:'100%'},
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
value:'1'
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'schema',
|
|
|
|
|
label: '数据库用户',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"logSchema",
|
|
|
|
|
label:"schema",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'tableName',
|
|
|
|
|
label: '表名',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"logTablename",
|
|
|
|
|
label:"物理表",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'validateResultTable',
|
|
|
|
|
label: '校验结果表的表名',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"",
|
|
|
|
|
label:"抽样数据",
|
|
|
|
|
component:"Divider",
|
|
|
|
|
remove:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field:"resDscode",
|
|
|
|
|
label:"校验结果信息数据源",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'dataRule',
|
|
|
|
|
label: '数据规则',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"resSchema",
|
|
|
|
|
label:"schema",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'redscode',
|
|
|
|
|
label: '备份数据源',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
field:"resTablename",
|
|
|
|
|
label:"物理表",
|
|
|
|
|
component:"Select",
|
|
|
|
|
colProps:{
|
|
|
|
|
span:24
|
|
|
|
|
},
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
hidden:gradeShow.value
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const rules = reactive({
|
|
|
|
|
modelCode: [required()],
|
|
|
|
|
beginDate: [required()],
|
|
|
|
|
endDate: [required()],
|
|
|
|
|
ruleId: [required()],
|
|
|
|
|
dscode: [required()],//数据源不能为空
|
|
|
|
|
storeType:[required()],//操作类型不能为空
|
|
|
|
|
storeOperateType:[required()],//类型不能为空
|
|
|
|
|
storeContent:[required()],//数据集合不能为空
|
|
|
|
|
date:[required()],//日期不能为空
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const submit = async () => {
|
|
|
|
@ -147,7 +337,11 @@ const submit = async () => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
if (valid) {
|
|
|
|
|
const formData = await getFormData()
|
|
|
|
|
const formData = await getFormData();
|
|
|
|
|
if(formData.date){
|
|
|
|
|
formData.beginDate = formData.date[0];
|
|
|
|
|
formData.endDate = formData.date[1];
|
|
|
|
|
}
|
|
|
|
|
return formData
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|