<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"
|
/>
|
</app-layout-col>
|
</app-layout-row>
|
<detail-dialog v-bind="detailDialogProps"/>
|
</template>
|
|
<script setup>
|
import DetailDialog from './DetailDialog';
|
import {useI18n} from 'vue-i18n';
|
|
import {meta} from "@/hooks";
|
import {useEntityStore} from '@/store/modules';
|
|
import {convertFilter} from '@/utils/filter.js';
|
|
const route = useRoute();
|
|
const {t} = useI18n();
|
|
const {useMetaData} = meta;
|
|
const tableSearchRef = ref();
|
const tableProRef = ref();
|
const detailDialogRef = ref();
|
const entityStore = useEntityStore();
|
|
const props = defineProps({
|
subCurrent: {
|
type: Function,
|
default: () => {
|
}
|
}
|
});
|
|
const detailDialogProps = {
|
ref: detailDialogRef,
|
subReload() {
|
tableProRef.value.getTableData(true);
|
}
|
}
|
|
const [columns, filters, fields] = useMetaData(
|
'hd_discount_grant',
|
async () => {
|
await onInit()
|
});
|
|
const tableProps = {
|
ref: tableProRef,
|
requestParams: {
|
base: {},
|
search: {}
|
},
|
complementHeight: 30,
|
subRequest: async (page) => {
|
const result = await entityStore.getEntitySet({
|
dataName: 'hd_discount_grant',
|
filter: convertFilter({
|
andLikeParams: tableProps.requestParams.search
|
}),
|
...page
|
});
|
return result;
|
},
|
subCurrent(row) {
|
props.subCurrent(row);
|
},
|
title: t('views.discount.discountSettle.IndexPage.SettleTable.title'),
|
columns: []
|
};
|
|
const searchProps = {
|
ref: tableSearchRef,
|
formFields: filters,
|
subSubmit: (params) => {
|
tableProps.requestParams.search = params;
|
tableProRef.value.getTableData(true);
|
}
|
}
|
|
const onInit = async () => {
|
|
tableProps.columns = columns;
|
searchProps.formFields = filters;
|
|
await nextTick();
|
|
tableProRef.value.$forceUpdate(tableProps);
|
tableSearchRef.value.$forceUpdate(searchProps);
|
|
tableProRef.value.getTableData(true);
|
}
|
|
onMounted(async () => {
|
await onInit();
|
});
|
|
const onApprove = async (row) => {
|
detailDialogRef.value.onOpen(row);
|
}
|
|
defineExpose({
|
/**
|
* 初始化
|
*/
|
onApprove
|
});
|
|
|
</script>
|