Преглед изворни кода

feat: 指标标题显示共N项/M项异常,异常数红色

Xiaogang Liao пре 1 месец
родитељ
комит
2c7a2ecd3b
1 измењених фајлова са 39 додато и 6 уклоњено
  1. 39 6
      cfc-frontend/pages/health/report-confirm.vue

+ 39 - 6
cfc-frontend/pages/health/report-confirm.vue

@@ -148,7 +148,9 @@
       <!-- 健康指标(舌诊时隐藏,使用上方舌象指标卡片) -->
       <view class="card" v-if="payload.type !== 'tongue' && payload.indicators && payload.indicators.length">
         <view class="card-title">
-          <text>健康指标 ({{ payload.indicators.length }})</text>
+          <text>健康指标</text>
+          <text class="title-count">共 {{ payload.indicators.length }} 项</text>
+          <text class="title-abnormal" v-if="totalAbnormalCount > 0">,{{ totalAbnormalCount }} 项异常</text>
           <view class="card-title-actions">
             <text class="expand-all-btn" @click="toggleAllGroups(true)">全部展开</text>
             <text class="expand-all-btn" @click="toggleAllGroups(false)">全部折叠</text>
@@ -163,7 +165,7 @@
               <text class="indicator-group-name">{{ group.category }}</text>
             </view>
             <view class="indicator-group-header-right">
-              <text class="indicator-group-need" v-if="group.needCount > 0">{{ group.needCount }} 项需处理</text>
+              <text class="indicator-group-abnormal" v-if="group.abnormalCount > 0">{{ group.abnormalCount }} 项异常</text>
               <text class="indicator-group-count">{{ group.items.length }} 项</text>
             </view>
           </view>
@@ -358,16 +360,24 @@ export default {
         var cat = ind.category || '其他指标'
         if (!orderMap[cat]) {
           orderMap[cat] = groups.length
-          groups.push({ category: cat, items: [], needCount: 0 })
+          groups.push({ category: cat, items: [], needCount: 0, abnormalCount: 0 })
         }
         var group = groups[orderMap[cat]]
         group.items.push(ind)
-        var st = ind.status || 'normal'
-        if (st === 'high' || st === 'low' || st === 'abnormal') {
+        if (this.isAbnormalStatus(ind.status)) {
           group.needCount++
+          group.abnormalCount++
         }
       }
       return groups
+    },
+    totalAbnormalCount() {
+      var list = (this.payload && this.payload.indicators) || []
+      var count = 0
+      for (var i = 0; i < list.length; i++) {
+        if (this.isAbnormalStatus(list[i].status)) count++
+      }
+      return count
     }
   },
   onLoad: function(options) {
@@ -524,6 +534,10 @@ export default {
       if (status === '未检出') return '未检出'
       return '正常'
     },
+    isAbnormalStatus(status) {
+      if (!status || status === 'normal' || status === '正常' || status === '低风险' || status === '未检出') return false
+      return true
+    },
     showHelp(ind) {
       this.helpData = {
         name: ind.indicatorName || ind.name || '',
@@ -691,9 +705,22 @@ export default {
   display: flex;
   flex-direction: row;
   align-items: center;
-  justify-content: space-between;
+  flex-wrap: wrap;
+  gap: 4rpx;
+}
+.title-count {
+  font-size: 24rpx;
+  font-weight: normal;
+  color: #94A3B8;
+  margin-left: 8rpx;
+}
+.title-abnormal {
+  font-size: 24rpx;
+  font-weight: normal;
+  color: #C62828;
 }
 .card-title-actions {
+  margin-left: auto;
   display: flex;
   flex-direction: row;
   gap: 16rpx;
@@ -771,6 +798,12 @@ export default {
   font-size: 22rpx;
   color: #94A3B8;
 }
+.indicator-group-abnormal {
+  font-size: 22rpx;
+  color: #C62828;
+  font-weight: 500;
+  margin-right: 8rpx;
+}
 .indicator-group-body {
   padding: 16rpx;
 }