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 @@