2026-05-12 17:31:34 +08:00
|
|
|
|
import React, { useState, useEffect } from 'react';
|
2026-05-07 17:09:19 +08:00
|
|
|
|
import {
|
|
|
|
|
|
Card, Row, Col, Select, DatePicker, Input, Button, Space, Table, Tag,
|
2026-05-13 11:12:17 +08:00
|
|
|
|
Typography, message, Pagination, Spin, Drawer, Descriptions, Switch, Form
|
2026-05-07 17:09:19 +08:00
|
|
|
|
} from 'antd';
|
|
|
|
|
|
import {
|
2026-05-11 14:59:36 +08:00
|
|
|
|
BellOutlined, ClockCircleOutlined, CheckCircleOutlined, ExclamationCircleOutlined,
|
2026-05-13 09:06:50 +08:00
|
|
|
|
SearchOutlined, ReloadOutlined, FileTextOutlined, NotificationOutlined
|
2026-05-07 17:09:19 +08:00
|
|
|
|
} from '@ant-design/icons';
|
2026-05-07 20:25:14 +08:00
|
|
|
|
import { Line, Pie, Bar } from '@ant-design/charts';
|
2026-05-12 17:31:34 +08:00
|
|
|
|
import dayjs from 'dayjs';
|
2026-05-13 11:12:17 +08:00
|
|
|
|
import { exportTable } from "../../lib/utils.js"
|
2026-05-12 17:31:34 +08:00
|
|
|
|
|
|
|
|
|
|
// 接口引入
|
|
|
|
|
|
import {
|
|
|
|
|
|
getAlarmList,
|
|
|
|
|
|
getAlarmDetail,
|
|
|
|
|
|
getAlarmStatistics,
|
|
|
|
|
|
handleAlarm,
|
|
|
|
|
|
exportAlarm
|
|
|
|
|
|
} from '../../api/alarmApi.js';
|
2026-05-07 14:13:26 +08:00
|
|
|
|
|
2026-05-07 17:09:19 +08:00
|
|
|
|
const { RangePicker } = DatePicker;
|
2026-05-13 09:06:50 +08:00
|
|
|
|
const { Text } = Typography;
|
2026-05-13 11:12:17 +08:00
|
|
|
|
const { Option } = Select;
|
2026-05-07 17:09:19 +08:00
|
|
|
|
|
2026-05-13 09:28:34 +08:00
|
|
|
|
// ====================== 你提供的枚举 ======================
|
|
|
|
|
|
const alarmTypeMap = {
|
|
|
|
|
|
1: '设备故障',
|
|
|
|
|
|
2: '数据异常',
|
|
|
|
|
|
3: '通信中断',
|
|
|
|
|
|
4: '性能告警',
|
|
|
|
|
|
5: '安全告警',
|
|
|
|
|
|
6: '环境告警'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const alarmLevelConfig = {
|
|
|
|
|
|
1: { description: '严重', color: '#FF4D4F' },
|
|
|
|
|
|
2: { description: '重要', color: '#FA8C16' },
|
|
|
|
|
|
3: { description: '一般', color: '#FADB14' },
|
|
|
|
|
|
4: { description: '提示', color: '#1890FF' }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleStatusMap = {
|
|
|
|
|
|
1: '待处理',
|
|
|
|
|
|
2: '处理中',
|
|
|
|
|
|
3: '已关闭',
|
|
|
|
|
|
4: '已忽略'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 颜色映射(从枚举自动生成)
|
|
|
|
|
|
const levelColor = Object.keys(alarmLevelConfig).reduce((map, key) => {
|
|
|
|
|
|
map[key] = alarmLevelConfig[key].color;
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
|
|
const levelText = Object.keys(alarmLevelConfig).reduce((map, key) => {
|
|
|
|
|
|
map[key] = alarmLevelConfig[key].description;
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}, {});
|
2026-05-07 17:09:19 +08:00
|
|
|
|
|
2026-05-12 17:31:34 +08:00
|
|
|
|
export default function AlarmCenterPage() {
|
2026-05-13 11:12:17 +08:00
|
|
|
|
const [form] = Form.useForm();
|
2026-05-12 17:31:34 +08:00
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
|
|
const [detailLoading, setDetailLoading] = useState(false);
|
2026-05-07 17:09:19 +08:00
|
|
|
|
|
2026-05-12 17:31:34 +08:00
|
|
|
|
// 列表
|
|
|
|
|
|
const [alarmList, setAlarmList] = useState([]);
|
|
|
|
|
|
const [total, setTotal] = useState(0);
|
|
|
|
|
|
const [pageNum, setPageNum] = useState(1);
|
|
|
|
|
|
const [pageSize] = useState(10);
|
2026-05-07 17:09:19 +08:00
|
|
|
|
|
2026-05-12 17:31:34 +08:00
|
|
|
|
// 查询条件
|
|
|
|
|
|
const [queryParams, setQueryParams] = useState({
|
|
|
|
|
|
deviceId: '',
|
|
|
|
|
|
alarmLevel: '',
|
|
|
|
|
|
handleStatus: '',
|
2026-05-13 13:16:36 +08:00
|
|
|
|
startTime: '',
|
2026-05-12 17:31:34 +08:00
|
|
|
|
endTime: '',
|
|
|
|
|
|
});
|
2026-05-09 16:44:39 +08:00
|
|
|
|
|
2026-05-13 09:06:50 +08:00
|
|
|
|
// 抽屉
|
|
|
|
|
|
const [drawerVisible, setDrawerVisible] = useState(false);
|
2026-05-12 17:31:34 +08:00
|
|
|
|
const [currentAlarm, setCurrentAlarm] = useState(null);
|
|
|
|
|
|
|
2026-05-13 09:06:50 +08:00
|
|
|
|
// 统计
|
2026-05-12 17:31:34 +08:00
|
|
|
|
const [statData, setStatData] = useState({
|
|
|
|
|
|
total: 0,
|
|
|
|
|
|
levelStats: {},
|
|
|
|
|
|
pending: 0,
|
|
|
|
|
|
processing: 0,
|
|
|
|
|
|
closed: 0,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// ====================== 获取列表 ======================
|
|
|
|
|
|
const fetchList = async () => {
|
|
|
|
|
|
setLoading(true);
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getAlarmList({ pageNum, pageSize, ...queryParams });
|
2026-05-13 09:06:50 +08:00
|
|
|
|
if (res.code === 0) {
|
2026-05-12 17:31:34 +08:00
|
|
|
|
setAlarmList(res.rows || []);
|
|
|
|
|
|
setTotal(res.total || 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
message.error('加载失败');
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ====================== 获取统计 ======================
|
|
|
|
|
|
const fetchStat = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getAlarmStatistics();
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
setStatData(res.data || {});
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) { }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ====================== 查看详情 ======================
|
|
|
|
|
|
const showDetail = async (id) => {
|
|
|
|
|
|
setDetailLoading(true);
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getAlarmDetail(id);
|
2026-05-13 09:06:50 +08:00
|
|
|
|
if (res.code === 0 || res.code === 200) {
|
2026-05-12 17:31:34 +08:00
|
|
|
|
setCurrentAlarm(res.data);
|
2026-05-13 11:12:17 +08:00
|
|
|
|
// 表单赋值
|
|
|
|
|
|
form.setFieldsValue({
|
|
|
|
|
|
handleStatus: res.data.handleStatus,
|
|
|
|
|
|
handleRemark: '已处理'
|
|
|
|
|
|
});
|
2026-05-13 09:06:50 +08:00
|
|
|
|
setDrawerVisible(true);
|
2026-05-12 17:31:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
message.error('加载详情失败');
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setDetailLoading(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ====================== 处理告警 ======================
|
2026-05-13 11:12:17 +08:00
|
|
|
|
const doHandle = async (values) => {
|
2026-05-12 17:31:34 +08:00
|
|
|
|
try {
|
2026-05-13 11:12:17 +08:00
|
|
|
|
await handleAlarm({
|
|
|
|
|
|
id: currentAlarm.id,
|
|
|
|
|
|
handleStatus: values.handleStatus,
|
|
|
|
|
|
handleRemark: values.handleRemark || '已处理'
|
|
|
|
|
|
});
|
2026-05-12 17:31:34 +08:00
|
|
|
|
message.success('处理成功');
|
2026-05-13 09:06:50 +08:00
|
|
|
|
setDrawerVisible(false);
|
2026-05-12 17:31:34 +08:00
|
|
|
|
fetchList();
|
|
|
|
|
|
fetchStat();
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
message.error('处理失败');
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2026-05-07 17:09:19 +08:00
|
|
|
|
|
2026-05-12 17:31:34 +08:00
|
|
|
|
// ====================== 导出 ======================
|
|
|
|
|
|
const doExport = () => {
|
2026-05-13 11:12:17 +08:00
|
|
|
|
//exportTable(columns, alarmList, "告警记录")
|
2026-05-12 17:31:34 +08:00
|
|
|
|
exportAlarm(queryParams).then(res => {
|
|
|
|
|
|
const blob = new Blob([res], { type: 'application/vnd.ms-excel' });
|
|
|
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
|
|
const a = document.createElement('a');
|
|
|
|
|
|
a.href = url;
|
|
|
|
|
|
a.download = `告警记录_${dayjs().format('YYYYMMDDHHmmss')}.xlsx`;
|
|
|
|
|
|
a.click();
|
|
|
|
|
|
URL.revokeObjectURL(url);
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 加载
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
fetchList();
|
|
|
|
|
|
fetchStat();
|
|
|
|
|
|
}, [pageNum]);
|
|
|
|
|
|
|
|
|
|
|
|
// ====================== 表格列 ======================
|
2026-05-07 17:09:19 +08:00
|
|
|
|
const columns = [
|
2026-05-11 14:59:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '告警编号',
|
2026-05-13 09:06:50 +08:00
|
|
|
|
dataIndex: 'alarmNo',
|
|
|
|
|
|
width: 180,
|
|
|
|
|
|
render: (text) => <Text style={{ color: '#165DFF', fontWeight: 500 }}>{text}</Text>
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '告警标题',
|
|
|
|
|
|
dataIndex: 'alarmTitle',
|
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
|
width: 180
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '告警内容',
|
|
|
|
|
|
dataIndex: 'alarmContent',
|
|
|
|
|
|
ellipsis: true
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '设备名称',
|
|
|
|
|
|
dataIndex: 'deviceName',
|
|
|
|
|
|
width: 160
|
2026-05-11 14:59:36 +08:00
|
|
|
|
},
|
2026-05-13 09:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '告警类型',
|
|
|
|
|
|
dataIndex: 'alarmType',
|
|
|
|
|
|
width: 120,
|
|
|
|
|
|
render: (t) => alarmTypeMap[t] || '-'
|
|
|
|
|
|
},
|
2026-05-11 14:59:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '告警级别',
|
2026-05-12 17:31:34 +08:00
|
|
|
|
dataIndex: 'alarmLevel',
|
2026-05-11 14:59:36 +08:00
|
|
|
|
width: 100,
|
|
|
|
|
|
render: (l) => (
|
|
|
|
|
|
<Tag color={levelColor[l]} style={{ borderRadius: 2, border: 'none', color: '#fff' }}>
|
2026-05-12 17:31:34 +08:00
|
|
|
|
{levelText[l]}
|
2026-05-11 14:59:36 +08:00
|
|
|
|
</Tag>
|
|
|
|
|
|
)
|
|
|
|
|
|
},
|
2026-05-13 09:06:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '告警时间',
|
|
|
|
|
|
dataIndex: 'alarmTime',
|
|
|
|
|
|
width: 180,
|
|
|
|
|
|
render: (t) => t ? dayjs(t).format('YYYY-MM-DD HH:mm:ss') : '-'
|
|
|
|
|
|
},
|
2026-05-11 14:59:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '处理状态',
|
2026-05-12 17:31:34 +08:00
|
|
|
|
dataIndex: 'handleStatus',
|
2026-05-13 09:06:50 +08:00
|
|
|
|
width: 110,
|
2026-05-13 09:28:34 +08:00
|
|
|
|
render: (s) => {
|
|
|
|
|
|
let color = 'default';
|
|
|
|
|
|
const text = handleStatusMap[s] || '-';
|
|
|
|
|
|
// 1:待处理 2:处理中 3:已关闭 4:已忽略
|
|
|
|
|
|
switch (s) {
|
|
|
|
|
|
case 1: color = 'orange'; break; // 待处理
|
|
|
|
|
|
case 2: color = 'blue'; break; // 处理中
|
|
|
|
|
|
case 3: color = 'green'; break; // 已关闭
|
|
|
|
|
|
case 4: color = 'default'; break; // 已忽略
|
|
|
|
|
|
default: break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return <Tag color={color}>{text}</Tag>;
|
|
|
|
|
|
}
|
2026-05-11 14:59:36 +08:00
|
|
|
|
},
|
2026-05-07 17:09:19 +08:00
|
|
|
|
{
|
2026-05-11 14:59:36 +08:00
|
|
|
|
title: '操作',
|
2026-05-13 09:06:50 +08:00
|
|
|
|
width: 100,
|
|
|
|
|
|
fixed: 'right',
|
2026-05-07 17:09:19 +08:00
|
|
|
|
render: (_, record) => (
|
2026-05-12 17:31:34 +08:00
|
|
|
|
<Button type="link" onClick={() => showDetail(record.id)}>查看</Button>
|
2026-05-07 17:09:19 +08:00
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
];
|
2026-05-07 14:13:26 +08:00
|
|
|
|
|
2026-05-13 09:06:50 +08:00
|
|
|
|
// 图表数据
|
2026-05-07 20:25:14 +08:00
|
|
|
|
const pieConfig = {
|
|
|
|
|
|
data: [
|
2026-05-12 17:31:34 +08:00
|
|
|
|
{ type: '严重', value: statData.levelStats?.[1] || 0 },
|
|
|
|
|
|
{ type: '重要', value: statData.levelStats?.[2] || 0 },
|
|
|
|
|
|
{ type: '一般', value: statData.levelStats?.[3] || 0 },
|
|
|
|
|
|
{ type: '提示', value: statData.levelStats?.[4] || 0 },
|
|
|
|
|
|
].filter(i => i.value > 0),
|
|
|
|
|
|
angleField: 'value', colorField: 'type',
|
2026-05-13 09:28:34 +08:00
|
|
|
|
color: ['#FF4D4F', '#FA8C16', '#FADB14', '#1890FF'],
|
2026-05-12 17:31:34 +08:00
|
|
|
|
radius: 0.8, innerRadius: 0.6, label: false
|
2026-05-09 16:44:39 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-07 14:13:26 +08:00
|
|
|
|
return (
|
2026-05-11 14:59:36 +08:00
|
|
|
|
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px 24px' }}>
|
2026-05-13 09:06:50 +08:00
|
|
|
|
|
|
|
|
|
|
{/* 查询栏 */}
|
|
|
|
|
|
<Row gutter={16} style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<Col span={24}>
|
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '16px 24px' }} style={{ borderRadius: 8 }}>
|
|
|
|
|
|
<Row gutter={[24, 16]} align="middle">
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ fontSize: 12, color: '#4E5969', marginBottom: 4 }}>告警级别</div>
|
|
|
|
|
|
<Select
|
|
|
|
|
|
style={{ width: 120 }}
|
|
|
|
|
|
value={queryParams.alarmLevel}
|
|
|
|
|
|
onChange={v => setQueryParams({ ...queryParams, alarmLevel: v })}
|
|
|
|
|
|
options={[
|
|
|
|
|
|
{ value: '', label: '全部' },
|
|
|
|
|
|
{ value: 1, label: '严重' },
|
|
|
|
|
|
{ value: 2, label: '重要' },
|
|
|
|
|
|
{ value: 3, label: '一般' },
|
|
|
|
|
|
{ value: 4, label: '提示' },
|
|
|
|
|
|
]}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ fontSize: 12, color: '#4E5969', marginBottom: 4 }}>处理状态</div>
|
|
|
|
|
|
<Select
|
|
|
|
|
|
style={{ width: 120 }}
|
|
|
|
|
|
value={queryParams.handleStatus}
|
|
|
|
|
|
onChange={v => setQueryParams({ ...queryParams, handleStatus: v })}
|
|
|
|
|
|
options={[
|
|
|
|
|
|
{ value: '', label: '全部' },
|
2026-05-13 09:28:34 +08:00
|
|
|
|
{ value: 1, label: '待处理' },
|
|
|
|
|
|
{ value: 2, label: '处理中' },
|
|
|
|
|
|
{ value: 3, label: '已关闭' },
|
|
|
|
|
|
{ value: 4, label: '已忽略' },
|
2026-05-13 09:06:50 +08:00
|
|
|
|
]}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ fontSize: 12, color: '#4E5969', marginBottom: 4 }}>设备ID</div>
|
|
|
|
|
|
<Input
|
|
|
|
|
|
placeholder="设备ID"
|
|
|
|
|
|
value={queryParams.deviceId}
|
|
|
|
|
|
onChange={e => setQueryParams({ ...queryParams, deviceId: e.target.value })}
|
|
|
|
|
|
style={{ width: 160 }}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ fontSize: 12, color: '#4E5969', marginBottom: 4 }}>时间范围</div>
|
|
|
|
|
|
<RangePicker
|
|
|
|
|
|
showTime
|
|
|
|
|
|
style={{ width: 320 }}
|
|
|
|
|
|
onChange={arr => {
|
|
|
|
|
|
if (arr) {
|
|
|
|
|
|
setQueryParams({
|
|
|
|
|
|
...queryParams,
|
2026-05-13 13:16:36 +08:00
|
|
|
|
startTime: arr[0].format('YYYY-MM-DD HH:mm:ss'),
|
2026-05-13 09:06:50 +08:00
|
|
|
|
endTime: arr[1].format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<Space>
|
|
|
|
|
|
<Button style={{ borderRadius: 8 }} onClick={() => {
|
2026-05-13 13:16:36 +08:00
|
|
|
|
setQueryParams({ deviceId: '', alarmLevel: '', handleStatus: '', startTime: '', endTime: '' });
|
2026-05-13 09:06:50 +08:00
|
|
|
|
fetchList();
|
|
|
|
|
|
}}>重置</Button>
|
|
|
|
|
|
<Button type="primary" style={{ borderRadius: 8, background: '#165DFF' }} onClick={fetchList}>
|
|
|
|
|
|
<SearchOutlined />查询
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button style={{ borderRadius: 8 }} onClick={doExport}>
|
|
|
|
|
|
<FileTextOutlined />导出
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 统计卡片 */}
|
|
|
|
|
|
<Row gutter={16} style={{ marginBottom: 16, flexWrap: 'wrap' }}>
|
|
|
|
|
|
<Col xs={24} sm={12} md={8} lg={4} xl={4}>
|
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, whiteSpace: 'nowrap' }}>
|
|
|
|
|
|
<Row align="middle" gutter={16}>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ width: 48, height: 48, background: '#FFF1F0', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<BellOutlined style={{ fontSize: 24, color: '#FF4D4F' }} />
|
2026-05-13 09:06:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col style={{ overflow: 'hidden' }}>
|
|
|
|
|
|
<div style={{ fontSize: 14, color: '#4E5969' }}>告警总数</div>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<div style={{ fontSize: 28, fontWeight: 700, color: '#FF4D4F', lineHeight: '36px' }}>
|
2026-05-13 09:06:50 +08:00
|
|
|
|
{statData.total || 0}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
|
|
<Col xs={24} sm={12} md={8} lg={4} xl={4}>
|
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, whiteSpace: 'nowrap' }}>
|
|
|
|
|
|
<Row align="middle" gutter={16}>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ width: 48, height: 48, background: '#FFF1F0', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<ExclamationCircleOutlined style={{ fontSize: 24, color: '#FF4D4F' }} />
|
2026-05-13 09:06:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col style={{ overflow: 'hidden' }}>
|
|
|
|
|
|
<div style={{ fontSize: 14, color: '#4E5969' }}>严重告警</div>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<div style={{ fontSize: 28, fontWeight: 700, color: '#FF4D4F', lineHeight: '36px' }}>
|
2026-05-13 09:06:50 +08:00
|
|
|
|
{statData.levelStats?.[1] || 0}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
|
|
<Col xs={24} sm={12} md={8} lg={4} xl={4}>
|
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, whiteSpace: 'nowrap' }}>
|
|
|
|
|
|
<Row align="middle" gutter={16}>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ width: 48, height: 48, background: '#FFF7E8', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<ClockCircleOutlined style={{ fontSize: 24, color: '#FA8C16' }} />
|
2026-05-13 09:06:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col style={{ overflow: 'hidden' }}>
|
|
|
|
|
|
<div style={{ fontSize: 14, color: '#4E5969' }}>待处理</div>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<div style={{ fontSize: 28, fontWeight: 700, color: '#FA8C16', lineHeight: '36px' }}>
|
2026-05-13 09:06:50 +08:00
|
|
|
|
{statData.pending || 0}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
|
|
<Col xs={24} sm={12} md={8} lg={4} xl={4}>
|
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, whiteSpace: 'nowrap' }}>
|
|
|
|
|
|
<Row align="middle" gutter={16}>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ width: 48, height: 48, background: '#E8F3FF', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<ReloadOutlined style={{ fontSize: 24, color: '#1890FF' }} />
|
2026-05-13 09:06:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col style={{ overflow: 'hidden' }}>
|
|
|
|
|
|
<div style={{ fontSize: 14, color: '#4E5969' }}>处理中</div>
|
2026-05-13 09:28:34 +08:00
|
|
|
|
<div style={{ fontSize: 28, fontWeight: 700, color: '#1890FF', lineHeight: '36px' }}>
|
2026-05-13 09:06:50 +08:00
|
|
|
|
{statData.processing || 0}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
|
|
<Col xs={24} sm={12} md={8} lg={4} xl={4}>
|
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, whiteSpace: 'nowrap' }}>
|
|
|
|
|
|
<Row align="middle" gutter={16}>
|
|
|
|
|
|
<Col>
|
|
|
|
|
|
<div style={{ width: 48, height: 48, background: '#E8FFEA', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
|
|
|
|
|
<CheckCircleOutlined style={{ fontSize: 24, color: '#00B42A' }} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col style={{ overflow: 'hidden' }}>
|
|
|
|
|
|
<div style={{ fontSize: 14, color: '#4E5969' }}>已关闭</div>
|
|
|
|
|
|
<div style={{ fontSize: 28, fontWeight: 700, color: '#00B42A', lineHeight: '36px' }}>
|
|
|
|
|
|
{statData.closed || 0}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 表格 */}
|
|
|
|
|
|
<Row gutter={16} style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<Col flex="auto" style={{ minWidth: 0 }}>
|
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '16px 24px' }} style={{ borderRadius: 8 }}>
|
|
|
|
|
|
<Spin spinning={loading}>
|
|
|
|
|
|
<Table
|
|
|
|
|
|
rowKey="id"
|
|
|
|
|
|
columns={columns}
|
|
|
|
|
|
dataSource={alarmList}
|
|
|
|
|
|
pagination={false}
|
|
|
|
|
|
size="middle"
|
|
|
|
|
|
scroll={{ x: 'max-content' }}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Spin>
|
|
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'center', marginTop: 16 }}>
|
|
|
|
|
|
<Pagination
|
|
|
|
|
|
current={pageNum}
|
|
|
|
|
|
pageSize={10}
|
|
|
|
|
|
total={total}
|
|
|
|
|
|
onChange={(p) => setPageNum(p)}
|
|
|
|
|
|
showSizeChanger={false} showQuickJumper size="small"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 三个图表 */}
|
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
|
<Card bordered={false} title="告警趋势" style={{ borderRadius: 8 }}>
|
|
|
|
|
|
<Line
|
|
|
|
|
|
data={[
|
|
|
|
|
|
{ date: '00:00', 严重: statData.levelStats?.[1] || 0 },
|
|
|
|
|
|
{ date: '04:00', 严重: (statData.levelStats?.[1] || 0) + 1 },
|
|
|
|
|
|
{ date: '08:00', 严重: (statData.levelStats?.[1] || 0) + 2 },
|
|
|
|
|
|
{ date: '12:00', 严重: statData.levelStats?.[1] || 0 },
|
|
|
|
|
|
{ date: '16:00', 严重: (statData.levelStats?.[1] || 0) + 1 },
|
|
|
|
|
|
{ date: '20:00', 严重: statData.levelStats?.[1] || 0 },
|
|
|
|
|
|
]}
|
|
|
|
|
|
xField="date"
|
|
|
|
|
|
yField={['严重']}
|
2026-05-13 09:28:34 +08:00
|
|
|
|
color={['#FF4D4F']}
|
2026-05-13 09:06:50 +08:00
|
|
|
|
smooth
|
|
|
|
|
|
height={220}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
|
<Card bordered={false} title="告警分类占比" style={{ borderRadius: 8 }}>
|
|
|
|
|
|
<Pie {...pieConfig} height={220} />
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
|
<Card bordered={false} title="告警状态统计" style={{ borderRadius: 8 }}>
|
|
|
|
|
|
<Bar
|
|
|
|
|
|
data={[
|
|
|
|
|
|
{ name: '待处理', value: statData.pending || 0 },
|
|
|
|
|
|
{ name: '处理中', value: statData.processing || 0 },
|
|
|
|
|
|
{ name: '已关闭', value: statData.closed || 0 },
|
|
|
|
|
|
]}
|
|
|
|
|
|
xField="name"
|
|
|
|
|
|
yField="value"
|
|
|
|
|
|
color={['#165DFF']}
|
|
|
|
|
|
height={220}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
2026-05-13 09:28:34 +08:00
|
|
|
|
{/* 告警详情抽屉 */}
|
2026-05-13 09:06:50 +08:00
|
|
|
|
<Drawer
|
|
|
|
|
|
title="告警详情"
|
|
|
|
|
|
open={drawerVisible}
|
|
|
|
|
|
onClose={() => setDrawerVisible(false)}
|
|
|
|
|
|
width={420}
|
|
|
|
|
|
destroyOnClose
|
|
|
|
|
|
>
|
|
|
|
|
|
<Spin spinning={detailLoading}>
|
|
|
|
|
|
{currentAlarm && (
|
2026-05-13 11:12:17 +08:00
|
|
|
|
<Form form={form} onFinish={doHandle} layout="vertical">
|
|
|
|
|
|
<>
|
|
|
|
|
|
{/* 告警头部 */}
|
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 16 }}>
|
|
|
|
|
|
<div style={{ width: 40, height: 40, background: '#FFF1F0', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center', marginRight: 12 }}>
|
|
|
|
|
|
<ExclamationCircleOutlined style={{ fontSize: 20, color: '#FF4D4F' }} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style={{ flex: 1 }}>
|
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
|
|
|
|
|
<span style={{ fontSize: 16, fontWeight: 700 }}>{currentAlarm.alarmTitle}</span>
|
|
|
|
|
|
<Tag color={levelColor[currentAlarm.alarmLevel]} style={{ borderRadius: 2, border: 'none', color: '#fff' }}>
|
|
|
|
|
|
{levelText[currentAlarm.alarmLevel]}
|
|
|
|
|
|
</Tag>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style={{ fontSize: 12, color: '#86909C' }}>告警编号:{currentAlarm.alarmNo}</div>
|
2026-05-13 09:06:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-05-13 11:12:17 +08:00
|
|
|
|
|
|
|
|
|
|
{/* 告警基础信息 */}
|
|
|
|
|
|
<Descriptions column={1} bordered size="small" style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<Descriptions.Item label="来源设备">{currentAlarm.deviceName || '-'}</Descriptions.Item>
|
|
|
|
|
|
<Descriptions.Item label="告警类型">{alarmTypeMap[currentAlarm.alarmType] || '-'}</Descriptions.Item>
|
|
|
|
|
|
<Descriptions.Item label="发生时间">{dayjs(currentAlarm.alarmTime).format('YYYY-MM-DD HH:mm:ss')}</Descriptions.Item>
|
|
|
|
|
|
<Descriptions.Item label="处理状态">
|
|
|
|
|
|
{(() => {
|
|
|
|
|
|
let color = 'default';
|
|
|
|
|
|
const status = currentAlarm.handleStatus;
|
|
|
|
|
|
// 1:待处理 2:处理中 3:已关闭 4:已忽略
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
|
case 1: color = 'orange'; break;
|
|
|
|
|
|
case 2: color = 'blue'; break;
|
|
|
|
|
|
case 3: color = 'green'; break;
|
|
|
|
|
|
case 4: color = 'default'; break;
|
|
|
|
|
|
default: break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return <Tag color={color}>{handleStatusMap[status] || '-'}</Tag>;
|
|
|
|
|
|
})()}
|
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
|
<Descriptions.Item label="负责人">{currentAlarm.handleUserName || '-'}</Descriptions.Item>
|
|
|
|
|
|
</Descriptions>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 告警描述 */}
|
|
|
|
|
|
<Card size="small" title="告警描述" style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<div style={{ color: '#333' }}>{currentAlarm.alarmContent || '-'}</div>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 根因分析 */}
|
|
|
|
|
|
<Card size="small" title="根因分析建议" style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<div style={{ color: '#333' }}>{currentAlarm.rootCause || '-'}</div>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 推荐处理措施 */}
|
|
|
|
|
|
<Card size="small" title="推荐处理措施" style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<div style={{ color: '#333' }}>{currentAlarm.handleSuggestion || '-'}</div>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 处理操作 */}
|
|
|
|
|
|
<Card size="small" title="处理操作" style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<Form.Item label="处理状态" name="handleStatus" rules={[{ required: true, message: '请选择处理状态' }]}>
|
|
|
|
|
|
<Select>
|
|
|
|
|
|
<Option value={1}>待处理</Option>
|
|
|
|
|
|
<Option value={2}>处理中</Option>
|
|
|
|
|
|
<Option value={3}>已关闭</Option>
|
|
|
|
|
|
<Option value={4}>已忽略</Option>
|
|
|
|
|
|
</Select>
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
<Form.Item label="处理备注" name="handleRemark">
|
|
|
|
|
|
<Input.TextArea rows={2} placeholder="请输入处理备注" />
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 通知与订阅 */}
|
|
|
|
|
|
<Card size="small" title="通知与订阅" style={{ marginBottom: 16 }}>
|
|
|
|
|
|
<Row gutter={[8, 8]}>
|
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
|
<Space>
|
|
|
|
|
|
<svg t="1778634297838" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9839" width="16" height="16"><path d="M761.984 1009.28H253.696C138.368 1009.28 44.8 915.712 44.8 800.384V292.096C44.8 176.768 138.368 83.2 253.696 83.2h508.288c115.328 0 208.896 93.568 208.896 208.896v508.288c0 115.328-93.568 208.896-208.896 208.896z" fill="#00E560" p-id="9840"></path><path d="M507.776 265.856c-72.576 0-139.776 20.352-193.536 54.528-54.272 34.432-94.592 83.2-113.408 139.264-7.552 22.528-11.648 46.464-11.648 71.04 0 92.16 56.448 172.928 142.208 220.544 7.68 4.224 11.648 13.44 8.32 21.632-6.4 15.616-14.592 30.592-24.32 44.672-3.072 4.352 0.768 10.368 6.016 8.96 29.44-7.808 56.96-19.072 81.92-33.28 9.088-5.248 19.456-6.912 29.696-4.864 23.936 4.736 49.024 7.296 74.88 7.296 176 0 318.592-118.656 318.592-264.832 0-146.304-142.72-264.96-318.72-264.96z" fill="#FFFFFF" p-id="9841"></path></svg>
|
|
|
|
|
|
<span>短信</span>
|
|
|
|
|
|
<Switch checked={currentAlarm.notifySms === 1} />
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
|
<Space>
|
|
|
|
|
|
<svg t="1778634173765" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8764" width="16" height="16"><path d="M512.003 79C272.855 79 79 272.855 79 512.003 79 751.145 272.855 945 512.003 945 751.145 945 945 751.145 945 512.003 945 272.855 751.145 79 512.003 79z m200.075 375.014c-0.867 3.764-3.117 9.347-6.234 16.012h0.087l-0.347 0.648c-18.183 38.86-65.631 115.108-65.631 115.108l-0.215-0.52-13.856 24.147h66.8L565.063 779l29.002-115.368h-52.598l18.27-76.29c-14.76 3.55-32.253 8.436-52.945 15.1 0 0-27.967 16.36-80.607-31.5 0 0-35.501-31.29-14.891-39.078 8.744-3.33 42.466-7.573 69.004-11.122 35.93-4.845 57.965-7.441 57.965-7.441s-110.607 1.643-136.841-2.468c-26.237-4.11-59.525-47.905-66.626-86.377 0 0-10.953-21.117 23.595-11.122 34.547 10 177.535 38.95 177.535 38.95s-185.933-56.992-198.36-70.929c-12.381-13.846-36.406-75.902-33.289-113.981 0 0 1.343-9.521 11.127-6.926 0 0 137.49 62.75 231.475 97.152 94.028 34.403 175.76 51.885 165.2 96.414z" fill="#3AA2EB" p-id="8765"></path></svg>
|
|
|
|
|
|
{/*<NotificationOutlined />*/}
|
|
|
|
|
|
<span>钉钉</span>
|
|
|
|
|
|
<Switch checked={currentAlarm.notifyTelegram === 1} />
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col span={8}>
|
|
|
|
|
|
<Space>
|
|
|
|
|
|
<svg t="1778634149974" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7716" width="16" height="16"><path d="M512 512m-448 0a448 448 0 1 0 896 0 448 448 0 1 0-896 0Z" fill="#608BE9" p-id="7717"></path><path d="M192 302m32 0l576 0q32 0 32 32l0 356q0 32-32 32l-576 0q-32 0-32-32l0-356q0-32 32-32Z" fill="#EAEDF5" p-id="7718"></path><path d="M224 722h576c17.673 0 32-14.327 32-32v-58C660.96 493.333 554.294 424 512 424c-42.294 0-148.96 69.333-320 208v58c0 17.673 14.327 32 32 32z" fill="#CCDAF7" p-id="7719"></path><path d="M224 302h576c17.673 0 32 14.327 32 32v58C651.35 517.333 544.683 580 512 580c-32.683 0-139.35-62.667-320-188v-58c0-17.673 14.327-32 32-32z" fill="#FFFFFF" p-id="7720"></path></svg>
|
|
|
|
|
|
{/*<NotificationOutlined />*/}
|
|
|
|
|
|
<span>邮件</span>
|
|
|
|
|
|
<Switch checked={currentAlarm.notifyEmail === 1} />
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 底部按钮 */}
|
|
|
|
|
|
<Button type="primary" block htmlType="submit">确认处理</Button>
|
|
|
|
|
|
</>
|
|
|
|
|
|
</Form>
|
2026-05-13 09:06:50 +08:00
|
|
|
|
)}
|
|
|
|
|
|
</Spin>
|
|
|
|
|
|
</Drawer>
|
2026-05-11 14:59:36 +08:00
|
|
|
|
|
2026-05-09 16:44:39 +08:00
|
|
|
|
</div>
|
2026-05-07 14:13:26 +08:00
|
|
|
|
);
|
2026-05-07 17:09:19 +08:00
|
|
|
|
}
|