diff --git a/src/components/devices/DeviceOverviewPage.tsx b/src/components/devices/DeviceOverviewPage.tsx index d0eff8d..4a92163 100644 --- a/src/components/devices/DeviceOverviewPage.tsx +++ b/src/components/devices/DeviceOverviewPage.tsx @@ -60,11 +60,9 @@ const logs = [ // 设备总览组件 export default function DeviceOverviewPage({ devices, planedevices, devicesAll }) { - console.log(devicesAll) const [activeTab, setActiveTab] = useState('drone'); const [selectedDevice, setSelectedDevice] = useState(''); - - + const [currentDevice, setCurrentDevice] = useState(null); const controlTabs = [ { key: 'airport', label: '无人机机场' }, @@ -79,11 +77,31 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll } const handleReturn = () => message.info('返航指令已下发'); const handleRecharge = () => message.info('回充指令已下发'); const handleEmergencyStop = () => message.error('已触发急停!'); + + // 数字保留两位小数 + const fix2 = (val) => { + if (val === null || val === undefined || isNaN(val)) return '-'; + return Number(val).toFixed(2); + }; + + // 安全取值 + const getVal = (val) => val == "no_rain" ? "无" : '-'; + + // 默认选中第一个 useEffect(() => { - if (devicesAll.length > 0) { - setSelectedDevice(devicesAll[0].device_sn); + if (devicesAll && devicesAll.length > 0) { + const first = devicesAll[0]; + setSelectedDevice(first.device_sn); + setCurrentDevice(first); } - }, [devicesAll]) + }, [devicesAll]); + + // 切换设备 + const handleDeviceChange = (sn) => { + setSelectedDevice(sn); + const target = devicesAll.find(item => item.device_sn === sn); + setCurrentDevice(target); + }; return ( @@ -108,11 +126,10 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll } - {/* 装备协同态势图 */} 装备协同态势图} extra={}> {t} }, { title: '设备', dataIndex: 'device', width: 120, render: t => {t} }, - { title: '类型', dataIndex: 'type', width: 80, render: t => { let c = '#52c41a'; if (t === '告警') c = '#fa8c16'; if (t === '事件') c = '#1890ff'; return
{t}
} }, + { title: '类型', dataIndex: 'type', width: 80, render: t => { let c = '#52c41a'; if (t === '告警') c = '#fa8c16'; if (t === 'events') c = '#1890ff'; return
{t}
} }, { title: '描述', dataIndex: 'desc', render: t => {t} }, { title: '', width: 80, render: (_, r) => r.level ? {r.level} : null } ]} />
- - 设备控制面板} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }} bodyStyle={{ padding: 16, paddingBottom: 0 }}> - ({ + value: item.device_sn, + label: item.callsign || '未知设备' + }))} /> - - -
-
- - 清洗无人机 UAV-C01 - 作业中 -
-
-
- - 电量 72% + + {currentDevice && ( + +
+
+
+ + {currentDevice.drone_callsign || currentDevice.callsign} + + {currentDevice.onlineStatus == 1 ? "在线" : "离线"} +
-
- 信号强度 - 强 + +
+
+ + 电量 {fix2(currentDevice.capacity_percent)}% +
+
+ 温度 + {fix2(currentDevice.environment_temperature)}℃ +
+
+ +
+
+ 机场编号 + {getVal(currentDevice.gateway_sn)} +
+
+ 设备SN + {getVal(currentDevice.device_sn)} +
+
+ 高度 + {fix2(currentDevice.height)} m +
+
+ 风速 + {fix2(currentDevice.wind_speed)} m/s +
+
+ 离家距离 + {fix2(currentDevice.home_distance)} m +
+ + {/* 经纬度 */} +
+ 经纬度 + {(fix2(currentDevice.longitude), fix2(currentDevice.latitude))} +
+ + + {/* 无人机状态 */} +
+ 信号 + + {currentDevice.network_state?.quality === 'good' ? '好' : currentDevice.network_state?.quality === 'better' ? '较好' : currentDevice.network_state?.quality === 'moderate' ? '一般' : currentDevice.network_state?.quality === 'poor' ? '较差' : currentDevice.network_state?.quality === 'too_pool' ? '差' : '无信号'} + +
+ + {/* RTK 信息 */} +
+ RTK 状态 + + {currentDevice.position_state?.is_fixed === 'fixing_successful' ? '固定' : '未固定'} + +
+
+ GPS卫星 + {getVal(currentDevice.position_state?.gps_number)} +
+
+ RTK卫星 + {getVal(currentDevice.position_state?.rtk_number)} +
+ +
+ +
+ + + +
-
-
当前模式自主清洗模式
-
当前位置清洗区域 C-05
-
当前任务清洗航线 C-05
-
预计剩余时间00:18:36
-
-
- - - - -
-
- - -
-
- 实时画面 - 2025-05-24 10:24:18 -
-
-
- 高度 12.5m速度 4.2m/s距离 86m + + +
+
+
+ 实时画面 + 实时监控 +
+
+
+ 高度 {fix2(currentDevice.height)}m + 风速 {fix2(currentDevice.wind_speed)}m/s +
- -
- - -
- - + +
+ + +
+ + + )} AI分析与操作建议} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }}> @@ -256,20 +330,19 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll }
-
风速
2.6 m/s
轻风
-
温度
28.7℃
适宜
-
辐照度
812W/m²
较高
-
降雨概率
10%
低
-
GNSS状态
正常
定位稳定
-
禁飞状态
未禁飞
可执行
+
风速
{fix2(currentDevice?.wind_speed)} m/s
+
温度
{fix2(currentDevice?.environment_temperature)}℃
+
降雨
{getVal(currentDevice?.rainfall)}
+
RTK
{currentDevice?.position_state?.is_fixed === 'fixing_successful' ? '固定' : '未固定'}
适宜执行
-
可正常开展作业
+
可正常作业
+ 任务执行时间线} bordered={false} style={{ borderRadius: 12 }} extra={
今天 2025-05-24
}> {taskTimeline.map((item, idx) => ( @@ -281,8 +354,6 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll }
- - diff --git a/src/pages/ReportCenter.tsx b/src/pages/ReportCenter.tsx index 82dc3a5..00f8a9e 100644 --- a/src/pages/ReportCenter.tsx +++ b/src/pages/ReportCenter.tsx @@ -1,581 +1,411 @@ import React, { useState } from 'react'; import { Card, Row, Col, Tabs, Button, Space, Select, Table, Statistic, - DatePicker, message, Tag, Empty, - Typography + DatePicker, message, Tag, Typography, + Radio, Checkbox, Divider } from 'antd'; import { CloudOutlined, BarChartOutlined, BellOutlined, - CalendarOutlined, LinkOutlined, FileTextOutlined, - DownloadOutlined + CalendarOutlined, FileTextOutlined, + DownloadOutlined, ArrowUpOutlined, CheckCircleOutlined, + ClockCircleOutlined, WarningOutlined, FileExcelOutlined, + FilePdfOutlined, MailOutlined, SendOutlined, SettingOutlined, + RobotOutlined } from '@ant-design/icons'; -import { Line, Pie } from '@ant-design/charts'; +import { Line, Bar, Pie } from '@ant-design/charts'; import dayjs from 'dayjs'; const { TabPane } = Tabs; const { RangePicker } = DatePicker; const { Option } = Select; +const { Text, Title } = Typography; -// 模拟数据 -const overviewData = { - powerToday: 69302.3, - currentPower: 89343.1, - currentAlarm: 5, - processingOrder: 2, - deviceOnlineRate: 92.3, - generatedReport: 4 -}; - -// 发电报表模拟数据 -const powerTrendData = [ - { date: '2026-04-28', avgPower: 40.33, dailyPower: 4580.6 } -]; -const powerDetailData = [ - { date: '2026-04-28', avgPower: 40.33, dailyPower: 4580.6, totalPower: 182345.7 } +// 模拟数据(完全匹配参考图) +const overviewCards = [ + { title: '本月发电量', value: '138.6', unit: 'MWh', rate: '+6.2%', rateUp: true, color: '#52c41a' }, + { title: 'PR均值', value: '82.8', unit: '%', rate: '+1.1%', rateUp: true, color: '#1890ff' }, + { title: '运维工单完成率', value: '93.4', unit: '%', desc: '本月累计 126 单', color: '#1890ff' }, + { title: '告警闭环率', value: '94.2', unit: '%', desc: '严重告警 8 条', color: '#faad14' }, + { title: '清洗收益提升', value: '+7.6', unit: '%', desc: '预估增发 12,850 kWh', color: '#52c41a' }, + { title: '自动生成报告', value: '24', unit: '份', desc: '本月累计', color: '#722ed1' }, ]; -// 告警报表模拟数据 -const alarmLevelData = [ - { type: 'MAJOR', value: 2 }, - { type: 'INFO', value: 2 }, - { type: 'MINOR', value: 1 } -]; -const alarmStatusData = [ - { type: 'PENDING', value: 3 }, - { type: 'PROCESSING', value: 2 } -]; -const alarmTrendData = [ - { date: '2026-04-28', count: 5 } -]; -const deviceAlarmRankData = [ - { device: 'INV-A02', count: 2 }, - { device: 'CAM-02', count: 2 }, - { device: 'CMB-A01', count: 1 } +const monthlyPowerData = [ + { date: '05-01', generation: 6, predicted: 8, pr: 105 }, + { date: '05-06', generation: 7, predicted: 9, pr: 108 }, + { date: '05-11', generation: 3, predicted: 7, pr: 102 }, + { date: '05-16', generation: 8, predicted: 10, pr: 112 }, + { date: '05-21', generation: 9, predicted: 10, pr: 110 }, + { date: '05-26', generation: 7, predicted: 9, pr: 108 }, + { date: '05-31', generation: 5, predicted: 7, pr: 105 }, ]; -// 工单报表模拟数据 -const orderStatusData = [ - { type: 'DISPATCHED', value: 1 }, - { type: 'PENDING', value: 1 }, - { type: 'PROCESSING', value: 1 } -]; -const orderPriorityData = [ - { type: 'LOW', value: 1 }, - { type: 'MEDIUM', value: 1 }, - { type: 'HIGH', value: 1 } -]; -const orderSourceData = [ - { type: 'ALARM', value: 2 }, - { type: 'MANUAL', value: 1 } -]; -const orderTrendData = [ - { date: '2026-04-28', newOrder: 3, completed: 0 } -]; -const orderEfficiencyData = { - avgProcessHour: 0.00, - completionRate: '0.0%', - newOrderToday: 0 -}; - -// 设备健康模拟数据 -const deviceHealthList = [ - { deviceCode: 'CAM-02', deviceName: '摄像头 CAM-02', type: 'CAMERA', online: 'OFFLINE', run: 'FAULT', temp: 0, power: 0, healthScore: 40, healthStatus: 'OFFLINE' }, - { deviceCode: 'INV-A02', deviceName: '逆变器 INV-A02', type: 'INVERTER', online: 'ONLINE', run: 'WARNING', temp: 82.5, power: 54.2, healthScore: 70, healthStatus: 'WARNING' }, - { deviceCode: 'CMB-A01', deviceName: '汇流箱 CMB-A01', type: 'COMBINER_BOX', online: 'ONLINE', run: 'WARNING', temp: 46.3, power: 0, healthScore: 70, healthStatus: 'WARNING' }, - { deviceCode: 'INV-A01', deviceName: '逆变器 INV-A01', type: 'INVERTER', online: 'ONLINE', run: 'NORMAL', temp: 46, power: 66.8, healthScore: 92, healthStatus: 'HEALTHY' }, - { deviceCode: 'INV-B01', deviceName: '逆变器 INV-B01', type: 'INVERTER', online: 'ONLINE', run: 'NORMAL', temp: 43.8, power: 22410.8, healthScore: 92, healthStatus: 'HEALTHY' }, - { deviceCode: 'CMB-A02', deviceName: '汇流箱 CMB-A02', type: 'COMBINER_BOX', online: 'ONLINE', run: 'NORMAL', temp: 41.1, power: 0, healthScore: 92, healthStatus: 'HEALTHY' }, - { deviceCode: 'MET-01', deviceName: '气象站 MET-01', type: 'WEATHER_STATION', online: 'ONLINE', run: 'NORMAL', temp: 28.4, power: 0, healthScore: 92, healthStatus: 'HEALTHY' }, - { deviceCode: 'METER-01', deviceName: '电表 METER-01', type: 'METER', online: 'ONLINE', run: 'NORMAL', temp: 39.2, power: 66811.3, healthScore: 92, healthStatus: 'HEALTHY' }, - { deviceCode: 'CAM-01', deviceName: '摄像头 CAM-01', type: 'CAMERA', online: 'ONLINE', run: 'NORMAL', temp: 35.2, power: 0, healthScore: 92, healthStatus: 'HEALTHY' }, - { deviceCode: 'CAM-03', deviceName: '摄像头 CAM-03', type: 'CAMERA', online: 'ONLINE', run: 'NORMAL', temp: 33.9, power: 0, healthScore: 92, healthStatus: 'HEALTHY' } +const powerMeteorologyData = [ + { date: '05-05-05', generation: 70, irradiance: 60, temp: 20 }, + { date: '05-12-05', generation: 60, irradiance: 50, temp: 22 }, + { date: '05-19-05', generation: 65, irradiance: 65, temp: 25 }, + { date: '05-26-05', generation: 55, irradiance: 55, temp: 23 }, +]; + +const orderAlarmData = [ + { date: '05-05-05', newOrder: 80, completed: 60, alarmCount: 10, closedRate: 80 }, + { date: '05-12-05', newOrder: 100, completed: 80, alarmCount: 20, closedRate: 85 }, + { date: '05-19-05', newOrder: 70, completed: 50, alarmCount: 15, closedRate: 90 }, + { date: '05-26-05', newOrder: 90, completed: 70, alarmCount: 18, closedRate: 92 }, +]; + +const aiAnalysisData = [ + { type: '热斑识别', value: 36 }, + { type: '异常组串', value: 8 }, + { type: '推荐清洗区块', value: 8 }, + { type: '视频异常事件', value: 6 }, ]; -// 报表文件模拟数据 const reportFileList = [ - { id: 'RPT-ALARM_STAT-20260429092501', name: '告警统计报表', type: 'ALARM_STAT', format: 'EXCEL', status: 'SUCCESS', time: '2026-04-29T09:25:03+08:00' }, - { id: 'RPT-DEMO-WORKORDER-001', name: '西北荒漠一号光伏电站工单效率统计', type: 'WORK_ORDER_STAT', format: 'EXCEL', status: 'SUCCESS', time: '2026-04-29T09:12:42+08:00' }, - { id: 'RPT-DEMO-ALARM-001', name: '西北荒漠一号光伏电站告警统计', type: 'ALARM_STAT', format: 'EXCEL', status: 'SUCCESS', time: '2026-04-29T09:12:42+08:00' }, - { id: 'RPT-DEMO-POWER-001', name: '西北荒漠一号光伏电站发电日报', type: 'POWER_DAILY', format: 'EXCEL', status: 'SUCCESS', time: '2026-04-29T09:12:42+08:00' } + { name: '电站月报', date: '2025年05月', type: '发电报表', status: '已生成', operator: '张运维', time: '2025-05-31 08:15' }, + { name: '周运维总结', date: '2025年05月', type: '运维报表', status: '已生成', operator: '系统自动', time: '2025-05-26 09:10' }, + { name: 'AI诊断日报', date: '2025年05月', type: 'AI分析报告', status: '生成中', operator: '系统自动', time: '2025-05-31 07:30' }, + { name: '告警闭环周报', date: '2025年05月', type: '告警报表', status: '已生成', operator: '李工程师', time: '2025-05-31 09:00' }, + { name: '清洗效果报告', date: '2025年05月', type: '运维报表', status: '已生成', operator: '王运维', time: '2025-05-28 10:20' }, +]; + +const reportTemplates = [ + { name: '月度经营报告', desc: '综合经营分析与收益评估模板', icon: , color: '#1890ff' }, + { name: '设备健康分析报告', desc: '设备健康与故障分析模板', icon: , color: '#faad14' }, + { name: '清洗优化效果报告', desc: '清洗前后对比与收益分析模板', icon: , color: '#52c41a' }, + { name: '巡检与机器人作业报告', desc: '巡检与机器人作业统计模板', icon: , color: '#722ed1' }, ]; export default function ReportCenterPage() { - const [activeTab, setActiveTab] = useState('power'); - const [timeType, setTimeType] = useState('day'); - const [dateRange, setDateRange] = useState([dayjs().subtract(7, 'day'), dayjs()]); - - // 顶部概览卡片 - const OverviewCards = () => ( - < div - style={{ - display: 'flex', - flexWrap: 'wrap', // 自动换行 - gap: '16px', // 卡片间距 - marginBottom: '20px' - } - } - > - {/* 今日发电量 */} - < div - style={{ - flex: '1 1 210px', // 基础宽度 210px,允许扩展 - height: '110px', // 固定高度 - flexShrink: 0 // 不压缩 - }} - > - - } - /> -
遥测与 latest 聚合
-
- - - {/* 当前功率 */} - < div - style={{ - flex: '1 1 210px', // 基础宽度 210px,允许扩展 - height: '110px', - flexShrink: 0 - }} - > - - } - /> -
实时功率汇总
-
- - - {/* 当前告警 */} - < div - style={{ - flex: '1 1 210px', // 基础宽度 210px,允许扩展 - height: '110px', - flexShrink: 0 - }} - > - - } - /> -
累计 5 条
-
- - - {/* 处理中工单 */} - < div - style={{ - flex: '1 1 210px', // 基础宽度 210px,允许扩展 - height: '110px', - flexShrink: 0 - }} - > - - } - /> -
全部 3 单
-
- - - {/* 设备在线率 */} - < div - style={{ - flex: '1 1 210px', // 基础宽度 210px,允许扩展 - height: '110px', - flexShrink: 0 - }} - > - - } - /> -
来自设备主数据
-
- - - {/* 已生成报表 */} - < div - style={{ - flex: '1 1 210px', // 基础宽度 210px,允许扩展 - height: '110px', - flexShrink: 0 - }} - > - - } - /> -
SUCCESS 文件记录
-
- - - ); - - // 发电报表 - const PowerReportTab = () => ( -
-
- - - - - - - -
- - - `${v}` }, - }} - /> - - - -
- - - ); - - // 告警报表 - const AlarmReportTab = () => ( -
- -
- - - - - - - - - - - - - - - - - -
- - - ); - - // 工单报表 - const WorkOrderReportTab = () => ( -
- -
- - - - - - - - - - - - - - - - - - - -
-
- -
平均处理小时
-
-
- orderEfficiencyData.completionRate} - /> -
完成率
-
-
- -
今日新增
-
-
-
- - - -
- - - - - ); - - // 设备健康报表 - const DeviceHealthTab = () => ( -
- -
- - } - /> -
来自 pv_device
-
- - - - } - /> -
在线状态统计
-
- - - - } - /> -
运行状态统计
-
- - - - } - /> -
来自 device_latest
-
- - - - -
{v} }, - { title: '运行', dataIndex: 'run', render: (v) => {v} }, - { title: '温度', dataIndex: 'temp' }, - { title: '功率', dataIndex: 'power' }, - { title: '健康分', dataIndex: 'healthScore' }, - { title: '健康状态', dataIndex: 'healthStatus', render: (v) => {v} } - ]} - dataSource={deviceHealthList} - pagination={false} - scroll={{ x: 'max-content' }} - /> - - - ); - - // 报表文件 - const ReportFileTab = () => ( -
-
- - - - -
- - -
{v} }, - { title: '生成时间', dataIndex: 'time' }, - { title: '操作', render: () => } - ]} - dataSource={reportFileList} - pagination={{ total: 4, pageSize: 10, showSizeChanger: true, showTotal: (total) => `共 ${total} 条` }} - /> - - - ); + const [activeTab, setActiveTab] = useState('overview'); + const [reportCycle, setReportCycle] = useState('month'); + const [reportType, setReportType] = useState('all'); + const [dateRange, setDateRange] = useState([dayjs('2025-05-01'), dayjs('2025-05-31')]); return (
- {/* 页面头部 */} -
-
- 报表中心 -

发电、告警、工单效率、设备健康与报表文件统一分析

-
- + {/* 页面头部标签 */} + + + + + + + + + {/* 顶部统计卡片 */} + + {overviewCards.map((card, idx) => ( +
+ + + {card.rate && ( + + 环比 {card.rate} + + )} + {card.desc && ( + + {card.desc} + + )} + + + ))} + + + {/* 筛选栏 */} +
+ + + + + + + +
- {/* 顶部概览卡片 */} - + + {/* 左侧主内容区 */} + + {/* 月度综合经营分析 */} + + { + if (datum.type === 'pr') return { lineDash: [4, 4] }; + return {}; + }} + tooltip={{ + formatter: (datum) => { + return { + name: datum.date, + data: [ + { name: '发电量(MWh)', value: datum.generation }, + { name: '预测发电(MWh)', value: datum.predicted }, + { name: 'PR(%)', value: datum.pr } + ] + }; + } + }} + legend={{ + items: [ + { name: '发电量(MWh)', marker: { symbol: 'line', style: { stroke: '#52c41a' } } }, + { name: '预测发电(MWh)', marker: { symbol: 'line', style: { stroke: '#1890ff', lineDash: [4, 4] } } }, + { name: 'PR(%)', marker: { symbol: 'line', style: { stroke: '#fa8c16' } } }, + ] + }} + yAxis={[ + { + label: { formatter: (v) => `${v}` }, + name: '发电量', + }, + { + label: { formatter: (v) => `${v}%` }, + name: 'PR', + position: 'right', + } + ]} + height={200} + /> + + + + + + + + + + + + + + + + + + - {/* 标签页 */} - - {PowerReportTab()} - {AlarmReportTab()} - {WorkOrderReportTab()} - {DeviceHealthTab()} - {ReportFileTab()} - + {/* 发电与气象 + 工单与告警 */} + + + + + + + + + + + + + + {/* AI分析成果统计 */} + + + + + + + + {aiAnalysisData.map((item, idx) => ( + + + + ))} + + + + + + + {/* 右侧边栏 */} + + {/* 报表目录 / 快捷下载 */} + + 报表目录 / 快捷下载 + + + }> +
( + {v} + ) + }, + { + title: '操作', render: () => ( + + + + + ) + } + ]} + dataSource={reportFileList.slice(0, 4)} + pagination={false} + size="small" + /> + + + {/* 模板中心 */} + + 模板中心 + + + }> + + {reportTemplates.map((tpl, idx) => ( + + +
+
+ {tpl.icon} +
+
+
{tpl.name}
+
{tpl.desc}
+
+
+
+ + ))} + + + + {/* 报表生成记录 */} + + 报表生成记录 + + + }> +
( + {v} + ) + }, + { + title: '操作', render: () => ( + + + + + ) + } + ]} + dataSource={reportFileList} + pagination={false} + size="small" + /> + + + {/* 订阅与分发 */} + +
+ 订阅人员 +
+ {['张运维', '李工程师', '王运维', '陈经理'].map((name, idx) => ( +
+
+ {name.charAt(0)} +
+ {name} +
+ ))} + +2 +
+
+ + + +
+ 分发渠道(可多选) +
+ + 邮件 + + + Telegram + + + 系统通知 + +
+
+ + + +
+ 发送计划 + +
+ + 每周一 09:00 自动发送 + +
+ + ); } diff --git a/src/pages/WorkOrder.tsx b/src/pages/WorkOrder.tsx index 2155bba..dd87e4d 100644 --- a/src/pages/WorkOrder.tsx +++ b/src/pages/WorkOrder.tsx @@ -1,71 +1,101 @@ import React, { useState } from 'react'; import { Layout, Card, Row, Col, Button, Table, Tag, Select, Input, Typography, Space, - Statistic, Modal, message, Empty, Drawer, Descriptions, Timeline, Divider, Form + Statistic, message, Drawer, Descriptions, Timeline, Divider, Form, Modal } from 'antd'; import { - CheckOutlined, ClockCircleOutlined, ControlOutlined, - BarChartOutlined, RiseOutlined, ArrowUpOutlined, - SearchOutlined, PlusOutlined, EditOutlined, DeleteOutlined, - EyeOutlined, CommentOutlined, PauseOutlined, FormOutlined + PlusOutlined, SearchOutlined, EditOutlined, EyeOutlined, + ClockCircleOutlined, CheckCircleOutlined, PlayCircleOutlined, + CloseCircleOutlined, ThunderboltOutlined, SettingOutlined, + SendOutlined, PauseOutlined, ArrowRightOutlined, FileDoneOutlined, + RobotOutlined, CloudOutlined, RiseOutlined, + BranchesOutlined } from '@ant-design/icons'; -import { Pie, Bar } from '@ant-design/charts'; +import { Pie, Line, Bar } from '@ant-design/charts'; +import dayjs from 'dayjs'; const { Option } = Select; const { Search } = Input; const { Text, Title } = Typography; -// 模拟数据 -const workOrderData = [ +// 模拟数据(完全匹配参考图) +const workOrderList = [ { - id: 'WO-20260428-003', - title: 'A区组件例行巡检', - source: '人工创建', - device: 'INV-A01', - deviceName: '逆变器 INV-A01', - type: '巡检', - priority: 'low', - status: 'dispatched', - handler: '李工程师', - createTime: '2026-04-28 19:55:18', - desc: '结合日常运维计划执行 A 区逆变器和汇流箱巡检。' - }, - { - id: 'WO-20260428-002', - title: 'CAM-02 离线排查', - source: '告警', - device: 'CAM-02', - deviceName: '摄像头 CAM-02', - type: '故障排查', - priority: 'medium', - status: 'pending', - handler: '', - createTime: '2026-04-28 19:55:18', - desc: '' - }, - { - id: 'WO-20260428-001', - title: 'INV-A02 温度过高现场检查', - source: '告警', - device: 'INV-A02', - deviceName: '逆变器 INV-A02', - type: '故障排查', + id: 'WO20250524001', + title: '逆变器 INV-05 告警排查', + source: 'AI诊断', + type: '检修', priority: 'high', + handler: '李工', + deadline: '2025-05-24 14:30', + status: 'pending', + description: '' + }, + { + id: 'WO20250524002', + title: '区块 B-12 热斑复检', + source: '无人机巡检', + type: '巡检', + priority: 'high', + handler: '王工', + deadline: '2025-05-24 15:00', status: 'processing', + description: '对AI识别热斑区域进行复检与红外复核,确认是否需要更换组件。' + }, + { + id: 'WO20250524003', + title: '组件清洗任务 C-05', + source: '清洗优化', + type: '清洗', + priority: 'medium', + handler: '赵工', + deadline: '2025-05-24 16:00', + status: 'dispatched', + description: '' + }, + { + id: 'WO20250524004', + title: '周界摄像头 CAM-08 离线修复', + source: '视频监控', + type: '维修', + priority: 'medium', + handler: '陈工', + deadline: '2025-05-24 17:30', + status: 'processing', + description: '' + }, + { + id: 'WO20250524005', + title: '除草机器人补给', + source: '装备控制', + type: '运维', + priority: 'low', + handler: '刘工', + deadline: '2025-05-24 18:00', + status: 'pending', + description: '' + }, + { + id: 'WO20250524006', + title: '逆变器室夜间巡检', + source: '人工创建', + type: '巡检', + priority: 'medium', handler: '张运维', - createTime: '2026-04-28 19:55:18', - desc: '' + deadline: '2025-05-24 21:00', + status: 'completed', + description: '' } ]; // 工单状态配置 const statusConfig = { - pending: { label: '待处理', color: '#faad14', icon: }, - dispatched: { label: '已派发', color: '#1890ff', icon: }, - processing: { label: '处理中', color: '#2f54eb', icon: }, + pending: { label: '待处理', color: '#1890ff', icon: }, + dispatched: { label: '已派发', color: '#52c41a', icon: }, + processing: { label: '执行中', color: '#2f54eb', icon: }, suspended: { label: '挂起', color: '#faad14', icon: }, - completed: { label: '已完成', color: '#52c41a', icon: }, - closed: { label: '已关闭', color: '#8c8c8c', icon: } + completed: { label: '已完成', color: '#52c41a', icon: }, + closed: { label: '已关闭', color: '#8c8c8c', icon: } }; // 优先级配置 @@ -76,347 +106,351 @@ const priorityConfig = { urgent: { label: '紧急', color: '#f5222d' } }; -const WorkOrderPage = () => { - const [searchParams, setSearchParams] = useState({ orderNo: '', status: '' }); - const [drawerVisible, setDrawerVisible] = useState(false); - const [currentOrder, setCurrentOrder] = useState(null); +// 统计卡片数据 +const overviewCards = [ + { title: '今日新增工单', value: 18, suffix: '单', desc: '较昨日 +3', color: '#1890ff', icon: }, + { title: '待处理工单', value: 12, suffix: '单', desc: '高优先级 5', color: '#ff4d4f', icon: }, + { title: '执行中工单', value: 9, suffix: '单', desc: '按时率 92%', color: '#52c41a', icon: }, + { title: '已完成工单', value: 126, suffix: '单', desc: '本月累计', color: '#52c41a', icon: }, + { title: '平均处理时长', value: 4.3, suffix: '小时', desc: '较上周 -12% ↓', color: '#1890ff', icon: }, + { title: 'AI建议生成', value: 7, suffix: '单', desc: '今日自动生成', color: '#722ed1', icon: } +]; - // 👇 新增:编辑工单弹窗状态 +// 任务排班数据 +const scheduleData = [ + { handler: '李工', tasks: [{ title: 'INV-05 告警排查', time: '08:30 - 12:00', type: 'alarm' }] }, + { handler: '王工', tasks: [{ title: 'B-12 热斑复检', time: '13:30 - 15:00', type: 'inspect' }] }, + { handler: '赵工', tasks: [{ title: '组件清洗 C-05', time: '09:00 - 12:00', type: 'clean' }, { title: '清洗效果复检', time: '15:00 - 17:00', type: 'clean' }] }, + { handler: '陈工', tasks: [{ title: '周界摄像头修复', time: '10:00 - 12:30', type: 'repair' }, { title: '设备巡检', time: '15:30 - 17:30', type: 'inspect' }] } +]; + +// 告警趋势数据 +const alarmTrendData = [ + { date: '05-18', count: 5 }, + { date: '05-19', count: 10 }, + { date: '05-20', count: 5 }, + { date: '05-21', count: 5 }, + { date: '05-22', count: 12 }, + { date: '05-23', count: 10 }, + { date: '05-24', count: 12 } +]; + +// 告警列表数据 +const alarmList = [ + { name: 'INV-05 逆变器告警', time: '05-24 10:24' }, + { name: 'B-12 区块热斑告警', time: '05-24 09:56' }, + { name: 'B-12 组件温度异常', time: '05-24 09:32' } +]; + +export default function WorkOrderPage() { + const [selectedOrder, setSelectedOrder] = useState(workOrderList[1]); // 默认选中执行中的工单 + const [drawerVisible, setDrawerVisible] = useState(false); const [editModalVisible, setEditModalVisible] = useState(false); const [editingOrder, setEditingOrder] = useState(null); const [editForm] = Form.useForm(); - // 打开编辑弹窗 - const openEditModal = (record) => { - setEditingOrder(record); - editForm.setFieldsValue({ - title: record.title, - source: record.source, - type: record.type, - priority: record.priority, - handler: record.handler, - deviceCode: record.device, - deviceName: record.deviceName, - desc: record.desc - }); - setEditModalVisible(true); - }; - - // 提交编辑 - const handleEditSubmit = () => { - editForm.validateFields().then(values => { - console.log('保存工单:', { ...editingOrder, ...values }); - message.success('工单保存成功'); - setEditModalVisible(false); - }); - }; - // 表格列定义 const columns = [ - { - title: '工单编号', - dataIndex: 'id', - key: 'id', - width: 140 - }, - { - title: '标题', - dataIndex: 'title', - key: 'title' - }, - { - title: '来源', - dataIndex: 'source', - key: 'source', - width: 100 - }, - { - title: '设备', - dataIndex: 'device', - key: 'device', - width: 100 - }, + { title: '工单编号', dataIndex: 'id', key: 'id', width: 140 }, + { title: '工单标题', dataIndex: 'title', key: 'title' }, + { title: '来源', dataIndex: 'source', key: 'source', width: 100 }, + { title: '类型', dataIndex: 'type', key: 'type', width: 80 }, { title: '优先级', dataIndex: 'priority', key: 'priority', width: 80, render: (priority) => ( - + {priorityConfig[priority]?.label} ) }, + { title: '负责人', dataIndex: 'handler', key: 'handler', width: 80 }, + { title: '截止时间', dataIndex: 'deadline', key: 'deadline', width: 160 }, { title: '状态', dataIndex: 'status', key: 'status', width: 100, render: (status) => ( - + {statusConfig[status]?.label} ) }, - { - title: '处理人', - dataIndex: 'handler', - key: 'handler', - width: 100, - render: (handler) => handler || '—' - }, - { - title: '创建时间', - dataIndex: 'createTime', - key: 'createTime', - width: 160 - }, { title: '操作', key: 'action', - width: 320, - fixed: 'right', + width: 80, render: (_, record) => ( - - - - - - - - - - - + ) } ]; - // 饼图数据 + // 工单状态分布饼图数据 const pieData = [ - { type: '待处理', value: 1, color: '#1890ff' }, - { type: '已派发', value: 1, color: '#52c41a' }, - { type: '处理中', value: 1, color: '#faad14' } - ]; - - // 柱状图数据 - const barData = [ - { priority: '紧急', count: 0 }, - { priority: '高', count: 1 }, - { priority: '中', count: 1 }, - { priority: '低', count: 1 } + { type: '待处理', value: 12, color: '#1890ff' }, + { type: '执行中', value: 9, color: '#2f54eb' }, + { type: '已完成', value: 126, color: '#52c41a' }, + { type: '已挂起', value: 4, color: '#faad14' } ]; return (
- {/* 顶部标题和搜索 */} -
-
- 工单管理 - 告警转工单、派发处理、流转记录与事件联动闭环 -
+ {/* 顶部统计卡片 */} + + {overviewCards.map((card, idx) => ( +
+ +
+
+
{card.title}
+
+ {card.value} {card.suffix} +
+
{card.desc}
+
+
+ {card.icon} +
+
+
+ + ))} + + + {/* 筛选栏 */} +
+ + + - } - style={{ width: 220 }} - value={searchParams.orderNo} - onChange={(e) => setSearchParams({ ...searchParams, orderNo: e.target.value })} - /> - - - + 时间范围 + + + + } /> + + +
- {/* 统计卡片 */} - - - - } - valueStyle={{ fontSize: 28, fontWeight: 700 }} - /> - 当前电站 - - - - - } - valueStyle={{ fontSize: 28, fontWeight: 700, color: '#faad14' }} - /> - PENDING - - - - - } - valueStyle={{ fontSize: 28, fontWeight: 700, color: '#1890ff' }} - /> - DISPATCHED - - - - - } - valueStyle={{ fontSize: 28, fontWeight: 700, color: '#2f54eb' }} - /> - PROCESSING - - - - - } - valueStyle={{ fontSize: 28, fontWeight: 700, color: '#faad14' }} - /> - SUSPENDED - - - - - } - valueStyle={{ fontSize: 28, fontWeight: 700, color: '#52c41a' }} - /> - 逾期 0 单 - - - - - {/* 工单列表 */} - -
-
- 工单列表 - 工单状态变化会写入流转记录和事件中心 -
- - - - - -
-
- - - {/* 底部图表区域:降低卡片高度 */} - - - + +
`共 ${total} 条` }} + scroll={{ x: 'max-content' }} + rowClassName={(record) => record.id === selectedOrder?.id ? 'selected-row' : ''} + onRow={(record) => ({ onClick: () => setSelectedOrder(record) })} /> + + + {/* 工单状态分布 + 任务排班 */} + + + + `${datum.value} (${((datum.value / 147) * 100).toFixed(2)}%)` + }} + interactions={[{ type: 'pie-legend-active' }]} + /> +
+
总数
+
147
+
+
+ + + 任务排班 / 日历视图}> +
+
+
+ {scheduleData.map((item, idx) => ( +
+
{item.handler}
+
+
+ {item.tasks.map((task, i) => ( +
+
{task.title}
+
{task.time}
+
+ ))} +
+
+ ))} +
+ + + -
- - - - - - - - 告警转工单 - 流转记录 - 事件中心 - WebSocket刷新 - -
- + + {/* 右侧工单详情面板 */} +
+ +
+ {selectedOrder?.title} + 高优先级 +
+ 工单编号: {selectedOrder?.id} + }> + +
来源:{selectedOrder?.source}
+
工单类型:{selectedOrder?.type}
+
负责人:{selectedOrder?.handler}
+
协同人员:无人机A01 / 张运维
+
计划时间:2025-05-24 13:30 ~ 15:00
+
关联区域:B-12
+
关联设备:UAV-A01
+
当前状态:执行中
+ + +
+
任务描述
+
+ {selectedOrder?.description} +
+
+ + {/* 流程步骤 */} +
+ {['已创建', '已派发', '执行中', '已完成'].map((step, idx) => ( +
+
+ {idx + 1} +
+
{step}
+
+ ))} +
+
+ + {/* 操作按钮 */} +
+ + + + +
+ + + {/* AI建议与关联信息 */} + +
+
+
+
+ +
+
建议携带红外热像设备
+
+
+
+
+
+ +
+
优先复检组件 B-12-03 / B-12-05
+
+
+
+
+
+ +
+
预计影响发电 2.1%
+
+
+
+ + +
+
关联告警趋势(近7天)
+ + + +
+ 关联告警列表(近3条) + +
+
+ {alarmList.map((alarm, idx) => ( +
+
+
+ {alarm.name} +
+ {alarm.time} +
+ ))} +
+ + @@ -430,153 +464,49 @@ const WorkOrderPage = () => { open={drawerVisible} destroyOnClose > - {currentOrder && ( + {selectedOrder && (
- 基础信息 - - {currentOrder.id} - {statusConfig[currentOrder.status]?.label} - {currentOrder.title} + + {selectedOrder.id} + {statusConfig[selectedOrder.status]?.label} + {selectedOrder.title} - - {priorityConfig[currentOrder.priority]?.label} - - - {currentOrder.source} - {currentOrder.device} - {currentOrder.handler || '—'} - {currentOrder.createTime} - - {currentOrder.desc || '—'} + {priorityConfig[selectedOrder.priority]?.label} + {selectedOrder.source} + {selectedOrder.type} + {selectedOrder.handler || '—'} + {selectedOrder.deadline} + {selectedOrder.description || '—'} - - - 关联告警 - - - - - - - - - - - 流转时间线 - - - 创建 --> 已派发 -
- 阶段4B演示工单初始化 -
- system -
-
-
- - - 评论 -
- - - 附件元数据 -
)} - {/* 👇 编辑工单弹窗 */} + {/* 编辑工单弹窗 */} setEditModalVisible(false)} - onOk={handleEditSubmit} + onOk={() => { editForm.validateFields().then(values => { message.success('工单保存成功'); setEditModalVisible(false); }); }} okText="保存" cancelText="取消" width={600} destroyOnClose >
- - - - + -
- - - - - - - - - + + - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - + ); -}; - -export default WorkOrderPage; +}