自适应

This commit is contained in:
mmc
2026-05-14 10:47:56 +08:00
parent 4ac279139b
commit c34c09a3cc
5 changed files with 587 additions and 745 deletions

View File

@@ -346,96 +346,92 @@ export default function AlarmCenterPage() {
</Row>
{/* 统计卡片 */}
<Row gutter={[16, 16]} style={{ marginBottom: 16 }}>
<Col xs={24} sm={12} md={8} lg={6} xl={4.8} style={{ flex: '1 0 200px' }}>
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, height: '100%' }}>
<Row align="middle" gutter={16} style={{ height: '100%' }}>
<Col>
<div style={{ width: 48, height: 48, background: '#FFF1F0', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<BellOutlined style={{ fontSize: 24, color: '#FF4D4F' }} />
</div>
</Col>
<Col style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ fontSize: 14, color: '#4E5969' }}>告警总数</div>
<div style={{ fontSize: 28, fontWeight: 700, color: '#FF4D4F', lineHeight: '36px' }}>
{statData.total || 0}
</div>
</Col>
</Row>
</Card>
</Col>
<Col xs={24} sm={12} md={8} lg={6} xl={4.8} style={{ flex: '1 0 200px' }}>
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, height: '100%' }}>
<Row align="middle" gutter={16} style={{ height: '100%' }}>
<Col>
<div style={{ width: 48, height: 48, background: '#FFF1F0', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<ExclamationCircleOutlined style={{ fontSize: 24, color: '#FF4D4F' }} />
</div>
</Col>
<Col style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ fontSize: 14, color: '#4E5969' }}>严重告警</div>
<div style={{ fontSize: 28, fontWeight: 700, color: '#FF4D4F', lineHeight: '36px' }}>
{statData.levelStats?.[1] || 0}
</div>
</Col>
</Row>
</Card>
</Col>
<Col xs={24} sm={12} md={8} lg={6} xl={4.8} style={{ flex: '1 0 200px' }}>
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, height: '100%' }}>
<Row align="middle" gutter={16} style={{ height: '100%' }}>
<Col>
<div style={{ width: 48, height: 48, background: '#FFF7E8', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<ClockCircleOutlined style={{ fontSize: 24, color: '#FA8C16' }} />
</div>
</Col>
<Col style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ fontSize: 14, color: '#4E5969' }}>待处理</div>
<div style={{ fontSize: 28, fontWeight: 700, color: '#FA8C16', lineHeight: '36px' }}>
{statData.pending || 0}
</div>
</Col>
</Row>
</Card>
</Col>
<Col xs={24} sm={12} md={8} lg={6} xl={4.8} style={{ flex: '1 0 200px' }}>
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, height: '100%' }}>
<Row align="middle" gutter={16} style={{ height: '100%' }}>
<Col>
<div style={{ width: 48, height: 48, background: '#E8F3FF', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<ReloadOutlined style={{ fontSize: 24, color: '#1890FF' }} />
</div>
</Col>
<Col style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ fontSize: 14, color: '#4E5969' }}>处理中</div>
<div style={{ fontSize: 28, fontWeight: 700, color: '#1890FF', lineHeight: '36px' }}>
{statData.processing || 0}
</div>
</Col>
</Row>
</Card>
</Col>
<Col xs={24} sm={12} md={8} lg={6} xl={4.8} style={{ flex: '1 0 200px' }}>
<Card bordered={false} bodyStyle={{ padding: '16px 20px' }} style={{ borderRadius: 8, height: '100%' }}>
<Row align="middle" gutter={16} style={{ height: '100%' }}>
<Col>
<div style={{ width: 48, height: 48, background: '#E8FFEA', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<CheckCircleOutlined style={{ fontSize: 24, color: '#00B42A' }} />
</div>
</Col>
<Col style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ fontSize: 14, color: '#4E5969' }}>已关闭</div>
<div style={{ fontSize: 28, fontWeight: 700, color: '#00B42A', lineHeight: '36px' }}>
{statData.closed || 0}
</div>
</Col>
</Row>
</Card>
</Col>
<Row gutter={[16, 16]} style={{ marginBottom: 16, flexWrap: 'wrap' }}>
{[
{
title: '今日告警总数',
value: statData.total || 0,
unit: '',
trend: '较昨日 +28.6% ↑',
trendColor: '#FF4D4F',
subText: `昨日 ${statData.yesterdayTotal || 0}`,
icon: <BellOutlined />,
color: '#FF4D4F',
bg: '#FFF1F0'
},
{
title: '严重告警',
value: statData.levelStats?.[1] || 0,
unit: '',
trend: '较昨日 +33.3% ↑',
trendColor: '#FF4D4F',
subText: `昨日 ${statData.yesterdayCritical || 0}`,
icon: <ExclamationCircleOutlined />,
color: '#FF4D4F',
bg: '#FFF1F0'
},
{
title: '处理中',
value: statData.processing || 0,
unit: '',
trend: '较昨日 +20.0% ↑',
trendColor: '#FF4D4F',
subText: `昨日 ${statData.yesterdayProcessing || 0}`,
icon: <ClockCircleOutlined />,
color: '#FA8C16',
bg: '#FFF7E8'
},
{
title: '已关闭',
value: statData.closed || 0,
unit: '',
trend: '较昨日 +45.5% ↑',
trendColor: '#00B42A',
subText: `昨日 ${statData.yesterdayClosed || 0}`,
icon: <CheckCircleOutlined />,
color: '#00B42A',
bg: '#E8FFEA'
},
].map((item, idx) => (
<Col key={idx} style={{ minWidth: '200px', flex: '1 0 auto' }}>
<Card
bordered={false}
bodyStyle={{ padding: '16px 20px' }}
style={{ borderRadius: 8, height: 120 }}
>
<Row align="middle" gutter={16} style={{ height: '100%' }}>
<Col>
<div style={{
width: 48,
height: 48,
background: item.bg,
borderRadius: '50%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}}>
{React.cloneElement(item.icon, { style: { fontSize: 24, color: item.color } })}
</div>
</Col>
<Col style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ fontSize: 14, color: '#4E5969', marginBottom: 4 }}>{item.title}</div>
<div style={{ fontSize: 28, fontWeight: 700, color: item.color, lineHeight: '36px' }}>
{item.value}
</div>
<div style={{ fontSize: 12, marginTop: 4 }}>
<span style={{ color: '#86909C' }}>{item.trend.split(' ')[0]}</span>
<span style={{ color: item.trendColor, fontWeight: 600, marginLeft: 4 }}>
{item.trend.split(' ').slice(1).join(' ')}
</span>
</div>
<div style={{ fontSize: 12, color: '#86909C', marginTop: 2 }}>
{item.subText}
</div>
</Col>
</Row>
</Card>
</Col>
))}
</Row>
{/* 表格 */}

View File

@@ -133,9 +133,13 @@ export default function AIDiagnosisPage() {
};
return (
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px 24px' }}>
{/* 顶部指标卡片 */}
{/* 优化版:宽高统一 + 最小168px + 自动换行 + 样式统一 */}
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '0px 24px' }}>
<div style={{ display: 'flex', paddingBottom: "12px" }}>
<div style={{ padding: '20px 0px 0' }}>
<Typography.Title level={4} style={{ margin: 0 }}>AI诊断分析</Typography.Title>
</div>
</div>
<Row
gutter={[12, 12]}
style={{
@@ -335,7 +339,8 @@ export default function AIDiagnosisPage() {
>
<div style={{ display: 'flex', gap: 16, flex: 1 }}>
<div style={{ flex: 1 }}>
<Line {...generationPerformanceConfig} height={220} />
<Line {...generationPerformanceConfig} height={220} autoFit={true}
/>
</div>
<div style={{ width: 100, fontSize: 12, display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 12 }}>
<div>

View File

@@ -68,21 +68,27 @@ export default function AlarmCenterPage() {
};
return (
<Layout style={{ minHeight: '100vh', background: '#fff', overflow: 'hidden' }}>
<Layout style={{ minHeight: '100vh', overflow: 'hidden' }}>
<div style={{ display: 'flex', paddingBottom: "12px" }}>
<div style={{ padding: '20px 24px 0' }}>
<Typography.Title level={4} style={{ margin: 0 }}>告警中心</Typography.Title>
<Text type="secondary">告警处置闭环、规则管理与事件中心</Text>
</div>
<Header style={{ background: '#fff', padding: 0, borderBottom: '1px solid #f0f0f0', position: 'sticky', top: 0, zIndex: 10 }}>
<Menu
<Header style={{ padding: 0, borderBottom: '1px solid #f0f0f0', position: 'sticky', top: 0, zIndex: 10 }}>
{/*<Menu
mode="horizontal"
selectedKeys={[activeTab]}
onClick={({ key }) => setActiveTab(key)}
items={showTabs}
style={{ border: 0, height: 64, lineHeight: '64px' }}
/>
style={{
border: 'none',
height: 64,
lineHeight: '64px',
background: 'transparent !important',
backgroundColor: 'transparent !important',
}}
/>*/}
</Header>
</div>

View File

@@ -5,11 +5,19 @@ import {
RiseOutlined, BellOutlined, WalletOutlined,
MinusOutlined, PlusOutlined, SyncOutlined,
MoneyCollectOutlined,
DashboardOutlined
DashboardOutlined,
FullscreenOutlined,
RocketOutlined,
VideoCameraOutlined,
AppstoreOutlined,
ExperimentOutlined,
BranchesOutlined,
RobotOutlined
} from '@ant-design/icons';
import { Line, Bar, Pie } from '@ant-design/charts';
import { Line, Bar, Pie, } from '@ant-design/charts';
import { getWeatherData, getWeatherType } from '../lib/utils';
import WeatherDisplay from '../components/Weather';
import bgMain from '../assets/images/bgmain.jpg';
@@ -257,11 +265,27 @@ export default function StationDashboard() {
legend: { position: 'right' }
};
const cardStyle = { borderRadius: 8, };
const cardStyle = { borderRadius: 12, border: '1px solid #f0f0f0', boxShadow: '0 2px 8px rgba(0,0,0,0.04)' };
// 顶部卡片微型图表配置
const tinyAreaConfig = {
height: 40,
autoFit: true,
data: [264, 417, 438, 887, 309, 397, 550, 575, 563, 430, 525, 592, 492, 467, 513, 546, 983, 340, 539, 243, 226, 192],
smooth: true,
areaStyle: { fill: 'l(270) 0:#ffffff 0.5:#165DFF 1:#165DFF', fillOpacity: 0.1 },
line: { color: '#165DFF' },
};
const tinyColumnConfig = {
height: 40,
autoFit: true,
data: [274, 337, 81, 497, 666, 219, 269],
color: '#00B42A',
};
return (
<div style={{ background: '#f0f2f5', paddingTop: "12px", minHeight: '100vh', width: '100%', boxSizing: 'border-box', overflow: "auto" }}>
{/* 顶部统计卡片 */}
<div style={{ background: '#f8fafc', padding: '16px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
<Row gutter={[16, 16]} style={{ margin: '0 16px 16px 16px' }}>
{[
{ title: '今日发电量', value: '4,752', unit: 'kWh', sub: '日目标 5,000 kWh', color: '#00B42A', bg: '#E8FFEA', icon: <ThunderboltOutlined /> },
@@ -294,357 +318,216 @@ export default function StationDashboard() {
</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: '12px',
overflowX: 'hidden',
overflowY: 'auto',
scrollbarWidth: 'thin',
}}
>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>发电趋势</span>}
bordered={false}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Line {...powerTrendConfig} height={140} autoFit />
</Card>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>辐照度与温度</span>}
bordered={false}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Line {...irradianceConfig} height={140} autoFit />
</Card>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>逆变器效率</span>}
bordered={false}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Bar {...invEfficiencyConfig} height={140} autoFit />
</Card>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>运维任务进度</span>}
bordered={false}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Pie {...taskProgressConfig} height={140} autoFit />
</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: 800, color: '#0837A8' }}>电站概览</div>
<div style={{ fontSize: 12, color: '#999' }}>GeoTIFF 正射底图 · 设备点位叠加</div>
</div>
{/* 主体布局 */}
<Row gutter={[16, 16]}>
{/* 左侧:图表列 */}
<Col xs={24} xl={6}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card title={<span style={{ fontWeight: 800 }}>发电趋势</span>} extra={<Space><SyncOutlined /><FullscreenOutlined /></Space>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ fontSize: 12, color: '#666', marginBottom: 12 }}>今日发电功率趋势 (kW)</div>
<Line {...powerTrendConfig} height={180} />
</Card>
<Card title={<span style={{ fontWeight: 800 }}>辐照度与温度趋势</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Line {...irradianceConfig} height={180} />
</Card>
<Card title={<span style={{ fontWeight: 800 }}>逆变器效率对比</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Bar {...invEfficiencyConfig} height={180} />
</Card>
<Card title={<span style={{ fontWeight: 800 }}>运维任务进度</span>} extra={<Button type="link" size="small">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Pie {...taskProgressConfig} height={160} width={160} />
<div style={{ flex: 1, paddingLeft: 12 }}>
<div style={{ textAlign: 'center' }}>
<div style={{ fontSize: 12, color: '#999' }}>总任务</div>
<div style={{ fontSize: 20, fontWeight: 800 }}>12</div>
</div>
}
bordered={false}
style={{ ...cardStyle, height: '100%', padding: '12px' }}
bodyStyle={{ height: "86%" }}
</div>
</div>
</Card>
</Space>
</Col>
>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 12 }}>
<div style={{ display: 'flex', gap: 12, fontSize: 12 }}>
{/* 中间:底图与状态 */}
<Col xs={24} xl={12}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontWeight: 800 }}>电站概览</span>
<div style={{ display: 'flex', gap: 16, 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: "100%", background: '#111827', borderRadius: 8, width: '100%', overflow: 'hidden', position: "relative" }}>
<iframe
src="https://pvs.satabot.com/?platform=web"
style={{
width: '100%',
height: '100%',
border: 'none',
borderRadius: '8px',
position: "absolute",
}}
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
title="外部系统"
/>
</div> </Card>
</Col>
{/* 右侧:实时告警 */}
<Col
xs={24}
lg={6}
style={{
flex: '1 0 25%',
height: "100%",
overflow: 'auto',
scrollbarWidth: 'thin',
scrollbarColor: '#ccc transparent',
display: 'flex',
flexDirection: 'column',
gap: '12px' // 缩小卡片间距
}}
}
bordered={false}
style={cardStyle}
bodyStyle={{ padding: 0, position: 'relative', overflow: 'hidden', height: 500 }}
>
{/* 实时告警 */}
<Card
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontWeight: 800, fontSize: 14, color: '#0837A8' }}>实时告警</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',
flex: 1,
}}
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>
<span style={{ color: '#666', fontSize: 12 }}>{alert.time}</span>
</div>
))}
</Card>
{/* 设备在线状态 */}
<Card
title={<span style={{ fontWeight: 800, fontSize: 14, color: '#0837A8' }}>设备在线状态</span>}
bordered={false}
style={{
borderRadius: 8,
boxShadow: '0 1px 2px rgba(0,0,0,0.05)',
padding: '4px 8px',
flex: 1,
}}
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: 800, fontSize: 14, color: '#0837A8' }}>天气信息</span>}
bordered={false}
style={{
borderRadius: 8,
boxShadow: '0 1px 2px rgba(0,0,0,0.05)',
padding: '8px',
flex: 1,
}}
bodyStyle={{ padding: 8 }}
>
<div
<div style={{ height: "100%", background: '#111827', borderRadius: 8, width: '100%', overflow: 'hidden', position: "relative" }}>
<iframe
src="https://pvs.satabot.com/?platform=web"
style={{
display: 'flex',
alignItems: 'center',
gap: 24,
height: '100%'
width: '100%',
height: '100%',
border: 'none',
borderRadius: '8px',
position: "absolute",
}}
>
{/* 左侧:动态天气图标 */}
<div
style={{
width: 60,
height: 60,
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}
>
<WeatherDisplay type={weatherType} />
</div>
{/* 右侧:天气信息 */}
<div style={{ flex: 1, flexDirection: "row" }}>
<div style={{ fontSize: 28, fontWeight: 800, color: '#1890ff' }}>
{weatherdata.temperature}℃
</div>
<div>
<div style={{ fontSize: 14, color: '#333', marginBottom: 6 }}>
{weatherdata.weather}
</div>
<div style={{ fontSize: 12, color: '#666', lineHeight: 1.6 }}>
<div>湿度 {weatherdata.humidity}%</div>
<div>{weatherdata.wind_direction} {weatherdata.wind_power}</div>
<div>{weatherdata.city} · {weatherdata.district}</div>
</div>
</div>
</div>
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
title="外部系统"
/>
</div>
{/* 背景图层 */}
{/*<div style={{
width: '100%', height: '100%',
background: `url(${bgMain}) center/cover no-repeat`,
backgroundColor: '#f0f2f5',
position: 'relative'
}}>*/}
{/* 信息点 */}
{/*<div style={{ position: 'absolute', top: '15%', left: '20%', background: 'rgba(0,0,0,0.6)', color: '#fff', padding: '4px 10px', borderRadius: 20, fontSize: 12 }}>
<CloudOutlined style={{ marginRight: 4 }} /> 气象站 · <span style={{ color: '#52c41a' }}>正常</span>
</div>
</Card>
{/* 清洗建议 */}
<Card
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontWeight: 800, fontSize: 14, color: '#0837A8' }}>清洗建议</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',
flex: 1,
}}
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: 800, color: '#1890ff' }}>46</div>
<div style={{ fontSize: 12, color: '#666' }}>分</div>
</div>
</div>
<div>
<div style={{ fontSize: 12, color: '#333', marginBottom: 4 }}>污染指数中等,建议3天内安排B区清洗。</div>
<div style={{ fontSize: 11, color: '#999' }}>预计收益 ¥ 8,278</div>
</div>
<div style={{ position: 'absolute', top: '10%', left: '60%', background: 'rgba(0,0,0,0.6)', color: '#fff', padding: '4px 10px', borderRadius: 20, fontSize: 12 }}>
<RocketOutlined style={{ marginRight: 4 }} /> 无人机 · <span style={{ color: '#52c41a' }}>正常</span>
</div>
</Card>
</Col>
<div style={{ position: 'absolute', top: '20%', left: '80%', background: 'rgba(0,0,0,0.6)', color: '#fff', padding: '4px 10px', borderRadius: 20, fontSize: 12 }}>
<VideoCameraOutlined style={{ marginRight: 4 }} /> 摄像头 12 · <span style={{ color: '#52c41a' }}>正常</span>
</div>
<div style={{ position: 'absolute', top: '40%', left: '45%', background: 'rgba(0,0,0,0.6)', color: '#fff', padding: '6px 12px', borderRadius: 20, fontSize: 13, border: '1px solid #165DFF' }}>
<AppstoreOutlined style={{ marginRight: 4 }} /> 组件阵列 · <span style={{ color: '#52c41a' }}>正常</span>
</div>
<div style={{ position: 'absolute', bottom: '30%', left: '30%', background: 'rgba(0,0,0,0.6)', color: '#fff', padding: '4px 10px', borderRadius: 20, fontSize: 12 }}>
<ThunderboltOutlined style={{ marginRight: 4 }} /> 逆变器 5 · <span style={{ color: '#52c41a' }}>正常</span>
</div>
<div style={{ position: 'absolute', bottom: '20%', left: '50%', background: 'rgba(0,0,0,0.6)', color: '#fff', padding: '4px 10px', borderRadius: 20, fontSize: 12 }}>
<BranchesOutlined style={{ marginRight: 4 }} /> 汇流箱 20 · <span style={{ color: '#52c41a' }}>正常</span>
</div>
<div style={{ position: 'absolute', bottom: '15%', left: '70%', background: 'rgba(0,0,0,0.6)', color: '#fff', padding: '4px 10px', borderRadius: 20, fontSize: 12 }}>
<RobotOutlined style={{ marginRight: 4 }} /> 巡检机器人 · <span style={{ color: '#52c41a' }}>正常</span>
</div>*/}
{/*</div>*/}
</Card>
</Row>
<Row gutter={16} style={{ height: '25%' }} >
<Col xs={12} style={{ height: '100%' }}>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>近期巡检记录</span>}
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>
<Row gutter={16}>
<Col span={12}>
<Card title={<span style={{ fontWeight: 800 }}>近期巡检记录</span>} extra={<Button type="link" size="small">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '0 12px' }}>
<Table
dataSource={patrolRecords}
pagination={false}
size="small"
columns={[
{ title: '巡检类型', dataIndex: 'name', key: 'name', ellipsis: true },
{ title: '巡检时间', dataIndex: 'time', key: 'time', render: (t) => t.substring(0, 10) },
{ title: '状态', dataIndex: 'status', key: 'status', render: (s) => <span style={{ color: '#52c41a', fontSize: 12 }}>● 已完成</span> },
]}
/>
</Card>
</Col>
<Col span={12}>
<Card title={<span style={{ fontWeight: 800 }}>AI 分析摘要</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '8px', background: '#f9f9f9', borderRadius: 8 }}>
<Space><ThunderboltOutlined style={{ color: '#722ed1' }} /> <span style={{ fontSize: 13 }}>热点检测</span></Space>
<Button type="link" size="small">查看详情</Button>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Tag size="small">{item.status}</Tag>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '8px', background: '#f9f9f9', borderRadius: 8 }}>
<Space><AppstoreOutlined style={{ color: '#52c41a' }} /> <span style={{ fontSize: 13 }}>组串异常</span></Space>
<Button type="link" size="small">查看详情</Button>
</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '8px', background: '#f9f9f9', borderRadius: 8 }}>
<Space><RiseOutlined style={{ color: '#165DFF' }} /> <span style={{ fontSize: 13 }}>发电偏差分析</span></Space>
<Button type="link" size="small">查看详情</Button>
</div>
</div>
))}
</Card>
</Col>
<Col xs={12} style={{ height: '100%', }}>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>AI分析摘要</span>}
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>
</Card>
</Col>
</Row>
</Space>
</Col>
</Row >
</div >
{/* 右侧:状态与分析 */}
<Col xs={24} xl={6}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card title={<span style={{ fontWeight: 800 }}>实时告警</span>} extra={<Button type="link" size="small">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
{realtimeAlerts.map((alert, idx) => (
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 12, borderBottom: '1px solid #f5f5f5', paddingBottom: 8 }}>
<div>
<div style={{ fontSize: 13, fontWeight: 500 }}>{alert.type}</div>
<div style={{ fontSize: 11, color: '#999' }}>发生时间: 10:24:15</div>
</div>
<Tag color={alert.level === '严重' ? 'error' : 'warning'}>{alert.level}</Tag>
</div>
))}
</Card>
<Card title={<span style={{ fontWeight: 800 }}>设备在线状态</span>} extra={<Button type="link" size="small">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Row gutter={[8, 8]}>
{[
{ name: '组件阵列', count: '320/320', icon: <AppstoreOutlined /> },
{ name: '逆变器', count: '5/5', icon: <ThunderboltOutlined /> },
{ name: '汇流箱', count: '20/20', icon: <BranchesOutlined /> },
{ name: '气象站', count: '1/1', icon: <CloudOutlined /> },
{ name: '摄像头', count: '12/12', icon: <VideoCameraOutlined /> },
{ name: '环境传感器', count: '8/8', icon: <ExperimentOutlined /> },
{ name: '无人机', count: '1/1', icon: <RocketOutlined /> },
{ name: '巡检机器人', count: '1/1', icon: <RobotOutlined /> },
].map((item, idx) => (
<Col span={6} key={idx} style={{ textAlign: 'center' }}>
<div style={{ background: '#f9f9f9', borderRadius: 8, padding: '8px 4px' }}>
<div style={{ color: '#165DFF', fontSize: 16 }}>{item.icon}</div>
<div style={{ fontSize: 11, color: '#333', fontWeight: 600, marginTop: 4 }}>{item.count}</div>
<div style={{ fontSize: 10, color: '#999' }}>{item.name}</div>
</div>
</Col>
))}
</Row>
</Card>
<Card title={<span style={{ fontWeight: 800 }}>天气信息</span>} extra={<Button type="link" size="small">详细 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<div style={{ fontSize: 32, color: '#faad14' }}><CloudOutlined /></div>
<div>
<div style={{ fontSize: 24, fontWeight: 800 }}>28℃</div>
<div style={{ fontSize: 14 }}>晴</div>
</div>
</div>
<div style={{ fontSize: 12, color: '#666', lineHeight: '20px' }}>
<div>辐照度: 815 W/m²</div>
<div>组件温度: 45.6 ℃</div>
<div>湿度: 56%</div>
</div>
</div>
</Card>
<Card title={<span style={{ fontWeight: 800 }}>清洗建议</span>} extra={<Button type="link" size="small">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 16, marginBottom: 16 }}>
<div style={{ width: 80, height: 80, position: 'relative' }}>
{/*<RingProgress percent={0.85} width={80} height={80} color={['#00B42A', '#E8FFEA']} innerRadius={0.7} radius={1}
statistic={{
content: {
style: { fontSize: '14px', fontWeight: 800, color: '#000' },
formatter: () => '85分',
},
}}
/>*/}
</div>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 12, color: '#666', marginBottom: 4 }}>建议清洗时间: <span style={{ color: '#165DFF' }}>3天内</span></div>
<div style={{ fontSize: 12, color: '#666', marginBottom: 4 }}>预计提升发电量: <span style={{ color: '#00B42A' }}>2.6 %</span></div>
<div style={{ fontSize: 12, color: '#666' }}>预计提升电量: <span style={{ color: '#00B42A' }}>120 kWh/天</span></div>
</div>
</div>
<Button type="primary" block style={{ borderRadius: 8, height: 36 }} onClick={() => message.success('清洗工单已生成')}>生成清洗工单</Button>
</Card>
</Space>
</Col>
</Row>
</div>
);
}

View File

@@ -1,62 +1,46 @@
import React, { useState } from 'react';
import {
Card, Row, Col, Statistic, Table, Select, Input, Tag,
Typography, Button
Card, Row, Col, Table, Select, Input, Tag,
Typography, Button, Space, Avatar, Pagination
} from 'antd';
import {
CloudOutlined, CheckCircleOutlined, WarningOutlined,
MinusCircleOutlined, ThunderboltOutlined,
RiseOutlined, SunOutlined, BarChartOutlined
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';
const { Option } = Select;
const { Search } = Input;
const { Text, Title } = Typography;
// 模拟数据
// 模拟数据扩展
const deviceList = [
{ id: 1, name: '摄像头 CAM-01', type: '摄像头', status: '正常', data: '35.2 ℃', communication: '通讯正常', updateTime: '2026-04-28 11:32:45' },
{ id: 2, name: '摄像头 CAM-02', type: '摄像头', status: '离线', data: '-', communication: '通讯离线', updateTime: '2026-04-28 12:10:00' },
{ id: 3, name: '摄像头 CAM-03', type: '摄像头', status: '正常', data: '33.9 ℃', communication: '通讯正常', updateTime: '2026-04-28 11:32:45' },
{ id: 4, name: '汇流箱 CMB-A01', type: '汇流箱', status: '预警', data: '46.3 ℃', communication: '通讯正常', updateTime: '2026-04-28 11:32:45' },
{ id: 5, name: '汇流箱 CMB-A02', type: '汇流箱', status: '正常', data: '41.1 ℃', communication: '通讯正常', updateTime: '2026-04-28 11:32:45' },
{ id: 6, name: '逆变器 INV-A01', type: '逆变器', status: '正常', data: '66.8 kW', communication: '通讯正常', updateTime: '2026-04-28 12:00:00' },
{ id: 7, name: '逆变器 INV-A02', type: '逆变器', status: '预警', data: '54.2 kW', communication: '通讯正常', updateTime: '2026-04-28 12:05:00' },
{ id: 8, name: '逆变器 INV-B01', type: '逆变器', status: '正常', data: '22.4 kW', communication: '通讯正常', updateTime: '2026-04-28 11:32:45' },
{ id: 9, name: '电表 METER-01', type: '电表', status: '正常', data: '66.8 kW', communication: '通讯正常', updateTime: '2026-04-28 11:32:45' }
{ 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: 13.4, type: '今日' },
{ time: '00:00', value: 12.1, type: '昨日' },
{ time: '00:00', value: 1000, type: '额定' },
{ time: '04:00', value: 15.7, type: '今日' },
{ time: '04:00', value: 14.3, type: '昨日' },
{ time: '04:00', value: 1000, type: '额定' },
{ time: '08:00', value: 220.5, type: '今日' },
{ time: '08:00', value: 200.8, type: '昨日' },
{ time: '08:00', value: 1000, type: '额定' },
{ time: '12:00', value: 350.2, type: '今日' },
{ time: '12:00', value: 320.5, type: '昨日' },
{ time: '12:00', value: 1000, type: '额定' },
{ time: '16:00', value: 280.7, type: '今日' },
{ time: '16:00', value: 260.3, type: '昨日' },
{ time: '16:00', value: 1000, type: '额定' },
{ time: '20:00', value: 13.4, type: '今日' },
{ time: '20:00', value: 11.9, type: '昨日' },
{ time: '20:00', value: 1000, type: '额定' },
{ time: '24:00', value: 10.2, type: '今日' },
{ time: '24:00', value: 9.8, type: '昨日' },
{ time: '24:00', value: 1000, type: '额定' },
{ 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 },
@@ -65,303 +49,271 @@ const inverterPowerData = [
{ name: 'INV-05', power: 159.8 }
];
const heatmapData = [
['#1677ff', '#52c41a', '#1677ff', '#faad14', '#52c41a', '#1677ff', '#faad14', '#1677ff', '#1677ff', '#52c41a', '#1677ff', '#1677ff'],
['#52c41a', '#1677ff', '#faad14', '#52c41a', '#1677ff', '#faad14', '#1677ff', '#1677ff', '#52c41a', '#1677ff', '#1677ff', '#52c41a'],
['#1677ff', '#faad14', '#52c41a', '#1677ff', '#faad14', '#1677ff', '#1677ff', '#52c41a', '#1677ff', '#1677ff', '#1677ff', '#52c41a'],
['#faad14', '#52c41a', '#1677ff', '#faad14', '#1677ff', '#1677ff', '#52c41a', '#1677ff', '#1677ff', '#52c41a', '#1677ff', '#faad14'],
['#52c41a', '#1677ff', '#faad14', '#1677ff', '#1677ff', '#52c41a', '#1677ff', '#1677ff', '#52c41a', '#1677ff', '#faad14', '#52c41a']
];
const OnlineRateData = [
{ type: '在线', value: 12 },
{ type: '离线', value: 1 },
{ type: '告警', value: 2 },
{ type: '总数', value: 13 }
];
const heatmapColors = ['#52c41a', '#1890ff', '#faad14', '#1890ff', '#52c41a'];
const RealTimeMonitorPage = () => {
const [loading, setLoading] = useState(false);
const [filterStatus, setFilterStatus] = useState('all');
const [filterType, setFilterType] = useState(undefined);
const [searchName, setSearchName] = useState('');
const filteredList = deviceList.filter(item => {
if (filterStatus === 'all') return true;
if (filterStatus === 'normal') return item.status === '正常';
if (filterStatus === 'warning') return item.status === '预警';
if (filterStatus === 'offline') return item.status === '离线';
return true;
}).filter(item => !filterType || item.type === filterType)
.filter(item => !searchName || item.name.includes(searchName));
const cardStyle = { borderRadius: 12, border: '1px solid #f0f0f0', boxShadow: '0 2px 8px rgba(0,0,0,0.04)' };
const getStatusTag = (status) => {
switch (status) {
case '正常': return <Tag color="green" icon={<CheckCircleOutlined />}>正常</Tag>;
case '预警': return <Tag color="orange" icon={<WarningOutlined />}>预警</Tag>;
case '离线': return <Tag color="gray" icon={<MinusCircleOutlined />}>离线</Tag>;
default: return status;
}
const color = status === '正常' ? '#52c41a' : status === '告警' ? '#faad14' : '#999';
return (
<Space size={4}>
<span style={{ width: 8, height: 8, borderRadius: '50%', background: color, display: 'inline-block' }} />
<span style={{ color }}>{status}</span>
</Space>
);
};
const columns = [
{
title: '设备名称', dataIndex: 'name', key: 'name',
render: (name, record) => (
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<span style={{ color: '#1890ff' }}>
{record.type === '摄像头' ? '摄' : record.type === '汇流箱' ? '汇' : record.type === '逆变器' ? '逆' : record.type === '电表' ? '网' : '其'}
</span>
{name}
</div>
render: (text, record) => (
<Space>
<div style={{ width: 24, height: 24, background: '#f5f5f5', borderRadius: 4, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
{record.type === '逆变器' ? <ThunderboltOutlined style={{ fontSize: 14 }} /> : <BranchesOutlined style={{ fontSize: 14 }} />}
</div>
<span style={{ fontSize: 13 }}>{text}</span>
</Space>
)
},
{ title: '类型', dataIndex: 'type' },
{ title: '类型', dataIndex: 'type', render: (t) => <span style={{ fontSize: 13, color: '#666' }}>{t}</span> },
{ title: '当前状态', dataIndex: 'status', render: getStatusTag },
{ title: '实时功率/数据', dataIndex: 'data' },
{ title: '通讯状态', dataIndex: 'communication' },
{ title: '更新时间', dataIndex: 'updateTime' }
{ title: '实时功率/数据', dataIndex: 'data', render: (d) => <span style={{ fontSize: 13, fontWeight: 500 }}>{d}</span> },
{
title: '通讯状态', dataIndex: 'communication',
render: (c) => (
<Space size={4}>
<span style={{ fontSize: 13 }}>{c}</span>
<RiseOutlined style={{ color: '#52c41a' }} />
</Space>
)
},
{ title: '更新时间', dataIndex: 'updateTime', render: (t) => <span style={{ fontSize: 12, color: '#999' }}>{t}</span> }
];
return (
<div style={{ padding: 20, background: '#f0f2f5', minHeight: '100vh' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 20 }}>
<div>
<Title level={4} style={{ margin: 0 }}>实时监控中心</Title>
<Text type="secondary">全方位实时掌握电站设备运行状态与发电表现</Text>
</div>
<div style={{ display: 'flex', gap: 16 }}>
<div style={{ textAlign: 'right' }}>
<Statistic
title="在线率"
value="92.3"
suffix="%"
valueStyle={{ color: '#52c41a', fontSize: 20, fontWeight: 700 }}
/>
</div>
<div style={{ textAlign: 'right' }}>
<Statistic
title="设备"
value={13}
valueStyle={{ fontSize: 20, fontWeight: 700 }}
/>
</div>
<div style={{ textAlign: 'right' }}>
<Statistic
title="离线"
value={1}
valueStyle={{ color: '#8c8c8c', fontSize: 20, fontWeight: 700 }}
/>
</div>
<div style={{ textAlign: 'right' }}>
<Statistic
title="告警"
value={2}
valueStyle={{ color: '#faad14', fontSize: 20, fontWeight: 700 }}
/>
</div>
</div>
<div style={{ background: '#f8fafc', padding: '16px', minHeight: '100vh', width: '100%', boxSizing: 'border-box' }}>
<div>
<Title level={4} style={{ margin: 0 }}>实时监控中心</Title>
<Text type="secondary">全方位实时掌握电站设备运行状态与发电表现</Text>
</div>
<Row gutter={16}>
<Col span={14}>
<Card
title="电站拓扑图 (实时)"
style={{ marginBottom: 16, borderRadius: 8 }}
extra={<Text type="secondary">真实正射底图 · 设备状态联动</Text>}
>
<div style={{ height: 360, background: '#111827', borderRadius: 8, width: '100%', overflow: 'hidden', position: "relative" }}>
<iframe
src="https://pvs.satabot.com/?platform=web"
style={{
width: '100%',
height: '100%',
border: 'none',
borderRadius: '8px',
position: "absolute",
}}
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
title="外部系统"
/>
</div>
</Card>
<Card title="设备实时监控列表" style={{ borderRadius: 8 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 16, marginBottom: 16 }}>
<div style={{ display: 'flex', gap: 8 }}>
<Button type={filterStatus === 'all' ? 'primary' : 'default'} onClick={() => setFilterStatus('all')}>全部 13</Button>
<Button type={filterStatus === 'normal' ? 'primary' : 'default'} onClick={() => setFilterStatus('normal')}>正常 10</Button>
<Button type={filterStatus === 'warning' ? 'primary' : 'default'} onClick={() => setFilterStatus('warning')}>告警 2</Button>
<Button type={filterStatus === 'offline' ? 'primary' : 'default'} onClick={() => setFilterStatus('offline')}>离线 1</Button>
<Row gutter={[16, 16]}>
{/* 左侧大栏 */}
<Col xs={24} xl={16}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
{/* 电站拓扑图 */}
<Card
title={<span style={{ fontWeight: 800 }}>电站拓扑图 (实时)</span>}
extra={
<div style={{ display: 'flex', gap: 16, 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: '#faad14', 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={{ color: '#1890ff', marginLeft: 8 }}>•• 通讯中</span></span>
</div>
}
bordered={false}
style={cardStyle}
bodyStyle={{ padding: 0, position: 'relative', height: 480, overflow: 'hidden' }}
>
<div style={{ height: "100%", background: '#111827', borderRadius: 8, width: '100%', overflow: 'hidden', position: "relative" }}>
<iframe
src="https://pvs.satabot.com/?platform=web"
style={{
width: '100%',
height: '100%',
border: 'none',
borderRadius: '8px',
position: "absolute",
}}
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
title="外部系统"
/>
</div>
<Select placeholder="全部类型" style={{ width: 120 }} allowClear onChange={setFilterType}>
<Option value="摄像头">摄像头</Option>
<Option value="汇流箱">汇流箱</Option>
<Option value="逆变器">逆变器</Option>
<Option value="电表">电表</Option>
</Select>
<Search placeholder="搜索设备名称" style={{ width: 200 }} value={searchName} onChange={(e) => setSearchName(e.target.value)} />
</div>
<Table rowKey="id" columns={columns} dataSource={filteredList} pagination={{ total: 13, pageSize: 10 }} size="small" />
</Card>
</Card>
{/* 设备实时监控列表 */}
<Card
title={<span style={{ fontWeight: 800 }}>设备实时监控列表</span>}
bordered={false}
style={cardStyle}
extra={
<Space>
<span style={{ fontSize: 12, color: '#999' }}>全部 56</span>
<span style={{ fontSize: 12, color: '#52c41a' }}>正常 52</span>
<span style={{ fontSize: 12, color: '#faad14' }}>告警 1</span>
<span style={{ fontSize: 12, color: '#999' }}>离线 3</span>
<Select defaultValue="all" size="small" style={{ width: 100 }}>
<Option value="all">全部类型</Option>
</Select>
<Input size="small" placeholder="搜索设备名称" prefix={<SearchOutlined />} style={{ width: 150 }} />
</Space>
}
>
<Table
rowKey="id"
columns={columns}
dataSource={deviceList}
pagination={false}
size="middle"
/>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 16, alignItems: 'center' }}>
<span style={{ color: '#999', fontSize: 12 }}>共 56 条</span>
<Pagination size="small" total={56} current={1} pageSize={10} showSizeChanger />
</div>
</Card>
</Space>
</Col>
<Col span={10}>
<Row
gutter={[8, 8]}
style={{
marginBottom: 16,
flexWrap: 'wrap',
}}
>
{[
{
title: '当前总功率',
value: '812.6',
unit: 'kW',
color: '#165DFF',
bg: '#E8F3FF',
icon: <ThunderboltOutlined />,
sub: '额定功率 1,000 kW'
},
{
title: '并网状态',
value: '并网正常',
unit: '',
color: '#00B42A',
bg: '#E8FFEA',
icon: <CheckCircleOutlined />,
sub: '频率 50.02 Hz'
},
{
title: '电网电压',
value: '380.2',
unit: 'V',
color: '#165DFF',
bg: '#E8F3FF',
icon: <BarChartOutlined />,
sub: 'A相 380.1 V'
},
{
title: '今日累计发电量',
value: '4,752',
unit: 'kWh',
color: '#00B42A',
bg: '#E8FFEA',
icon: <RiseOutlined />,
sub: '昨日 5,000 kWh'
},
{
title: '当前辐照度',
value: '815',
unit: 'W/m²',
color: '#165DFF',
bg: '#E8F3FF',
icon: <SunOutlined />,
sub: '较昨日 +5.6%'
},
{
title: '环境温度',
value: '28.0',
unit: '℃',
color: '#165DFF',
bg: '#E8F3FF',
icon: <CloudOutlined />,
sub: '较昨日 +1.2 ℃'
},
].map((item, idx) => (
<Col key={idx} style={{ minWidth: '168px', flex: '0 0 auto' }}>
<Card
bordered={false}
style={{ borderRadius: 8, width: 168, height: 100 }}
bodyStyle={{ padding: '16px', height: '100%' }}
>
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 12 }}>
{/* 左侧图标 */}
<div style={{
width: 30,
height: 30,
borderRadius: '50%',
background: item.bg,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexShrink: 0
}}>
{React.cloneElement(item.icon, { style: { fontSize: 20, color: item.color } })}
</div>
{/* 右侧文字 */}
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 12, color: '#333', marginBottom: 4 }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', marginBottom: 4 }}>
<span style={{ color: item.color, fontSize: 20, fontWeight: 600 }}>{item.value}</span>
{item.unit && <span style={{ color: item.color, fontSize: 12, marginLeft: 4 }}>{item.unit}</span>}
{/* 右侧小栏 */}
<Col xs={24} xl={8}>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
{/* 6个统计卡片 */}
<Row gutter={[8, 8]}>
{[
{ title: '当前总功率', value: '812.6', unit: 'kW', sub: '额定功率 1,000 kW', color: '#165DFF', icon: <ThunderboltOutlined /> },
{ title: '并网状态', value: '并网正常', unit: '', sub: '频率 50.02 Hz', color: '#00B42A', icon: <CheckCircleOutlined /> },
{ title: '电网电压', value: '380.2', unit: 'V', sub: 'A相 380.1 V', color: '#165DFF', icon: <BarChartOutlined /> },
{ title: '今日累计发电量', value: '4,752', unit: 'kWh', sub: '昨日 5,000 kWh', color: '#00B42A', icon: <RiseOutlined /> },
{ title: '当前辐照度', value: '815', unit: 'W/m²', sub: '较昨日 +5.6%', color: '#faad14', icon: <SunOutlined /> },
{ title: '环境温度', value: '28.0', unit: '℃', sub: '较昨日 +1.2 ℃', color: '#165DFF', icon: <CloudOutlined /> },
].map((item, idx) => (
<Col span={8} key={idx}>
<Card bordered={false} style={{ ...cardStyle, height: '100%' }} bodyStyle={{ padding: '12px' }}>
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 8 }}>
<div style={{ color: item.color, fontSize: 18 }}>{item.icon}</div>
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 'clamp(10px, 0.8vw, 11px)', color: '#666', marginBottom: 4, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{item.title}</div>
<div style={{ display: 'flex', alignItems: 'baseline', flexWrap: 'wrap' }}>
<span style={{ fontSize: 'clamp(14px, 1.2vw, 18px)', fontWeight: 700 }}>{item.value}</span>
<span style={{ fontSize: 10, marginLeft: 2 }}>{item.unit}</span>
</div>
<div style={{ fontSize: 9, color: '#999', marginTop: 4 }}>{item.sub}</div>
</div>
<div style={{ fontSize: 10, color: '#999' }}>{item.sub}</div>
</div>
</Card>
</Col>
))}
</Row>
{/* 实时功率曲线 */}
<Card title={<span style={{ fontWeight: 800 }}>实时功率曲线</span>} extra={<Select defaultValue="today" size="small"><Option value="today">今天</Option></Select>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Line
data={powerTrendData}
xField="time"
yField="value"
seriesField="type"
height={180}
smooth
area={{ style: { fill: 'l(270) 0:#ffffff 0.5:#165DFF 1:#165DFF', fillOpacity: 0.1 } }}
color={['#165DFF']}
xAxis={{ tickCount: 5 }}
yAxis={{ title: { text: '功率 (kW)', style: { fontSize: 10 } } }}
/>
</Card>
{/* 逆变器功率对比 */}
<Card title={<span style={{ fontWeight: 800 }}>逆变器功率对比 (实时)</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Bar
data={inverterPowerData}
xField="name"
yField="power"
height={180}
color="#165DFF"
columnStyle={{ radius: [4, 4, 0, 0] }}
label={{ position: 'top', style: { fill: '#000', fontSize: 10 } }}
/>
</Card>
{/* 热力图与在线率 */}
<Row gutter={8}>
<Col span={12}>
<Card title={<span style={{ fontWeight: 800 }}>组串电流热力图 (单位: A)</span>} extra={<Select defaultValue="a" size="small" style={{ width: 60 }}><Option value="a">电流</Option></Select>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
{['INV-01', 'INV-02', 'INV-03', 'INV-04', 'INV-05'].map((name, i) => (
<div key={i} style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<span style={{ fontSize: 10, width: 40 }}>{name}</span>
<div style={{ display: 'flex', gap: 2, flex: 1 }}>
{Array.from({ length: 12 }).map((_, j) => (
<div key={j} style={{ flex: 1, height: 16, background: heatmapColors[Math.floor(Math.random() * 5)], borderRadius: 2 }} />
))}
</div>
</div>
))}
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 9, color: '#999', marginTop: 4 }}>
<span>1</span><span>5</span><span>10</span><span>15</span><span>20</span><span>25</span><span>30</span><span>32</span>
</div>
</div>
<div style={{ maxHeight: 180, overflow: 'auto' }} className="custom-scrollbar">
{[
{ name: '逆变器 INV-01', status: '正常', color: '#52c41a' },
{ name: '逆变器 INV-02', status: '正常', color: '#52c41a' },
{ name: '逆变器 INV-03', status: '正常', color: '#52c41a' },
{ name: '逆变器 INV-04', status: '正常', color: '#52c41a' },
{ name: '逆变器 INV-05', status: '告警', color: '#faad14' },
{ name: '气象站', status: '正常', color: '#52c41a' },
{ name: '无人机机场', status: '正常', color: '#52c41a' },
{ name: '巡检机器人', status: '正常', color: '#52c41a' },
].map((item, idx) => (
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', padding: '6px 4px', borderBottom: '1px solid #f5f5f5' }}>
<Space size={4}>
{item.name.includes('逆变器') ? <ThunderboltOutlined style={{ fontSize: 10 }} /> : <ExperimentOutlined style={{ fontSize: 10 }} />}
<span style={{ fontSize: 11 }}>{item.name}</span>
</Space>
<span style={{ fontSize: 11, color: item.color }}>{item.status}</span>
</div>
))}
</div>
</Card>
</Col>
))}
</Row>
{/* 👇 修改后的实时功率曲线:两天对比 */}
<Card title="实时功率曲线" style={{ marginBottom: 16, borderRadius: 8 }}>
<Line
data={powerTrendData}
xField="time"
yField="value"
seriesField="type"
scale={{
color: {
relations: [
['今日', '#1890ff'],
['昨日', '#faad14'],
['额定', '#52c41a']
]
}
}}
tooltip={{
formatter: (datum) => ({
name: datum.type,
value: `${datum.value} kW`
})
}}
lineStyle={{
lineDash: (datum) => (datum.type === '额定' ? [4, 4] : undefined)
}}
point={{
size: 3
}}
height={180}
/>
</Card>
<Card title="逆变器功率对比" style={{ marginBottom: 16, borderRadius: 8 }}>
<Bar data={inverterPowerData} xField="name" yField="power" color={'#1677ff'} height={180} />
</Card>
<Row gutter={16}>
<Col span={12}>
<Card title="组串电流热力图" style={{ borderRadius: 8 }}>
{heatmapData.map((row, i) => (
<div key={i} style={{ display: 'flex', gap: 4, marginBottom: 4 }}>
<div style={{ width: 40 }}>INV-0{i + 1}</div>
{row.map((c, j) => <div key={j} style={{ width: 16, height: 24, background: c, borderRadius: 2 }} />)}
<Col span={12}>
<Card title={<span style={{ fontWeight: 800 }}>设备在线率</span>} bordered={false} style={{ ...cardStyle, height: "100%" }} bodyStyle={{ padding: '12px' }}>
<div style={{ position: 'relative', height: 160 }}>
<Pie
data={[
{ type: '在线', value: 52 },
{ type: '离线', value: 3 },
{ type: '告警', value: 1 }
]}
angleField="value"
colorField="type"
color={['#52c41a', '#f5f5f5', '#faad14']}
radius={1}
innerRadius={0.7}
legend={false}
height={140}
/>
<div style={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', textAlign: 'center' }}>
<div style={{ fontSize: 16, fontWeight: 800 }}>92.1%</div>
<div style={{ fontSize: 10, color: '#999' }}>在线率</div>
</div>
</div>
))}
</Card>
</Col>
<Col span={12}>
<Card title="设备在线率" style={{ borderRadius: 8 }}>
<Pie data={OnlineRateData} angleField="value" colorField="type" radius={0.7} innerRadius={0.6} height={220} />
</Card>
</Col>
</Row>
<div style={{ fontSize: 10, display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 8 }}>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#52c41a', marginRight: 4 }}></span>在线 52 (92.1%)</span>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#f5f5f5', marginRight: 4 }}></span>离线 3 (5.3%)</span>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#faad14', marginRight: 4 }}></span>告警 1 (1.8%)</span>
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#999', marginRight: 4 }}></span>总数 56</span>
</div>
<div style={{ width: '100%', height: '100%', background: `url(${bgMain}) center/cover no-repeat`, position: 'relative' }}>
{/* 简易地图点位 */}
{/*<div style={{ position: 'absolute', top: '20%', left: '30%', width: 8, height: 8, background: '#52c41a', borderRadius: '50%', border: '1px solid #fff' }} />
<div style={{ position: 'absolute', top: '40%', left: '60%', width: 8, height: 8, background: '#faad14', borderRadius: '50%', border: '1px solid #fff' }} />
<div style={{ position: 'absolute', bottom: '20%', left: '40%', width: 8, height: 8, background: '#52c41a', borderRadius: '50%', border: '1px solid #fff' }} />*/}
</div>
</Card>
</Col>
</Row>
</Space>
</Col>
</Row>
</div>
</div >
);
};