From 2f1220d7ce4157e1ef8e3ff06d5d8ff527229f4e Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期六, 05 九月 2026 19:24:14 +0800
Subject: [PATCH] 展示接收中设备离线告警及异常管理记录
---
src/stores/exceptions.ts | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/src/stores/exceptions.ts b/src/stores/exceptions.ts
index 3b4c08e..954eec1 100644
--- a/src/stores/exceptions.ts
+++ b/src/stores/exceptions.ts
@@ -1,5 +1,6 @@
import { ref } from 'vue'
import { closeWarningException, getWarningExceptions, type WarningExceptionRecord } from '@/api/tests'
+import { formatBusinessTime } from '@/utils/businessTime'
export type ExceptionStatus = '待处理' | '已处理'
@@ -22,9 +23,21 @@
const records = ref<ExceptionRecord[]>([])
function mapRecord(item: WarningExceptionRecord): ExceptionRecord {
+ const offline = item.exceptionType === 'DEVICE_OFFLINE'
let normalValue = '-'
try { const rule = JSON.parse(item.ruleSnapshot || '{}'); normalValue = rule.maxValue != null ? `≤ ${rule.maxValue} ${item.unit}` : rule.minValue != null ? `≥ ${rule.minValue} ${item.unit}` : '-' } catch { /* 快照不可解析时仍展示异常事实 */ }
- return { id: item.exceptionId, testId: item.testId, testName: item.testName || `测试 #${item.testId}`, testTime: item.firstOccurredAtUtc, source: `${item.sourceType}${item.sourceIdentity ? ` · ${item.sourceIdentity}` : ''}`, exceptionItem: item.metricCode, abnormalValue: `${item.abnormalValue} ${item.unit}`, normalValue, generatedAt: item.lastOccurredAtUtc, processor: item.handledByName || '', handledAt: item.handledAtUtc || '-', status: item.exceptionStatus === 'OPEN' ? '待处理' : '已处理', handleRemark: item.handlingNote || '' }
+ const sourceLabel = ({ CABINET: '检测柜', CABINET_CHANNEL: '检测柜通道', COLLECTOR: '采集器' } as Record<string, string>)[item.sourceType] || item.sourceType
+ return {
+ id: item.exceptionId, testId: item.testId, testName: item.testName || `测试 #${item.testId}`,
+ testTime: formatBusinessTime(item.firstOccurredAtUtc),
+ source: `${sourceLabel}${item.sourceIdentity ? ` · ${item.sourceIdentity}` : ''}`,
+ exceptionItem: offline ? '设备离线' : item.metricCode,
+ abnormalValue: offline ? '离线' : item.abnormalValue == null ? '-' : `${item.abnormalValue} ${item.unit}`,
+ normalValue: offline ? '在线' : normalValue,
+ generatedAt: formatBusinessTime(item.lastOccurredAtUtc), processor: item.handledByName || '',
+ handledAt: formatBusinessTime(item.handledAtUtc), status: item.exceptionStatus === 'OPEN' ? '待处理' : '已处理',
+ handleRemark: item.handlingNote || '',
+ }
}
export function useExceptions() {
--
Gitblit v1.7.1