zhengyiming
3 天以前 fc6bbae5805da6c95fd675210999a03802cd62ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { EnumParkRewardStatisticsDetailScene } from '@/constants';
import { useTable } from '@bole-core/components';
import * as parkBountyApplyServices from '@/services/api/ParkBountyApply';
import { OrderInputType } from '@bole-core/core';
 
type UseRewardStatisticsDetailOptions = {
  scene?: Ref<EnumParkRewardStatisticsDetailScene>;
  enterpriseId?: Ref<string>;
  month?: Ref<string>;
};
export function useRewardStatisticsDetail(options: UseRewardStatisticsDetailOptions = {}) {
  const { scene = '' as any as EnumParkRewardStatisticsDetailScene, enterpriseId, month } = options;
 
  const {
    getDataSource: getRewardStatisticsDetail,
    proTableProps,
    paginationState,
    extraParamState,
    reset,
  } = useTable(
    async ({ pageIndex, pageSize }, extraParamState) => {
      try {
        let params: API.GetRewardStatisticsDetailInput = {
          pageModel: {
            rows: pageSize,
            page: pageIndex,
            orderInput: extraParamState.orderInput,
          },
          enterpriseId: unref(enterpriseId),
          scene: unref(scene),
          month: unref(month),
        };
        let res = await parkBountyApplyServices.getRewardStatisticsDetail(params);
        return res;
      } catch (error) {}
    },
    {
      defaultExtraParams: {
        orderInput: [{ property: 'creationTime', order: OrderInputType.Desc }],
      },
      columnsRenderProps: {
        creationTime: { type: 'date', format: 'YYYY-MM-DD HH:mm:ss' },
        auditTime: { type: 'date', format: 'YYYY-MM-DD HH:mm:ss' },
        amount: { type: 'money' },
      },
    }
  );
 
  return {
    getRewardStatisticsDetail,
    proTableProps,
    paginationState,
    extraParamState,
    reset,
  };
}