<template>
|
<app-dialog-form
|
v-bind="dialogFormProps"
|
>
|
<app-layout-row>
|
|
<app-layout-col :span="24">
|
<app-table-list v-bind="baseTableListProps" v-loading="loading"/>
|
</app-layout-col>
|
|
<app-layout-col :span="24" paddingTop="20">
|
<app-table-list v-bind="standradTableListProps" v-show="typeCode === 'data_standrad'" v-loading="loading"/>
|
</app-layout-col>
|
|
<app-layout-col :span="24" paddingTop="20">
|
<app-table-list v-bind="filterTableListProps" v-show="typeCode === 'data_standrad'" v-loading="loading">
|
<template #table-relation="scope">
|
{{ dictMapCode?.filter_type[scope.row.relation] }}
|
</template>
|
</app-table-list>
|
</app-layout-col>
|
</app-layout-row>
|
|
</app-dialog-form>
|
</template>
|
|
<script setup>
|
|
import {structure, dict} from '@/hooks';
|
|
const {useStructureData} = structure;
|
const {useDictMap} = dict;
|
|
import {useEntityStore} from "@/store/modules";
|
import {decode} from "@/utils/tools.js";
|
|
const entityStore = useEntityStore();
|
|
const loading = ref(false);
|
|
const props = defineProps({
|
options: {
|
type: Object,
|
default: {}
|
},
|
});
|
|
const baseTableListRef = ref();
|
|
const baseTableListProps = {
|
ref: baseTableListRef,
|
title: '参数列表',
|
complementHeight: -1,
|
columns: [
|
{
|
prop: `$data_field_name.${props.options.property.name}`,
|
label: "参数描述",
|
}
|
]
|
};
|
|
const standradTableListRef = ref();
|
|
const standradTableListProps = {
|
ref: standradTableListRef,
|
title: '参数列表',
|
complementHeight: -1,
|
columns: [
|
{
|
prop: `$data_field_name.${props.options.property.name}`,
|
label: "参数描述",
|
},
|
{
|
prop: '$criterion_field_name.labelchinese',
|
label: "数据描述",
|
},
|
{
|
prop: 'remark',
|
label: "描述",
|
}
|
]
|
};
|
|
const filterTableListRef = ref();
|
|
const filterTableListProps = {
|
ref: filterTableListRef,
|
title: '过滤参数',
|
complementHeight: -1,
|
columns: [
|
{
|
prop: `$data_field_name.${props.options.property.name}`,
|
label: "参数描述",
|
},
|
{
|
type: 'slot',
|
prop: 'relation',
|
label: "等式",
|
},
|
{
|
prop: '$criterion_field_name.labelchinese',
|
label: "数据描述",
|
},
|
{
|
prop: 'remark',
|
label: '备注',
|
}
|
]
|
};
|
|
const [actionStructure] = useStructureData([
|
{
|
target: {name: 'sys_data_field_rule', field: 'rule_code'},
|
entity: {name: 'sys_library_rule', field: 'code'},
|
type: 'object'
|
},
|
{
|
target: {name: 'sys_data_field_rule_standrad', field: 'data_field_name'},
|
entity: {name: props.options.property.dataName, field: props.options.property.value},
|
type: 'object'
|
},
|
{
|
target: {name: 'sys_data_field_rule_filter', field: 'data_field_name'},
|
entity: {name: props.options.property.dataName, field: props.options.property.value},
|
type: 'object'
|
}
|
]);
|
|
const [_, dictMapCode] = useDictMap(['filter_type']);
|
|
const typeCode = ref('');
|
|
const init = async (row) => {
|
if (row.id) {
|
loading.value = true;
|
const {data} = await entityStore.getEntity({
|
dataName: "pkg_data_field_rule",
|
attachMeta: false,
|
id: row.id,
|
});
|
|
const structureData = await actionStructure(data);
|
|
typeCode.value = structureData.sys_data_field_rule.$rule_code.type_code;
|
|
if (structureData.sys_data_field_rule.$rule_code.type_code === 'data_standrad') {
|
const {meta} = await entityStore.getEntitySet({
|
dataName: structureData.sys_data_field_rule.$rule_code.object_code,
|
filter: '1 != 1',
|
attachMeta: true,
|
});
|
const fields = meta[structureData.sys_data_field_rule.$rule_code.object_code].fields;
|
|
fields.forEach(e => {
|
e.labelchinese = decode(e.labelchinese)
|
});
|
|
structureData.sys_data_field_rule_standrad.forEach(e => {
|
e.$criterion_field_name = fields.find(f => f.field === e.criterion_field_name)
|
});
|
|
structureData.sys_data_field_rule_filter.forEach(e => {
|
e.$criterion_field_name = fields.find(f => f.field === e.criterion_field_name)
|
});
|
|
standradTableListRef.value.setTableData(structureData.sys_data_field_rule_standrad);
|
filterTableListRef.value.setTableData(structureData.sys_data_field_rule_filter);
|
}
|
|
baseTableListRef.value.setTableData(structureData.sys_data_field_rule_standrad);
|
|
loading.value = false;
|
}
|
}
|
|
const dialogFormRef = ref();
|
|
const dialogFormProps = {
|
width: 1000,
|
title: '参数列表',
|
ref: dialogFormRef,
|
footerDom: false
|
};
|
|
const onOpen = async (row) => {
|
dialogFormRef.value.$forceUpdate(dialogFormProps);
|
dialogFormRef.value.onOpen();
|
await nextTick();
|
await init(row);
|
}
|
|
defineExpose({
|
onOpen
|
});
|
|
</script>
|