2026-04-28 11:01:54 +08:00
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
|
import {
|
|
|
|
|
|
Table,
|
|
|
|
|
|
Tag,
|
|
|
|
|
|
Input,
|
|
|
|
|
|
Button,
|
|
|
|
|
|
Row,
|
|
|
|
|
|
Col,
|
|
|
|
|
|
Card,
|
|
|
|
|
|
Typography,
|
|
|
|
|
|
Space,
|
|
|
|
|
|
Statistic,
|
|
|
|
|
|
Select,
|
|
|
|
|
|
DatePicker,
|
|
|
|
|
|
List,
|
2026-04-28 14:45:07 +08:00
|
|
|
|
Layout,
|
2026-04-17 17:20:41 +08:00
|
|
|
|
} from 'antd';
|
2026-04-28 11:01:54 +08:00
|
|
|
|
import {
|
|
|
|
|
|
BellOutlined,
|
|
|
|
|
|
AlertOutlined,
|
|
|
|
|
|
SyncOutlined,
|
|
|
|
|
|
CheckCircleOutlined,
|
|
|
|
|
|
ClockCircleOutlined,
|
|
|
|
|
|
RiseOutlined,
|
|
|
|
|
|
FallOutlined,
|
2026-04-28 14:45:07 +08:00
|
|
|
|
CloseOutlined,
|
2026-04-17 17:20:41 +08:00
|
|
|
|
} from '@ant-design/icons';
|
|
|
|
|
|
|
2026-04-28 14:45:07 +08:00
|
|
|
|
const { Text } = Typography;
|
2026-04-28 11:01:54 +08:00
|
|
|
|
const { RangePicker } = DatePicker;
|
2026-04-28 14:45:07 +08:00
|
|
|
|
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: <BellOutlined style={{ color: '#ff4d4f' }} />,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '严重告警',
|
|
|
|
|
|
value: 8,
|
|
|
|
|
|
change: '+33.3%',
|
|
|
|
|
|
up: true,
|
|
|
|
|
|
extra: '昨日 6',
|
|
|
|
|
|
icon: <AlertOutlined style={{ color: '#ff4d4f' }} />,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '处理中',
|
|
|
|
|
|
value: 12,
|
|
|
|
|
|
change: '+20.0%',
|
|
|
|
|
|
up: true,
|
|
|
|
|
|
extra: '昨日 10',
|
|
|
|
|
|
icon: <SyncOutlined style={{ color: '#fa8c16' }} />,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '已关闭',
|
|
|
|
|
|
value: 16,
|
|
|
|
|
|
change: '+45.5%',
|
|
|
|
|
|
up: true,
|
|
|
|
|
|
extra: '昨日 11',
|
|
|
|
|
|
icon: <CheckCircleOutlined style={{ color: '#52c41a' }} />,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '平均响应时长',
|
|
|
|
|
|
value: '18分32秒',
|
|
|
|
|
|
change: '-12.6%',
|
|
|
|
|
|
up: false,
|
|
|
|
|
|
extra: '昨日 21分12秒',
|
|
|
|
|
|
icon: <ClockCircleOutlined style={{ color: '#1890ff' }} />,
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
2026-04-17 17:20:41 +08:00
|
|
|
|
|
|
|
|
|
|
export default function Alerts() {
|
2026-04-28 14:45:07 +08:00
|
|
|
|
// 控制右侧详情面板
|
|
|
|
|
|
const [showDetail, setShowDetail] = useState(false);
|
2026-04-28 11:01:54 +08:00
|
|
|
|
const [selectedAlert, setSelectedAlert] = useState<any>(null);
|
2026-04-17 17:20:41 +08:00
|
|
|
|
|
2026-04-28 11:01:54 +08:00
|
|
|
|
const columns = [
|
|
|
|
|
|
{ title: '告警编号', dataIndex: 'id', key: 'id', width: 120 },
|
|
|
|
|
|
{ title: '告警内容', dataIndex: 'content', key: 'content' },
|
2026-04-28 14:45:07 +08:00
|
|
|
|
{ title: '来源设备', dataIndex: 'device', key: 'device', width: 160 },
|
2026-04-28 11:01:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '告警级别',
|
|
|
|
|
|
dataIndex: 'level',
|
|
|
|
|
|
key: 'level',
|
|
|
|
|
|
width: 80,
|
|
|
|
|
|
render: (level: string) => {
|
|
|
|
|
|
const colorMap: Record<string, string> = {
|
2026-04-28 14:45:07 +08:00
|
|
|
|
严重: 'red',
|
|
|
|
|
|
重要: 'orange',
|
|
|
|
|
|
一般: 'gold',
|
|
|
|
|
|
提示: 'blue',
|
2026-04-28 11:01:54 +08:00
|
|
|
|
};
|
|
|
|
|
|
return <Tag color={colorMap[level]}>{level}</Tag>;
|
2026-04-28 14:45:07 +08:00
|
|
|
|
},
|
2026-04-28 11:01:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
{ title: '发生时间', dataIndex: 'time', key: 'time', width: 160 },
|
2026-04-28 14:45:07 +08:00
|
|
|
|
{ title: '持续时长', dataIndex: 'duration', key: 'duration', width: 110 },
|
2026-04-28 11:01:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '处理状态',
|
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
|
key: 'status',
|
|
|
|
|
|
width: 100,
|
|
|
|
|
|
render: (status: string) => {
|
|
|
|
|
|
const colorMap: Record<string, string> = {
|
2026-04-28 14:45:07 +08:00
|
|
|
|
处理中: 'blue',
|
|
|
|
|
|
待处理: 'orange',
|
|
|
|
|
|
已关闭: 'green',
|
2026-04-28 11:01:54 +08:00
|
|
|
|
};
|
|
|
|
|
|
return <Tag color={colorMap[status]}>{status}</Tag>;
|
2026-04-28 14:45:07 +08:00
|
|
|
|
},
|
2026-04-28 11:01:54 +08:00
|
|
|
|
},
|
2026-04-28 14:45:07 +08:00
|
|
|
|
{ title: '负责人', dataIndex: 'handler', key: 'handler', width: 90 },
|
2026-04-28 11:01:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '操作',
|
|
|
|
|
|
key: 'action',
|
2026-04-28 14:45:07 +08:00
|
|
|
|
width: 80,
|
|
|
|
|
|
render: (_, record) => (
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="link"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
setSelectedAlert(record);
|
|
|
|
|
|
setShowDetail(true);
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
查看
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
),
|
2026-04-28 11:01:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
];
|
2026-04-17 17:20:41 +08:00
|
|
|
|
|
2026-04-28 11:01:54 +08:00
|
|
|
|
return (
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<div style={{ background: '#f4f7f9', minHeight: '100%' }}>
|
|
|
|
|
|
<Layout style={{ background: 'transparent' }}>
|
|
|
|
|
|
{/* 左侧主内容区:宽度动态变化 */}
|
|
|
|
|
|
<Layout.Content
|
|
|
|
|
|
style={{
|
|
|
|
|
|
padding: '16px',
|
|
|
|
|
|
transition: 'width 0.3s ease',
|
|
|
|
|
|
width: showDetail ? 'calc(100% - 460px)' : '100%',
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
<div style={{ fontSize: 16, fontWeight: 600, marginBottom: 12 }}>告警中心</div>
|
2026-04-17 17:20:41 +08:00
|
|
|
|
|
2026-04-28 14:45:07 +08:00
|
|
|
|
{/* 筛选栏 */}
|
|
|
|
|
|
<AntdCard size="small" style={{ borderRadius: 8, marginBottom: 16 }}>
|
|
|
|
|
|
<Row gutter={[16, 16]} align="middle">
|
|
|
|
|
|
<Col span={4}><Select placeholder="告警级别" style={{ width: '100%' }} /></Col>
|
|
|
|
|
|
<Col span={4}><Select placeholder="告警类型" style={{ width: '100%' }} /></Col>
|
|
|
|
|
|
<Col span={4}><Select placeholder="设备类型" style={{ width: '100%' }} /></Col>
|
|
|
|
|
|
<Col span={6}><RangePicker style={{ width: '100%' }} /></Col>
|
|
|
|
|
|
<Col span={6}><Select placeholder="处理状态" style={{ width: '100%' }} /></Col>
|
|
|
|
|
|
<Col span={24} style={{ display: 'flex', gap: 8, marginTop: 8 }}>
|
|
|
|
|
|
<Input placeholder="搜索" style={{ width: 220 }} />
|
|
|
|
|
|
<Button>重置</Button>
|
|
|
|
|
|
<Button type="primary">查询</Button>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</AntdCard>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 统计卡片 */}
|
|
|
|
|
|
<Row gutter={[16, 16]} style={{ marginBottom: 16 }}>
|
|
|
|
|
|
{stats.map((stat, idx) => (
|
|
|
|
|
|
<Col xs={24} sm={12} md={8} lg={4} key={idx}>
|
|
|
|
|
|
<AntdCard size="small" style={{ borderRadius: 8 }}>
|
|
|
|
|
|
<Statistic
|
|
|
|
|
|
title={<span style={{ fontSize: 13 }}>{stat.title}</span>}
|
|
|
|
|
|
value={stat.value}
|
|
|
|
|
|
valueStyle={{ fontSize: 20, fontWeight: 600 }}
|
|
|
|
|
|
prefix={stat.icon}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 4 }}>
|
|
|
|
|
|
<Text type="secondary" style={{ fontSize: 12 }}>{stat.extra}</Text>
|
|
|
|
|
|
<Text style={{ color: stat.up ? '#ff4d4f' : '#52c41a', fontSize: 12 }}>
|
|
|
|
|
|
{stat.change} {stat.up ? <RiseOutlined /> : <FallOutlined />}
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</AntdCard>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</Row>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
|
|
|
|
|
|
{/* 告警列表 */}
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<AntdCard
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
title={
|
|
|
|
|
|
<div style={{ fontSize: 14, fontWeight: 600 }}>
|
|
|
|
|
|
<span style={{ color: '#165DFF' }}>告警列表</span>
|
|
|
|
|
|
<span style={{ color: '#333' }}>(共36条)</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
}
|
|
|
|
|
|
style={{ borderRadius: 8 }}
|
|
|
|
|
|
>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
<Table
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
columns={columns}
|
|
|
|
|
|
dataSource={alertList}
|
2026-04-28 14:45:07 +08:00
|
|
|
|
pagination={{ pageSize: 10 }}
|
2026-04-28 11:01:54 +08:00
|
|
|
|
rowKey="id"
|
2026-04-28 14:45:07 +08:00
|
|
|
|
onRow={(record) => ({
|
|
|
|
|
|
onClick: () => {
|
|
|
|
|
|
setSelectedAlert(record);
|
|
|
|
|
|
setShowDetail(true);
|
|
|
|
|
|
},
|
|
|
|
|
|
})}
|
2026-04-28 11:01:54 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</AntdCard>
|
2026-04-28 14:45:07 +08:00
|
|
|
|
</Layout.Content>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
|
2026-04-28 14:45:07 +08:00
|
|
|
|
{/* 右侧详情面板:推挤式,非覆盖 */}
|
|
|
|
|
|
{showDetail && (
|
|
|
|
|
|
<Layout.Sider
|
|
|
|
|
|
width={460}
|
|
|
|
|
|
style={{
|
|
|
|
|
|
background: '#fff',
|
|
|
|
|
|
padding: '16px',
|
|
|
|
|
|
height: 'calc(100vh - 50px)',
|
|
|
|
|
|
overflow: 'auto',
|
|
|
|
|
|
boxShadow: '-2px 0 8px rgba(0,0,0,0.08)',
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
{selectedAlert && (
|
2026-04-28 11:01:54 +08:00
|
|
|
|
<div>
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
|
|
|
|
|
<Text strong style={{ fontSize: 16 }}>告警详情</Text>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
icon={<CloseOutlined />}
|
|
|
|
|
|
onClick={() => setShowDetail(false)}
|
|
|
|
|
|
style={{ fontSize: 16 }}
|
|
|
|
|
|
/> </div>
|
|
|
|
|
|
|
2026-04-28 11:01:54 +08:00
|
|
|
|
<div style={{ marginBottom: 16 }}>
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 8 }}>
|
|
|
|
|
|
<BellOutlined style={{ color: '#ff4d4f', fontSize: 20 }} />
|
|
|
|
|
|
<Text strong style={{ fontSize: 16 }}>{selectedAlert.content}</Text>
|
|
|
|
|
|
<Tag color="red">{selectedAlert.level}</Tag>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
</div>
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<div style={{ fontSize: 12, color: '#666', lineHeight: 1.8 }}>
|
|
|
|
|
|
<div>告警编号:{selectedAlert.id}</div>
|
|
|
|
|
|
<div>来源设备:{selectedAlert.device}</div>
|
|
|
|
|
|
<div>发生时间:{selectedAlert.time}</div>
|
|
|
|
|
|
<div>持续时长:{selectedAlert.duration}</div>
|
|
|
|
|
|
<div>处理状态:{selectedAlert.status}</div>
|
|
|
|
|
|
<div>负责人:{selectedAlert.handler}</div>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<Text strong style={{ fontSize: 13, marginBottom: 8, display: 'block' }}>根因分析建议</Text>
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<List
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
dataSource={[
|
|
|
|
|
|
'逆变器内部保护触发(IGBT/继电器故障)',
|
|
|
|
|
|
'交流侧电压异常或并网不稳定',
|
|
|
|
|
|
'散热风扇故障导致过温保护',
|
|
|
|
|
|
]}
|
|
|
|
|
|
renderItem={(item) => <List.Item style={{ padding: '4px 0' }}>{item}</List.Item>}
|
|
|
|
|
|
/>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<Text strong style={{ fontSize: 13, marginBottom: 8, display: 'block' }}>推荐处理措施</Text>
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<List
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
dataSource={[
|
|
|
|
|
|
'现场检查逆变器告警记录及指示灯状态',
|
|
|
|
|
|
'检查散热风扇运行及通风条件',
|
|
|
|
|
|
'检查交流侧电压及并网条件',
|
|
|
|
|
|
]}
|
|
|
|
|
|
renderItem={(item) => <List.Item style={{ padding: '4px 0' }}>{item}</List.Item>}
|
|
|
|
|
|
/>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-04-28 14:45:07 +08:00
|
|
|
|
<Button type="primary" block style={{ marginTop: 16 }}>
|
|
|
|
|
|
标记为已解决
|
|
|
|
|
|
</Button>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-04-28 14:45:07 +08:00
|
|
|
|
</Layout.Sider>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</Layout>
|
2026-04-28 11:01:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
2026-04-17 17:20:41 +08:00
|
|
|
|
}
|