284 lines
11 KiB
TypeScript
284 lines
11 KiB
TypeScript
|
|
import React, { useState } from 'react';
|
||
|
|
import {
|
||
|
|
Card, Row, Col, Statistic, Table, Select, Input, Tag,
|
||
|
|
Typography, Button
|
||
|
|
} from 'antd';
|
||
|
|
import {
|
||
|
|
CloudOutlined, CheckCircleOutlined, WarningOutlined,
|
||
|
|
MinusCircleOutlined, ThunderboltOutlined,
|
||
|
|
RiseOutlined, SunOutlined, BarChartOutlined
|
||
|
|
} from '@ant-design/icons';
|
||
|
|
import { Line, Bar, Pie } from '@ant-design/charts';
|
||
|
|
|
||
|
|
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' }
|
||
|
|
];
|
||
|
|
|
||
|
|
const powerTrendData = [
|
||
|
|
{ time: '00:00', power: 50, rated: 1000 },
|
||
|
|
{ time: '04:00', power: 70, rated: 1000 },
|
||
|
|
{ time: '08:00', power: 90, rated: 1000 },
|
||
|
|
{ time: '12:00', power: 110, rated: 1000 },
|
||
|
|
{ time: '16:00', power: 100, rated: 1000 },
|
||
|
|
{ time: '20:00', power: 80, rated: 1000 },
|
||
|
|
{ time: '24:00', power: 60, rated: 1000 }
|
||
|
|
];
|
||
|
|
|
||
|
|
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 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 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 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 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>
|
||
|
|
)
|
||
|
|
},
|
||
|
|
{ title: '类型', dataIndex: 'type' },
|
||
|
|
{ title: '当前状态', dataIndex: 'status', render: getStatusTag },
|
||
|
|
{ title: '实时功率/数据', dataIndex: 'data' },
|
||
|
|
{ title: '通讯状态', dataIndex: 'communication' },
|
||
|
|
{ title: '更新时间', dataIndex: 'updateTime' }
|
||
|
|
];
|
||
|
|
|
||
|
|
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>
|
||
|
|
|
||
|
|
<Row gutter={16}>
|
||
|
|
<Col span={14}>
|
||
|
|
<Card
|
||
|
|
title="电站拓扑图 (实时)"
|
||
|
|
style={{ marginBottom: 16, borderRadius: 8 }}
|
||
|
|
extra={<Text type="secondary">真实正射底图 · 设备状态联动</Text>}
|
||
|
|
>
|
||
|
|
<div style={{ position: 'relative', height: 400, background: '#e6f7ff', borderRadius: 8 }}>
|
||
|
|
<div style={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%,-50%)', textAlign: 'center' }}>
|
||
|
|
<CloudOutlined style={{ fontSize: 48, color: '#1890ff' }} />
|
||
|
|
<p>电站拓扑底图</p>
|
||
|
|
</div>
|
||
|
|
</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>
|
||
|
|
</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>
|
||
|
|
</Col>
|
||
|
|
|
||
|
|
<Col span={10}>
|
||
|
|
<Row gutter={16} style={{ marginBottom: 16 }}>
|
||
|
|
<Col span={8}>
|
||
|
|
<Card bordered={false} style={{ borderRadius: 8 }}>
|
||
|
|
<Statistic
|
||
|
|
title="当前总功率"
|
||
|
|
value={66.8}
|
||
|
|
suffix="kW"
|
||
|
|
prefix={<ThunderboltOutlined />}
|
||
|
|
valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 700 }}
|
||
|
|
/>
|
||
|
|
</Card>
|
||
|
|
</Col>
|
||
|
|
<Col span={8}>
|
||
|
|
<Card bordered={false} style={{ borderRadius: 8 }}>
|
||
|
|
<Statistic
|
||
|
|
title="并网状态"
|
||
|
|
value="并网正常"
|
||
|
|
prefix={<CheckCircleOutlined />}
|
||
|
|
valueStyle={{ color: '#52c41a', fontSize: 20, fontWeight: 700 }}
|
||
|
|
/>
|
||
|
|
</Card>
|
||
|
|
</Col>
|
||
|
|
<Col span={8}>
|
||
|
|
<Card bordered={false} style={{ borderRadius: 8 }}>
|
||
|
|
<Statistic
|
||
|
|
title="电网电压"
|
||
|
|
value={380.2}
|
||
|
|
suffix="v"
|
||
|
|
prefix={<BarChartOutlined />}
|
||
|
|
valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 700 }}
|
||
|
|
/>
|
||
|
|
</Card>
|
||
|
|
</Col>
|
||
|
|
</Row>
|
||
|
|
|
||
|
|
<Row gutter={16} style={{ marginBottom: 16 }}>
|
||
|
|
<Col span={8}>
|
||
|
|
<Card bordered={false} style={{ borderRadius: 8 }}>
|
||
|
|
<Statistic
|
||
|
|
title="今日发电量"
|
||
|
|
value={4752}
|
||
|
|
suffix="kWh"
|
||
|
|
prefix={<RiseOutlined />}
|
||
|
|
valueStyle={{ color: '#52c41a', fontSize: 24, fontWeight: 700 }}
|
||
|
|
/>
|
||
|
|
</Card>
|
||
|
|
</Col>
|
||
|
|
<Col span={8}>
|
||
|
|
<Card bordered={false} style={{ borderRadius: 8 }}>
|
||
|
|
<Statistic
|
||
|
|
title="辐照度"
|
||
|
|
value={815}
|
||
|
|
suffix="W/m²"
|
||
|
|
prefix={<SunOutlined />}
|
||
|
|
valueStyle={{ color: '#faad14', fontSize: 24, fontWeight: 700 }}
|
||
|
|
/>
|
||
|
|
</Card>
|
||
|
|
</Col>
|
||
|
|
<Col span={8}>
|
||
|
|
<Card bordered={false} style={{ borderRadius: 8 }}>
|
||
|
|
<Statistic
|
||
|
|
title="环境温度"
|
||
|
|
value={28.4}
|
||
|
|
suffix="℃"
|
||
|
|
valueStyle={{ color: '#1890ff', fontSize: 24, fontWeight: 700 }}
|
||
|
|
/>
|
||
|
|
</Card>
|
||
|
|
</Col>
|
||
|
|
</Row>
|
||
|
|
|
||
|
|
<Card title="实时功率曲线" style={{ marginBottom: 16, borderRadius: 8 }}>
|
||
|
|
<Line data={powerTrendData} xField="time" yField={['power', 'rated']} color={['#1890ff', '#52c41a']} 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 }} />)}
|
||
|
|
</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>
|
||
|
|
</Col>
|
||
|
|
</Row>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default RealTimeMonitorPage;
|