Explorar el Código

feat(cockpit): 统一详情关联信息与等级徽标

- 当前预警前端只排除草稿与已解除,历史分析保留全部非草稿
- 工单处置流水按时间倒序,最近一步置顶
- 报警/预警/工单详情统一为「关联信息」页签,整合设备与可关联事件
- 等级/优先级徽标移到状态右侧,删除上方等级指标卡
- 报警信息补相关人员指标;工单优先级改用等级色徽标
- 当前预警切换按钮与其它面板视觉统一
ChenJZ hace 1 día
padre
commit
b5afa4b91e

+ 2 - 0
src/modules/cockpit/components/EntityDetailDrawer.vue

@@ -15,6 +15,8 @@
                 <span v-if="view.status" class="entity-drawer__badge entity-drawer__status" :data-tone="view.tone" data-entity-status>
                     <em v-if="view.statusCaption" class="entity-drawer__status-caption">{{ view.statusCaption }}</em>{{ view.status }}
                 </span>
+                <!-- 等级/优先级与状态并排:状态定位置,等级给风险语义。 -->
+                <span v-if="view.levelLabel" class="entity-drawer__badge entity-drawer__level" :data-tone="view.levelTone" data-entity-level>{{ view.levelLabel }}</span>
             </div>
             <p v-if="store.loading" class="entity-drawer__hint" data-entity-detail-loading>正在更新详情…</p>
             <p v-if="store.error" class="entity-drawer__hint is-error" data-entity-detail-error>

+ 29 - 4
src/modules/cockpit/components/EntityDetailSections.vue

@@ -45,6 +45,20 @@
                 </li>
             </ol>
         </section>
+        <section v-if="showRelations" class="entity-sections__group">
+            <h3><span class="entity-sections__icon" aria-hidden="true" v-html="sectionIcon('关联信息')"></span>关联信息</h3>
+            <p v-if="!view.relations.length" class="entity-sections__empty">暂无可关联信息</p>
+            <ul v-else class="entity-sections__relations">
+                <li v-for="item in view.relations" :key="`${item.kind}:${item.code}:${item.name}`">
+                    <span class="entity-sections__relation-kind">{{ item.kindLabel }}</span>
+                    <b>{{ item.name }}</b>
+                    <span v-if="item.code" class="entity-sections__relation-code">{{ item.code }}</span>
+                    <span v-if="item.status" class="entity-sections__relation-status">{{ item.status }}</span>
+                    <small v-if="item.meta">{{ item.meta }}</small>
+                    <button v-if="item.locateCode" type="button" class="entity-sections__locate" :data-locate-device="item.locateCode" @click.stop="locateDevice(item.locateCode)">定位 {{ item.locateCode }}</button>
+                </li>
+            </ul>
+        </section>
         <section v-if="showDevices && view.devices.length" class="entity-sections__group">
             <h3><span class="entity-sections__icon" aria-hidden="true" v-html="sectionIcon('设备信息')"></span>设备信息</h3>
             <ul><li v-for="item in view.devices" :key="item.code || item.name"><b>{{ item.name }}</b><span>{{ [item.code, item.status].filter(Boolean).join(' · ') }}</span><small v-if="item.type">{{ item.type }}</small><small v-if="item.location">{{ item.location }}</small><button v-if="item.code" type="button" class="entity-sections__locate" :data-locate-device="item.code" @click.stop="locateDevice(item.code)">定位 {{ item.code }}</button></li></ul>
@@ -128,10 +142,13 @@ const activeSections = computed(() => {
     return view.value.sections
 })
 const showPeople = computed(() => showOverview.value)
-// 工单的设备信息只放「设备信息」页签,避免概览与页签各一份;其它实体维持概览可见。
-const showDevices = computed(() => view.value.kind === 'work-order'
-    ? activeTab.value === 'devices'
-    : (!activeTab.value || activeTab.value === 'overview' || activeTab.value === 'devices'))
+const showRelations = computed(() => activeTab.value === 'relations')
+// 事件与工单的设备/关联对象统一进「关联信息」页签;其它实体保持原概览行为。
+const showDevices = computed(() => {
+    if (view.value.kind === 'event') return false
+    if (view.value.kind === 'work-order') return activeTab.value === 'devices'
+    return !activeTab.value || activeTab.value === 'overview' || activeTab.value === 'devices'
+})
 const showRecords = computed(() => activeTab.value === 'records')
 const showAttachments = computed(() => activeTab.value === 'attachments')
 const showFlow = computed(() => activeTab.value === 'flow')
@@ -219,6 +236,14 @@ function locateDevice(code) {
 
 /* 设备 / 关联 / 报警列表 */
 .entity-sections__group ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
+.entity-sections__relations li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: baseline; }
+.entity-sections__relation-kind { grid-row: span 2; align-self: start; padding: 0 6px; border: 1px solid rgba(1, 171, 234, .45); border-radius: 9px; color: var(--cyan-hi); font-size: calc(9.5 * var(--u, 1px)); line-height: 1.7; }
+.entity-sections__relation-code,
+.entity-sections__relation-status { color: var(--muted); font-size: calc(10 * var(--u, 1px)); overflow-wrap: anywhere; }
+.entity-sections__relation-code { grid-column: 2; }
+.entity-sections__relation-status { grid-column: 3; justify-self: end; }
+.entity-sections__relations small { grid-column: 2 / -1; }
+.entity-sections__relations .entity-sections__locate { grid-column: 2 / -1; justify-self: start; }
 .entity-sections__group ul li { padding: 5px 0; }
 .entity-sections__group ul li + li { border-top: 1px solid rgba(1, 171, 234, .12); }
 .entity-sections__group li b { display: block; color: var(--text-strong); font-size: calc(12 * var(--u, 1px)); overflow-wrap: anywhere; }

+ 4 - 4
src/modules/cockpit/components/EventListPane.vue

@@ -216,26 +216,26 @@ function setMode(next) {
 }
 
 .event-list-pane__switch-btn {
-    padding: calc(1 * var(--u, 1px)) calc(10 * var(--u, 1px));
+    padding: calc(1 * var(--u, 1px)) calc(8 * var(--u, 1px));
     border: 1px solid rgba(1, 171, 234, 0.32);
     border-radius: calc(8 * var(--u, 1px));
     background: rgba(0, 20, 72, 0.6);
     color: var(--text-2);
     font: inherit;
     font-size: var(--fs-caption, 10.5px);
-    letter-spacing: 0.04em;
     cursor: pointer;
 }
 
 .event-list-pane__switch-btn:hover,
 .event-list-pane__switch-btn:focus-visible {
-    border-color: rgba(1, 171, 234, 0.6);
+    border-color: rgba(0, 184, 255, 0.85);
+    background: rgba(0, 82, 168, 0.72);
     color: var(--text-strong);
 }
 
 .event-list-pane__switch-btn.is-active {
     border-color: rgba(0, 184, 255, 0.85);
-    background: linear-gradient(180deg, rgba(1, 171, 234, 0.85), rgba(0, 82, 168, 0.85));
+    background: rgba(0, 82, 168, 0.72);
     color: var(--text-strong);
 }
 

+ 135 - 24
src/modules/cockpit/domain/entityDetail.js

@@ -117,6 +117,7 @@ export function entityDetailView(detail) {
         sections: Array.isArray(current.sections) ? current.sections : [],
         people: Array.isArray(current.people) ? current.people : [],
         devices: Array.isArray(current.devices) ? current.devices : [],
+        relations: Array.isArray(current.relations) ? current.relations : [],
         sectionMap: current.sectionMap && typeof current.sectionMap === 'object' ? current.sectionMap : {},
         attachments: Array.isArray(current.attachments) ? current.attachments : [],
         maintenanceImages: Array.isArray(current.maintenanceImages) ? current.maintenanceImages : [],
@@ -746,6 +747,7 @@ function normalizeEvent(identity, source) {
     // 报警族的处置记录/附件在不同后端版本字段不一,这里做兼容收集(预警族字段不变)。
     const auditRecords = collectAuditRecords(source)
     const attachments = collectAttachmentItems(source)
+    const relations = eventRelations(family, source)
     return {
         ...identity,
         name,
@@ -759,16 +761,19 @@ function normalizeEvent(identity, source) {
         levelLabel: level.label,
         levelTone: level.tone,
         raw: source,
-        // 等级带语义色(与卡片同一张词表),是摘要里唯一的等级呈现位置。
-        // 状态只在抬头徽标展示;摘要卡不再重复(等级 / 当前值 / 发生时间)。
-        summary: summaryItems([['等级', level.label, level.tone], ['当前值', withUnit(source.value ?? source.actualValue, source.unit || source.warningUnit)], ['发生时间', formatEventTime(source.eventTime || source.createTime)]]),
+        // 等级已移到状态徽标右侧;摘要卡不再重复(保留当前值 / 发生时间)。
+        summary: summaryItems([['当前值', withUnit(source.value ?? source.actualValue, source.unit || source.warningUnit)], ['发生时间', formatEventTime(source.eventTime || source.createTime)]]),
         tabs: family === 'WARNING'
-            ? [tab('overview', '预警信息'), tab('records', '处置记录'), tab('alarms', '关联报警'), tab('attachments', '附件')]
-            : [tab('overview', '报警信息'), tab('devices', '设备信息'), tab('records', '处置记录'), tab('attachments', '附件')],
+            ? [tab('overview', '预警信息'), tab('records', '处置记录'), tab('relations', '关联信息'), tab('attachments', '附件')]
+            : [tab('overview', '报警信息'), tab('relations', '关联信息'), tab('records', '处置记录'), tab('attachments', '附件')],
         relatedAlarms: Array.isArray(source.alarmList) ? source.alarmList.map(relatedAlarm) : [],
         stage: eventStage(family, rawStatus, auditRecords),
-        people: peopleItems([['发布人', source.publisherName], ['处置人', source.handlerName], ['核验人', source.reviewerName]]),
+        // 报警的「相关人员」即使后端暂未回填姓名也要有指标位;预警沿用原口径。
+        people: family === 'ALARM'
+            ? alarmPeople(source, auditRecords)
+            : peopleItems([['发布人', source.publisherName], ['处置人', source.handlerName], ['核验人', source.reviewerName]]),
         devices: deviceItems(source),
+        relations,
         attachments,
         records: recordItems(auditRecords),
         sections: compactSections([
@@ -782,14 +787,6 @@ function normalizeEvent(identity, source) {
                 field('阈值', threshold(source)),
                 field('超出幅度', withUnit(source.deviationRatio, '%')),
             ]),
-            section('关联信息', [
-                field('设备名称', source.deviceName),
-                field('监测点', source.monitoringPointName || source.monitoringPointCode),
-                // 设备编码单独整行:长编码不换行、也不截断成省略号。
-                field('设备编码', source.deviceCode || source.monitoringPointCode, true),
-                field('工单', source.workOrderCode || source.orderNo),
-                field('位置', source.location || source.address || locationText(source.gisLocation), true),
-            ]),
             section('处置与附件', [
                 field('处置记录', listCount(auditRecords, '条')),
                 field('关联报警', listCount(source.alarmList, '条')),
@@ -800,6 +797,99 @@ function normalizeEvent(identity, source) {
     }
 }
 
+function alarmPeople(source, records) {
+    const latest = latestOperator(records)
+    const handler = text(source.receiveUserName || source.handlerName || source.receiverName || latest)
+    const verifier = text(source.verifyUserName || source.reviewerName)
+    return [
+        { role: '处置人', name: handler || '未提供' },
+        { role: '核验人', name: verifier || '未提供' },
+    ]
+}
+
+function latestOperator(records) {
+    const list = Array.isArray(records) ? records : records ? [records] : []
+    const hit = list.find((item) => item && text(item.operatorName || item.operator))
+    return hit ? text(hit.operatorName || hit.operator) : ''
+}
+
+/** 关联信息:只列当前数据真实带出的设备 / 预警 / 报警 / 工单,不猜不补。 */
+function eventRelations(family, source) {
+    const list = []
+    const device = deviceRelation(source)
+    if (device) list.push(device)
+    if (family === 'WARNING' && Array.isArray(source.alarmList)) {
+        source.alarmList.map(relatedAlarm).forEach((item) => {
+            const relation = alarmRelation(item)
+            if (relation) list.push(relation)
+        })
+    }
+    if (family === 'ALARM') {
+        const warning = warningRelation(source)
+        if (warning) list.push(warning)
+    }
+    const workOrder = workOrderRelation(source)
+    if (workOrder) list.push(workOrder)
+    return list
+}
+
+function deviceRelation(source) {
+    const name = text(source.deviceName || source.monitoringPointName)
+    const code = text(source.deviceCode || source.monitoringPointCode)
+    if (!name && !code) return null
+    return {
+        kind: 'device',
+        kindLabel: '设备',
+        code,
+        name: name || code,
+        status: '',
+        meta: [text(source.deviceTypeName), text(source.deviceLocation || source.location || source.address)].filter(Boolean).join(' · '),
+        locateCode: code,
+    }
+}
+
+function alarmRelation(item) {
+    const code = text(item && (item.code || item.alarmNo))
+    const name = text(item && (item.name || item.alarmContent || item.alarmName))
+    if (!code && !name) return null
+    return {
+        kind: 'alarm',
+        kindLabel: '报警',
+        code,
+        name: name || code,
+        status: text(item && (item.status || item.alarmStatusName)) || '',
+        meta: '',
+    }
+}
+
+function warningRelation(source) {
+    const code = text(source.warningNo || source.warningId || source.warningCode)
+    const name = text(source.warningName || source.warningTypeName || source.warningContent)
+    if (!code && !name) return null
+    return {
+        kind: 'warning',
+        kindLabel: '预警',
+        code,
+        name: name || code,
+        status: eventStatusText(source.warningStatus || source.status, 'WARNING'),
+        meta: '',
+    }
+}
+
+function workOrderRelation(source) {
+    const code = text(source.orderNo || source.workOrderCode || source.workOrderNo)
+    const name = text(source.orderDesc || source.workOrderDesc || source.orderTitle)
+    if (!code && !name) return null
+    return {
+        kind: 'work-order',
+        kindLabel: '工单',
+        code,
+        name: name || code,
+        status: text(source.orderStatusName || source.workOrderStateName),
+        meta: '',
+    }
+}
+
 function normalizeWorkOrder(identity, source) {
     const detailSource = source && source.order ? source : { order: source, logs: source.logs || [] }
     const raw = { ...(detailSource.order || {}) }
@@ -821,6 +911,19 @@ function normalizeWorkOrder(identity, source) {
         track = trackOf(toWorkOrderTimeline(source))
     }
     const stateText = order.stateName || workOrderStateName(order.stateCode)
+    const relations = []
+    const device = deviceRelation(order)
+    if (device) relations.push(device)
+    if (order.code) {
+        relations.push({
+            kind: 'work-order',
+            kindLabel: '工单',
+            code: order.code,
+            name: order.description || order.code,
+            status: stateText,
+            meta: order.orderLevel === null ? '' : `优先级 ${orderLevelText(order.orderLevel)}`,
+        })
+    }
     return {
         ...identity,
         name: order.description || order.code || '工单名称未提供',
@@ -829,17 +932,21 @@ function normalizeWorkOrder(identity, source) {
         kindLabel: '工单',
         statusText: stateText,
         tone: workOrderTone(order.stateCode),
+        // 优先级作为等级徽标放在状态右侧,与报警/预警的等级徽标同一位置。
+        levelLabel: order.orderLevel === null ? '' : `优先级 ${orderLevelText(order.orderLevel)}`,
+        levelTone: orderLevelTone(order.orderLevel),
         order,
         track,
         raw: source,
-        // 抬头已有状态徽标;顶部指标卡不再重复工单号/状态/优先级(维护者 2026-12-01)。
+        // 抬头已有状态/优先级徽标;顶部指标卡不再重复工单号或优先级(维护者 2026-12-01)。
         summary: [],
-        tabs: [tab('overview', '工单信息'), tab('flow', '处理流程'), tab('devices', '设备信息'), tab('attachments', '附件')],
+        tabs: [tab('overview', '工单信息'), tab('flow', '处理流程'), tab('relations', '关联信息'), tab('attachments', '附件')],
         stage: workOrderStage(order.stateCode),
         // 相关人员与「处置内容」里的处置人/核验人重复;工单详情不再单独出这一栏。
         people: [],
-        // 设备信息统一放「设备信息」页签,概览不再重复一份。
+        // 设备信息统一在「关联信息」页签,概览不再重复一份。
         devices: order.deviceCode || order.deviceName ? [{ name: order.deviceName || order.deviceCode, code: order.deviceCode, type: order.deviceTypeName, location: order.deviceLocation }] : [],
+        relations,
         // 附件页签保留完整清单;处理流程页签另外按维修前/后分组展示。
         attachments: attachmentItems([
             ...order.maintenanceBeforeImages,
@@ -852,8 +959,8 @@ function normalizeWorkOrder(identity, source) {
         ].filter((group) => group.images.length),
         records: recordItems(timelineRaw),
         sections: compactSections([
-            // 只保留工单号与优先级;状态只由左上角徽标展示。
-            section('工单摘要', [field('工单号', order.code || '未提供'), field('优先级', orderLevelText(order.orderLevel))]),
+            // 工单号在摘要;状态和优先级只由左上角徽标展示。
+            section('工单摘要', [field('工单号', order.code || '未提供')]),
             // 与设备详情同口径:ISO 带时区串统一 yyyy-MM-dd HH:mm:ss(维护者 2026-11-23)。
             section('时间信息', [field('创建时间', formatEventTime(order.createTime)), field('计划完成', formatEventTime(order.planFinishTime)), field('实际完成', formatEventTime(order.realFinishTime))]),
             section('处置内容', [field('处置人', order.receiveUserName), field('核验人', order.verifyUserName), field('故障描述', order.description, true), field('处置结果', order.repairResult, true)]),
@@ -869,6 +976,11 @@ function orderLevelText(value) {
     return { '0': '紧急', '1': '一般', '2': '低' }[code] || code
 }
 
+/** 工单优先级色:0 紧急红 / 1 一般黄 / 2 低蓝;认不出回中性。 */
+function orderLevelTone(value) {
+    return { '0': 'lv1', '1': 'lv2', '2': 'lv3' }[String(value ?? '').trim()] || 'neutral'
+}
+
 function tab(key, label) { return { key, label } }
 function relatedAlarm(item) { const code = text(item.code || item.alarmNo || item.alarm_no || item.alarmCode || item.alarmId || item.alarm_id || item.id); const name = item.alarmName || item.alarm_name || item.content || item.alarmContent || item.alarm_content || item.deviceName || item.device_name || item.title || (code ? `报警 ${code}` : '关联报警'); return { id: item.alarmId || item.alarm_id || item.id || '', code, name, status: eventStatusText(mobileAlarmStatus(item.alarmStatus ?? item.alarm_status) || item.status || item.auditStatusName || item.alarmStatusName, 'ALARM') } }
 function summaryItems(entries) { return entries.filter(([,value]) => value !== null && value !== undefined && String(value).trim() !== '').map(([label,value,tone]) => ({ label, value: String(value), tone: tone || '' })) }
@@ -897,7 +1009,10 @@ function recordItems(value) {
 /** 处置记录来源兼容:预警 disposalHistory/logs;报警可能来自 audit 列表、工单时间线或最近操作。 */
 function collectAuditRecords(source) {
     const list = []
-    const push = (value) => { if (Array.isArray(value)) list.push(...value.filter(Boolean)) }
+    const push = (value) => {
+        if (Array.isArray(value)) list.push(...value.filter(Boolean))
+        else if (value && typeof value === 'object') list.push(value)
+    }
     push(source.disposalHistory)
     push(source.logs)
     push(source.timelineEntries)
@@ -983,9 +1098,5 @@ function threshold(source) {
 function positive(value, fallback) { const n = Number(value); return Number.isFinite(n) && n > 0 ? Math.floor(n) : fallback }
 function nonNegative(value, fallback) { const n = Number(value); return Number.isFinite(n) && n >= 0 ? Math.floor(n) : fallback }
 function listCount(value, unit) { return Array.isArray(value) ? `${value.length} ${unit}` : '' }
-function locationText(value) {
-    if (!value || typeof value !== 'object') return ''
-    return value.location || value.address || [value.longitude, value.latitude].filter((item) => item !== undefined && item !== null).join(', ')
-}
 function matchesId(row, id) { return !!row && [row.id, row.code, row.workOrderCode, row.warningNo, row.alarmId, row.facilityCode, row.resourceId].some((value) => String(value ?? '').trim() === id) }
 function workOrderTone(code) { if (code === 5) return 'lv4'; if (code === 7) return 'lv1'; if (code === 6) return 'lv2'; return 'lv3' }

+ 4 - 4
src/modules/cockpit/domain/eventList.js

@@ -299,11 +299,11 @@ export function isTerminalEventStatus(status) {
 /**
  * 「当前」列表按族排除的状态(维护者 2026-11-05)。
  *
- * 预警状态为 DRAFT/PENDING/RECEIVED/PROCESSING/HANDLED/CLOSED 六态,**只有草稿不进入
- * 当前列表**;已处置与已解除仍需核查/展示,维护者实测应为 8。报警维持原口径:已处理即离开「当前」。
- * 认不出/缺失的状态按「不能证明已排除」保留。
+ * 预警状态为 DRAFT/PENDING/RECEIVED/PROCESSING/HANDLED/CLOSED 六态,**当前预警只在前端
+ * 排除草稿与已解除**;历史分析保留全部非草稿状态。已处置仍需核查,照旧进入当前列表。
+ * 报警维持原口径:已处理即离开「当前」。认不出/缺失的状态按「不能证明已排除」保留。
  */
-const WARNING_EXCLUDED_FROM_CURRENT = new Set(['DRAFT'])
+const WARNING_EXCLUDED_FROM_CURRENT = new Set(['DRAFT', 'CLOSED'])
 export function isHiddenFromCurrentList(status, family) {
     const value = typeof status === 'string' ? status.trim().toUpperCase() : ''
     if (!value) return false

+ 2 - 1
src/modules/cockpit/domain/workOrderTimeline.js

@@ -154,7 +154,8 @@ export function trackOf(timeline) {
         stateCode: isWorkOrderStateCode(stateCode) ? stateCode : null,
         stateName: workOrderStateName(stateCode) || '状态未知',
         reachedCode,
-        steps,
+        // 维护者 2026-12-01:处置流水按时间倒序(最近一步在最上面);状态路径仍按码表正序。
+        steps: steps.reverse(),
         entryCount: steps.length,
         rollbackCount,
         hasRollback: rollbackCount > 0,

+ 6 - 7
tests/entityDetailWarning.test.js

@@ -111,19 +111,18 @@ test('状态只在抬头徽标出现,摘要卡与事件摘要都不重复', ()
     assert.equal(summarySection.fields.find((f) => f.label === '事件编码').wide, true)
 })
 
-test('关联信息:设备编码独立整行,标签为「设备编码」', () => {
+test('关联信息:设备进入关联信息页签,编码完整展示', () => {
     const raw = {
         basicInfo: { warningNo: 'YJ1', status: 'CLOSED', eventTime: '2026-11-27T16:26:21.000+08:00', deviceCode: '4101050000132000000', deviceName: '测试设备' },
         disposalHistory: [],
         alarmList: [],
     }
     const view = entityDetailView(normalizeEntityDetail({ kind: 'event', id: 'YJ1', family: 'WARNING' }, raw))
-    const related = view.sections.find((g) => g.title === '关联信息')
-    assert.ok(related, '应有关联信息分区')
-    const codeField = related.fields.find((f) => f.label === '设备编码')
-    assert.ok(codeField, '应有「设备编码」字段')
-    assert.equal(codeField.wide, true)
-    assert.equal(related.fields.some((f) => f.label === '设备'), false)
+    assert.equal(view.tabs.some((tab) => tab.label === '关联信息'), true)
+    const device = view.relations.find((item) => item.kind === 'device')
+    assert.ok(device, '应有关联设备')
+    assert.equal(device.code, '4101050000132000000')
+    assert.equal(device.name, '测试设备')
 })
 
 test('草稿预警判定:仅 WARNING + DRAFT 排除', () => {

+ 18 - 1
tests/entityDetailWorkOrder.test.js

@@ -39,9 +39,14 @@ test('工单详情保留时间线过程图片与维修前后图片', () => {
     assert.equal(view.title, '测试压力故障')
     assert.deepEqual(view.summary, [])
     assert.deepEqual(view.people, [])
-    assert.deepEqual(view.sections.find((group) => group.title === '工单摘要').fields.map((item) => item.label), ['工单号', '优先级'])
+    assert.deepEqual(view.sections.find((group) => group.title === '工单摘要').fields.map((item) => item.label), ['工单号'])
+    assert.equal(view.levelLabel, '优先级 低')
+    assert.equal(view.levelTone, 'lv3')
     assert.equal(view.sections.some((group) => group.title === '设备信息'), false)
     assert.equal(view.devices[0].name, '平升压力流量计-测试01')
+    assert.equal(view.tabs.some((item) => item.label === '关联信息'), true)
+    assert.equal(view.tabs.some((item) => item.label === '设备信息'), false)
+    assert.equal(view.relations.length, 2)
     assert.equal(view.track.steps.length, 1)
     assert.deepEqual(view.track.steps[0].attachImages, ['/upload/process-1.png', '/upload/process-2.png'])
     assert.equal(view.track.steps[0].operatedAt, '2026-12-01 09:30:00')
@@ -57,6 +62,18 @@ test('工单详情保留时间线过程图片与维修前后图片', () => {
     ].sort())
 })
 
+test('工单处置流水按时间倒序,最近一步在最上面', () => {
+    const detail = normalizeEntityDetail({ kind: 'work-order', id: '280' }, {
+        order: { orderNo: 'WO-2', orderStatus: 3 },
+        timelineEntries: [
+            { stateCode: 3, stateName: '处理中', operationName: '处理中', operatedAt: '2026-12-01T09:00:00+08:00' },
+            { stateCode: 4, stateName: '待验收', operationName: '待验收', operatedAt: '2026-12-01T10:00:00+08:00' },
+        ],
+    })
+    const view = entityDetailView(detail)
+    assert.deepEqual(view.track.steps.map((step) => step.operatedAt), ['2026-12-01 10:00:00', '2026-12-01 09:00:00'])
+})
+
 test('工单卡身份使用 orderId,而不是 workOrderCode', () => {
     const order = toWorkOrder({ orderId: 279, orderNo: 'WO-2026120100001', orderStatus: 0 })
     const [row] = workOrderCardRows([order])

+ 4 - 3
tests/eventListCurrentStatus.test.js

@@ -1,14 +1,15 @@
-/** 当前预警只排除草稿;PENDING/HANDLED/CLOSED 都必须留在当前列表与统计中。 */
+/** 当前预警只排除草稿与已解除;历史分析保留全部非草稿,PENDING/HANDLED 必须在当前可见。 */
 import assert from 'node:assert/strict'
 import { test } from 'node:test'
 
 import { isHiddenFromCurrentList } from '../src/modules/cockpit/domain/eventList.js'
 
-test('当前预警仅排除 DRAFT,其余五态均可见', () => {
-    for (const status of ['PENDING', 'RECEIVED', 'PROCESSING', 'HANDLED', 'CLOSED']) {
+test('当前预警只排除 DRAFT/CLOSED,PENDING/HANDLED 等保留', () => {
+    for (const status of ['PENDING', 'RECEIVED', 'PROCESSING', 'HANDLED']) {
         assert.equal(isHiddenFromCurrentList(status, 'WARNING'), false, `${status} 不应被当前预警排除`)
     }
     assert.equal(isHiddenFromCurrentList('DRAFT', 'WARNING'), true)
+    assert.equal(isHiddenFromCurrentList('CLOSED', 'WARNING'), true)
 })
 
 test('报警维持原口径:终态离开当前列表', () => {