Просмотр исходного кода

fix(cockpit): 统一设备状态图例与效率指标文案

ChenJZ 1 день назад
Родитель
Сommit
8a468fa950

+ 1 - 1
src/modules/cockpit/domain/overviewPanels.js

@@ -674,7 +674,7 @@ export function warningStudyPanel(data, section) {
     const current = data || {}
     const today = current.today || {}
     const ranking = current.typeRanking || {}
-    // 排行标题按设计稿拆成两段:块标题「预警类型排行」+ 右上角小字「近30日 · 共XX起 · 点击筛选」。
+    // 排行标题按设计稿拆成两段:块标题「预警类型排行(30日)」+ 右上角小字「近30日发生 · 共XX起 · 点击筛选」。
     // 小字整句仍是需求原文的锁定文案(拆位置不拆字),闸门按整句断言。
     const rankingAside = `近30日发生 · 共${valueText(ranking.total)}起 · 点击筛选`
     const blocks = [

+ 6 - 2
src/modules/cockpit/domain/pointStatus.js

@@ -240,9 +240,13 @@ export function legendIconFor(key) {
  * 读不出「这台设备有没有在采集」。点位/设备卡片仍读后端 `statusLabel`「正常」,不受影响。
  */
 const LEGEND_LABEL_BY_KEY = {
-    NORMAL: '在线',
+    ALARM: '报警设备',
+    WARNING: '预警设备',
+    WORK_ORDER: '工单处置',
+    NORMAL: '在线设备',
+    OFFLINE: '离线设备',
     EMPTY: '无设备监测点',
-    UNASSOCIATED: '独立设备(未关联监测点)',
+    UNASSOCIATED: '独立设备(无关联监测点)',
 }
 
 /** 六态 + 两条附加词条的**原始 label**(下标访问要防原型链,故用 Map 而非普通对象)。 */

+ 2 - 2
src/modules/cockpit/domain/warningResponsePanels.js

@@ -726,7 +726,7 @@ function warningEfficiencyKpis(current) {
     const states = current.warningStates
     const counts = states && states.length ? warningStateCounts(states) : null
     return kpiBlock([
-        { key: 'warningTotal', label: '预警数', value: valueText(current.totalEvents), unit: '条', span: KPI_GRID_SPAN.third },
+        { key: 'warningTotal', label: '预警条数', value: valueText(current.totalEvents), unit: '条', span: KPI_GRID_SPAN.third },
         {
             key: 'warningUnresolved',
             label: '未解除预警',
@@ -781,7 +781,7 @@ function warningEfficiencyKpis(current) {
  */
 function alarmEfficiencyKpis(current) {
     return kpiBlock([
-        { key: 'alarmTotal', label: '报警数', value: valueText(current.totalEvents), unit: '条', span: KPI_GRID_SPAN.third },
+        { key: 'alarmTotal', label: '报警条数', value: valueText(current.totalEvents), unit: '条', span: KPI_GRID_SPAN.third },
         {
             key: 'alarmUnlinked',
             label: '未关联工单',

+ 16 - 0
tests/legendLabels.test.js

@@ -0,0 +1,16 @@
+/** 设备状态图例统一文案;报警/预警/在线/离线都带“设备”后缀。 */
+import assert from 'node:assert/strict'
+import { test } from 'node:test'
+
+import { legendVisuals } from '../src/modules/cockpit/domain/pointStatus.js'
+
+test('设备状态图例使用设备语义文案', () => {
+    const labels = Object.fromEntries(legendVisuals().map((row) => [row.key, row.label]))
+    assert.equal(labels.ALARM, '报警设备')
+    assert.equal(labels.WARNING, '预警设备')
+    assert.equal(labels.WORK_ORDER, '工单处置')
+    assert.equal(labels.NORMAL, '在线设备')
+    assert.equal(labels.OFFLINE, '离线设备')
+    assert.equal(labels.EMPTY, '无设备监测点')
+    assert.equal(labels.UNASSOCIATED, '独立设备(无关联监测点)')
+})