From 2174f758e8a963964198e092f0d528ef1ae9b81e Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期二, 22 七月 2025 09:59:05 +0800 Subject: [PATCH] feat: 页面 --- src/hooks/fourStreams.ts | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 175 insertions(+), 0 deletions(-) diff --git a/src/hooks/fourStreams.ts b/src/hooks/fourStreams.ts new file mode 100644 index 0000000..b312d80 --- /dev/null +++ b/src/hooks/fourStreams.ts @@ -0,0 +1,175 @@ +import { defineColumns, defineOperationBtns, useFormDialog, useTable } from '@bole-core/components'; +import { OrderInputType } from '@bole-core/core'; +import { useQueryClient } from '@tanstack/vue-query'; +import { setOSSLink } from '@/utils'; +import { + CustomerApplyFileTypeListItem, + EnterpriseApplyFileUtils, +} from '@/components/commonView/utils'; +import * as parkBountyApplyServices from '@/services/api/ParkBountyApply'; +import * as enterpriseApplyFileServices from '@/services/api/EnterpriseApplyFile'; +import { BaseDeclareEnterpriseTableViewColumns, EnterpriseTypeText } from '@/constants'; + +export const rewardGrantRegisterColumns = computed(() => + defineColumns([ + ...BaseDeclareEnterpriseTableViewColumns, + { + id: '9', + enCode: 'a', + name: '璐㈡斂鎷ㄤ粯閲戦', + }, + { + id: '10', + enCode: 'a', + name: '璐㈡斂鎷ㄤ粯宸茬櫥璁�', + }, + { + id: '11', + enCode: 'a', + name: '鏈�杩戠櫥璁版棩鏈�', + }, + { + id: '12', + enCode: 'a', + name: '璐㈡斂鎷ㄤ粯鐧昏鐘舵��', + }, + { + id: '13', + enCode: 'a', + name: '骞冲彴鎷ㄤ粯閲戦', + }, + { + id: '14', + enCode: 'a', + name: '骞冲彴鎷ㄤ粯宸茬櫥璁�', + }, + { + id: '15', + enCode: 'a', + name: '鏈�杩戠櫥璁版棩鏈�', + }, + { + id: '16', + enCode: 'a', + name: '骞冲彴鎷ㄤ粯鐧昏鐘舵��', + }, + ]) +); + +type UseDeclareEnterpriseTableOptions = { + id?: Ref<string>; + applyMonth?: Ref<string>; +}; + +export function useDeclareEnterpriseTable(options: UseDeclareEnterpriseTableOptions = {}) { + const { id, applyMonth } = options; + + const { + getDataSource: getList, + proTableProps, + paginationState, + extraParamState, + reset, + } = useTable( + async ({ pageIndex, pageSize }, extraParamState) => { + try { + let params: API.GetParkBountyApplyInfoInput = { + pageModel: { + rows: pageSize, + page: pageIndex, + orderInput: extraParamState.orderInput, + }, + searchKeyWord: extraParamState.searchKeyWord, + parkBountyApplyId: id.value, + }; + let res = await parkBountyApplyServices.getOutCheckParkBountyApplyDetailList(params); + return res; + } catch (error) {} + }, + { + defaultExtraParams: { + orderInput: [{ property: 'parkBountyApplyId', order: OrderInputType.Desc }], + searchKeyWord: '', + }, + columnsRenderProps: { + authType: { type: 'enum', valueEnum: EnterpriseTypeText }, + licenseUrl: { + type: 'urlV2', + formatter: (row: API.UserCertificationAuditListDto) => setOSSLink(row.licenseUrl), + }, + applyAmount: { type: 'money' }, + }, + } + ); + + const queryClient = useQueryClient(); + const { dialogProps, handleAdd, editForm, dialogState } = useFormDialog({ + defaultFormParams: { + list: [] as CustomerApplyFileTypeListItem[], + companyId: '', + }, + }); + async function openDialog(row: API.ParkBountyApplyDetailInfo) { + try { + const applyFilesRes = await queryClient.ensureQueryData({ + queryKey: [ + 'enterpriseApplyFileServices/getCustomerUploadApplyFiles', + row.enterpriseId, + applyMonth.value, + ], + queryFn: async () => { + return await enterpriseApplyFileServices.getCustomerUploadApplyFiles({ + enterpriseId: row.enterpriseId, + withMonth: applyMonth.value, + }); + }, + }); + const lastUploadEnterPactFile = await queryClient.ensureQueryData({ + queryKey: ['enterpriseApplyFileServices/getCustomerUploadApplyFiles', row.enterpriseId], + queryFn: async () => { + return await parkBountyApplyServices.getEnterpriseLastUploadEnterPactFileNew({ + companyId: row.enterpriseId, + }); + }, + }); + + const applyUploadFiles = await parkBountyApplyServices.getEnterpriseParkApplyUploadFiles({ + companyId: row.enterpriseId, + parkBountyApplyId: id.value, + }); + handleAdd({ + list: EnterpriseApplyFileUtils.initParkCollectFileListApplyFiles( + applyUploadFiles, + applyFilesRes.items, + lastUploadEnterPactFile + ), + companyId: row.enterpriseId, + }); + } catch (error) {} + } + + const operationBtns = defineOperationBtns([ + { + data: { + enCode: 'detailBtn', + name: '璇︽儏', + }, + emits: { + onClick: (row) => openDialog(row), + }, + }, + ]); + + return { + getList, + proTableProps, + paginationState, + extraParamState, + reset, + openDialog, + dialogProps, + dialogState, + editForm, + operationBtns, + }; +} -- Gitblit v1.9.1