总览和 告警 界面

This commit is contained in:
mmc
2026-05-07 20:25:14 +08:00
parent 5ef889e435
commit dea212151a
3 changed files with 834 additions and 468 deletions

View File

@@ -1,402 +1,510 @@
import React from 'react';
import { Card, Row, Col, Statistic, Button, Space, Tag, Typography } from 'antd';
import {
Card,
Row,
Col,
Statistic,
Table,
Tag,
Progress,
List,
Button,
Typography,
Space,
} from 'antd';
import {
ThunderboltOutlined,
DashboardOutlined,
DotChartOutlined,
RocketOutlined,
BellOutlined,
CloudUploadOutlined,
CloudOutlined, ThunderboltOutlined, BarChartOutlined,
RiseOutlined, BellOutlined, WalletOutlined,
MinusOutlined, PlusOutlined, SyncOutlined
} from '@ant-design/icons';
import { DEVICES, ALERTS } from '../constants';
import { useNavigate } from 'react-router-dom';
import { Line, Column } from '@ant-design/charts';
import { Line, Bar, Pie } from '@ant-design/charts';
import { getOverflowOptions } from 'antd/es/_util/placements';
const { Text, Title } = Typography;
const AntdCard = Card as any;
const { Text } = Typography;
export default function Home() {
const navigate = useNavigate();
export default function StationDashboard() {
// 模拟数据
const stationOverview = {
todayEnergy: 45.9,
currentPower: 66811.3,
systemEfficiency: 66.8,
yesterdayEfficiency: 81.3,
systemAvailability: 92.31,
onlineDevices: "12/13",
alarmCount: 5,
costSaved: 8278
};
// 顶部统计卡片数据(和参考图完全一致)
const topStats = [
{
title: '今日发电量',
value: 4752,
suffix: 'kWh',
extra: <span style={{ color: '#52c41a', fontSize: 12 }}>日目标 5,000 kWh</span>,
percent: 95,
color: '#52c41a'
},
{
title: '当前功率',
value: 812.6,
suffix: 'kW',
extra: <span style={{ color: '#888', fontSize: 12 }}>装机容量 1,000 kWp</span>,
color: '#1890ff'
},
{
title: 'Performance Ratio(PR)',
value: 82.6,
suffix: '%',
extra: <span style={{ color: '#888', fontSize: 12 }}>昨日 81.3% 环比 ↑1.3%</span>,
color: '#13c2c2'
},
{
title: '系统可用率',
value: 99.35,
suffix: '%',
extra: <span style={{ color: '#888', fontSize: 12 }}>昨日 99.12% 环比 ↑0.23%</span>,
color: '#52c41a'
},
{
title: '告警数量',
value: 8,
extra: <span style={{ color: '#888', fontSize: 12 }}>未处理 5 / 已处理 3</span>,
color: '#ff4d4f'
},
{
title: '节省运维成本',
value: 36540,
prefix: '¥',
extra: <span style={{ color: '#888', fontSize: 12 }}>本月累计节省</span>,
color: '#faad14'
},
const realtimeAlerts = [
{ level: "INFO", type: "设备离线", time: "04-28 18:44" },
{ level: "严重", type: "逆变器温度过高", time: "04-28 18:44" }
];
// 发电趋势图数据
const powerTrendData = [
{ time: '00:00', actual: 0, forecast: 0 },
{ time: '06:00', actual: 200, forecast: 180 },
{ time: '09:00', actual: 800, forecast: 750 },
{ time: '12:00', actual: 1100, forecast: 1050 },
{ time: '15:00', actual: 900, forecast: 920 },
{ time: '18:00', actual: 300, forecast: 280 },
{ time: '24:00', actual: 0, forecast: 0 },
const deviceStatus = [
{ name: "汇流箱", count: "2/2", status: "异常 1" },
{ name: "逆变器", count: "3/3", status: "异常 1" },
{ name: "电表", count: "1/1", status: "正常" },
{ name: "巡检机器人", count: "1/1", status: "正常" }
];
// 辐照度与温度趋势数据
const irradianceData = [
{ time: '00:00', irradiance: 0, temp: 20 },
{ time: '06:00', irradiance: 200, temp: 22 },
{ time: '09:00', irradiance: 800, temp: 28 },
{ time: '12:00', irradiance: 1050, temp: 35 },
{ time: '15:00', irradiance: 750, temp: 32 },
{ time: '18:00', irradiance: 200, temp: 26 },
{ time: '24:00', irradiance: 0, temp: 21 },
const patrolRecords = [
{ name: "升压站安防巡检任务", device: "UAV-01", status: "草稿", time: "04-29T..." },
{ name: "B区清洗任务", device: "CLEAN-01", status: "待执行", time: "04-29T..." },
{ name: "A区巡检任务", device: "ROBOT-01", status: "已派发", time: "04-29T..." }
];
// 逆变器效率数据
const inverterData = [
{ name: 'INV-01', value: 98.2 },
{ name: 'INV-02', value: 97.6 },
{ name: 'INV-03', value: 98.9 },
{ name: 'INV-04', value: 97.1 },
{ name: 'INV-05', value: 98.0 },
const aiAnalysis = [
{ type: "AI分析", content: "AI发现逆变器温度与组串电流存在轻微异常,建议优先复核A区设备。" },
{ type: "严重", content: "INV-A02散热检修建议:建议检查INV-A02散热风扇、风道和运行负载,持续高温时转维修工单。" },
{ type: "严重", content: "A05阵列热斑处置建议:建议现场复核PV-A05-018至PV-A05-020组件接线和旁路二极管状态,必要时更换异常组件。" }
];
// 告警列表数据
const alertList = [
{ key: 1, content: 'INV-03 逆变直流电压异常', level: '严重', time: '10:24:15' },
{ key: 2, content: '组串 String-07 绝缘电阻低', level: '重要', time: '10:18:42' },
{ key: 3, content: '汇流箱 Combiner-12 过温', level: '重要', time: '10:12:33' },
{ key: 4, content: '气象站辐照度传感器离线', level: '次要', time: '09:58:11' },
{ key: 5, content: '组件温度异常偏高', level: '次要', time: '09:41:28' },
];
// 图表配置
const powerTrendConfig = {
data: [
{ time: "00:00", actual: 2000, predict: 1800 },
{ time: "08:00", actual: 35000, predict: 33000 },
{ time: "16:00", actual: 55000, predict: 53000 },
{ time: "24:00", actual: 2000, predict: 1800 }
],
xField: 'time',
yField: ['actual', 'predict'],
color: ['#1890ff', '#52c41a'],
areaStyle: { fillOpacity: 0.15 },
legend: { position: 'top-left' }
};
// 巡检记录数据
const patrolData = [
{ key: 1, type: '日常巡检', time: '2025-05-23 09:30', person: '张运维', status: '已完成' },
{ key: 2, type: '无人机巡检', time: '2025-05-22 14:15', person: '无人机01号', status: '已完成' },
{ key: 3, type: '夜间巡检', time: '2025-05-21 20:45', person: '李班长', status: '已完成' },
{ key: 4, type: '专项巡检', time: '2025-05-20 10:20', person: '王技术员', status: '已完成' },
{ key: 5, type: '日常巡检', time: '2025-05-19 09:25', person: '张运维', status: '已完成' },
];
const irradianceConfig = {
data: [
{ time: "00:00", irradiance: 50, temperature: 15 },
{ time: "08:00", irradiance: 400, temperature: 20 },
{ time: "16:00", irradiance: 800, temperature: 30 },
{ time: "24:00", irradiance: 50, temperature: 15 }
],
xField: 'time',
yField: ['irradiance', 'temperature'],
color: ['#1890ff', '#52c41a'],
areaStyle: { fillOpacity: 0.15 },
legend: { position: 'top-left' }
};
const invEfficiencyConfig = {
data: [
{ device: 'INV-01', efficiency: 98 },
{ device: 'INV-03', efficiency: 97 },
{ device: 'INV-05', efficiency: 96 },
{ device: 'INV-07', efficiency: 95 },
{ device: 'INV-09', efficiency: 94 }
],
xField: 'device',
yField: 'efficiency',
color: '#1890ff',
label: { position: 'top' }
};
const taskProgressConfig = {
data: [
{ type: '已完成', value: 40 },
{ type: '进行中', value: 35 },
{ type: '待开始', value: 20 },
{ type: '异常', value: 5 }
],
angleField: 'value',
colorField: 'type',
color: ['#1890ff', '#52c41a', '#faad14', '#ff4d4f'],
radius: 0.8,
innerRadius: 0.6,
legend: { position: 'right' }
};
const cardStyle = { borderRadius: 8, };
return (
<div style={{ padding: '16px', background: '#f4f7f9', minHeight: '100%' }}>
{/* 顶部统计卡片 */}
<Row gutter={[16, 16]} style={{ marginBottom: 16 }}>
{topStats.map((stat, idx) => (
<Col xs={24} sm={12} md={8} lg={4} key={idx}>
<AntdCard
size="small"
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
<div style={{ background: '#f0f2f5', minHeight: '100vh', width: '100%', boxSizing: 'border-box', overflow: "hidden" }}>
{/* 顶部一排6个卡片 —— 等宽、不换行、自适应 */}
<Row
gutter={[16, 16]}
style={{
marginBottom: 16,
width: '100%',
margin: '0 0 16px 0',
flexWrap: 'nowrap',
overflow: 'hidden'
}}
>
<Col flex="1 1 16.666%">
<Card bordered={false} style={cardStyle}>
<Statistic title={<span style={{ color: '#000', fontSize: 14, fontWeight: 600 }}>今日发电量</span>}
value={stationOverview.todayEnergy} precision={1} valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 800 }} prefix={<CloudOutlined style={{ fontSize: 20 }} />} suffix="kWh" />
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>日发电实时累计</div>
</Card>
</Col>
<Col flex="1 1 16.666%">
<Card bordered={false} style={cardStyle}>
<Statistic title={<span style={{ color: '#000', fontSize: 14, fontWeight: 600 }}>当前功率</span>}
value={stationOverview.currentPower} precision={1} valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 800 }} prefix={<ThunderboltOutlined style={{ fontSize: 20 }} />} suffix="kW" />
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>装机容量 100.0 MWp</div>
</Card>
</Col>
<Col flex="1 1 16.666%">
<Card bordered={false} style={cardStyle}>
<Statistic title={<span style={{ color: '#000', fontSize: 14, fontWeight: 600 }}>系统效率 PR</span>}
value={stationOverview.systemEfficiency} precision={1} valueStyle={{ color: '#52c41a', fontSize: 24, fontWeight: 800 }} prefix={<BarChartOutlined style={{ fontSize: 20 }} />} suffix="%" />
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>昨日 {stationOverview.yesterdayEfficiency}% +1.3%</div>
</Card>
</Col>
<Col flex="1 1 16.666%">
<Card bordered={false} style={cardStyle}>
<Statistic title={<span style={{ color: '#000', fontSize: 14, fontWeight: 600 }}>系统可用率</span>}
value={stationOverview.systemAvailability} precision={2} valueStyle={{ color: '#faad14', fontSize: 24, fontWeight: 800 }} prefix={<RiseOutlined style={{ fontSize: 20 }} />} suffix="%" />
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>在线设备 {stationOverview.onlineDevices}</div>
</Card>
</Col>
<Col flex="1 1 16.666%">
<Card bordered={false} style={cardStyle}>
<Statistic title={<span style={{ color: '#000', fontSize: 14, fontWeight: 600 }}>告警数量</span>}
value={stationOverview.alarmCount} valueStyle={{ color: '#ff4d4f', fontSize: 24, fontWeight: 800 }} prefix={<BellOutlined style={{ fontSize: 20 }} />} suffix="条" />
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>今日新增 0 条</div>
</Card>
</Col>
<Col flex="1 1 16.666%">
<Card bordered={false} style={cardStyle}>
<Statistic title={<span style={{ color: '#000', fontSize: 14, fontWeight: 600 }}>节省运维成本</span>}
value={stationOverview.costSaved} valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 800 }} prefix="¥" />
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>清洗收益 + 工单闭环估算</div>
</Card>
</Col>
</Row>
{/* 主体:左侧图表 + 中间电站 + 右侧告警 —— 强制一行不换行 */}
<Row
gutter={[16, 16]}
style={{
width: '100%',
margin: 0,
flexWrap: 'nowrap',
height: 'calc(100vh - 167px)',
}}
>
{/* 左侧图表列 - 最终完美版:不溢出 + 一定可见 */}
<Col xs={24} lg={6} style={{ flex: '0 0 25%', padding: '0 8px', display: 'flex', flexDirection: 'column', height: '100%', gap: "8px", overflowX: 'hidden', overflowY: 'auto', scrollbarWidth: 'thin', scrollbarColor: '#ccc transparent' }}>
<Card
title="发电趋势"
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
>
<Line
{...powerTrendConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
</Card>
<Card
title="辐照度与温度"
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
>
<Line
{...irradianceConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
</Card>
<Card
title="逆变器效率"
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
>
<Bar
{...invEfficiencyConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
</Card>
<Card
title="运维任务进度"
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
>
<Pie
{...taskProgressConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
</Card>
</Col>
<Col style={{ flex: '1 1 auto', }}>
<Row gutter={16} style={{ marginBottom: 8, height: '75%' }}>
<Col style={{ flex: '0 0 auto', width: '75%', height: "100%" }}>
<Card
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<div style={{ fontWeight: 500 }}>电站概览</div>
<div style={{ fontSize: 12, color: '#999' }}>GeoTIFF 正射底图 · 设备点位叠加</div>
</div>
</div>
}
bordered={false}
style={{ ...cardStyle, height: '100%', padding: '12px' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 12 }}>
<div style={{ display: 'flex', gap: 12, fontSize: 12 }}>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#52c41a', marginRight: 4 }}></span>正常</span>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#ff4d4f', marginRight: 4 }}></span>告警</span>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#888', marginRight: 4 }}></span>离线</span>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#faad14', marginRight: 4 }}></span>维护中</span>
</div>
<Space size="small">
<Button size="small">适应</Button>
<Button size="small" icon={<MinusOutlined />} />
<Button size="small" icon={<PlusOutlined />} />
<Button size="small" icon={<SyncOutlined />}>重置</Button>
<span style={{ fontSize: 12 }}>65%</span>
</Space>
</div>
<div style={{ height: 360, background: '#111827', borderRadius: 8, width: '100%' }} />
</Card>
</Col>
{/* 右侧:实时告警 */}
<Col
xs={24}
lg={6}
style={{
flex: '0 0 25%',
height: "100%",
overflow: 'auto',
scrollbarWidth: 'thin',
scrollbarColor: '#ccc transparent',
display: 'flex',
flexDirection: 'column',
gap: '12px' // 缩小卡片间距
}}
>
<Statistic
title={<span style={{ fontSize: 13, color: '#666' }}>{stat.title}</span>}
value={stat.value}
precision={stat.value % 1 !== 0 ? 1 : 0}
valueStyle={{ color: '#1f2329', fontWeight: 600, fontSize: 20 }}
prefix={stat.prefix}
suffix={stat.suffix}
/>
<div style={{ marginTop: 4, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
{stat.extra}
{stat.percent && <Progress percent={stat.percent} size="small" style={{ width: 60 }} />}
</div>
</AntdCard>
</Col>
))}
</Row>
<Row gutter={[16, 16]}>
{/* 左侧图表区域 */}
<Col xs={24} lg={6}>
{/* 发电趋势 */}
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>今日发电功率趋势</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', marginBottom: 16 }}
extra={<Space size="small"><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#52c41a' }}>■</span> 实际功率</span><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#1890ff' }}>■</span> 预测功率</span></Space>}
>
<Line
data={powerTrendData}
xField="time"
yField="actual"
smooth
color="#52c41a"
style={{ height: 120 }}
yAxis={{ min: 0, max: 1250 }}
/>
</AntdCard>
{/* 辐照度与温度趋势 */}
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>辐照度与温度趋势</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', marginBottom: 16 }}
extra={<Space size="small"><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#fa8c16' }}>■</span> 辐照度(W/m²)</span><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#1890ff' }}>■</span> 环境温度(℃)</span></Space>}
>
<Line
data={irradianceData}
xField="time"
yField="irradiance"
smooth
color="#fa8c16"
style={{ height: 120 }}
yAxis={{ min: 0, max: 1250 }}
/>
</AntdCard>
{/* 逆变器效率对比 */}
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>逆变器效率对比</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
>
<Column
data={inverterData}
xField="name"
yField="value"
color="#1890ff"
style={{ height: 120 }}
yAxis={{ min: 60, max: 100 }}
/>
</AntdCard>
</Col>
{/* 中间:电站概览 */}
<Col xs={24} lg={12}>
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>电站概览</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', height: '100%' }}
extra={<Space size="small"><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#52c41a' }}>●</span> 正常</span><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#ff4d4f' }}>●</span> 告警</span><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#888' }}>●</span> 离线</span><span style={{ fontSize: 11, color: '#888' }}><span style={{ color: '#faad14' }}>●</span> 维护中</span></Space>}
>
{/* 这里替换成你的电站3D图 */}
<div style={{ width: '100%', height: 400, background: '#e6f7ff', borderRadius: 4, display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#888' }}>
电站3D概览图(可替换为你的图片/地图组件)
</div>
</AntdCard>
</Col>
{/* 右侧信息面板 */}
<Col xs={24} lg={6}>
{/* 实时告警 */}
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>实时告警</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', marginBottom: 16 }}
extra={<Button type="link" size="small">更多&gt;</Button>}
>
<List
size="small"
dataSource={alertList}
renderItem={(item) => (
<List.Item style={{ padding: '8px 0', borderBottom: '1px solid #f0f0f0' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
<div>
<span style={{ fontSize: 12 }}>{item.content}</span>
{/* 实时告警 */}
<Card
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontWeight: 600, fontSize: 14 }}>实时告警</span> {/* 缩小标题 */}
<Button type="link" style={{ padding: 0, fontSize: 12 }}>更多</Button>
</div>
}
bordered={false}
style={{
borderRadius: 8,
boxShadow: '0 1px 2px rgba(0,0,0,0.05)',
padding: '4px 8px'
}}
bodyStyle={{ padding: 4 }}
>
{realtimeAlerts.map((alert, idx) => (
<div
key={idx}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: idx === realtimeAlerts.length - 1 ? 0 : 8, // 缩小行间距
fontSize: 12
}}
>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Tag
color={alert.level === 'INFO' ? 'success' : 'error'}
style={{
borderRadius: 12,
padding: '0 6px',
marginRight: 8,
display: 'flex',
alignItems: 'center',
gap: 4,
fontSize: 10
}}
>
<span style={{ width: 6, height: 6, borderRadius: '50%', background: '#fff' }}></span>
{alert.level}
</Tag>
<span style={{ fontSize: 12 }}>{alert.type}</span> {/* 缩小 */}
</div>
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<Tag color={item.level === '严重' ? 'error' : item.level === '重要' ? 'warning' : 'default'} size="small" style={{ fontSize: 10 }}>{item.level}</Tag>
<span style={{ fontSize: 11, color: '#888' }}>{item.time}</span>
<span style={{ color: '#666', fontSize: 12 }}>{alert.time}</span>
</div>
))}
</Card>
{/* 设备在线状态 */}
<Card
title={<span style={{ fontWeight: 600, fontSize: 14 }}>设备在线状态</span>}
bordered={false}
style={{
borderRadius: 8,
boxShadow: '0 1px 2px rgba(0,0,0,0.05)',
padding: '4px 8px'
}}
bodyStyle={{ padding: 4 }}
>
<Row gutter={[8, 8]}>
{deviceStatus.map((item, idx) => (
<Col span={12} key={idx}>
<div
style={{
padding: '8px 4px',
background: '#f5f7fa',
borderRadius: 6,
border: '1px solid #e8e8e8'
}}
>
<div style={{ fontSize: 14, color: '#333', marginBottom: 2 }}>
<span style={{ color: item.status === '正常' ? '#52c41a' : '#faad14' }}>{item.count}</span>
</div>
<div style={{ fontSize: 12, color: '#333', marginBottom: 2 }}>{item.name}</div>
<div style={{ fontSize: 10, color: item.status === '正常' ? '#52c41a' : '#faad14' }}>{item.status}</div>
</div>
</Col>
))}
</Row>
</Card>
{/* 天气信息 */}
<Card
title={<span style={{ fontWeight: 600, fontSize: 14 }}>天气信息</span>}
bordered={false}
style={{
borderRadius: 8,
boxShadow: '0 1px 2px rgba(0,0,0,0.05)',
padding: '4px 8px'
}}
bodyStyle={{ padding: 4 }}
>
<div style={{ display: 'flex', alignItems: 'center' }}>
<CloudOutlined style={{ fontSize: 32, color: '#1890ff', marginRight: 12 }} />
<div style={{ display: 'flex', flexDirection: 'row', gap: 12, alignItems: 'center' }}>
<div>
<div style={{ fontSize: 24, fontWeight: 600, color: '#1890ff' }}>22℃</div>
<div style={{ fontSize: 14, color: '#666', marginBottom: 2 }}>阴天</div>
</div>
<div>
<div style={{ fontSize: 11, color: '#999' }}>辐照度 89 W/m²</div>
<div style={{ fontSize: 11, color: '#999' }}>风速 4.1 m/s</div>
<div style={{ fontSize: 11, color: '#999' }}>中卫市</div>
</div>
</div>
</div>
</Card>
{/* 清洗建议 */}
<Card
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontWeight: 600, fontSize: 14 }}>清洗建议</span>
<Button type="link" style={{ padding: 0, fontSize: 12 }}>详情</Button>
</div>
}
bordered={false}
style={{
borderRadius: 8,
boxShadow: '0 1px 2px rgba(0,0,0,0.05)',
padding: '4px 8px'
}}
bodyStyle={{ padding: 4 }}
>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ position: 'relative', width: 80, height: 80, marginRight: 12 }}>
<Pie
data={[{ type: '污染指数', value: 46 }]}
angleField="value"
colorField="type"
color={['#52c41a']}
radius={0.8}
innerRadius={0.7}
height={80}
autoFit={true}
/>
<div style={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', textAlign: 'center' }}>
<div style={{ fontSize: 24, fontWeight: 600, color: '#1890ff' }}>46</div>
<div style={{ fontSize: 12, color: '#666' }}>分</div>
</div>
</div>
</List.Item>
)}
/>
</AntdCard>
{/* 设备在线状态 */}
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>设备在线状态</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', marginBottom: 16 }}
extra={<Button type="link" size="small">更多&gt;</Button>}
>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 8 }}>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>组件阵列</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>320/320</span></div>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>逆变器</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>5/5</span></div>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>汇流箱</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>20/20</span></div>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>气象站</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>1/1</span></div>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>摄像头</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>12/12</span></div>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>环境传感器</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>8/8</span></div>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>无人机</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>1/1</span></div>
<div style={{ textAlign: 'center' }}><span style={{ fontSize: 11 }}>巡检机器人</span><br /><span style={{ fontSize: 12, color: '#52c41a' }}>1/1</span></div>
</div>
</AntdCard>
{/* 天气信息 */}
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>天气信息</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', marginBottom: 16 }}
extra={<Button type="link" size="small">详细&gt;</Button>}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
<span style={{ fontSize: 32 }}>☀️</span>
<div>
<div style={{ fontSize: 24, fontWeight: 600 }}>28℃</div>
<div style={{ fontSize: 12, color: '#888' }}>晴</div>
</div>
<div style={{ fontSize: 11, color: '#888', marginLeft: 16 }}>
<div>辐照度: 815 W/m²</div>
<div>组件温度: 45.6℃</div>
<div>环境温度: 28.3℃</div>
<div>风速: 2.6 m/s</div>
<div>风向: 东南风</div>
<div>湿度: 56%</div>
</div>
</div>
</AntdCard>
{/* 清洗建议 */}
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>清洗建议</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
extra={<Button type="link" size="small">更多&gt;</Button>}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
<Progress percent={85} type="circle" size={60} strokeColor="#52c41a" />
<div>
<div style={{ fontSize: 12 }}>建议清洗时间: 3 天内</div>
<div style={{ fontSize: 12 }}>预计提升发电量: 2.6%</div>
<div style={{ fontSize: 12 }}>预计提升电量: 120 kWh/天</div>
<Button type="primary" size="small" style={{ marginTop: 8 }}>生成清洗工单</Button>
</div>
</div>
</AntdCard>
</Col>
</Row>
{/* 底部:运维任务/巡检记录/AI分析 */}
<Row gutter={[16, 16]} style={{ marginTop: 16 }}>
<Col xs={24} lg={6}>
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>运维任务进度</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
extra={<Button type="link" size="small">更多&gt;</Button>}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
<Progress percent={58} type="circle" size={80} strokeColor="#52c41a" success={{ percent: 25 }} // ✅ 新写法
/>
<div style={{ fontSize: 12 }}>
<div><span style={{ color: '#52c41a' }}>●</span> 已完成 7 (58%)</div>
<div><span style={{ color: '#faad14' }}>●</span> 进行中 3 (25%)</div>
<div><span style={{ color: '#1890ff' }}>●</span> 待开始 2 (17%)</div>
<div><span style={{ color: '#ff4d4f' }}>●</span> 已延期 0 (0%)</div>
</div>
</div>
</AntdCard>
</Col>
<Col xs={24} lg={12}>
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>近期巡检记录</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
extra={<Button type="link" size="small">更多&gt;</Button>}
>
<Table
size="small"
dataSource={patrolData}
pagination={false}
columns={[
{ title: '巡检类型', dataIndex: 'type', key: 'type', width: 80 },
{ title: '巡检时间', dataIndex: 'time', key: 'time', width: 120 },
{ title: '巡检人员', dataIndex: 'person', key: 'person', width: 100 },
{ title: '状态', dataIndex: 'status', key: 'status', render: (status) => <Tag color="success" size="small">{status}</Tag> },
]}
/>
</AntdCard>
</Col>
<Col xs={24} lg={6}>
<AntdCard
size="small"
title={<span style={{ fontSize: 13 }}>AI分析摘要</span>}
variant={false}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
>
<List
size="small"
dataSource={[
{ title: '热点检测', desc: '发现 2 处组件存在异常热斑', link: '查看详情' },
{ title: '组串异常', desc: '3 个组串存在发电异常', link: '查看详情' },
{ title: '发电偏差分析', desc: '整体发电偏差 -2.8%', link: '查看详情' },
]}
renderItem={(item) => (
<List.Item style={{ padding: '8px 0', borderBottom: '1px solid #f0f0f0' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
<div>
<div style={{ fontSize: 12, fontWeight: 500 }}>{item.title}</div>
<div style={{ fontSize: 11, color: '#888' }}>{item.desc}</div>
</div>
<Button type="link" size="small">{item.link}</Button>
<div>
<div style={{ fontSize: 12, color: '#333', marginBottom: 4 }}>污染指数中等,建议3天内安排B区清洗。</div>
<div style={{ fontSize: 11, color: '#999' }}>预计收益 ¥ 8,278</div>
</div>
</List.Item>
)}
/>
</AntdCard>
</div>
</Card>
</Col>
</Row>
<Row gutter={16} style={{ height: '25%' }} >
<Col xs={12} style={{ height: '100%' }}>
<Card title="近期巡检记录" bordered={false} style={{ ...cardStyle, height: '100%' }} bodyStyle={{ padding: 12, height: '66%', overflow: 'auto', scrollbarWidth: 'thin', scrollbarColor: '#ccc transparent' }}>
{patrolRecords.map((item, idx) => (
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<div>
<div style={{ fontSize: 13 }}>{item.name}</div>
<div style={{ fontSize: 12, color: '#999' }}>{item.device}</div>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Tag size="small">{item.status}</Tag>
</div>
</div>
))}
</Card>
</Col>
<Col xs={12} style={{ height: '100%', }}>
<Card title="AI分析摘要" bordered={false} style={{ ...cardStyle, height: '100%' }} bodyStyle={{ padding: 12, height: '66%', overflow: 'auto', scrollbarWidth: 'thin', scrollbarColor: '#ccc transparent' }}>
{aiAnalysis.map((item, idx) => (
<div key={idx} style={{ display: 'flex', marginBottom: 10 }}>
<Tag color={item.type === 'AI分析' ? 'blue' : 'red'} style={{ marginRight: 8 }}>{item.type}</Tag>
<span style={{ fontSize: 12 }}>{item.content}</span>
</div>
))}
</Card>
</Col>
</Row>
</Col>
</Row>
</div>
</Row >
</div >
);
}