import React, { useState } from 'react'; import { Table, Tag, Input, Button, Row, Col, Card, Typography, Space, Statistic, Select, DatePicker, List, Layout, } from 'antd'; import { BellOutlined, AlertOutlined, SyncOutlined, CheckCircleOutlined, ClockCircleOutlined, RiseOutlined, FallOutlined, CloseOutlined, } from '@ant-design/icons'; const { Text } = Typography; const { RangePicker } = DatePicker; 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: '-', }, ]; const stats = [ { title: '今日告警总数', value: 36, change: '+28.6%', up: true, extra: '昨日 28', icon: , }, { title: '严重告警', value: 8, change: '+33.3%', up: true, extra: '昨日 6', icon: , }, { title: '处理中', value: 12, change: '+20.0%', up: true, extra: '昨日 10', icon: , }, { title: '已关闭', value: 16, change: '+45.5%', up: true, extra: '昨日 11', icon: , }, { title: '平均响应时长', value: '18分32秒', change: '-12.6%', up: false, extra: '昨日 21分12秒', icon: , }, ]; export default function Alerts() { // 控制右侧详情面板 const [showDetail, setShowDetail] = useState(false); const [selectedAlert, setSelectedAlert] = useState(null); const columns = [ { title: '告警编号', dataIndex: 'id', key: 'id', width: 120 }, { title: '告警内容', dataIndex: 'content', key: 'content' }, { title: '来源设备', dataIndex: 'device', key: 'device', width: 160 }, { 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: 110 }, { title: '处理状态', dataIndex: 'status', key: 'status', width: 100, render: (status: string) => { const colorMap: Record = { 处理中: 'blue', 待处理: 'orange', 已关闭: 'green', }; return {status}; }, }, { title: '负责人', dataIndex: 'handler', key: 'handler', width: 90 }, { title: '操作', key: 'action', width: 80, render: (_, record) => ( ), }, ]; return (
{/* 左侧主内容区:宽度动态变化 */}
告警中心
{/* 筛选栏 */} {/* 统计卡片 */} {stats.map((stat, idx) => ( {stat.title}} value={stat.value} valueStyle={{ fontSize: 20, fontWeight: 600 }} prefix={stat.icon} />
{stat.extra} {stat.change} {stat.up ? : }
))}
{/* 告警列表 */} 告警列表 (共36条)
} style={{ borderRadius: 8 }} > ({ onClick: () => { setSelectedAlert(record); setShowDetail(true); }, })} /> {/* 右侧详情面板:推挤式,非覆盖 */} {showDetail && ( {selectedAlert && (
告警详情
{selectedAlert.content} {selectedAlert.level}
告警编号:{selectedAlert.id}
来源设备:{selectedAlert.device}
发生时间:{selectedAlert.time}
持续时长:{selectedAlert.duration}
处理状态:{selectedAlert.status}
负责人:{selectedAlert.handler}
根因分析建议 {item}} />
推荐处理措施 {item}} />
)}
)} ); }