import React, { useState } from 'react'; import { Card, Row, Col, Select, DatePicker, Input, Button, Space, Table, Tag, Statistic, Typography, Tabs } from 'antd'; import { BellOutlined, ClockCircleOutlined, CheckCircleOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; const { RangePicker } = DatePicker; const { Text } = Typography; // 级别 + 状态颜色 const levelColor = { 严重: 'red', 重要: 'orange', 一般: 'gold', 提示: 'blue' }; const statusColor = { 处理中: 'processing', 待处理: 'warning', 已关闭: 'success' }; // 模拟数据 const mockAlerts = [ { id: 'DEVICE_OFFLINE_CAM-02', content: '设备离线', device: 'CAM-02', level: '提示', time: '2026-04-28 17:22:04', duration: '1小时23分', status: '待处理', handler: '-' }, { id: 'INV_TEMP_HIGH_INV-A02', content: '逆变器温度过高', device: 'INV-A02', level: '重要', time: '2026-04-28 17:21:54', duration: '1小时23分', status: '待处理', handler: '-' }, { id: 'AL-20260428-001', content: 'INV-A02 温度过高', device: 'INV-A02', level: '重要', time: '2026-04-28 10:54:45', duration: '36分钟', status: '待处理', handler: '-' }, { id: 'AL-20260428-002', content: 'CMB-A01 组串电流异常', device: 'CMB-A01', level: '一般', time: '2026-04-28 10:32:45', duration: '52分钟', status: '处理中', handler: '张运维' }, { id: 'AL-20260428-003', content: 'CAM-02 视频离线', device: 'CAM-02', level: '提示', time: '2026-04-28 09:32:45', duration: '0分钟', status: '待处理', handler: '-' }, ]; export default function AlarmCenterPage() { const [selectedAlert, setSelectedAlert] = useState(mockAlerts[0]); const [detailVisible, setDetailVisible] = useState(true); const columns = [ { title: '告警编号', dataIndex: 'id', width: 180 }, { title: '告警内容', dataIndex: 'content', ellipsis: true }, { title: '来源设备', dataIndex: 'device', width: 120 }, { title: '告警级别', dataIndex: 'level', width: 100, render: l => {l} }, { title: '发生时间', dataIndex: 'time', width: 160 }, { title: '持续时长', dataIndex: 'duration', width: 100 }, { title: '处理状态', dataIndex: 'status', width: 100, render: s => {s} }, { title: '负责人', dataIndex: 'handler', width: 100 }, { title: '操作', width: 120, render: (_, record) => ( ) } ]; return (
{/* ===================== 统一宽度容器 ===================== */}
{/* ===================== 左侧:所有模块宽度完全一致 ===================== */}
{/* 筛选卡片 */} {/* 统计卡片 */} } valueStyle={{ fontSize: 22 }} />
昨日 28
} valueStyle={{ fontSize: 22 }} />
重要 2
} valueStyle={{ fontSize: 22 }} />
待处理 4
} valueStyle={{ fontSize: 22 }} />
闭环完成
} valueStyle={{ fontSize: 22 }} />
时间估算
{/* 告警列表(宽度 = 筛选卡片 完全一致) */}
告警列表(共8条)
点击告警查看详情
{/* ===================== 右侧详情面板 ===================== */} {detailVisible && selectedAlert && (
{selectedAlert.content}
{selectedAlert.level}
{selectedAlert.id}
来源设备
{selectedAlert.device}
发生时间
{selectedAlert.time}
持续时长
{selectedAlert.duration}
处理状态
{selectedAlert.status}
根因分析建议
设备离线/网络异常
电源或通讯模块故障
现场信号弱或采集器异常
)} ); }