diff --git a/frontend/src/views/alert/AlertPage.vue b/frontend/src/views/alert/AlertPage.vue
index 02c6560..b5b7ff0 100644
--- a/frontend/src/views/alert/AlertPage.vue
+++ b/frontend/src/views/alert/AlertPage.vue
@@ -18,6 +18,8 @@
+
+
@@ -31,7 +33,7 @@
-
+
@@ -146,6 +148,8 @@ function alertTypeTag(type: string): string {
production_anomaly: 'warning',
unknown_device: 'info',
service_error: 'danger',
+ production_error: 'danger',
+ summary_error: 'danger',
}
return map[type] || 'info'
}
@@ -157,6 +161,8 @@ function alertTypeLabel(type: string): string {
production_anomaly: '产量异常',
unknown_device: '未知设备',
service_error: '服务错误',
+ production_error: '产量跟踪异常',
+ summary_error: '日终汇总异常',
}
return map[type] || type
}
diff --git a/src/CncModels/Dto/Alert/AlertStatisticsResponse.cs b/src/CncModels/Dto/Alert/AlertStatisticsResponse.cs
index 76fa1a9..a100728 100644
--- a/src/CncModels/Dto/Alert/AlertStatisticsResponse.cs
+++ b/src/CncModels/Dto/Alert/AlertStatisticsResponse.cs
@@ -7,10 +7,27 @@ namespace CncModels.Dto.Alert
///
public class AlertStatisticsResponse
{
- /// 未处理告警总数
+ /// 未处理告警总数(前端用 unresolved)
public int UnresolvedCount { get; set; }
/// 按告警类型统计的未处理数量
public Dictionary UnresolvedByType { get; set; } = new Dictionary();
+
+ // 以下为前端 AlertStats 接口需要的扁平字段
+
+ /// 未处理总数(前端字段名 unresolved)
+ public int Unresolved => UnresolvedCount;
+
+ /// 采集失败未处理数
+ public int CollectFail => UnresolvedByType.TryGetValue("collect_fail", out var v) ? v : 0;
+
+ /// 设备离线未处理数
+ public int DeviceOffline => UnresolvedByType.TryGetValue("device_offline", out var v) ? v : 0;
+
+ /// 产量异常未处理数
+ public int ProductionAnomaly => UnresolvedByType.TryGetValue("production_anomaly", out var v) ? v : 0;
+
+ /// 未知设备未处理数
+ public int UnknownDevice => UnresolvedByType.TryGetValue("unknown_device", out var v) ? v : 0;
}
}
diff --git a/src/CncRepository/Impl/AlertRepository.cs b/src/CncRepository/Impl/AlertRepository.cs
index 043bc6f..934a38a 100644
--- a/src/CncRepository/Impl/AlertRepository.cs
+++ b/src/CncRepository/Impl/AlertRepository.cs
@@ -30,7 +30,7 @@ namespace CncRepository.Impl
{
using (var conn = CreateConnection())
{
- string sql = @"SELECT a.id, a.created_at, a.alert_type, a.title, m.name AS MachineName, a.detail, a.is_resolved, a.resolved_at
+ string sql = @"SELECT a.id AS Id, a.created_at AS CreatedAt, a.alert_type AS AlertType, a.title AS Title, m.name AS MachineName, a.detail AS Detail, a.is_resolved AS IsResolved, a.resolved_at AS ResolvedAt
FROM cnc_alert a LEFT JOIN cnc_machine m ON a.machine_id = m.id
WHERE 1=1";
string countSql = @"SELECT COUNT(*) FROM cnc_alert a LEFT JOIN cnc_machine m ON a.machine_id = m.id WHERE 1=1";