关联趋势列表 查看全部按钮

This commit is contained in:
mmc
2026-07-20 16:22:18 +08:00
parent a3b30e1f83
commit 48d3fc0d8d

View File

@@ -144,7 +144,7 @@ const WorkOrderPage = () => {
const [weekAlarmList, setWeekAlarmList] = useState([]);
const [alarmChartData, setAlarmChartData] = useState([]);
const [latestThreeAlarm, setLatestThreeAlarm] = useState([]);
const [alarmAllModalVisible, setAlarmAllModalVisible] = useState(false);
@@ -430,15 +430,6 @@ const WorkOrderPage = () => {
const pieData = getOrderStatusPieData();
const alarmTrendData = [
{ date: '05-181', value: 5 },
{ date: '05-19', value: 10 },
{ date: '05-20', value: 7 },
{ date: '05-21', value: 12 },
{ date: '05-22', value: 8 },
{ date: '05-23', value: 15 },
{ date: '05-24', value: 11 },
];
const getWorkOrderList = async (params = {}) => {
setLoading(true);
@@ -1358,8 +1349,16 @@ const WorkOrderPage = () => {
<Col span={11}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>关联告警列表 <Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}>(近 3 条)</Text></div>
<Button type="link" size="small" style={{ fontSize: 11, padding: 0 }}>查看全部</Button>
</div>
{weekAlarmList.length > 3 && (
<Button
type="link"
size="small"
style={{ fontSize: 11, padding: 0 }}
onClick={() => setAlarmAllModalVisible(true)}
>
查看全部
</Button>
)} </div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
{latestThreeAlarm.length === 0 ? (
<Text type="secondary" style={{ fontSize: 11 }}>近7天无告警记录</Text>
@@ -1565,6 +1564,72 @@ const WorkOrderPage = () => {
</Form.Item>
</Form>
</Modal>
{/* 近7天全部告警弹窗 */}
<Modal
title="近7天全部关联告警"
open={alarmAllModalVisible}
onCancel={() => setAlarmAllModalVisible(false)}
width={900}
footer={null}
>
<Table
rowKey="id"
size="small"
dataSource={(() => {
// 时间倒序展示全部告警
return [...weekAlarmList].sort((a, b) => dayjs(b.alarmTime).valueOf() - dayjs(a.alarmTime).valueOf());
})()}
columns={[
{
title: '告警编号',
dataIndex: 'alarmNo',
width: 140
},
{
title: '告警标题',
dataIndex: 'alarmTitle',
ellipsis: true
},
{
title: '告警级别',
dataIndex: 'alarmLevel',
width: 90,
render: (level) => {
const color = levelColorMap[level] || '#86909C';
const label = priorityConfig[level]?.label || '未知';
return <Tag color={color}>{label}</Tag>;
}
},
{
title: '告警时间',
dataIndex: 'alarmTime',
width: 170,
render: (t) => dayjs(t).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '设备名称',
dataIndex: 'deviceName',
ellipsis: true,
width: 200
},
{
title: '处理状态',
dataIndex: 'handleStatus',
width: 100,
render: (s) => {
const map = { 1: '待处理', 2: '处理中', 3: '已关闭', 4: '已忽略' };
let tagColor = 'default';
if (s === 1) tagColor = 'orange';
if (s === 2) tagColor = 'blue';
if (s === 3) tagColor = 'green';
return <Tag color={tagColor}>{map[s] || '-'}</Tag>;
}
}
]}
/>
</Modal>
</div >
</>