import React, { useState } from 'react';
import {
Card, Row, Col, Tabs, Button, Space, Select, Table, Statistic,
DatePicker, message, Tag, Empty,
Typography
} from 'antd';
import {
CloudOutlined, BarChartOutlined, BellOutlined,
CalendarOutlined, LinkOutlined, FileTextOutlined,
DownloadOutlined
} from '@ant-design/icons';
import { Line, Pie } from '@ant-design/charts';
import dayjs from 'dayjs';
const { TabPane } = Tabs;
const { RangePicker } = DatePicker;
const { Option } = Select;
// 模拟数据
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 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 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 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' }
];
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: '140px', // 固定高度
flexShrink: 0 // 不压缩
}}
>