<template>
|
<app-layout-row>
|
<app-layout-col :span="24">
|
<app-table-search
|
v-bind="searchProps"
|
/>
|
</app-layout-col>
|
<app-layout-col :span="24" :top="10">
|
<app-table-pro v-bind="tableProps">
|
<template #table-name="scope">
|
<el-link type="primary" @click="onOpenTab(scope.row)">{{ scope.row.name }}</el-link>
|
</template>
|
</app-table-pro>
|
</app-layout-col>
|
</app-layout-row>
|
</template>
|
|
<script setup>
|
|
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';
|
import {openTab, openJiminTab} from "@/utils/iframe.js";
|
import {uuid} from "@/utils/tools.js";
|
|
const props = defineProps({
|
subCurrent: {
|
type: Function,
|
default: () => {
|
}
|
}
|
});
|
|
const tableSearchRef = ref();
|
const tableProRef = ref();
|
const entityStore = useEntityStore();
|
|
const [columns, filters, fields] = useMetaData(
|
'fee_model_plan',
|
async ({columnsTools}) => {
|
columnsTools.assign('name', {type: 'slot'});
|
tableProps.columns = columns;
|
searchProps.formFields = filters;
|
|
tableProRef.value.$forceUpdate(tableProps);
|
tableSearchRef.value.$forceUpdate(searchProps);
|
|
tableProRef.value.getTableData(true);
|
}
|
);
|
|
const tableProps = {
|
ref: tableProRef,
|
requestParams: {
|
search: {}
|
},
|
complementHeight: 80,
|
subRequest: async (page) => {
|
const {search} = tableProps.requestParams;
|
const result = await entityStore.getEntitySet({
|
dataName: "fee_plan",
|
filter: dataFilter(search, filters),
|
...page
|
});
|
|
return result;
|
},
|
subCurrent(row) {
|
props.subCurrent(row);
|
},
|
title: t('views.fee.easyTable.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.deleteEntity({
|
dataName: 'fee_plan',
|
id: row.id
|
});
|
tableProRef.value.getTableData(false);
|
};
|
|
const onTabForm = async (row) => {
|
await openTab({
|
icon: 'icon-product',
|
id: uuid(),
|
sceneCode: "edit",
|
text: "折扣方案",
|
title: "折扣方案编辑",
|
path: '/fee/feePlan',
|
params: {view: 'form', ...(row.id ? {id: row.id} : {})}
|
}
|
);
|
}
|
|
const onOpenTab = async (row) => {
|
await openJiminTab({
|
icon: 'icon-product',
|
id: uuid(),
|
sceneCode: "edit",
|
text: "试算模版",
|
title: "试算模版",
|
path: '/feeDesigner/page/designer/designer.html',
|
params: {id: row.id}
|
}
|
);
|
}
|
|
|
const onOpenDetail = async (row) => {
|
await openTab({
|
icon: 'icon-product',
|
id: uuid(),
|
sceneCode: "edit",
|
text: "折扣方案",
|
title: "折扣方案编辑",
|
path: '/fee/feePlan',
|
params: {view: 'detail', ...(row.id ? {id: row.id} : {})}
|
}
|
);
|
}
|
|
defineExpose({
|
onDelete,
|
onTabForm,
|
onOpenDetail
|
});
|
|
</script>
|