<template>
|
<app-layout-row>
|
<app-layout-col :span="24">
|
<app-table-search
|
v-bind="searchProps"
|
/>
|
</app-layout-col>
|
<app-layout-col :span="24" :padding-top="10">
|
<app-table-pro
|
v-bind="tableProps"
|
>
|
|
<template #table-operate="scope">
|
<el-button
|
size="small"
|
link
|
type="primary"
|
@click="onOpen(scope.row)"
|
>
|
参数
|
</el-button>
|
</template>
|
</app-table-pro>
|
</app-layout-col>
|
</app-layout-row>
|
<properties-dialog v-bind="propertiesDialogProps"/>
|
</template>
|
|
<script setup>
|
import PropertiesDialog from './PropertiesDialog';
|
import {useEntityStore, useAppStore} from '@/store/modules';
|
import {convertFilter} from '@/utils/filter.js';
|
|
import {meta} from "@/hooks";
|
|
const {useMetaData} = meta;
|
|
const props = defineProps({
|
subCurrent: {
|
type: Function,
|
default: () => {
|
}
|
},
|
subParams: {
|
type: Function,
|
default: () => {
|
}
|
},
|
options: {
|
type: Object,
|
default: {
|
lib: {},
|
rule: {},
|
property: {}
|
}
|
},
|
});
|
|
const tableSearchRef = ref();
|
const tableProRef = ref();
|
const entityStore = useEntityStore();
|
const appStore = useAppStore();
|
const propertiesDialogRef = ref();
|
|
const onOpen = (row) => {
|
propertiesDialogRef.value.onOpen(row);
|
}
|
|
const [columns, filters, fields] = useMetaData(
|
'sys_data_field_rule',
|
async ({columnsTools}) => {
|
columnsTools.splice(fields.length + 1, 0,
|
{
|
type: 'slot',
|
prop: "operate",
|
label: '操作',
|
table: {
|
fixed: 'right',
|
width: 100
|
},
|
}
|
);
|
searchProps.formFields = fields;
|
tableSearchRef.value.$forceUpdate(searchProps);
|
|
tableProps.columns = columns;
|
tableProps.requestParams.search = tableSearchRef.value.formFields.getModel();
|
tableProRef.value.$forceUpdate(tableProps);
|
|
tableProRef.value.getTableData(true);
|
|
|
}
|
);
|
|
|
const tableProps = {
|
ref: tableProRef,
|
requestParams: {search: {}},
|
complementHeight: 30,
|
subRequest: async (page) => {
|
props.subCurrent({
|
add: {
|
dataobject_id: 'sys_data_field_rule',
|
list_order_no: page.page.recordCount + 1,
|
form_order_no: page.page.recordCount + 1
|
}
|
});
|
const result = await entityStore.getEntitySet({
|
dataName: "sys_data_field_rule",
|
attachMeta: false,
|
filter: `${
|
convertFilter({
|
andLikeParams: tableProps.requestParams.search
|
})
|
}${props.options.rule.filter}`,
|
...page
|
});
|
return result;
|
},
|
subCurrent(row) {
|
props.subCurrent({edit: row});
|
},
|
title: '规则列表',
|
columns:[]
|
};
|
|
const searchProps = {
|
ref: tableSearchRef,
|
formFields: [],
|
subSubmit: (params) => {
|
tableProps.requestParams.search = params;
|
tableProRef.value.getTableData(true);
|
}
|
}
|
|
const onReload = (bool) => {
|
tableProRef.value.getTableData(bool);
|
}
|
|
const propertiesDialogProps = {
|
options: props.options,
|
ref: propertiesDialogRef
|
};
|
|
defineExpose({
|
onReload
|
});
|
|
</script>
|