From 173b3ceb2e817e8f767dc1a30987d5e764e06025 Mon Sep 17 00:00:00 2001 From: Jafeng <2998840497@qq.com> Date: Tue, 27 Jan 2026 17:38:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archive-detail/service-info-tab.vue | 29 ++++++++- pages/case/archive-detail.vue | 63 +++++++++++++++++-- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/components/archive-detail/service-info-tab.vue b/components/archive-detail/service-info-tab.vue index f94b22d..e928aae 100644 --- a/components/archive-detail/service-info-tab.vue +++ b/components/archive-detail/service-info-tab.vue @@ -45,7 +45,7 @@ - {{ i.taskContentDisplay || '暂无内容' }} + {{ displayTaskContent(i) || '暂无内容' }} @@ -152,9 +152,33 @@ function resolveUserName(userId) { return String(map[id] || '') || id; } +function escapeRegExp(str) { + return String(str).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} + +function replaceKnownUserIds(text) { + const map = userNameMap.value || {}; + const ids = Object.keys(map); + if (!ids.length) return text; + + let out = text; + ids.forEach((id) => { + const name = String(map[id] || ''); + if (!id || !name || name === id) return; + const re = new RegExp(`(^|[^0-9A-Za-z_])(${escapeRegExp(id)})(?=[^0-9A-Za-z_]|$)`, 'g'); + out = out.replace(re, (_, p1) => `${p1}${name}`); + }); + return out; +} + function formatTaskContent(text) { if (typeof text !== 'string') return ''; - return text.replace(/&&&([^&]+)&&&/g, (_, id) => resolveUserName(id)).trim(); + const withPlaceholders = text.replace(/&&&([^&]+)&&&/g, (_, id) => resolveUserName(id)); + return replaceKnownUserIds(withPlaceholders).trim(); +} + +function displayTaskContent(r) { + return formatTaskContent(String(r?.taskContent || '')); } async function loadTeamMembers(teamId) { @@ -196,7 +220,6 @@ function mapRow(i) { fileType, timeStr: i.executionTime ? dayjs(i.executionTime).format('YYYY-MM-DD HH:mm') : '--', typeStr: getServiceTypeLabel(i.eventType), - taskContentDisplay: formatTaskContent(String(i?.taskContent || '')), }; } diff --git a/pages/case/archive-detail.vue b/pages/case/archive-detail.vue index 8951780..542e2f6 100644 --- a/pages/case/archive-detail.vue +++ b/pages/case/archive-detail.vue @@ -217,9 +217,10 @@