<template>
|
<app-layout-row>
|
<app-layout-col :span="24">
|
<app-table-search
|
v-bind="searchProps"
|
/>
|
</app-layout-col>
|
<app-layout-col :span="24" :paddingTop="10">
|
<app-table-pro v-bind="tableProps">
|
<template #table-operate="scope">
|
<el-button
|
size="small"
|
link
|
type="primary"
|
@click="onOpenDetail(scope.row)"
|
>
|
字段
|
</el-button>
|
</template>
|
</app-table-pro>
|
</app-layout-col>
|
</app-layout-row>
|
<form-dialog v-bind="formDialogProps"/>
|
<detail-dialog v-bind="detailDialogProps"/>
|
</template>
|
|
<script setup>
|
|
import FormDialog from './FormDialog';
|
import DetailDialog from './DetailDialog';
|
|
import {useI18n} from 'vue-i18n';
|
import {modal} from '@/plugins';
|
|
const {t} = useI18n();
|
|
import {meta} from "@/hooks";
|
|
const {useMetaData} = meta;
|
|
import {dataFilter} from '@/utils/filter.js';
|
import {useEntityStore} from '@/store/modules';
|
|
const props = defineProps({
|
subCurrent: {
|
type: Function,
|
default: () => {
|
}
|
}
|
});
|
|
const formDialogRef = ref();
|
|
const formDialogProps = {
|
ref: formDialogRef,
|
subReload(bool) {
|
tableProRef.value.getTableData(bool);
|
}
|
}
|
|
const detailDialogRef = ref();
|
|
const detailDialogProps = {
|
ref: detailDialogRef,
|
}
|
|
const tableSearchRef = ref();
|
const tableProRef = ref();
|
const entityStore = useEntityStore();
|
|
const [columns, filters, fields] = useMetaData(
|
'v_joint',
|
({columnsTools}) => {
|
columnsTools.splice(fields.length + 1, 0,
|
{
|
type: 'slot',
|
prop: "operate",
|
label: '操作',
|
table: {
|
fixed: 'right',
|
width: 100
|
},
|
}
|
);
|
|
tableProps.columns = columns;
|
searchProps.formFields = filters;
|
|
tableProRef.value.$forceUpdate(tableProps);
|
tableSearchRef.value.$forceUpdate(searchProps);
|
|
tableProRef.value.getTableData(true);
|
}
|
);
|
|
const tableProps = {
|
ref: tableProRef,
|
requestParams: {
|
search: {}
|
},
|
subRequest: async (page) => {
|
const {search} = tableProps.requestParams;
|
const result = await entityStore.getEntitySet({
|
dataName: "v_joint",
|
filter: dataFilter(search, filters),
|
...page
|
});
|
|
return result;
|
},
|
subCurrent(row) {
|
props.subCurrent(row);
|
},
|
title: t('views.fee.feeJoint.IndexPage.title'),
|
columns: []
|
};
|
|
onMounted(() => {
|
|
})
|
|
const searchProps = {
|
ref: tableSearchRef,
|
formFields: [],
|
subSubmit: (params) => {
|
tableProps.requestParams.search = params;
|
tableProRef.value.getTableData(true);
|
}
|
}
|
|
const onOpenForm = async (row) => {
|
formDialogRef.value.onOpen(row);
|
}
|
|
const onOpenDetail = async (row) => {
|
detailDialogRef.value.onOpen(row);
|
}
|
|
const onDelete = async (row) => {
|
await modal.confirm("是否确认删除?");
|
|
await entityStore.deleteEntity({
|
dataName: 'pkg_joint',
|
id: row.id
|
});
|
tableProRef.value.getTableData(false);
|
};
|
|
defineExpose({
|
onOpenForm,
|
onDelete
|
});
|
|
</script>
|