<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"
|
/>
|
</app-layout-col>
|
</app-layout-row>
|
</template>
|
|
<script setup>
|
import {useI18n} from 'vue-i18n';
|
|
const {t} = useI18n();
|
|
import {meta} from "@/hooks";
|
|
const {useMetaData} = meta;
|
|
import {useEntityStore} from '@/store/modules';
|
|
import {dataFilter} from '@/utils/filter.js';
|
|
const tableSearchRef = ref();
|
const tableProRef = ref();
|
const entityStore = useEntityStore();
|
|
const props = defineProps({
|
subCurrent: {
|
type: Function,
|
default: () => {
|
}
|
}
|
});
|
|
const [columns, filters, fields] = useMetaData(
|
'fee_model_band',
|
async () => {
|
tableProps.columns = columns;
|
searchProps.formFields = filters;
|
|
tableProRef.value.$forceUpdate(tableProps);
|
tableSearchRef.value.$forceUpdate(searchProps);
|
}
|
);
|
|
const tableProps = {
|
ref: tableProRef,
|
requestParams: {
|
base: {},
|
search: {}
|
},
|
subRequest: async (page) => {
|
const {search, base} = tableProps.requestParams;
|
const result = await entityStore.getEntitySet({
|
dataName: "fee_model_band",
|
filter: Object.keys(base).length > 0 ? `${dataFilter(search, filters)} and group_code = '${base.code}' ` : '1 != 1',
|
...page
|
});
|
return result;
|
},
|
subCurrent(row) {
|
props.subCurrent({edit: row});
|
},
|
title: t('views.fee.feeModelBand.IndexPage.BandTable.title'),
|
columns: []
|
};
|
|
const searchProps = {
|
ref: tableSearchRef,
|
formFields: [],
|
subSubmit: (params) => {
|
tableProps.requestParams.search = params;
|
tableProRef.value.getTableData(true);
|
}
|
}
|
|
const onActive = async (active) => {
|
tableProps.requestParams.base.code = active.code;
|
|
if (!tableProps.columns.length) {
|
tableProps.columns = columns;
|
searchProps.formFields = filters;
|
|
tableProRef.value.$forceUpdate(tableProps);
|
tableSearchRef.value.$forceUpdate(searchProps);
|
}
|
|
tableProRef.value.getTableData(true);
|
}
|
|
const onReload = () => {
|
tableProRef.value.getTableData(true);
|
};
|
|
defineExpose({
|
onReload,
|
onActive
|
});
|
|
</script>
|