import React, { useState } from 'react'; import { Card, Row, Col, Select, DatePicker, Input, Button, Space, Table, Tag, Statistic, Typography, Modal, Form, Checkbox, message, Switch, Divider, Pagination } from 'antd'; import { BellOutlined, ClockCircleOutlined, CheckCircleOutlined, ExclamationCircleOutlined, SearchOutlined, ReloadOutlined, CloseOutlined, InfoCircleOutlined, SendOutlined, MailOutlined, MessageOutlined, DesktopOutlined, FileTextOutlined, LineChartOutlined, PieChartOutlined, BarChartOutlined, RiseOutlined } from '@ant-design/icons'; import { Line, Pie, Bar } from '@ant-design/charts'; const { RangePicker } = DatePicker; const { Text, Title } = Typography; // 级别 + 状态颜色 const levelColor = { 严重: '#F53F3F', 重要: '#FF7D00', 一般: '#F7BA1E', 提示: '#165DFF' }; const statusColor = { 处理中: '#165DFF', 待处理: '#F7BA1E', 已关闭: '#00B42A' }; // 模拟数据 const mockAlerts = [ { 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: '赵工程师' }, { id: 'AL20250525006', content: '发电量下降 > 15%', device: '组串 3-15', level: '重要', time: '2025-05-25 05:45:02', duration: '6小时10分', status: '处理中', handler: '李工程师' }, { id: 'AL20250525007', content: '逆变器停机', device: '逆变器 03 (组串式)', level: '严重', time: '2025-05-25 04:28:33', duration: '7小时28分', status: '处理中', handler: '张运维' }, { id: 'AL20250525008', content: '通信中断', device: '智能汇流箱 08', level: '一般', time: '2025-05-25 03:15:47', duration: '2小时18分', status: '已关闭', handler: '王运维' }, ]; // 通知渠道 const channelOptions = [ { label: '企业微信', value: 'wecom' }, { label: '钉钉', value: 'dingtalk' }, { label: '邮件', value: 'email' }, { label: '短信', value: 'sms' }, ]; export default function AlarmCenterPage() { const [selectedAlert, setSelectedAlert] = useState(null); const [detailVisible, setDetailVisible] = useState(false); const [confirmModalVisible, setConfirmModalVisible] = useState(false); const [notifyChannels, setNotifyChannels] = useState(['wecom', 'dingtalk', 'email']); const [form] = Form.useForm(); const columns = [ { title: '告警编号', dataIndex: 'id', width: 140, render: (text) => {text} }, { title: '告警内容', dataIndex: 'content', ellipsis: true }, { title: '来源设备', dataIndex: 'device', width: 160 }, { 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: 80, render: (_, record) => ( ) } ]; // 告警趋势图配置 const trendConfig = { data: [ { date: '05-19', type: '严重', value: 12 }, { date: '05-19', type: '重要', value: 5 }, { date: '05-19', type: '一般', value: 3 }, { date: '05-19', type: '提示', value: 2 }, { date: '05-20', type: '严重', value: 30 }, { date: '05-20', type: '重要', value: 16 }, { date: '05-20', type: '一般', value: 9 }, { date: '05-20', type: '提示', value: 6 }, { date: '05-21', type: '严重', value: 23 }, { date: '05-21', type: '重要', value: 11 }, { date: '05-21', type: '一般', value: 7 }, { date: '05-21', type: '提示', value: 5 }, { date: '05-22', type: '严重', value: 25 }, { date: '05-22', type: '重要', value: 17 }, { date: '05-22', type: '一般', value: 10 }, { date: '05-22', type: '提示', value: 4 }, { date: '05-23', type: '严重', value: 19 }, { date: '05-23', type: '重要', value: 9 }, { date: '05-23', type: '一般', value: 13 }, { date: '05-23', type: '提示', value: 7 }, { date: '05-24', type: '严重', value: 24 }, { date: '05-24', type: '重要', value: 18 }, { date: '05-24', type: '一般', value: 16 }, { date: '05-24', type: '提示', value: 8 }, { date: '05-25', type: '严重', value: 36 }, { date: '05-25', type: '重要', value: 29 }, { date: '05-25', type: '一般', value: 22 }, { date: '05-25', type: '提示', value: 13 }, ], xField: 'date', yField: 'value', seriesField: 'type', color: ['#F53F3F', '#FF7D00', '#F7BA1E', '#165DFF'], smooth: true, legend: { position: 'top-left' }, }; // 告警分类占比配置 const pieConfig = { data: [ { type: '严重', value: 8 }, { type: '重要', value: 12 }, { type: '一般', value: 11 }, { type: '提示', value: 5 } ], angleField: 'value', colorField: 'type', color: ['#F53F3F', '#FF7D00', '#F7BA1E', '#165DFF'], radius: 0.8, innerRadius: 0.6, label: false, legend: { position: 'right', layout: 'vertical', formatter: (text, item) => { const d = pieConfig.data.find(d => d.type === text); const total = pieConfig.data.reduce((a, b) => a + b.value, 0); return `${text} ${((d!.value / total) * 100).toFixed(1)}% (${d!.value})`; } }, statistic: { title: { offsetY: -12, style: { fontSize: '14px', color: '#86909C' }, content: '总告警' }, content: { offsetY: 12, style: { fontSize: '24px', fontWeight: '700', color: '#1D2129' }, content: '36' } } }; // 告警来源设备分布 const barConfig = { data: [ { device: '逆变器', count: 14 }, { device: '汇流箱', count: 8 }, { device: '组串', count: 6 }, { device: '气象站', count: 3 }, { device: '电表', count: 3 }, { device: '其他', count: 2 } ], xField: 'count', yField: 'device', seriesField: 'device', color: '#165DFF', barWidthRatio: 0.4, label: { position: 'right', //formatter: (text) => { // const total = barConfig.data.reduce((a, b) => a + b.count, 0); // const d = barConfig.data.find(d => d.count === Number(text.count)); // return `${text.count} (${((Number(text.count) / total) * 100).toFixed(1)}%)`; //} }, legend: false }; // 详情页趋势图配置 const detailTrendConfig = { data: [ { time: '05-25 04:00', type: '功率 (kW)', value: 100 }, { time: '05-25 05:00', type: '功率 (kW)', value: 120 }, { time: '05-25 06:00', type: '功率 (kW)', value: 150 }, { time: '05-25 07:00', type: '功率 (kW)', value: 130 }, { time: '05-25 08:00', type: '功率 (kW)', value: 140 }, { time: '05-25 09:00', type: '功率 (kW)', value: 20 }, { time: '05-25 10:00', type: '功率 (kW)', value: 10 }, { time: '05-25 04:00', type: '直流电压 (V)', value: 600 }, { time: '05-25 05:00', type: '直流电压 (V)', value: 610 }, { time: '05-25 06:00', type: '直流电压 (V)', value: 620 }, { time: '05-25 07:00', type: '直流电压 (V)', value: 600 }, { time: '05-25 08:00', type: '直流电压 (V)', value: 610 }, { time: '05-25 09:00', type: '直流电压 (V)', value: 580 }, { time: '05-25 10:00', type: '直流电压 (V)', value: 570 }, { time: '05-25 04:00', type: '温度 (℃)', value: 35 }, { time: '05-25 05:00', type: '温度 (℃)', value: 38 }, { time: '05-25 06:00', type: '温度 (℃)', value: 42 }, { time: '05-25 07:00', type: '温度 (℃)', value: 45 }, { time: '05-25 08:00', type: '温度 (℃)', value: 48 }, { time: '05-25 09:00', type: '温度 (℃)', value: 52 }, { time: '05-25 10:00', type: '温度 (℃)', value: 55 }, ], xField: 'time', yField: 'value', seriesField: 'type', color: ['#165DFF', '#00B42A', '#FF7D00'], smooth: true, legend: { position: 'top' }, yAxis: { grid: { line: { style: { lineDash: [4, 4] } } } } }; const handleConfirmAlarm = () => { form.validateFields().then(values => { message.success('告警已确认'); setConfirmModalVisible(false); }); }; return (
{/* 🔥 核心布局:左侧内容 + 右侧详情 永远一行显示 */}
{/* 左侧主内容区 */}
告警级别
设备类型
搜索关键词
今日告警总数
36 较昨日 +28.6% ↑
昨日 28
严重告警
8 较昨日 +33.3% ↑
昨日 6
处理中
12 较昨日 +20.0% ↑
昨日 10
已关闭
16 较昨日 +45.5% ↑
昨日 11
平均响应时长
18分32秒
昨日 21分12秒
告警列表(共 36 条)
告警趋势} extra={} style={{ borderRadius: 8 }}> 告警分类占比} extra={} style={{ borderRadius: 8 }}> 告警来源设备分布} extra={} style={{ borderRadius: 8 }}> {/* 🔥 右侧详情:丝滑滑入动画 */} {detailVisible && selectedAlert && (
告警详情} extra={ setDetailVisible(false)} />} bodyStyle={{ padding: 16 }} style={{ height: '100%', borderRadius: 8 }} >
{selectedAlert.content} {selectedAlert.level}
告警编号:{selectedAlert.id}
来源设备
{selectedAlert.device}
设备类型
逆变器
发生时间
{selectedAlert.time}
持续时长
{selectedAlert.duration}
处理状态
{selectedAlert.status}
负责人
{selectedAlert.handler}
当前处理人
张运维 (2025-05-25 09:22 接收)
告警描述
逆变器因内部故障自动停机,当前无功率输出。
根因分析建议
  1. 逆变器内部保护触发 (IGBT/继电器故障)
  2. 交流侧电压异常或并网不稳定
  3. 散热风扇故障导致过温保护
相关趋势
推荐处理措施
  • 现场检查逆变器告警记录及指示灯状态;
  • 检查散热风扇运行及通风条件;
  • 检查交流侧电压及并网条件;
  • 如无法恢复,建议联系厂家或更换模块。
通知与订阅
短信 Telegram 邮件 )} setConfirmModalVisible(false)} onOk={handleConfirmAlarm} destroyOnClose >
确认后将向选中渠道发送通知
); }