import React, { useState } from 'react';
import {
Row, Col, Card, Button, Tag, Table, Typography, Space, Statistic, message, Divider, Tooltip, Avatar, Empty
} from 'antd';
import {
ReloadOutlined, InfoCircleOutlined, ThunderboltOutlined,
LineChartOutlined, AppstoreOutlined, BellOutlined,
CheckCircleOutlined, CalendarOutlined, ArrowUpOutlined,
ArrowDownOutlined, RiseOutlined, FallOutlined, ScanOutlined,
DatabaseOutlined, CloudOutlined, RestOutlined, AimOutlined,
SelectOutlined, FireOutlined, WarningOutlined, ExclamationCircleOutlined
} from '@ant-design/icons';
import { Line, Area } from '@ant-design/charts';
import { UniversalLineChart } from "../components/recharts"
const { Title, Text } = Typography;
// 模拟数据
const aiSummaryData = [
{ key: '1', diagnosis: '热斑检测', status: '异常', confidence: '92%', impact: '高', conclusion: '检测到 36 处热斑疑似点' },
{ key: '2', diagnosis: '组串失配', status: '异常', confidence: '90%', impact: '高', conclusion: '8 串组串存在异常' },
{ key: '3', diagnosis: '遮挡风险', status: '轻微', confidence: '78%', impact: '中', conclusion: '局部遮挡影响 2% 发电量' },
{ key: '4', diagnosis: '组件衰减', status: '异常', confidence: '86%', impact: '中', conclusion: '平均衰减率 -5.32%' },
{ key: '5', diagnosis: '逆变器效率异常', status: '正常', confidence: '93%', impact: '低', conclusion: '所有逆变器运行正常' },
];
const aiRecommendations = [
{ key: '1', measure: '处理热斑组件', priority: '高', expectedGain: '+2.15%', confidence: '92%' },
{ key: '2', measure: '排查异常组串', priority: '高', expectedGain: '+1.85%', confidence: '90%' },
{ key: '3', measure: '清洗受遮挡区域', priority: '中', expectedGain: '+0.45%', confidence: '78%' },
{ key: '4', measure: '跟踪衰减较大组件', priority: '中', expectedGain: '+0.35%', confidence: '86%' },
{ key: '5', measure: '持续监控逆变器效率', priority: '低', expectedGain: '+0.10%', confidence: '93%' },
];
const thermalImagingData = [
{ name: '方阵 A-05', temp: '71.5℃', id: 'A05', status: 'serious' },
{ name: '方阵 A-12', temp: '68.3℃', id: 'A12', status: 'warning' },
{ name: '方阵 B-03', temp: '64.8℃', id: 'B03', status: 'warning' },
{ name: '方阵 C-07', temp: '67.2℃', id: 'C07', status: 'warning' },
];
const degradationData = [
{
date: '2024-01',
average: 0,
best: 0,
worst: -1.0,
},
{
date: '2024-04',
average: -1.2,
best: -0.5,
worst: -2.5,
},
{
date: '2024-07',
average: -2.5,
best: -1.0,
worst: -4.0,
},
{
date: '2024-10',
average: -3.8,
best: -1.5,
worst: -6.5,
},
{
date: '2025-01',
average: -4.5,
best: -2.0,
worst: -8.0,
},
{
date: '2025-05',
average: -5.32,
best: -2.5,
worst: -10.2,
},
];
const generationPerformanceData = [
{
time: '00:00',
actual: 0,
predict: 0,
theory: 0,
},
{
time: '03:00',
actual: 0,
predict: 0,
theory: 0,
},
{
time: '06:00',
actual: 100,
predict: 150,
theory: 200,
},
{
time: '09:00',
actual: 800,
predict: 950,
theory: 1100,
},
{
time: '12:00',
actual: 1400,
predict: 1650,
theory: 1800,
},
{
time: '15:00',
actual: 1200,
predict: 1350,
theory: 1500,
},
{
time: '18:00',
actual: 400,
predict: 550,
theory: 650,
},
{
time: '21:00',
actual: 0,
predict: 0,
theory: 0,
},
{
time: '24:00',
actual: 0,
predict: 0,
theory: 0,
},
];
export default function AIDiagnosisPage() {
const cardStyle = {
borderRadius: 12,
border: '1px solid #f0f0f0',
boxShadow: '0 4px 12px rgba(0,0,0,0.05)',
overflow: 'hidden'
};
const renderStatusTag = (status: string) => {
let color = '';
if (status === '异常') color = '#ff4d4f';
else if (status === '轻微') color = '#1677ff';
else if (status === '正常') color = '#52c41a';
return {status};
};
// 影响程度标签渲染
const renderImpactTag = (impact: string) => {
let color = '';
if (impact === '高') color = '#ff4d4f';
else if (impact === '中') color = '#fa8c16';
else if (impact === '低') color = '#52c41a';
return {impact};
};
// 优先级标签渲染(建议措施用)
const renderPriorityTag = (priority: string) => {
let color = '';
if (priority === '高') color = '#ff4d4f';
else if (priority === '中') color = '#fa8c16';
else if (priority === '低') color = '#52c41a';
return {priority};
};
return (
AI 智能诊断与分析中心
}>刷新数据
{/* 第一排:顶部统计卡片 */}
{[
{ title: 'PR值 (性能比)', value: '82.6%', trend: '较昨日 -1.3%', icon: , color: '#00B42A', bg: '#E8FFEA', trendColor: '#F53F3F', direction: 'down' },
{ title: '发电偏差率', value: '-4.35%', trend: '较昨日 -1.02%', icon: , color: '#F53F3F', bg: '#FFF1F0', trendColor: '#F53F3F', direction: 'down' },
{ title: '异常组串数量', value: '8', trend: '较昨日 +2 ↑', icon: , color: '#1D2129', bg: '#F5F7FA', trendColor: '#F53F3F', direction: 'up' },
{ title: '热斑疑似数量', value: '36', trend: '较昨日 +5 ↑', icon: , color: '#F53F3F', bg: '#FFF1F0', trendColor: '#F53F3F', direction: 'up' },
{ title: '电站健康度评分', value: '86.3', unit: '分', trend: '较昨日 -1.7', icon: , color: '#00B42A', bg: '#E8FFEA', trendColor: '#F53F3F', direction: 'down' },
{ title: '预测发电量', value: '4,821', unit: 'kWh', trend: '较昨日 +2.6% ↑', icon: , color: '#165DFF', bg: '#E8F3FF', trendColor: '#00B42A', direction: 'up' },
].map((item, index) => (
{item.title}
{item.value}
{item.unit && {item.unit}}
{item.trend}
{item.direction === 'up' ?
:
}
{React.cloneElement(item.icon as React.ReactElement, { style: { fontSize: 22, color: item.color === '#1D2129' ? '#4E5969' : item.color } })}
))}
{/* 第二排:热成像分析 和 组串异常定位 */}
无人机热成像巡检分析}
extra={巡检:2025-05-20 09:30 }
bordered={false}
bodyStyle={{ padding: '16px 20px' }}
style={{ ...cardStyle, height: '100%' }}
>
{thermalImagingData.map((item, idx) => (
{/* 模拟热斑点 */}
{item.temp}
{item.status === 'serious' ? '高危' : '注意'}
{item.name}
))}
组串实时状态定位图}
extra={} style={{ fontSize: 12, color: '#86909C' }}>
总组串: 160
异常: 8
}
bordered={false}
bodyStyle={{ padding: '16px 20px' }}
style={{ ...cardStyle, height: '100%' }}
>
{Array.from({ length: 20 }).map((_, i) => (
{String(i + 1).padStart(2, '0')}
))}
{['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'].map((row) => (
{row}排
{Array.from({ length: 20 }).map((_, col) => {
let color = '#E8F3FF'; // 正常
let icon = null;
let tooltip = `组串 ${row}-${col + 1}: 正常`;
// 模拟异常分布
if (row === 'B' && col === 3) { color = '#F53F3F'; icon = ; tooltip = `组串 ${row}-${col + 1}: 严重异常 (热斑)`; }
if (row === 'B' && col === 17) { color = '#F53F3F'; icon = ; tooltip = `组串 ${row}-${col + 1}: 严重异常 (断路)`; }
if (row === 'C' && col === 15) { color = '#FF7D00'; icon = ; tooltip = `组串 ${row}-${col + 1}: 异常 (功率偏差)`; }
if (row === 'E' && col === 4) { color = '#FF7D00'; icon = ; tooltip = `组串 ${row}-${col + 1}: 异常 (遮挡)`; }
if (row === 'F' && col === 11) { color = '#F7BA1E'; icon = ; tooltip = `组串 ${row}-${col + 1}: 轻微异常`; }
if (row === 'G' && col === 1) { color = '#F7BA1E'; icon = ; tooltip = `组串 ${row}-${col + 1}: 轻微异常`; }
if (row === 'H' && col === 10) { color = '#86909C'; tooltip = `组串 ${row}-${col + 1}: 离线`; }
return (
{icon}
);
})}
))}
{[
{ color: '#E8F3FF', label: '运行正常' },
{ color: '#F7BA1E', label: '轻微异常' },
{ color: '#FF7D00', label: '功率异常' },
{ color: '#F53F3F', label: '严重故障' },
{ color: '#86909C', label: '设备离线' },
].map(item => (
{item.label}
))}
异常类型分布
{[
{ label: '严重故障', value: 2, color: '#F53F3F', percent: '25%' },
{ label: '功率异常', value: 4, color: '#FF7D00', percent: '50%' },
{ label: '轻微异常', value: 2, color: '#F7BA1E', percent: '25%' },
{ label: '离线组串', value: 0, color: '#86909C', percent: '0%' },
].map(item => (
{item.label}
{item.value}
))}
{/* 第三排:三个主要分析区域 */}
组件衰减趋势分析}
bordered={false}
bodyStyle={{ padding: '16px 20px' }}
style={{ ...cardStyle, height: '100%' }}
>
衰减率趋势 (%)
当前均值: -5.32%
实时发电表现深度分析}
bordered={false}
bodyStyle={{ padding: '16px 20px' }}
style={{ ...cardStyle, height: '100%' }}
>
{[
{ label: '当日实际发电', value: '4,752', unit: 'kWh', color: '#165DFF' },
{ label: '当日预测发电', value: '4,960', unit: 'kWh', color: '#00B42A' },
{ label: '发电偏差率', value: '-4.35%', unit: '', color: '#F53F3F' },
{ label: '实时 PR 值', value: '82.6%', unit: '', color: '#1D2129' },
].map(item => (
{item.label}
{item.value} {item.unit}
))}
{/* AI诊断总结 */}
AI 诊断总结
更新时间: 2025-05-20 09:45
AI 建议与处置
{g}, width: 68 },
{ title: '置信度', dataIndex: 'confidence', width: 60 },
{
title: '操作',
key: 'action',
width: 76,
render: (_, record) => (
)
},
]}
dataSource={[
{ key: '1', measure: '处理热斑组件', priority: '高', gain: '+2.15%', confidence: '92%', isView: false },
{ key: '2', measure: '排查异常组串', priority: '高', gain: '+1.85%', confidence: '90%', isView: false },
{ key: '3', measure: '清洗受遮挡区域', priority: '中', gain: '+0.45%', confidence: '78%', isView: false },
{ key: '4', measure: '跟踪衰减组件', priority: '中', gain: '+0.35%', confidence: '86%', isView: false },
{ key: '5', measure: '监控逆变器效率', priority: '低', gain: '+0.10%', confidence: '93%', isView: true },
]}
pagination={false}
size="small"
rowKey="key"
style={{ fontSize: 12 }}
/>
{/* 底部:数据来源 */}
全栈数据融合来源}
bordered={false}
bodyStyle={{ padding: '16px 20px' }}
style={cardStyle}
>
{[
{ title: '无人机载荷热成像', time: '2025-05-20 09:30', icon: , status: '同步中' },
{ title: 'SCADA 实时遥测数据', time: '2025-05-20 09:45:12', icon: , status: '正常' },
{ title: '云端气象分析站', time: '2025-05-20 09:45:00', icon: , status: '正常' },
{ title: '电站运维资产库', time: '最近更新: 2025-05-18', icon: , status: '正常' },
].map((source, idx) => (
{source.icon}
{source.title}
数据点: {source.time}
))}
);
}