zhengyiming
3 天以前 fc6bbae5805da6c95fd675210999a03802cd62ad
src/hooks/fourStreams.ts
@@ -1,5 +1,5 @@
import { defineColumns, defineOperationBtns, useFormDialog, useTable } from '@bole-core/components';
import { OrderInputType } from '@bole-core/core';
import { Message, OrderInputType } from '@bole-core/core';
import { useQueryClient } from '@tanstack/vue-query';
import { setOSSLink } from '@/utils';
import {
@@ -15,72 +15,86 @@
  FinanceStatusEnumText,
  FinanceStatusEnumTextV2,
  FinanceStatusEnumTextV2Query,
  FourStreamsExtraMaterialFileSearchType,
  SearchType,
  SettleStatusEnumTextV2,
  TransferToStatusEnum,
  TransferToStatusEnumText,
} from '@/constants';
export const rewardGrantRegisterColumns = computed(() =>
  defineColumns([
    ...BaseDeclareEnterpriseTableViewColumns,
    {
      id: '9',
      enCode: 'financeAmount',
      name: '财政拨付金额',
      width: 160,
    },
    {
      id: '10',
      enCode: 'financeSumAmount',
      name: '财政拨付已登记',
      width: 160,
    },
    {
      id: '11',
      enCode: 'financeTime',
      name: '最近登记日期',
      width: 160,
    },
    {
      id: '12',
      enCode: 'financeStatus',
      name: '财政拨付登记状态',
      width: 160,
    },
    {
      id: '13',
      enCode: 'transferAmount',
      name: '平台拨付金额',
      width: 160,
    },
    {
      id: '14',
      enCode: 'settleSumAmount',
      name: '平台拨付已登记',
      width: 160,
    },
    {
      id: '15',
      enCode: 'settleTime',
      name: '最近登记日期',
      width: 160,
    },
    {
      id: '16',
      enCode: 'settleStatus',
      name: '平台拨付登记状态',
      width: 160,
    },
  ])
);
type UseRewardGrantRegisterColumnsOptions = {
  suportPlatRecharge?: MaybeRef<boolean>;
  suportFinance?: MaybeRef<boolean>;
};
export function useRewardGrantRegisterColumns(options: UseRewardGrantRegisterColumnsOptions = {}) {
  const { suportPlatRecharge, suportFinance } = options;
  const rewardGrantRegisterColumns = computed(() =>
    defineColumns([
      ...BaseDeclareEnterpriseTableViewColumns,
      {
        id: '9',
        enCode: 'financeAmount',
        name: '财政拨付金额',
        width: 160,
      },
      {
        id: '10',
        enCode: 'financeSumAmount',
        name: '财政拨付已登记',
        width: 160,
      },
      {
        id: '11',
        enCode: 'financeTime',
        name: '最近登记日期',
        width: 160,
      },
      {
        id: '12',
        enCode: 'financeStatus',
        name: '财政拨付登记状态',
        width: 160,
      },
      {
        id: '13',
        enCode: 'transferAmount',
        name: '平台拨付金额',
        width: 160,
      },
      {
        id: '14',
        enCode: 'settleSumAmount',
        name: '平台拨付已登记',
        width: 160,
      },
      {
        id: '15',
        enCode: 'settleTime',
        name: '最近登记日期',
        width: 160,
      },
      {
        id: '16',
        enCode: 'settleStatus',
        name: '平台拨付登记状态',
        width: 160,
      },
    ])
  );
  return { rewardGrantRegisterColumns };
}
type UseDeclareEnterpriseTableOptions = {
  id?: Ref<string>;
  applyMonth?: Ref<string>;
  enableUploadExtraFiles?: boolean;
};
export function useDeclareEnterpriseTable(options: UseDeclareEnterpriseTableOptions = {}) {
  const { id, applyMonth } = options;
  const { id, applyMonth, enableUploadExtraFiles = false } = options;
  const {
    getDataSource: getList,
@@ -134,6 +148,7 @@
  const queryClient = useQueryClient();
  const { dialogProps, handleAdd, editForm, dialogState } = useFormDialog({
    onConfirm: handleUpload,
    defaultFormParams: {
      list: [] as CustomerApplyFileTypeListItem[],
      companyId: '',
@@ -155,7 +170,10 @@
        },
      });
      const lastUploadEnterPactFile = await queryClient.ensureQueryData({
        queryKey: ['enterpriseApplyFileServices/getCustomerUploadApplyFiles', row.enterpriseId],
        queryKey: [
          'enterpriseApplyFileServices/getEnterpriseLastUploadEnterPactFileNew',
          row.enterpriseId,
        ],
        queryFn: async () => {
          return await parkBountyApplyServices.getEnterpriseLastUploadEnterPactFileNew({
            companyId: row.enterpriseId,
@@ -167,11 +185,18 @@
        companyId: row.enterpriseId,
        parkBountyApplyId: id.value,
      });
      const applyUploadExtraFiles =
        await parkBountyApplyServices.getEnterpriseParkApplyUploadExtraFiles({
          companyId: row.enterpriseId,
          parkBountyApplyId: id.value,
        });
      handleAdd({
        list: EnterpriseApplyFileUtils.initParkCollectFileListApplyFiles(
          applyUploadFiles,
          applyFilesRes.items,
          lastUploadEnterPactFile
          lastUploadEnterPactFile,
          applyUploadExtraFiles
        ),
        companyId: row.enterpriseId,
      });
@@ -188,7 +213,35 @@
        onClick: (row) => openDialog(row),
      },
    },
  ]);
    enableUploadExtraFiles && {
      data: {
        enCode: 'uploadBtn',
        name: '补充材料',
      },
      emits: {
        onClick: (row) => openDialog(row),
      },
    },
  ]).filter(Boolean);
  async function handleUpload() {
    try {
      if (!enableUploadExtraFiles) return;
      let params: API.UploadParkApplyCustomerFilesInput = {
        parkBountyApplyId: id.value,
        companyId: editForm.companyId,
        fileTypes: EnterpriseApplyFileUtils.convertFileTableListToApplyCompanyFile(
          editForm.list.filter((x) =>
            EnterpriseApplyFileUtils.isApplyUploadExtraFileSearchTypeId(x.fileSearchTypeId)
          )
        ),
      };
      let res = await parkBountyApplyServices.uploadParkBountyApplyCompanyExtraFile(params);
      if (res) {
        Message.successMessage('操作成功');
      }
    } catch (error) {}
  }
  return {
    getList,