| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <script setup lang="tsx">
- import { nextTick } from 'vue';
- import { fetchGetskuStatisticsList } from '@/service/api/finance/summary';
- import { fetchGetLoginUserList } from '@/service/api/common';
- import { useAuth } from '@/hooks/business/auth';
- import { commonExport } from '@/utils/common';
- import { useTable } from '@/components/zt/Table/hooks/useTable';
- const columns: NaiveUI.TableColumn<Api.finance.SkuStatisticsVo>[] = [
- {
- key: 'skuId',
- title: '商品ID',
- align: 'center',
- width: 120
- },
- {
- key: 'skuName',
- title: '商品名称',
- align: 'center',
- width: 200
- },
- {
- key: 'spec',
- title: '规格',
- align: 'center',
- width: 200
- },
- {
- key: 'price',
- title: '单价(元)',
- align: 'center',
- width: 120
- },
- {
- key: 'prodCount',
- title: '商品总数量',
- align: 'center',
- width: 200
- },
- {
- key: 'total',
- title: '小计(元)',
- align: 'center',
- width: 120
- }
- ];
- const [registerTable, { refresh, setTableLoading, setFieldsValue, getSeachForm, getTableData }] = useTable({
- searchFormConfig: {
- schemas: [
- {
- field: 'channelIds',
- label: '企业名称',
- component: 'ApiSelect',
- componentProps: {
- api: fetchGetLoginUserList,
- labelFeild: 'channelName',
- valueFeild: 'id',
- multiple: true,
- onUpdateValue: () => {
- nextTick(() => {
- handleSearch();
- });
- },
- getOptions: async (options: any) => {
- await setFieldsValue({ channelIds: [options[0].id] });
- handleSearch();
- }
- }
- },
- {
- label: '商品ID',
- field: 'skuId',
- component: 'NInput'
- },
- {
- label: '商品名称',
- field: 'skuName',
- component: 'NInput'
- },
- {
- label: '商品规格',
- field: 'spec',
- component: 'NInput'
- },
- {
- label: '结算周期',
- component: 'NDatePicker',
- field: 'createTime',
- componentProps: {
- type: 'datetimerange'
- }
- },
- {
- field: 'userAttrType',
- label: '人员属性',
- component: 'dictSelect',
- componentProps: {
- dictCode: 'user_attr_type',
- immediate: true
- },
- show: useAuth().hasAuth('user:attr:type')
- }
- ],
- labelWidth: 120,
- layout: 'horizontal',
- size: 'small',
- gridProps: {
- cols: '1 xl:4 s:1 l:3',
- itemResponsive: true
- },
- collapsedRows: 1
- },
- tableConfig: {
- keyField: 'id',
- title: '对账单汇总表(商品)',
- showAddButton: false,
- defaultParamsNotReset: 'channelIds',
- fieldMapToTime: [['Time', ['startTime', 'endTime']]]
- }
- });
- function handleSearch() {
- refresh();
- }
- async function handleExport() {
- setTableLoading(true);
- try {
- await commonExport('/platform/sku/skuStatisticsExcel', getSeachForm(), '对账单列表.xlsx');
- } finally {
- setTableLoading(false);
- }
- }
- </script>
- <template>
- <LayoutTable>
- <ZTable
- :columns="columns"
- :immediate="false"
- :api="fetchGetskuStatisticsList"
- :show-table-action="false"
- @register="registerTable"
- >
- <template #prefix="{ loading }">
- <NButton
- v-if="useAuth().hasAuth('finance:summary:export')"
- size="small"
- :loading="loading"
- :disabled="getTableData().length == 0"
- @click="handleExport"
- >
- 导出
- </NButton>
- </template>
- </ZTable>
- </LayoutTable>
- </template>
- <style scoped></style>
|