<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"
|
>
|
</app-table-pro>
|
</app-layout-col>
|
</app-layout-row>
|
<form-dialog v-bind="formDialogProps"/>
|
</template>
|
|
<script setup>
|
import FormDialog from './FormDialog';
|
import {useEntityStore, useAppStore} from '@/store/modules';
|
import {convertFilter} from '@/utils/filter.js';
|
|
import {useI18n} from 'vue-i18n';
|
|
const {t} = useI18n();
|
|
import {meta} from "@/hooks";
|
import {modal} from "@/plugins/index.js";
|
|
const {useMetaData} = meta;
|
|
const props = defineProps({
|
subCurrent: {
|
type: Function,
|
default: () => {
|
}
|
}
|
});
|
|
const tableSearchRef = ref();
|
const tableProRef = ref();
|
const entityStore = useEntityStore();
|
const appStore = useAppStore();
|
|
const formDialogRef = ref();
|
|
const formDialogProps = {
|
ref: formDialogRef,
|
subReload: (bool) => {
|
tableProRef.value.getTableData(bool);
|
}
|
};
|
|
const [columns, filters, fields] = useMetaData(
|
'agm_agreement_display_config',
|
async () => {
|
searchProps.formFields = filters;
|
tableSearchRef.value.$forceUpdate(searchProps);
|
|
tableProps.columns = columns;
|
tableProRef.value.$forceUpdate(tableProps);
|
|
tableProRef.value.getTableData(true);
|
|
}
|
);
|
|
|
const tableProps = {
|
ref: tableProRef,
|
requestParams: {search: {}},
|
complementHeight: 84,
|
subRequest: async (page) => {
|
const result = await entityStore.getEntitySet({
|
dataName: "agm_agreement_display_config",
|
attachMeta: false,
|
filter: convertFilter({
|
andLikeParams: tableProps.requestParams.search
|
}),
|
...page
|
});
|
return result;
|
},
|
subCurrent(row) {
|
props.subCurrent({edit: row});
|
},
|
title: t('views.agreement.agreementDisplay.IndexPage.title'),
|
columns: []
|
};
|
|
const searchProps = {
|
ref: tableSearchRef,
|
formFields: [],
|
subSubmit: (params) => {
|
tableProps.requestParams.search = params;
|
tableProRef.value.getTableData(true);
|
}
|
}
|
|
const onDelete = async (row) => {
|
await modal.confirm("是否完全删除?");
|
|
await entityStore.dataDelete({
|
dataName: 'agm_agreement_display_config',
|
id: row.id
|
});
|
|
tableProRef.value.getTableData(true);
|
|
};
|
|
const onOpenForm = (row) => {
|
formDialogRef.value.onOpen(row);
|
}
|
|
defineExpose({
|
onDelete,
|
onOpenForm
|
});
|
|
</script>
|