优化修复告警和工单

This commit is contained in:
mmc
2026-05-18 09:35:44 +08:00
parent f0ebf0e348
commit baf3a4141b
4 changed files with 162 additions and 36 deletions

View File

@@ -118,13 +118,25 @@ const WorkOrderPage = () => {
{ title: 'AI建议生成', value: 7, unit: '单', subValue: '', subText: '今日自动生成', icon: <Cpu size={24} color="#722ed1" />, bg: '#f9f0ff' },
];
// 图表模拟数据
const pieData = [
{ type: '待处理', value: 12 },
{ type: '执行中', value: 9 },
{ type: '已完成', value: 126 },
{ type: '已挂起', value: 4 },
];
const getOrderStatusPieData = () => {
const statusMap = {
1: '待处理',
2: '已派发',
3: '执行中',
4: '已完成',
5: '已挂起',
};
const countMap: Record<string, number> = {};
workOrderList.forEach((item: any) => {
const label = statusMap[item.orderStatus] || '其他';
countMap[label] = (countMap[label] || 0) + 1;
});
return Object.entries(countMap).map(([type, value]) => ({ type, value }));
};
const pieData = getOrderStatusPieData();
const alarmTrendData = [
{ date: '05-18', value: 5 },
@@ -540,9 +552,17 @@ const WorkOrderPage = () => {
<Col xs={24} md={9}>
<Card bordered={false} title={<Text strong style={{ fontSize: 14 }}>工单状态分布</Text>} style={{ ...cardStyle, height: 380 }}>
<div style={{ height: 300, position: 'relative' }}>
<Pie data={pieData} angleField="value" colorField="type" radius={1} innerRadius={0.65} label={false}
color={['#1890ff', '#165DFF', '#00B42A', '#F53F3F']}
legend={{ position: 'right', layout: 'vertical' }} height={260} />
<Pie
data={pieData}
angleField="value"
colorField="type"
radius={1}
innerRadius={0.65}
label={false}
color={['#1890ff', '#165DFF', '#F7BA1E', '#00B42A', '#722ed1']}
legend={{ position: 'right', layout: 'vertical' }}
height={260}
/>
<div style={{ position: 'absolute', top: '42%', left: '30%', textAlign: 'center', transform: 'translate(-50%, -50%)' }}>
<div style={{ fontSize: 12, color: '#86909C' }}>总数</div>
<div style={{ fontSize: 28, fontWeight: 800, color: '#1D2129' }}>{workOrderTotal}</div>