zhengyiming
昨天 6fc60fcdccd4c99e43be482ecf3757108e833c34
src/views/StatisticalReport/hooks/rewardStatistics.ts
@@ -2,6 +2,8 @@
import { useTable } from '@bole-core/components';
import * as parkBountyApplyServices from '@/services/api/ParkBountyApply';
import { OrderInputType } from '@bole-core/core';
import { useQuery } from '@tanstack/vue-query';
import dayjs from 'dayjs';
type UseRewardStatisticsDetailOptions = {
  scene?: Ref<EnumParkRewardStatisticsDetailScene>;
@@ -54,3 +56,35 @@
    reset,
  };
}
type UseRewardStatisticsMonthsOptions = {
  industrialParkId?: MaybeRef<string>;
  enabled?: MaybeRef<boolean>;
};
export function useRewardStatisticsMonths(options: UseRewardStatisticsMonthsOptions = {}) {
  const { industrialParkId, enabled } = options;
  const { data: rewardStatisticsMonths } = useQuery({
    queryKey: ['parkBountyApplyServices/getRewardStatisticsMonths', industrialParkId],
    queryFn: async () => {
      let params: API.APIgetRewardStatisticsMonthsParams = {
        industrialParkId: unref(industrialParkId),
      };
      let res = await parkBountyApplyServices.getRewardStatisticsMonths(params, {
        showLoading: false,
      });
      return res;
    },
    placeholderData: [] as string[],
    enabled: enabled,
  });
  const disabledDate = computed(() => {
    return (time: Date) => {
      return rewardStatisticsMonths.value.every((x) => !dayjs(x).isSame(dayjs(time), 'month'));
    };
  });
  return { rewardStatisticsMonths, disabledDate };
}