import React, { useState } from 'react'; import { Table, Tag, Input, Button, Row, Col, Card, Typography, Space, Statistic, Select, DatePicker, List, } from 'antd'; import { BellOutlined, AlertOutlined, SyncOutlined, CheckCircleOutlined, ClockCircleOutlined, RiseOutlined, FallOutlined, } from '@ant-design/icons'; import { ALERTS } from '../constants'; const { Text, Title } = Typography; const { RangePicker } = DatePicker; export default function Alerts() { const [selectedAlert, setSelectedAlert] = useState(null); const AntdCard = Card as any; // 模拟告警数据(和参考图一致) const alertList = [ { id: 'AL20250525001', content: '逆变器停机', device: '逆变器 12 (组串式)', level: '严重', time: '2025-05-25 09:18:32', duration: '2小时18分', status: '处理中', handler: '张运维' }, { id: 'AL20250525002', content: '发电量下降 > 15%', device: '汇流箱 05', level: '重要', time: '2025-05-25 08:46:11', duration: '3小时50分', status: '处理中', handler: '李工程师' }, { id: 'AL20250525003', content: '逆变器温度过高', device: '逆变器 07 (组串式)', level: '重要', time: '2025-05-25 07:32:45', duration: '4小时24分', status: '待处理', handler: '-' }, { id: 'AL20250525004', content: '通信中断', device: '气象站 01', level: '一般', time: '2025-05-25 06:51:20', duration: '5小时05分', status: '待处理', handler: '王运维' }, { id: 'AL20250525005', content: '数据异常', device: '电表 01 (并网点)', level: '提示', time: '2025-05-25 06:20:18', duration: '3小时36分', status: '已关闭', handler: '赵工程师' }, ]; const columns = [ { title: '告警编号', dataIndex: 'id', key: 'id', width: 120 }, { title: '告警内容', dataIndex: 'content', key: 'content' }, { title: '来源设备', dataIndex: 'device', key: 'device', width: 140 }, { title: '告警级别', dataIndex: 'level', key: 'level', width: 80, render: (level: string) => { const colorMap: Record = { '严重': 'red', '重要': 'orange', '一般': 'gold', '提示': 'blue' }; return {level}; } }, { title: '发生时间', dataIndex: 'time', key: 'time', width: 160 }, { title: '持续时长', dataIndex: 'duration', key: 'duration', width: 100 }, { title: '处理状态', dataIndex: 'status', key: 'status', width: 100, render: (status: string) => { const colorMap: Record = { '处理中': 'blue', '待处理': 'orange', '已关闭': 'green' }; return {status}; } }, { title: '负责人', dataIndex: 'handler', key: 'handler', width: 80 }, { title: '操作', key: 'action', width: 60, render: () => }, ]; // 顶部统计数据 const stats = [ { title: '今日告警总数', value: 36, suffix: '', change: '+28.6%', up: true, extra: '昨日 28', icon: }, { title: '严重告警', value: 8, suffix: '', change: '+33.3%', up: true, extra: '昨日 6', icon: }, { title: '处理中', value: 12, suffix: '', change: '+20.0%', up: true, extra: '昨日 10', icon: }, { title: '已关闭', value: 16, suffix: '', change: '+45.5%', up: true, extra: '昨日 11', icon: }, { title: '平均响应时长', value: '18分32秒', suffix: '', change: '-12.6%', up: false, extra: '昨日 21分12秒', icon: }, ]; return (

告警中心

{/* 顶部筛选栏 */} {/* 统计卡片 */} {stats.map((stat, idx) => ( {stat.title}} value={stat.value} valueStyle={{ color: '#1f2329', fontWeight: 600, fontSize: 20 }} prefix={stat.icon} suffix={stat.suffix} />
{stat.extra} {stat.change} {stat.up ? : }
))}
{/* 左侧主内容区 */} {/* 告警列表 */} 告警列表 (共36条)
} style={{ borderRadius: 8, marginBottom: 16 }}> ({ onClick: () => setSelectedAlert(record) })} rowSelection={{ selectedRowKeys: selectedAlert ? [selectedAlert.id] : [], type: 'radio' }} /> {/* 底部图表占位(和参考图结构一致) */}
趋势图占位
占比图占位
分布图占位
{/* 右侧告警详情面板 */} {selectedAlert ? (
{selectedAlert.content} {selectedAlert.level}
告警编号 AL20250525001
来源设备:{selectedAlert.device}(设备类型:逆变器)
发生时间:{selectedAlert.time} | 持续时长:{selectedAlert.duration}
处理状态:{selectedAlert.status} | 负责人:{selectedAlert.handler}
当前处理人:{selectedAlert.handler}({selectedAlert.time.split(' ')[0]} 接收)
告警描述:逆变器因内部故障自动停机,当前无功率输出。
根因分析建议 {item}} />
相关趋势
趋势图占位
推荐处理措施 {item}} />
通知与订阅
短信 已开启
Telegram 已开启
邮件 未开启
) : (
请选择一条告警查看详情
)}
); }