diff --git a/src/components/reports/Overview.tsx b/src/components/reports/Overview.tsx new file mode 100644 index 0000000..f6c7e6e --- /dev/null +++ b/src/components/reports/Overview.tsx @@ -0,0 +1,571 @@ +import React, { useState } from 'react'; +import { + Card, Row, Col, Tabs, Button, Space, Select, Table, Tag, Typography, + DatePicker, Divider, Checkbox, Avatar, Badge, Tooltip, Progress, + Statistic +} from 'antd'; +import { + BarChartOutlined, BellOutlined, CalendarOutlined, FileTextOutlined, + DownloadOutlined, ArrowUpOutlined, CheckCircleOutlined, + ClockCircleOutlined, WarningOutlined, FileExcelOutlined, + FilePdfOutlined, MailOutlined, SendOutlined, SettingOutlined, + RobotOutlined, CloudOutlined, ThunderboltOutlined, + PieChartOutlined, LineChartOutlined, InfoCircleOutlined, + ReloadOutlined, MoreOutlined, FileDoneOutlined, EyeOutlined, + EditOutlined, RiseOutlined, FallOutlined, + CheckCircleFilled +} from '@ant-design/icons'; +import { Line, Column, Pie, Area, DualAxes, Bar } from '@ant-design/charts'; +import dayjs from 'dayjs'; +import { ChevronRight } from 'lucide-react'; +import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../recharts'; +import { useTranslation } from 'react-i18next'; + +const { TabPane } = Tabs; + + +// 模拟数据(完全匹配参考图) +const monthlyPowerData = [ + { date: '05-01', generation: 6, predicted: 8, pr: 105 }, + { date: '05-03', generation: 5.5, predicted: 7.8, pr: 102 }, + { date: '05-05', generation: 6.2, predicted: 8.2, pr: 108 }, + { date: '05-07', generation: 7, predicted: 8.5, pr: 110 }, + { date: '05-09', generation: 6.8, predicted: 8.3, pr: 105 }, + { date: '05-11', generation: 4, predicted: 7.5, pr: 98 }, + { date: '05-13', generation: 3, predicted: 7, pr: 95 }, + { date: '05-15', generation: 8, predicted: 9.5, pr: 112 }, + { date: '05-17', generation: 8.5, predicted: 10, pr: 115 }, + { date: '05-19', generation: 7.8, predicted: 9.2, pr: 108 }, + { date: '05-21', generation: 9, predicted: 10.5, pr: 118 }, + { date: '05-23', generation: 8.2, predicted: 9.8, pr: 110 }, + { date: '05-25', generation: 7, predicted: 9, pr: 105 }, + { date: '05-27', generation: 6.5, predicted: 8.5, pr: 102 }, + { date: '05-29', generation: 5, predicted: 7.5, pr: 98 }, + { date: '05-31', generation: 4.5, predicted: 7, pr: 95 }, +]; + +const powerMeteorologyData = [ + { date: '05-05-11', generation: 70, irradiance: 60, temp: 20 }, + { date: '05-12-18', generation: 60, irradiance: 50, temp: 22 }, + { date: '05-19-25', generation: 65, irradiance: 65, temp: 25 }, + { date: '05-26-31', generation: 55, irradiance: 55, temp: 23 }, +]; + +const orderAlarmData = [ + { date: '05-05-11', newOrder: 80, completed: 60, alarmCount: 10, closedRate: 80 }, + { date: '05-12-18', newOrder: 100, completed: 80, alarmCount: 20, closedRate: 85 }, + { date: '05-19-25', newOrder: 70, completed: 50, alarmCount: 15, closedRate: 90 }, + { date: '05-26-31', newOrder: 90, completed: 70, alarmCount: 18, closedRate: 92 }, +]; +const { Text } = Typography; // 必须这一句! + + + +const { RangePicker } = DatePicker; +const { Option } = Select; +const { Title } = Typography; + + + +export default function ReportCenterOverview() { + const { t } = useTranslation(); + 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')]); + + const overviewCards = [ + { + title: t('report.monthlyGeneration'), + value: '138.6', + unit: 'MWh', + trend: t('report.monthOverMonthUp', { value: '+6.2%' }), + color: '#00B42A', + iconBg: '#E8FFEA', + icon: + }, + { + title: t('report.prAverage'), + value: '82.8', + unit: '%', + trend: t('report.monthOverMonthUp', { value: '+1.1%' }), + color: '#165DFF', + iconBg: '#E8F3FF', + icon: + }, + { + title: t('report.workOrderCompletionRate'), + value: '93.4', + unit: '%', + trend: t('report.monthlyTotalOrders', { count: 126 }), + color: '#165DFF', + iconBg: '#E8F3FF', + icon: + }, + { + title: t('report.alertClosureRate'), + value: '94.2', + unit: '%', + trend: t('report.criticalAlertCount', { count: 8 }), + color: '#F53F3F', + iconBg: '#FFF1F0', + icon: + }, + { + title: t('report.cleaningRevenueImprovement'), + value: '+7.6', + unit: '%', + trend: t('report.estimatedAdditionalGeneration', { value: '12,850' }), + color: '#00B42A', + iconBg: '#E8FFEA', + icon: + }, + { + title: t('report.autoGeneratedReports'), + value: '24', + unit: t('report.unitReport'), + trend: t('report.monthlyAccumulated'), + color: '#722ED1', + iconBg: '#F9F0FF', + icon: + }, + ]; + + const aiAnalysisData = [ + { type: t('aiAnalysis.hotspotRecognition'), value: 36, color: '#F53F3F', icon: }, + { type: t('aiAnalysis.abnormalString'), value: 8, color: '#FF7D00', icon: }, + { type: t('aiAnalysis.recommendedCleanBlock'), value: 8, color: '#00B42A', icon: }, + { type: t('aiAnalysis.videoAbnormalEvent'), value: 6, color: '#722ED1', icon: }, + ]; + const aiPieData = aiAnalysisData.map(item => ({ + name: item.type, + value: item.value, + color: item.color, + })); + + const reportFileList = [ + { name: t('report.stationMonthlyReportFile'), status: t('report.generated') }, + { name: t('report.weeklyOperationSummary'), status: t('report.generated') }, + { name: t('report.aiDiagnosisDaily'), status: t('report.generating') }, + { name: t('report.alertClosureWeekly'), status: t('report.generated') }, + ]; + + const reportTemplates = [ + { name: t('report.monthlyOperationReport'), desc: t('report.monthlyOperationReportDesc'), color: '#165DFF', bg: '#E8F3FF', icon: }, + { name: t('report.deviceHealthReport'), desc: t('report.deviceHealthReportDesc'), color: '#165DFF', bg: '#E8F3FF', icon: }, + { name: t('report.cleaningOptimizationReport'), desc: t('report.cleaningEffectReportDesc'), color: '#165DFF', bg: '#E8F3FF', icon: }, + { name: t('report.inspectionRobotReport'), desc: t('report.inspectionRobotReportDesc'), color: '#722ED1', bg: '#F9F0FF', icon: }, + ]; + + const cardStyle = { + borderRadius: 12, + border: '1px solid #f0f0f0', + boxShadow: '0 4px 12px rgba(0,0,0,0.05)', + overflow: 'hidden' + }; + const generationRecord = [ + { name: t('report.stationMonthly'), time: '2025-05-31 08:15', operator: '张运维', type: t('report.generationReport'), status: t('report.generated') }, + { name: t('report.alertWeekly'), time: '2025-05-26 09:10', operator: t('report.systemAuto'), type: t('report.alertReport'), status: t('report.generated') }, + { name: t('report.aiDiagnosisDaily'), time: '2025-05-31 07:30', operator: t('report.systemAuto'), type: t('report.aiAnalysisReport'), status: t('report.generating') }, + { name: t('report.operationSummary'), time: '2025-05-31 09:00', operator: '李工程师', type: t('report.operationReport'), status: t('report.generated') }, + { name: t('report.cleaningEffectReport'), time: '2025-05-28 10:20', operator: '王运维', type: t('report.operationReport'), status: t('report.generated') }, + ]; + + return ( + <> + + {overviewCards.map((card, idx) => ( + + + {/* 左侧文字区域 */} +
+
+ {card.title} +
+
+ {card.value} + {card.unit} +
+ {/* 底部环比/备注 */} +
+ {card.trend} +
+
+ + {/* 右侧圆形图标区域 */} + +
+ {card.icon} +
+ +
+ + ))} +
+ + {/* 筛选栏 */} +
+
+ {t('report.reportCycle')}: + +
+
+ {t('report.reportType')}: + +
+
+ {t('report.dateRange')}: + +
+
+ + + + + +
+
+ + + {/* 左侧主内容区 */} + + {/* 月度综合经营分析 */} + {t('report.monthlyOperationAnalysis')}}> + + +
+
{t('report.generation')} (MWh)
+
{t('report.predictedGeneration')} (MWh)
+
PR (%)
+
+ + + +
+
+ {[ + { label: t('report.monthlyAccumulatedGeneration'), value: '138.6', unit: 'MWh' }, + { label: t('report.theoreticalGeneration'), value: '166.8', unit: 'MWh' }, + { label: t('report.prAverage'), value: '82.8', unit: '%' }, + { label: t('report.generationDeviation'), value: '-3.4', unit: '%', color: '#F53F3F' }, + { label: t('report.averageIrradiance'), value: '5.3', unit: t('report.unitIrradiancePerDay') }, + ].map((item, idx) => ( +
+ {item.label} + {item.value} {item.unit} +
+ ))} +
+
+ +
+
+ + {/* 第二排:三个图表 */} + + + {t('report.generationMeteorology')}} + > +
+ + + + + +
+ +
+ + + + {t('report.workOrderAlertClosure')}} + > +
+ + + + + +
+ +
+ + + + {t('report.aiAnalysisStatistics')}} + > +
+ + +
+ {aiAnalysisData.map((item, idx) => ( +
+ +
+ {item.type} +
+ + {item.value} {t('report.unitItem')} + +
+ ))} +
+
+
+ +
+ {/* 订阅与分发 */} + {t('report.subscriptionDispatch')}}> + + +
{t('report.subscribers', { count: 6 })}
+
+ {[ + { name: '张运维', role: t('report.roleOmSupervisor'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' }, + { name: '李工程师', role: t('report.roleStationEngineer'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' }, + { name: '王运维', role: t('report.roleDeviceOm'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' }, + { name: '陈经理', role: t('report.roleOmManager'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' }, + ].map((p, idx) => ( + + + + ))} + +2 +
+ + + +
{t('report.dispatchChannels')}
+ + + + + + + + +
{t('report.sendPlan')}
+
+ + + {t('report.weeklyAutoSend')} + + +
+ +
+
+ + + {/* 右侧边栏 */} + + {/* 报表目录 / 快捷下载 */} + {t('report.reportDirectory')}} extra={}> + {text} + }, + { + title: t('roles.status'), dataIndex: 'status', width: 80, + render: (v) => {v} + }, + { + title: t('roles.actions'), width: 120, + render: () => ( + }> + + + + ) + } + ]} + dataSource={reportFileList} + pagination={false} + size="small" + className="compact-table" + /> + + + {/* 模板中心 */} + {t('report.templateCenter')}} extra={}> + + {reportTemplates.map((tpl, idx) => ( + +
+
+
+ {tpl.icon} +
+
{tpl.name}
+
+
{tpl.desc}
+
+ + ))} + + + + {/* 报表生成记录 */} + {t('report.generationRecords')}} extra={}> +
{v} + }, + { + title: t('roles.actions'), width: 90, + render: () => ( + +