修改模型规则显示信息

main
于阔 9 months ago
parent 5d9e779645
commit 8f42a4f1f7

@ -103,7 +103,6 @@ watch(
() => props.ruleInfo, () => props.ruleInfo,
(ruleInfo) => { (ruleInfo) => {
if (!ruleInfo) return if (!ruleInfo) return
console.log(ruleInfo,"ruleInfo信息");
sqlInfo = reactive(Object.assign(sqlInfo,ruleInfo)); sqlInfo = reactive(Object.assign(sqlInfo,ruleInfo));
// if(editorInstance){ // if(editorInstance){
// const model = editorInstance.getModel(); // const model = editorInstance.getModel();
@ -131,13 +130,11 @@ const rules = reactive<FormRules>({
}) })
// //
const submit = async () =>{ const submit = async () =>{
console.log(sqlInfo);
if(!sqlInfo.dataSourceId){ if(!sqlInfo.dataSourceId){
ElMessage.warning('请选择数据源信息'); ElMessage.warning('请选择数据源信息');
return false; return false;
} }
const model = editorInstance.getModel(); const model = editorInstance.getModel();
console.log(model.getValue(),"sql的信息");
if(!model.getValue()){ if(!model.getValue()){
ElMessage.warning('请输入SQL语句'); ElMessage.warning('请输入SQL语句');
return false; return false;

@ -37,7 +37,6 @@
const procedureConfigSubmit = await procedureConfigRef.value?.submit(); const procedureConfigSubmit = await procedureConfigRef.value?.submit();
let setParamsSubmit = await setParamsRef.value?.submit(); let setParamsSubmit = await setParamsRef.value?.submit();
const basicInfoSubmit = await basicInfoRef.value?.submit(); const basicInfoSubmit = await basicInfoRef.value?.submit();
console.log(props.currentRow,"props.currentRow");
if(!procedureConfigSubmit || !basicInfoSubmit){ if(!procedureConfigSubmit || !basicInfoSubmit){
return; return;
} }

@ -45,16 +45,16 @@ const ruleConfigRef = ref<ComponentRef<typeof RuleConfig>>()
// //
const getDictInfoList = async ()=>{ const getDictInfoList = async ()=>{
const indexType = await getIndexType({ paramName: 'indexType_param', systemCode: 'ordb' }); const indexType = await getIndexType({ paramName: 'indexType_param', systemCode: 'ordb' });
indexType_param_LIST.value = transfDictList(indexType.body.result); indexType_param_LIST.value = transfDictList(indexType.body.result);
const indexCalType = await getIndexType({ paramName: 'indexCalType_param', systemCode: 'ordb' }); const indexCalType = await getIndexType({ paramName: 'indexCalType_param', systemCode: 'ordb' });
indexCalType_param_LIST.value = transfDictList(indexCalType.body.result); indexCalType_param_LIST.value = transfDictList(indexCalType.body.result);
const indexDataType = await getIndexType({ paramName: 'indexDataType_param', systemCode: 'ordb' }); const indexDataType = await getIndexType({ paramName: 'indexDataType_param', systemCode: 'ordb' });
indexDataType_param_LIST.value = transfDictList(indexDataType.body.result); indexDataType_param_LIST.value = transfDictList(indexDataType.body.result);
const indexDataPrecision = await getIndexType({ paramName: 'indexDataPrecision_param', systemCode: 'ordb' }); const indexDataPrecision = await getIndexType({ paramName: 'indexDataPrecision_param', systemCode: 'ordb' });
indexDataPrecision_param_LIST.value = transfDictList(indexDataPrecision.body.result); indexDataPrecision_param_LIST.value = transfDictList(indexDataPrecision.body.result);
const indexDataUnit = await getIndexType({ paramName: 'indexDataUnit_param', systemCode: 'ordb' }); const indexDataUnit = await getIndexType({ paramName: 'indexDataUnit_param', systemCode: 'ordb' });
indexDataUnit_param_LIST.value = transfDictList(indexDataUnit.body.result); indexDataUnit_param_LIST.value = transfDictList(indexDataUnit.body.result);
} }
getDictInfoList(); getDictInfoList();
@ -145,6 +145,8 @@ const tableColumns = reactive<TableColumn[]>([
label: t('tableDemo.action'), label: t('tableDemo.action'),
width: 160, width: 160,
fixed: 'right', fixed: 'right',
align:'center',
headerAlign:"center",
slots: { slots: {
default: (data: any) => { default: (data: any) => {
return ( return (
@ -338,31 +340,31 @@ const exportExcel = async () => {
</script> </script>
<template> <template>
<ContentWrap> <!-- <ContentWrap> -->
<Search :schema="searchSchema" @reset="setSearchParams" @search="setSearchParams" /> <Search :schema="searchSchema" @reset="setSearchParams" @search="setSearchParams" />
<Table <Table
:columns="tableColumns" :columns="tableColumns"
v-model:pageSize="pageSize" v-model:pageSize="pageSize"
v-model:currentPage="currentPage" v-model:currentPage="currentPage"
default-expand-all default-expand-all
node-key="criid" node-key="criid"
:data="dataList" :data="dataList"
:loading="loading" :loading="loading"
:pagination="{ :pagination="{
total total
}" }"
@selection-change="onSelectionChange" @selection-change="onSelectionChange"
@register="tableRegister" @register="tableRegister"
@refresh="refresh" @refresh="refresh"
> >
<template #buttons> <template #buttons>
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton> <ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
<Upload :url="importExcelApiUrl" :callback="getList"> <ElButton type="primary">导入</ElButton> </Upload> <Upload :url="importExcelApiUrl" :callback="getList"> <ElButton type="primary">导入</ElButton> </Upload>
<ElButton type="primary" @click="exportExcel()"></ElButton> <ElButton type="primary" @click="exportExcel()"></ElButton>
</template> </template>
</Table> </Table>
</ContentWrap> <!-- </ContentWrap> -->
<Dialog v-model="dialogVisible" :title="dialogTitle"> <Dialog v-model="dialogVisible" :title="dialogTitle">
<Write <Write

@ -246,31 +246,31 @@ const exportExcel = async () => {
</script> </script>
<template> <template>
<ContentWrap> <!-- <ContentWrap> -->
<Search :schema="searchSchema" @reset="setSearchParams" @search="setSearchParams" /> <Search :schema="searchSchema" @reset="setSearchParams" @search="setSearchParams" />
<Table <Table
:columns="tableColumns" :columns="tableColumns"
v-model:pageSize="pageSize" v-model:pageSize="pageSize"
v-model:currentPage="currentPage" v-model:currentPage="currentPage"
default-expand-all default-expand-all
node-key="crtid" node-key="crtid"
:data="dataList" :data="dataList"
:loading="loading" :loading="loading"
:pagination="{ :pagination="{
total total
}" }"
@selection-change="onSelectionChange" @selection-change="onSelectionChange"
@register="tableRegister" @register="tableRegister"
@refresh="refresh" @refresh="refresh"
> >
<template #buttons> <template #buttons>
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton> <ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
<Upload :url="importExcelApiUrl" :callback="getList"> <ElButton type="primary">导入</ElButton> </Upload> <Upload :url="importExcelApiUrl" :callback="getList"> <ElButton type="primary">导入</ElButton> </Upload>
<ElButton type="primary" @click="exportExcel()"></ElButton> <ElButton type="primary" @click="exportExcel()"></ElButton>
</template> </template>
</Table> </Table>
</ContentWrap> <!-- </ContentWrap> -->
<Dialog v-model="dialogVisible" :title="dialogTitle"> <Dialog v-model="dialogVisible" :title="dialogTitle">
<Write <Write

@ -81,6 +81,8 @@ const tableColumns = reactive<TableColumn[]>([
label: t('tableDemo.action'), label: t('tableDemo.action'),
width: 200, width: 200,
fixed: 'right', fixed: 'right',
align: 'center',
headerAlign:"center",
slots: { slots: {
default: (data: any) => { default: (data: any) => {
return ( return (
@ -197,11 +199,12 @@ const save = async () => {
if (formData) { if (formData) {
saveLoading.value = true saveLoading.value = true
const res = await saveRepDataModelApi(formData) const res = await saveRepDataModelApi(formData)
.catch(() => {}) .catch(() => {ElMessage.warning('保存失败');})
.finally(() => { .finally(() => {
saveLoading.value = false saveLoading.value = false
}) })
if (res) { if (res) {
ElMessage.success(res.head.code == '0'?'保存成功':res.head.msg);
dialogVisible.value = false dialogVisible.value = false
currentPage.value = 1 currentPage.value = 1
getList() getList()

@ -127,8 +127,10 @@ const tableColumns = reactive<TableColumn[]>([
{ {
field: 'action', field: 'action',
label: t('tableDemo.action'), label: t('tableDemo.action'),
width: 200, width: 180,
fixed: 'right', fixed: 'right',
align:"center",
headerAlign:"center",
slots: { slots: {
default: (data: any) => { default: (data: any) => {
return ( return (

@ -219,7 +219,7 @@ const getModelMapping = (data)=>{
const AddAction = () => { const AddAction = () => {
dialogTitle.value = t('tableDemo.add') dialogTitle.value = t('tableDemo.add')
currentRow.value = undefined currentRow.value = {modelCode:modelCode}
dialogVisible.value = true dialogVisible.value = true
actionType.value = 'add' actionType.value = 'add'
} }

@ -5,7 +5,7 @@ import { PropType, reactive, watch } from 'vue'
import { useValidator } from '@/hooks/web/useValidator' import { useValidator } from '@/hooks/web/useValidator'
import { OPERATION_TYPE_LIST,RULE_TYPE_LIST,getRepStoreGeyDataSource,getRepStoreGeySchema,getRepStoreGeyTables } from '../constants'; import { OPERATION_TYPE_LIST,RULE_TYPE_LIST,getRepStoreGeyDataSource,getRepStoreGeySchema,getRepStoreGeyTables } from '../constants';
import {ref} from "vue" import {ref} from "vue"
import { randomCode } from '@/utils';
const { required } = useValidator() const { required } = useValidator()
const props = defineProps({ const props = defineProps({
@ -27,6 +27,7 @@ let gradeShow = ref(true);//下面的三个高级选项是否隐藏
let dataSource = reactive({ let dataSource = reactive({
dscode:'', dscode:'',
dsname:'', dsname:'',
stroageschema:"",//schema
}); });
const formSchema = reactive<FormSchema[]>([ const formSchema = reactive<FormSchema[]>([
@ -48,9 +49,10 @@ const formSchema = reactive<FormSchema[]>([
on:{ on:{
change:async (value)=>{ change:async (value)=>{
dataSource = value?formSchema[1].componentProps.options.find(item=>item.dscode==value):{}; dataSource = value?formSchema[1].componentProps.options.find(item=>item.dscode==value):{};
editStoreContent('dscode');
if(dataSource.dscode){ if(dataSource.dscode){
formSchema[5].componentProps.options = await getRepStoreGeySchema(dataSource)?await getRepStoreGeySchema(dataSource):[]; formSchema[5].componentProps.options = await getRepStoreGeySchema(dataSource)?await getRepStoreGeySchema(dataSource):[];
formSchema[6].componentProps.options = await getRepStoreGeyTables(dataSource)?await getRepStoreGeyTables(dataSource):[]; // formSchema[6].componentProps.options = await getRepStoreGeyTables(dataSource)?await getRepStoreGeyTables(dataSource):[];
} }
} }
}, },
@ -98,6 +100,11 @@ const formSchema = reactive<FormSchema[]>([
componentProps: { componentProps: {
options:RULE_TYPE_LIST, options:RULE_TYPE_LIST,
style:{width:'100%'}, style:{width:'100%'},
on:{
change:()=>{
editStoreContent();
}
},
}, },
value:'1' value:'1'
}, },
@ -111,6 +118,15 @@ const formSchema = reactive<FormSchema[]>([
componentProps:{ componentProps:{
options:[], options:[],
filterable:true, filterable:true,
on:{
change:async (value)=>{
dataSource.stroageschema = value;
editStoreContent('schema');
if(dataSource.dscode && dataSource.stroageschema){
formSchema[6].componentProps.options = await getRepStoreGeyTables(dataSource)?await getRepStoreGeyTables(dataSource):[];
}
}
},
style:{ style:{
width:"100%" width:"100%"
} }
@ -126,6 +142,11 @@ const formSchema = reactive<FormSchema[]>([
componentProps:{ componentProps:{
options:[], options:[],
filterable:true, filterable:true,
on:{
change:()=>{
editStoreContent();
}
},
style:{ style:{
width:"100%" width:"100%"
} }
@ -190,186 +211,196 @@ const formSchema = reactive<FormSchema[]>([
// style:{width:'100%'} // style:{width:'100%'}
// }, // },
// }, // },
// {
// field:"controlShowGrade",
// label: `(${gradeShow.value?'':''})`,
// component:"Divider",
// componentProps:{
// contentPosition:"center",
// borderStyle :'dashed',
// style:{
// fontSize:"20px !important",
// color:'rgb(29 127 29) !important',
// width:"100%"
// },
// 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: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"chkSchema",
// label:"schema",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"chkTablename",
// label:"",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"",
// label:"",
// component:"Divider",
// remove:gradeShow.value
// },
// {
// field:"logDscode",
// label:"",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"logSchema",
// label:"schema",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"logTablename",
// label:"",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"",
// label:"",
// component:"Divider",
// remove:gradeShow.value
// },
// {
// field:"resDscode",
// label:"",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"resSchema",
// label:"schema",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
// {
// field:"resTablename",
// label:"",
// component:"Select",
// colProps:{
// span:24
// },
// componentProps: {
// filterable:true,
// style:{
// width:"100%"
// }
// },
// hidden:gradeShow.value
// },
{ {
field:"controlShowGrade", field:"modelCode",
label: `高级(点击${gradeShow.value?'展开':'收起'})`, label:"模型编码",
component:"Divider", hidden:true
componentProps:{
contentPosition:"center",
borderStyle :'dashed',
style:{
fontSize:"20px !important",
color:'rgb(29 127 29) !important',
width:"100%"
},
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: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
},
{
field:"chkSchema",
label:"schema",
component:"Select",
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
},
{
field:"chkTablename",
label:"物理表",
component:"Select",
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
},
{
field:"",
label:"日志数据",
component:"Divider",
remove:gradeShow.value
},
{
field:"logDscode",
label:"校验结果信息数据源",
component:"Select",
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
},
{
field:"logSchema",
label:"schema",
component:"Select",
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
},
{
field:"logTablename",
label:"物理表",
component:"Select",
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
},
{
field:"",
label:"抽样数据",
component:"Divider",
remove:gradeShow.value
},
{
field:"resDscode",
label:"校验结果信息数据源",
component:"Select",
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
},
{
field:"resSchema",
label:"schema",
component:"Select",
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
}, },
{ {
field:"resTablename", field:"ruleId",
label:"物理表", label:"规则编码",
component:"Select", hidden:true
colProps:{
span:24
},
componentProps: {
filterable:true,
style:{
width:"100%"
}
},
hidden:gradeShow.value
}, },
]) ])
// //
@ -389,6 +420,33 @@ const rules = reactive({
}) })
//
const editStoreContent = async (editColumn:string = '')=>{
const formData = await getFormData();
switch(editColumn){
case 'dscode':
formData.schema = "";
formData.tableName = "";
break;
case 'schema':
formData.tableName = "";
break;
}
if(formData.dscode && formData.schema && formData.tableName){
switch(formData.storeType){
case "1":
formData.storeContent = `${formData.schema}.${formData.tableName}`
break;
case "2":
formData.storeContent = `select * from ${formData.schema}.${formData.tableName}`
break;
}
}else{
formData.storeContent = '';
}
setValues(formData);
}
const submit = async () => { const submit = async () => {
const elForm = await getElFormExpose() const elForm = await getElFormExpose()
const valid = await elForm?.validate().catch((err) => { const valid = await elForm?.validate().catch((err) => {

@ -21,7 +21,7 @@ export const RULE_TYPE_LIST = [//规则类型 1只读2读写
}, },
{ {
value:"2", value:"2",
label:"读写" label:"查询"
} }
] ]

@ -187,11 +187,12 @@ const save = async () => {
if (formData) { if (formData) {
saveLoading.value = true saveLoading.value = true
const res = await saveRepStoreParameterApi(formData) const res = await saveRepStoreParameterApi(formData)
.catch(() => {}) .catch(() => {ElMessage.warning('保存失败');})
.finally(() => { .finally(() => {
saveLoading.value = false saveLoading.value = false
}) })
if (res) { if (res) {
ElMessage.success(res.head.code=='0'?'保存成功':res.head.msg);
dialogVisible.value = false dialogVisible.value = false
currentPage.value = 1 currentPage.value = 1
getList() getList()

Loading…
Cancel
Save