总览和 告警 界面
This commit is contained in:
@@ -23,6 +23,8 @@ export default function StationManage() {
|
||||
|
||||
// 组织列表
|
||||
const [orgList, setOrgList] = useState([]);
|
||||
// 🔥 新增:选中的组织ID(用于筛选)
|
||||
const [selectedOrgId, setSelectedOrgId] = useState<number | undefined>(undefined);
|
||||
|
||||
// 获取当前登录用户信息
|
||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||
@@ -62,12 +64,14 @@ export default function StationManage() {
|
||||
});
|
||||
};
|
||||
|
||||
// ====================== 获取场站列表(分页) ======================
|
||||
// ====================== 获取场站列表(分页 + 组织筛选) ======================
|
||||
const getStationData = () => {
|
||||
const params = {
|
||||
pageNum: pagination.pageNum,
|
||||
pageSize: pagination.pageSize,
|
||||
orgId: userInfo?.orgId,
|
||||
// 🔥 把选中的组织ID传进去
|
||||
filterOrgId: selectedOrgId,
|
||||
};
|
||||
getStationList(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
@@ -89,11 +93,27 @@ export default function StationManage() {
|
||||
});
|
||||
};
|
||||
|
||||
// 🔥 组织筛选变化
|
||||
const handleOrgChange = (value: number) => {
|
||||
setSelectedOrgId(value);
|
||||
setPagination({ ...pagination, pageNum: 1 }); // 筛选重置页码
|
||||
};
|
||||
|
||||
// 🔥 重置筛选
|
||||
const handleReset = () => {
|
||||
setSelectedOrgId(undefined);
|
||||
setPagination({ ...pagination, pageNum: 1 });
|
||||
};
|
||||
|
||||
// 初始化加载
|
||||
useEffect(() => {
|
||||
getStationData();
|
||||
getOrgData();
|
||||
}, [pagination.pageNum, pagination.pageSize]);
|
||||
}, [
|
||||
pagination.pageNum,
|
||||
pagination.pageSize,
|
||||
selectedOrgId // 🔥 监听筛选变化
|
||||
]);
|
||||
|
||||
// ====================== 新增 / 编辑 场站 ======================
|
||||
const handleAdd = () => {
|
||||
@@ -206,11 +226,6 @@ export default function StationManage() {
|
||||
}
|
||||
},
|
||||
{ title: '地址', dataIndex: 'address' },
|
||||
//{
|
||||
// title: '状态',
|
||||
// dataIndex: 'status',
|
||||
// render: s => s === 1 ? <Tag color="green">启用</Tag> : <Tag color="red">停用</Tag>
|
||||
//},
|
||||
{
|
||||
title: '操作',
|
||||
width: 400,
|
||||
@@ -232,10 +247,28 @@ export default function StationManage() {
|
||||
{contextHolder}
|
||||
|
||||
<Card title="场站管理" style={{ borderRadius: 8 }}>
|
||||
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between' }}>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>
|
||||
新增场站
|
||||
</Button>
|
||||
{/* 🔥 筛选栏 */}
|
||||
<div style={{ marginBottom: 16, display: 'flex', alignItems: 'center', gap: 16 }}>
|
||||
<Select
|
||||
placeholder="请选择组织筛选"
|
||||
style={{ width: 220 }}
|
||||
value={selectedOrgId}
|
||||
onChange={handleOrgChange}
|
||||
allowClear
|
||||
>
|
||||
{orgList.map(item => (
|
||||
<Option key={item.id} value={item.id}>
|
||||
{item.orgName}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
<Button onClick={handleReset}>重置</Button>
|
||||
|
||||
<div style={{ marginLeft: 'auto' }}>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>
|
||||
新增场站
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
@@ -281,7 +314,6 @@ export default function StationManage() {
|
||||
<Form.Item name="orgId" label="所属组织" rules={[{ required: true }]}>
|
||||
<Select placeholder="请选择所属组织" allowClear>
|
||||
{orgList.map(item => (
|
||||
// ✅ 这里修复了!原来是 item.orgId,现在是 item.id
|
||||
<Option key={item.id} value={item.id}>
|
||||
{item.orgName}
|
||||
</Option>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Card, Row, Col, Select, DatePicker, Input, Button, Space, Table, Tag,
|
||||
Statistic, Typography, Tabs
|
||||
Statistic, Typography
|
||||
} from 'antd';
|
||||
import {
|
||||
BellOutlined, ClockCircleOutlined, CheckCircleOutlined, ExclamationCircleOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { Line, Pie, Bar } from '@ant-design/charts';
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
const { Text } = Typography;
|
||||
@@ -57,101 +58,326 @@ export default function AlarmCenterPage() {
|
||||
}
|
||||
];
|
||||
|
||||
// 告警趋势图配置
|
||||
const trendConfig = {
|
||||
data: [
|
||||
{ date: '05-19', 严重: 12, 重要: 5, 一般: 3, 提示: 2 },
|
||||
{ date: '05-20', 严重: 30, 重要: 16, 一般: 9, 提示: 6 },
|
||||
{ date: '05-21', 严重: 23, 重要: 11, 一般: 7, 提示: 5 },
|
||||
{ date: '05-22', 严重: 25, 重要: 17, 一般: 10, 提示: 4 },
|
||||
{ date: '05-23', 严重: 19, 重要: 9, 一般: 13, 提示: 7 },
|
||||
{ date: '05-24', 严重: 24, 重要: 18, 一般: 16, 提示: 8 },
|
||||
{ date: '05-25', 严重: 36, 重要: 29, 一般: 22, 提示: 13 }
|
||||
],
|
||||
xField: 'date',
|
||||
yField: ['严重', '重要', '一般', '提示'],
|
||||
color: ['#ff4d4f', '#faad14', '#52c41a', '#1890ff'],
|
||||
smooth: true,
|
||||
legend: { position: 'top-left' },
|
||||
label: { style: { fill: '#aaa' } }
|
||||
};
|
||||
|
||||
// 告警分类占比配置
|
||||
const pieConfig = {
|
||||
data: [
|
||||
{ type: '严重', value: 8, percent: 22.2 },
|
||||
{ type: '重要', value: 12, percent: 33.3 },
|
||||
{ type: '一般', value: 11, percent: 30.6 },
|
||||
{ type: '提示', value: 5, percent: 13.9 }
|
||||
],
|
||||
angleField: 'value',
|
||||
colorField: 'type',
|
||||
color: ['#ff4d4f', '#faad14', '#52c41a', '#1890ff'],
|
||||
radius: 0.8,
|
||||
innerRadius: 0.6,
|
||||
label: {
|
||||
type: 'outer',
|
||||
content: '{name}\n{percentage:.1%} ({value})'
|
||||
},
|
||||
annotations: [
|
||||
{
|
||||
type: 'text',
|
||||
style: {
|
||||
text: '36\n总告警',
|
||||
x: '50%',
|
||||
y: '50%',
|
||||
textAlign: 'center',
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 告警来源设备分布
|
||||
const barConfig = {
|
||||
data: [
|
||||
{ device: '逆变器', count: 14, percent: 38.9 },
|
||||
{ device: '汇流箱', count: 8, percent: 22.2 },
|
||||
{ device: '组串', count: 6, percent: 16.7 },
|
||||
{ device: '气象站', count: 3, percent: 8.3 },
|
||||
{ device: '电表', count: 3, percent: 8.3 },
|
||||
{ device: '其他', count: 2, percent: 5.6 }
|
||||
],
|
||||
xField: 'count',
|
||||
yField: 'device',
|
||||
colorField: 'device',
|
||||
color: ['#1890ff', '#40a9ff', '#69c0ff', '#91d5ff', '#bae7ff', '#e6f7ff'],
|
||||
barWidthRatio: 0.6,
|
||||
label: {
|
||||
position: 'right',
|
||||
style: { fill: '#666' },
|
||||
content: (item) => `${item.count}(${item.percent}%)`
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '0 24px 24px' }}>
|
||||
|
||||
{/* ===================== 统一宽度容器 ===================== */}
|
||||
<div style={{ display: 'flex', gap: 16, marginTop: 16 }}>
|
||||
<div style={{ display: 'flex', gap: 16, marginTop: 16, width: '100%' }}>
|
||||
|
||||
{/* ===================== 左侧:所有模块宽度完全一致 ===================== */}
|
||||
<div style={{ flex: 1 }}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
|
||||
{/* 筛选卡片 */}
|
||||
<Card style={{ borderRadius: 8, border: 'none', marginBottom: 16 }} bodyStyle={{ padding: '16px' }}>
|
||||
<Row gutter={16} align="middle">
|
||||
<Col><Select placeholder="告警级别" style={{ width: 120 }} /></Col>
|
||||
<Col><Select placeholder="告警类型" style={{ width: 120 }} /></Col>
|
||||
<Col><Select placeholder="设备类型" style={{ width: 120 }} /></Col>
|
||||
<Col><RangePicker placeholder={['开始', '结束']} style={{ width: 240 }} /></Col>
|
||||
<Col><Select placeholder="处理状态" style={{ width: 120 }} /></Col>
|
||||
<Col flex="auto"><Input placeholder="搜索告警编号/内容/设备" style={{ width: '100%' }} /></Col>
|
||||
<Col><Space><Button>重置</Button><Button type="primary">查询</Button></Space></Col>
|
||||
</Row>
|
||||
</Card>
|
||||
{/* 统一容器:保证 筛选 + 统计 宽度完全一样 */}
|
||||
<div style={{ width: "100%" }}>
|
||||
|
||||
{/* 统计卡片 */}
|
||||
<Row gutter={16} style={{ marginBottom: 16 }}>
|
||||
<Col span={4}><Card bordered={false} style={{ borderRadius: 8 }}><Statistic title="今日告警总数" value={5} prefix={<BellOutlined style={{ color: '#ff4d4f' }} />} valueStyle={{ fontSize: 22 }} /><div style={{ fontSize: 12, color: '#999' }}>昨日 28</div></Card></Col>
|
||||
<Col span={4}><Card bordered={false} style={{ borderRadius: 8 }}><Statistic title="严重告警" value={0} prefix={<ExclamationCircleOutlined style={{ color: '#ff4d4f' }} />} valueStyle={{ fontSize: 22 }} /><div style={{ fontSize: 12, color: '#999' }}>重要 2</div></Card></Col>
|
||||
<Col span={4}><Card bordered={false} style={{ borderRadius: 8 }}><Statistic title="处理中" value={1} prefix={<ClockCircleOutlined style={{ color: '#faad14' }} />} valueStyle={{ fontSize: 22 }} /><div style={{ fontSize: 12, color: '#999' }}>待处理 4</div></Card></Col>
|
||||
<Col span={4}><Card bordered={false} style={{ borderRadius: 8 }}><Statistic title="已关闭" value={0} prefix={<CheckCircleOutlined style={{ color: '#52c41a' }} />} valueStyle={{ fontSize: 22 }} /><div style={{ fontSize: 12, color: '#999' }}>闭环完成</div></Card></Col>
|
||||
<Col span={4}><Card bordered={false} style={{ borderRadius: 8 }}><Statistic title="平均响应" value="49分钟" prefix={<ClockCircleOutlined style={{ color: '#1890ff' }} />} valueStyle={{ fontSize: 22 }} /><div style={{ fontSize: 12, color: '#999' }}>时间估算</div></Card></Col>
|
||||
</Row>
|
||||
{/* 筛选卡片 */}
|
||||
<Card style={{ borderRadius: 8, border: 'none', marginBottom: 16 }} bodyStyle={{ padding: '16px' }}>
|
||||
<Row gutter={16} align="middle">
|
||||
<Col><Select placeholder="告警级别" style={{ width: 120 }} /></Col>
|
||||
<Col><Select placeholder="告警类型" style={{ width: 120 }} /></Col>
|
||||
<Col><Select placeholder="设备类型" style={{ width: 120 }} /></Col>
|
||||
<Col><RangePicker placeholder={['开始', '结束']} style={{ width: 240 }} /></Col>
|
||||
<Col><Select placeholder="处理状态" style={{ width: 120 }} /></Col>
|
||||
<Col flex="auto"><Input placeholder="搜索告警编号/内容/设备" style={{ width: '100%' }} /></Col>
|
||||
<Col><Space><Button>重置</Button><Button type="primary">查询</Button></Space></Col>
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
{/* 告警列表(宽度 = 筛选卡片 完全一致) */}
|
||||
<Card bordered={false} style={{ borderRadius: 8 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
||||
<div>
|
||||
<Typography.Text strong style={{ fontSize: 16 }}>告警列表(共8条)</Typography.Text><br />
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>点击告警查看详情</Text>
|
||||
{/* 统计卡片 - 现在和筛选卡片一样宽 */}
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "16px",
|
||||
marginBottom: 16,
|
||||
width: "100%"
|
||||
}}
|
||||
>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Card bordered={false} style={{ borderRadius: 8, padding: '12px' }} bodyStyle={{ padding: '12px 0 0 0' }}>
|
||||
<Statistic
|
||||
title="今日告警总数"
|
||||
value={5}
|
||||
prefix={<BellOutlined style={{ color: '#ff4d4f' }} />}
|
||||
valueStyle={{ fontSize: 28, fontWeight: 700, color: '#ff4d4f' }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>昨日 28</div>
|
||||
</Card>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Card bordered={false} style={{ borderRadius: 8, padding: '12px' }} bodyStyle={{ padding: '8px 0 0 0' }}>
|
||||
<Statistic
|
||||
title="严重告警"
|
||||
value={0}
|
||||
prefix={<ExclamationCircleOutlined style={{ color: '#ff4d4f' }} />}
|
||||
valueStyle={{ fontSize: 28, fontWeight: 700, color: '#ff4d4f' }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>重要 2</div>
|
||||
</Card>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Card bordered={false} style={{ borderRadius: 8, padding: '12px' }} bodyStyle={{ padding: '8px 0 0 0' }}>
|
||||
<Statistic
|
||||
title="处理中"
|
||||
value={1}
|
||||
prefix={<ClockCircleOutlined style={{ color: '#faad14' }} />}
|
||||
valueStyle={{ fontSize: 28, fontWeight: 700, color: '#faad14' }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>待处理 4</div>
|
||||
</Card>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Card bordered={false} style={{ borderRadius: 8, padding: '12px' }} bodyStyle={{ padding: '8px 0 0 0' }}>
|
||||
<Statistic
|
||||
title="已关闭"
|
||||
value={0}
|
||||
prefix={<CheckCircleOutlined style={{ color: '#52c41a' }} />}
|
||||
valueStyle={{ fontSize: 28, fontWeight: 700, color: '#52c41a' }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>闭环完成</div>
|
||||
</Card>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Card bordered={false} style={{ borderRadius: 8, padding: '12px' }} bodyStyle={{ padding: '8px 0 0 0' }}>
|
||||
<Statistic
|
||||
title="平均响应"
|
||||
value="49分钟"
|
||||
prefix={<ClockCircleOutlined style={{ color: '#1890ff' }} />}
|
||||
valueStyle={{ fontSize: 28, fontWeight: 700, color: '#1890ff' }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>时间估算</div>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
rowKey="id"
|
||||
columns={columns}
|
||||
dataSource={mockAlerts}
|
||||
pagination={{ pageSize: 8 }}
|
||||
scroll={{ x: '100%' }}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* 告警列表(宽度 = 筛选卡片 完全一致) */}
|
||||
{/* 告警列表 + 右侧详情(不换行、表格自适应、可横向滚动) */}
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
gap: 16,
|
||||
width: '100%',
|
||||
flexWrap: 'nowrap', /* 强制不换行 */
|
||||
alignItems: 'stretch', /* 高度对齐 */
|
||||
marginBottom: 16
|
||||
}}>
|
||||
|
||||
{/* 左侧告警列表:自适应宽度 + 横向滚动 */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
minWidth: 0, /* 关键:允许表格缩小 */
|
||||
}}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{
|
||||
borderRadius: 8,
|
||||
marginBottom: 16,
|
||||
height: '100%',
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
||||
<div>
|
||||
<Typography.Text strong style={{ fontSize: 16 }}>告警列表(共8条)</Typography.Text><br />
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>点击告警查看详情</Text>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
rowKey="id"
|
||||
columns={columns}
|
||||
dataSource={mockAlerts}
|
||||
pagination={{ pageSize: 8 }}
|
||||
scroll={{ x: 'max-content' }} /* 表格超出自动横向滚动 */
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* 右侧详情:固定 360px,不挤压、不换行 */}
|
||||
{detailVisible && selectedAlert && (
|
||||
<div style={{
|
||||
width: 360,
|
||||
flexShrink: 0, /* 关键:不被挤压 */
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}}>
|
||||
<Card
|
||||
title="告警详情"
|
||||
bordered={false}
|
||||
style={{
|
||||
borderRadius: 8,
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
overflow: 'hidden'
|
||||
}}
|
||||
bodyStyle={{
|
||||
padding: '16px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flex: 1,
|
||||
overflow: 'hidden'
|
||||
}}
|
||||
>
|
||||
|
||||
{/* 可滚动内容区域 */}
|
||||
<div style={{ flex: 1, overflow: 'auto', paddingRight: 8 }}>
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<ExclamationCircleOutlined style={{ color: '#ff4d4f', marginRight: 8 }} />
|
||||
<span style={{ fontSize: 16, fontWeight: 500 }}>{selectedAlert.content}</span>
|
||||
</div>
|
||||
<Tag color={levelColor[selectedAlert.level]}>{selectedAlert.level}</Tag>
|
||||
</div>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>{selectedAlert.id}</div>
|
||||
</div>
|
||||
|
||||
<div style={{ background: '#fafafa', borderRadius: 8, padding: 16, marginBottom: 16 }}>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>来源设备</div><div>{selectedAlert.device}</div></Col>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>发生时间</div><div>{selectedAlert.time}</div></Col>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>持续时长</div><div>{selectedAlert.duration}</div></Col>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>处理状态</div><div>{selectedAlert.status}</div></Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<div style={{ fontWeight: 500, marginBottom: 8 }}>根因分析建议</div>
|
||||
<div style={{ fontSize: 12, color: '#666', lineHeight: 1.7 }}>
|
||||
设备离线/网络异常<br />
|
||||
电源或通讯模块故障<br />
|
||||
现场信号弱或采集器异常
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 固定底部操作按钮 */}
|
||||
<div style={{ marginTop: 12, paddingTop: 12, borderTop: '1px solid #f0f0f0' }}>
|
||||
<Space direction="vertical" style={{ width: '100%' }}>
|
||||
<Button type="primary" block>确认告警</Button>
|
||||
<Button block>标记处理中</Button>
|
||||
<Button block danger>关闭告警</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 三个图表卡片:告警趋势 + 分类占比 + 设备分布 */}
|
||||
<Row gutter={16}>
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ borderRadius: 8 }}
|
||||
title="告警趋势"
|
||||
extra={<Button type="link">更多 </Button>}
|
||||
>
|
||||
<Line {...trendConfig} height={180} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ borderRadius: 8 }}
|
||||
title="告警分类占比"
|
||||
extra={<Button type="link">更多 </Button>}
|
||||
>
|
||||
<Pie {...pieConfig} height={180} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ borderRadius: 8 }}
|
||||
title="告警来源设备分布"
|
||||
extra={<Button type="link">更多</Button>}
|
||||
>
|
||||
<Bar {...barConfig} height={180} />
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
</div>
|
||||
|
||||
{/* ===================== 右侧详情面板 ===================== */}
|
||||
{detailVisible && selectedAlert && (
|
||||
<div style={{ width: 360, flexShrink: 0 }}>
|
||||
<Card title="告警详情" bordered={false} style={{ borderRadius: 8, height: '100%' }}>
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<ExclamationCircleOutlined style={{ color: '#ff4d4f', marginRight: 8 }} />
|
||||
<span style={{ fontSize: 16, fontWeight: 500 }}>{selectedAlert.content}</span>
|
||||
</div>
|
||||
<Tag color={levelColor[selectedAlert.level]}>{selectedAlert.level}</Tag>
|
||||
</div>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>{selectedAlert.id}</div>
|
||||
</div>
|
||||
{/* ===================== 右侧详情面板:高度拉伸至视口 ===================== */}
|
||||
|
||||
<div style={{ background: '#fafafa', borderRadius: 8, padding: 16, marginBottom: 16 }}>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>来源设备</div><div>{selectedAlert.device}</div></Col>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>发生时间</div><div>{selectedAlert.time}</div></Col>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>持续时长</div><div>{selectedAlert.duration}</div></Col>
|
||||
<Col span={12}><div style={{ fontSize: 12, color: '#888' }}>处理状态</div><div>{selectedAlert.status}</div></Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<div style={{ fontWeight: 500, marginBottom: 8 }}>根因分析建议</div>
|
||||
<div style={{ fontSize: 12, color: '#666', lineHeight: 1.7 }}>
|
||||
设备离线/网络异常<br />
|
||||
电源或通讯模块故障<br />
|
||||
现场信号弱或采集器异常
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Space direction="vertical" style={{ width: '100%' }}>
|
||||
<Button type="primary" block>确认告警</Button>
|
||||
<Button block>标记处理中</Button>
|
||||
<Button block danger>关闭告警</Button>
|
||||
</Space>
|
||||
</Card>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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">更多></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">更多></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">详细></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">更多></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">更多></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">更多></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 >
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user