import React, { useState } from 'react';
import {
Card, Row, Col, Tabs, Button, Space, Select, Table, Statistic,
DatePicker, message, Tag, Typography,
Radio, Checkbox, Divider
} from 'antd';
import {
CloudOutlined, BarChartOutlined, BellOutlined,
CalendarOutlined, FileTextOutlined,
DownloadOutlined, ArrowUpOutlined, CheckCircleOutlined,
ClockCircleOutlined, WarningOutlined, FileExcelOutlined,
FilePdfOutlined, MailOutlined, SendOutlined, SettingOutlined,
RobotOutlined
} from '@ant-design/icons';
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 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 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 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 = [
{ 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: