From f2c726c5c6567aec1be5edd87e7e2593343597d7 Mon Sep 17 00:00:00 2001 From: yuance <182865460@qq.com> Date: Mon, 2 Feb 2026 11:08:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=8F=96=E8=AF=81=E5=8D=95-=E9=99=84=E4=BB=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/components/EvidenceModal.vue | 25 +++++++++++++++++-- .../pwlProject/components/reportContent.vue | 9 ++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/views/pwl/pwlProject/components/components/EvidenceModal.vue b/src/views/pwl/pwlProject/components/components/EvidenceModal.vue index 72cd8b9..c67d1c1 100644 --- a/src/views/pwl/pwlProject/components/components/EvidenceModal.vue +++ b/src/views/pwl/pwlProject/components/components/EvidenceModal.vue @@ -309,6 +309,25 @@ const form = reactive(defaultForm()); + const formatAttachmentText = (caseIndex: string, raw: string) => { + const safeCaseIndex = (caseIndex || '').trim(); + const items = (raw || '') + .split(/[\n,,]/) + .map((s) => s.trim()) + .filter(Boolean); + if (!safeCaseIndex || items.length === 0) return raw || ''; + + const escaped = safeCaseIndex.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const prefixRe = new RegExp(`^${escaped}-\\d{3}-`); + return items + .map((name, idx) => { + const no = String(idx + 1).padStart(3, '0'); + const baseName = name.replace(prefixRe, ''); + return `${safeCaseIndex}-${no}-${baseName}`; + }) + .join('\n'); + }; + const applyBaseInfo = () => { console.log('applyBaseInfo called, selectedRows:', props.selectedRows); console.log('baseInfo:', props.baseInfo); @@ -322,7 +341,8 @@ console.log('Evidence data from selectedRows:', evidenceData); // 直接将后端返回的数据映射到表单字段 - form.caseIndex = evidenceData.caseIndex || form.caseIndex || ''; + form.caseIndex = + props.baseInfo?.caseIndex || props.project?.caseIndex || form.caseIndex || ''; form.projectName = evidenceData.projectName || form.projectName || ''; form.auditedTarget = evidenceData.auditedTarget || form.auditedTarget || ''; @@ -353,9 +373,10 @@ form.feedbackDeadline = 'XX年XX月XX日'; // 处理attachment字段(数组转字符串) if (evidenceData.attachment) { - form.attachment = Array.isArray(evidenceData.attachment) + const rawAttachment = Array.isArray(evidenceData.attachment) ? evidenceData.attachment.join('\n') : evidenceData.attachment; + form.attachment = formatAttachmentText(form.caseIndex, rawAttachment); } // 特殊处理:如果evidenceData中有title字段,也填充到summaryTitle diff --git a/src/views/pwl/pwlProject/components/reportContent.vue b/src/views/pwl/pwlProject/components/reportContent.vue index 99dc725..df7ba66 100644 --- a/src/views/pwl/pwlProject/components/reportContent.vue +++ b/src/views/pwl/pwlProject/components/reportContent.vue @@ -768,7 +768,7 @@ const section: any = navigationItems.value[sectionIndex]; const tableInfo = getTableInfo(sectionIndex); - evidenceBaseInfo.caseIndex = (form as any).code || props.data?.code || ''; + evidenceBaseInfo.caseIndex = (form as any).caseIndex || props.data?.caseIndex || ''; evidenceBaseInfo.projectName = form.name || props.data?.name || ''; evidenceBaseInfo.auditedTarget = (form as any).nickname || (props.data as any)?.nickname || ''; @@ -975,9 +975,10 @@ } // 调用generateAuditEvidence API + const projectCaseIndex = (form as any).caseIndex || props.data?.caseIndex || ''; const requestData = { // 基础信息 - caseIndex: (form as any).code || props.data?.code || '', + caseIndex: projectCaseIndex, projectName: form.name || props.data?.name || '', auditedTarget: (form as any).nickname || (props.data as any)?.nickname || '', auditMatter: currentTable.title || section?.title || section?.name || '', @@ -1031,7 +1032,7 @@ console.log('生成的取证单数据:', apiResult.data); // 自动打开取证单预览弹窗并填充数据 - evidenceBaseInfo.caseIndex = apiResult.data.caseIndex || (form as any).code || props.data?.code || ''; + evidenceBaseInfo.caseIndex = projectCaseIndex; evidenceBaseInfo.projectName = apiResult.data.projectName || form.name || props.data?.name || ''; evidenceBaseInfo.auditedTarget = apiResult.data.auditedTarget || (form as any).nickname || (props.data as any)?.nickname || ''; evidenceBaseInfo.auditMatter = apiResult.data.auditMatter || currentTable.title || section?.title || section?.name || ''; @@ -1039,7 +1040,7 @@ // 将生成的取证单数据作为选中的行数据传入,包含所有字段 const evidenceData = { // 基础信息字段 - caseIndex: apiResult.data.caseIndex || '', + caseIndex: projectCaseIndex, projectName: apiResult.data.projectName || '', auditedTarget: apiResult.data.auditedTarget || '', auditMatter: apiResult.data.auditMatter || '',