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, '_'); + } } };