From 9de6cb41f703291bb87174ac07cb2744521d78a5 Mon Sep 17 00:00:00 2001 From: xiao12feng8 <16507319+xiao12feng8@user.noreply.gitee.com> Date: Mon, 22 Dec 2025 15:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=87=8F=E8=A1=A8=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/psychology/report/index.vue | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/xinli-ui/src/views/psychology/report/index.vue b/xinli-ui/src/views/psychology/report/index.vue index 6750944a..d08e0487 100644 --- a/xinli-ui/src/views/psychology/report/index.vue +++ b/xinli-ui/src/views/psychology/report/index.vue @@ -1036,8 +1036,11 @@ export default { reportId: row.reportId, sourceType: row.sourceType, sourceId: row.sourceId, - reportTitle: row.reportTitle || report.reportTitle || '未命名报告', - reportContent: report.reportContent || '', + infoNumber: row.infoNumber || report.infoNumber, + reportTitle: report.reportTitle, + reportType: report.reportType, + summary: report.summary, + reportContent: report.reportContent, aiAnalysis: report.aiAnalysis || null, aiAnalysisTime: report.aiAnalysisTime || null, generating: false @@ -1201,8 +1204,9 @@ export default { `; - // 清理文件名中的非法字符 - const safeFileName = `${report.reportTitle || '报告'}_${report.reportId}` + const scaleName = this.extractScaleName(report.reportTitle || '报告'); + const infoNumber = this.sanitizeFilenamePart(report.infoNumber || '-'); + const safeFileName = `${scaleName}_${infoNumber}_${report.reportId}` .replace(/[\\/:*?"<>|]/g, '_') .substring(0, 80); @@ -1329,6 +1333,22 @@ export default { this.batchExportLoading = false; } } + , + extractScaleName(title) { + const raw = (title || '').toString(); + let t = raw.replace(/\(次数\d+\)/g, '').trim(); + t = t.replace(/(测评报告|答题报告|报告)$/g, '').trim(); + t = t.replace(/[\s\-–—_]+$/g, '').trim(); + return this.sanitizeFilenamePart(t || raw || '报告'); + } + , + sanitizeFilenamePart(value) { + const v = (value == null ? '' : String(value)).trim(); + if (!v) { + return '-'; + } + return v.replace(/[\\/:*?"<>|]/g, '_'); + } } };