Explorar el Código

fix(frontend): 修正指标异常计数与展示不一致

指标 status 为解析器原样提取的自由文本,isAbnormalStatus 用黑名单排除
(未知文本一律算异常),而 _cssClass/statusText 用白名单映射(未知显示正常),
导致分组标题'X 项异常'把样式正常的指标计入异常数。
改为与 _cssClass 一致的白名单判定(仅 high/low/abnormal/偏高/偏低/异常/
缺乏/不足/注意/高风险 计异常),并补齐 _cssClass/statusText 的'异常'中文键。
asus hace 1 mes
padre
commit
27a7c6195a
Se han modificado 1 ficheros con 9 adiciones y 7 borrados
  1. 9 7
      cfc-frontend/pages/health/report-confirm.vue

+ 9 - 7
cfc-frontend/pages/health/report-confirm.vue

@@ -733,15 +733,14 @@ export default {
       this.groupExpandList = arr
       this.groupExpandList = arr
     },
     },
     _cssClass(status) {
     _cssClass(status) {
-      var map = { 'high': 'high', 'low': 'low', 'abnormal': 'abnormal', 'normal': 'normal', '缺乏': 'deficient', '偏低': 'low', '不足': 'insufficient', '正常': 'normal', '注意': 'warning', '偏高': 'high', '高风险': 'high-risk', '低风险': 'low-risk', '未检出': 'not-detected' }
+      var map = { 'high': 'high', 'low': 'low', 'abnormal': 'abnormal', 'normal': 'normal', '缺乏': 'deficient', '偏低': 'low', '不足': 'insufficient', '正常': 'normal', '注意': 'warning', '偏高': 'high', '异常': 'abnormal', '高风险': 'high-risk', '低风险': 'low-risk', '未检出': 'not-detected' }
       return map[status] || 'normal'
       return map[status] || 'normal'
     },
     },
     statusText(status) {
     statusText(status) {
-      if (status === 'high') return '偏高'
-      if (status === 'low') return '偏低'
-      if (status === 'abnormal') return '异常'
+      if (status === 'high' || status === '偏高') return '偏高'
+      if (status === 'low' || status === '偏低') return '偏低'
+      if (status === 'abnormal' || status === '异常') return '异常'
       if (status === '缺乏') return '缺乏'
       if (status === '缺乏') return '缺乏'
-      if (status === '偏低') return '偏低'
       if (status === '不足') return '不足'
       if (status === '不足') return '不足'
       if (status === '正常') return '正常'
       if (status === '正常') return '正常'
       if (status === '注意') return '注意'
       if (status === '注意') return '注意'
@@ -750,9 +749,12 @@ export default {
       if (status === '未检出') return '未检出'
       if (status === '未检出') return '未检出'
       return '正常'
       return '正常'
     },
     },
+    // 与 _cssClass 保持同一白名单:仅明确异常/需关注的状态计入异常数,
+    // 未知状态文本(解析器自由提取)一律视为正常,避免"样式正常却计入异常"的矛盾。
     isAbnormalStatus(status) {
     isAbnormalStatus(status) {
-      if (!status || status === 'normal' || status === '正常' || status === '低风险' || status === '未检出') return false
-      return true
+      if (!status) return false
+      var abnormalMap = { 'high': 1, 'low': 1, 'abnormal': 1, '偏高': 1, '偏低': 1, '异常': 1, '缺乏': 1, '不足': 1, '注意': 1, '高风险': 1 }
+      return !!abnormalMap[String(status).trim()]
     },
     },
     showHelp(ind) {
     showHelp(ind) {
       this.helpData = {
       this.helpData = {