From 392e51701d00259cebf0244776198f3847f6a87f Mon Sep 17 00:00:00 2001 From: yuance <182865460@qq.com> Date: Wed, 7 Jan 2026 17:28:03 +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=B9-=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=BA=95=E7=A8=BF=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pwlProject/components/data/tableCommon.ts | 69 ++++++++++++++++--- .../pwlProject/components/reportContent.vue | 19 ++++- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/src/views/pwl/pwlProject/components/data/tableCommon.ts b/src/views/pwl/pwlProject/components/data/tableCommon.ts index b629e09..b3ba6c2 100644 --- a/src/views/pwl/pwlProject/components/data/tableCommon.ts +++ b/src/views/pwl/pwlProject/components/data/tableCommon.ts @@ -158,31 +158,75 @@ export function findTableConfigByInterface(interfaceName: string) { return null; } +// 解析workPaperIndex字符串为对象数组 +function parseWorkPaperIndex(workPaperIndex) { + if (!workPaperIndex || !Array.isArray(workPaperIndex)) return []; + + return workPaperIndex.map(item => { + if (typeof item === 'string') { + const parts = item.split('||'); + if (parts.length >= 3) { + return { + fileId: parts[0] || '', + fileName: parts[1] || '', + fileUrl: parts[2] || '' + }; + } + } + // 兼容旧格式 + return { + fileId: '', + fileName: typeof item === 'string' ? item : '', + fileUrl: '' + }; + }); +} + // 通用数据映射函数 export function createDataMapper(type: string) { const mappers = { - default1: (data) => data.map((item, index) => ({ key: index, index: index + 1, ...item })), - leaderList: (data) => data.map((item, index) => ({ key: index, ...item })), + default1: (data) => data.map((item, index) => ({ + key: index, + index: index + 1, + ...item, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) + })), + leaderList: (data) => data.map((item, index) => ({ + key: index, + ...item, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) + })), expense: (data) => data.map((item, index) => ({ key: index, ...item, finalStatementAmount: formatAmount(item.finalStatementAmount), - initialBudgetAmount: formatAmount(item.initialBudgetAmount) + initialBudgetAmount: formatAmount(item.initialBudgetAmount), + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) + })), + eightReg: (data) => data.map((item, index) => ({ + key: index, + ...item, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) })), - eightReg: (data) => data.map((item, index) => ({ key: index, ...item })), strategyAudit: (data) => data.map((item, index) => ({ key: index, index: index + 1, - ...item + ...item, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) + })), + tripleOne: (data) => data.map((item, index) => ({ + key: index, + ...item, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) })), - tripleOne: (data) => data.map((item, index) => ({ key: index, ...item })), decisionTable: (data) => data.map((item, index) => ({ key: index, index: index + 1, goods: item.executionEffect?.good || item.goods || '否', normal: item.executionEffect?.normal || item.normal || '否', bad: item.executionEffect?.bad || item.bad || '否', - ...item + ...item, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) })), budgetManage: (data) => data.map((item, index) => ({ key: index, @@ -202,7 +246,7 @@ export function createDataMapper(type: string) { govProcurement: formatAmount(item.indicatorUseGovProcurement), // 指标运用-政府采购 // 其他字段 indicatorBalance: formatAmount(item.indicatorBalance), // 指标结余 - workPaperIndex: Array.isArray(item.workPaperIndex) ? item.workPaperIndex : [], // 工作底稿索引 + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex), // 工作底稿索引 })), investmentSituation: (data) => data.map((item, index) => ({ key: index, @@ -211,11 +255,16 @@ export function createDataMapper(type: string) { auditContent: item.auditContent || item.content || '', checkEvidence: item.checkEvidence || item.evidence || '', testResult: item.testResult || '待检查', - workPaperIndex: Array.isArray(item.workPaperIndex) ? item.workPaperIndex : [], + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex), ...item })), // 其他类型的映射... - default: (data) => data.map((item, index) => ({ key: index, index: index + 1, ...item })) + default: (data) => data.map((item, index) => ({ + key: index, + index: index + 1, + ...item, + workPaperIndex: parseWorkPaperIndex(item.workPaperIndex) + })) }; return mappers[type] || mappers.default; diff --git a/src/views/pwl/pwlProject/components/reportContent.vue b/src/views/pwl/pwlProject/components/reportContent.vue index 092f211..362a4af 100644 --- a/src/views/pwl/pwlProject/components/reportContent.vue +++ b/src/views/pwl/pwlProject/components/reportContent.vue @@ -250,13 +250,28 @@
- {{ fileItem }} + + + {{ fileItem.fileName || '未命名文件' }} + + + + {{ fileItem.fileName || fileItem || '未命名文件' }} +