From 29f6579c8c9aed205474045c717f8d5cdc9a4d30 Mon Sep 17 00:00:00 2001 From: yuance <182865460@qq.com> Date: Wed, 14 Jan 2026 18:28:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=AE=A1=E8=AE=A1=E5=86=85=E5=AE=B99-=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E8=B4=B9=E8=B6=85=E8=8C=83=E5=9B=B4=E6=94=AF=E5=87=BA=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E6=B8=85=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pwlProject/components/data/tableCommon.ts | 25 +++++ .../pwlProject/components/reportContent.vue | 93 ++++++++++++++----- 2 files changed, 94 insertions(+), 24 deletions(-) diff --git a/src/views/pwl/pwlProject/components/data/tableCommon.ts b/src/views/pwl/pwlProject/components/data/tableCommon.ts index 4f80881..0ceb440 100644 --- a/src/views/pwl/pwlProject/components/data/tableCommon.ts +++ b/src/views/pwl/pwlProject/components/data/tableCommon.ts @@ -352,6 +352,31 @@ export function createDataMapper(type: string) { workPaperIndex: parseWorkPaperIndex(item.workPaperIndex), ...item })), + personnel: (data) => { + const mainData = data.map((item, index) => { + const { ext, ...rest } = item; + return { + key: index, + index: item.index || index + 1, + ...rest, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) + }; + }); + const extraData = data.reduce((acc, item) => { + if (item.ext && Array.isArray(item.ext)) { + return [...acc, ...item.ext]; + } + return acc; + }, []); + return { + mainData: mainData, + extraData: extraData.map((item, idx) => ({ + key: idx, + ...item, + index: item.index || idx + 1 + })) + }; + }, // 其他类型的映射... default: (data) => data.map((item, index) => ({ diff --git a/src/views/pwl/pwlProject/components/reportContent.vue b/src/views/pwl/pwlProject/components/reportContent.vue index cbf5249..e79ecf2 100644 --- a/src/views/pwl/pwlProject/components/reportContent.vue +++ b/src/views/pwl/pwlProject/components/reportContent.vue @@ -821,27 +821,27 @@ libraryIds: props.data?.libraryIds || '', projectLibrary: props.data?.projectLibrary || '', history: - section.data?.length > 0 ? JSON.stringify(section.data, null, 2) : '', + section.data?.length > 0 ? JSON.stringify(section.data, null, 2) : '', suggestion: section.suggestion || '', docList: checkedDirKeys.value, fileList: selectedFileKeys.value, // 重大经济决策调查表需要三重一大数据 ...(currentTable.value === 'decisionTable' - ? { data: tripleOneData.value } - : {}), + ? { data: tripleOneData.value } + : {}), // 预算管理审计表需要国资管理数据 ...(currentTable.value === 'budgetManage' - ? { data: stateAssetsData.value } - : {}), + ? { data: stateAssetsData.value } + : {}), // 预算执行情况审计表需要预算管理审计的数据 ...(currentTable.value === 'budgetExecution' - ? { data: tableData['auditContent5_budgetManage'] } - : {}) + ? { data: tableData['auditContent5_budgetManage'] } + : {}) }; // 获取对应的生成方法 const apiMethod = - apiMethodMap[currentTable.value] || apiMethodMap.default; + apiMethodMap[currentTable.value] || apiMethodMap.default; const generateMethod = auditContentApi[apiMethod.generate]; if (!generateMethod) { @@ -853,18 +853,38 @@ if (result.code === 0 && result.data?.success) { // 保存表格生成数据 saveTableGenerationData( - tableKey, - requestData, - result.data, - currentTable.value + tableKey, + requestData, + result.data, + currentTable.value ); // 使用对应的数据映射函数 const dataMapper = createDataMapper(currentTable.value); const mappedData = dataMapper(result.data.data); - // 保存数据 - tableData[tableKey] = mappedData; + // 处理不同类型的表格数据 + if (currentTable.value === 'personnel') { + // 对于人员编制管理审计,需要分别处理主表格和额外表格数据 + tableData[tableKey] = mappedData.mainData; + section.data = mappedData.mainData; + section.extraData = mappedData.extraData || []; // 设置额外表格数据 + + // 如果有额外数据,确保extraColumns存在 + if (mappedData.extraData && mappedData.extraData.length > 0) { + if (!section.extraColumns) { + // 从配置中获取extraColumns + const tableConfig = getTableConfig(sectionIndex); + if (tableConfig && tableConfig.extraColumns) { + section.extraColumns = tableConfig.extraColumns; + } + } + } + } else { + // 其他表格的正常处理 + tableData[tableKey] = mappedData; + section.data = mappedData; + } // 特殊处理数据存储 if (currentTable.value === 'tripleOne') { @@ -874,10 +894,15 @@ stateAssetsData.value = result.data.data; } - section.data = mappedData; section.suggestion = ''; + const recordCount = currentTable.value === 'personnel' + ? mappedData.mainData.length + : mappedData.length; message.success( - `成功生成 ${mappedData.length} 条${currentTable.title}记录` + `成功生成 ${recordCount} 条${currentTable.title}记录` + + (currentTable.value === 'personnel' && mappedData.extraData?.length > 0 + ? `,以及 ${mappedData.extraData.length} 条福利费明细记录` + : '') ); } else { throw new Error(result.data?.error || result.message || '生成失败'); @@ -1071,11 +1096,11 @@ /* 应用历史数据 */ const applyHistoryData = async ( - sectionIndex: number, - data: any[], - tableValue: string, - requestDataStr?: string, - interfaceName?: string + sectionIndex: number, + data: any[], + tableValue: string, + requestDataStr?: string, + interfaceName?: string ) => { const section: any = navigationItems.value[sectionIndex]; if (!section) return; @@ -1085,7 +1110,7 @@ // 找到对应的表格选项索引 const tableOptionIndex = section.tableOptions.findIndex( - (option) => option.value === tableValue + (option) => option.value === tableValue ); if (tableOptionIndex === -1) return; @@ -1113,14 +1138,30 @@ const mappedData = dataMapper(data); // 保存数据 - tableData[tableKey] = mappedData; + if (tableValue === 'personnel') { + tableData[tableKey] = mappedData.mainData; + section.extraData = mappedData.extraData || []; // 设置额外表格数据 + + // 如果有额外数据,确保extraColumns存在 + if (mappedData.extraData && mappedData.extraData.length > 0) { + if (!section.extraColumns) { + section.extraColumns = tableConfig.extraColumns || []; + } + } + } else { + tableData[tableKey] = mappedData; + } // 切换表格(如果当前不是这个表格) if (section.currentTableIndex !== tableOptionIndex) { await handleTableChange(sectionIndex, tableOptionIndex); } else { // 如果已经是当前表格,直接更新数据 - section.data = mappedData; + if (tableValue === 'personnel') { + section.data = mappedData.mainData; + } else { + section.data = mappedData; + } } // 特殊处理数据存储 @@ -1130,6 +1171,10 @@ // 存储国资管理数据,供预算管理审计表使用 stateAssetsData.value = data; } + + // 清空选中行 + selectedRowsMap[sectionIndex] = []; + selectedRowKeysMap[sectionIndex] = []; }; /* 编辑行 */