import React, { useState } from 'react';
import {
Card, Row, Col, Table, Select, Input, Tag,
Typography, Button, Space, Avatar, Pagination
} from 'antd';
import {
CloudOutlined, CheckCircleOutlined, WarningOutlined,
MinusCircleOutlined, ThunderboltOutlined,
RiseOutlined, SunOutlined, BarChartOutlined,
VideoCameraOutlined, RocketOutlined, AppstoreOutlined,
RobotOutlined, BranchesOutlined, ExperimentOutlined,
SearchOutlined, MoreOutlined, ArrowRightOutlined,
FullscreenOutlined, SyncOutlined
} from '@ant-design/icons';
import { Line, Bar, Pie } from '@ant-design/charts';
import bgMain from '../assets/images/bgmain.jpg';
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts';
import CesiumMap from '../components/Map';
const { Option } = Select;
const { Search } = Input;
const { Text, Title } = Typography;
// 模拟数据扩展
const deviceList = [
{ id: 1, name: '逆变器 INV-01', type: '逆变器', status: '正常', data: '164.2 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
{ id: 2, name: '逆变器 INV-02', type: '逆变器', status: '正常', data: '166.8 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
{ id: 3, name: '逆变器 INV-03', type: '逆变器', status: '正常', data: '162.1 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
{ id: 4, name: '逆变器 INV-04', type: '逆变器', status: '正常', data: '159.7 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
{ id: 5, name: '逆变器 INV-05', type: '逆变器', status: '告警', data: '159.8 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
{ id: 6, name: '汇流箱 01', type: '汇流箱', status: '正常', data: '32 组 / 32 组', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
{ id: 7, name: '汇流箱 02', type: '汇流箱', status: '正常', data: '32 组 / 32 组', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
{ id: 8, name: '气象站', type: '气象站', status: '正常', data: '28.0 ℃ / 815W/m²', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
];
const powerTrendData = [
{ time: '00:00', value: 0, type: '实时功率' },
{ time: '04:00', value: 50, type: '实时功率' },
{ time: '08:00', value: 350, type: '实时功率' },
{ time: '12:00', value: 750, type: '实时功率' },
{ time: '16:00', value: 500, type: '实时功率' },
{ time: '20:00', value: 50, type: '实时功率' },
{ time: '24:00', value: 0, type: '实时功率' },
];
const inverterPowerData = [
{ name: 'INV-01', power: 164.2 },
{ name: 'INV-02', power: 166.8 },
{ name: 'INV-03', power: 162.1 },
{ name: 'INV-04', power: 159.7 },
{ name: 'INV-05', power: 159.8 }
];
const heatmapColors = ['#52c41a', '#1890ff', '#faad14', '#1890ff', '#52c41a'];
const RealTimeMonitorPage = () => {
const [filterStatus, setFilterStatus] = useState('all');
const [filterType, setFilterType] = useState(undefined);
const [searchName, setSearchName] = useState('');
const cardStyle = { borderRadius: 12, border: '1px solid #f0f0f0', boxShadow: '0 2px 8px rgba(0,0,0,0.04)' };
const getStatusTag = (status) => {
const color = status === '正常' ? '#52c41a' : status === '告警' ? '#faad14' : '#999';
return (