中英文切换 初始化
This commit is contained in:
@@ -16,22 +16,14 @@ import { Line, Bar, Pie } from '@ant-design/charts';
|
||||
import bgMain from '../assets/images/bgmain.jpg';
|
||||
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts';
|
||||
import CesiumMap from '../components/Map';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const { Option } = Select;
|
||||
const { Search } = Input;
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
// 模拟数据扩展
|
||||
const deviceList = [
|
||||
{ id: 1, name: '逆变器 INV-01', type: '逆变器', status: '正常', data: '164.2 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 2, name: '逆变器 INV-02', type: '逆变器', status: '正常', data: '166.8 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 3, name: '逆变器 INV-03', type: '逆变器', status: '正常', data: '162.1 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 4, name: '逆变器 INV-04', type: '逆变器', status: '正常', data: '159.7 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 5, name: '逆变器 INV-05', type: '逆变器', status: '告警', data: '159.8 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 6, name: '汇流箱 01', type: '汇流箱', status: '正常', data: '32 组 / 32 组', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 7, name: '汇流箱 02', type: '汇流箱', status: '正常', data: '32 组 / 32 组', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 8, name: '气象站', type: '气象站', status: '正常', data: '28.0 ℃ / 815W/m²', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
];
|
||||
|
||||
|
||||
const powerTrendData = [
|
||||
{ time: '00:00', value: 0, type: '实时功率' },
|
||||
@@ -54,6 +46,7 @@ const inverterPowerData = [
|
||||
const heatmapColors = ['#52c41a', '#1890ff', '#faad14', '#1890ff', '#52c41a'];
|
||||
|
||||
const RealTimeMonitorPage = () => {
|
||||
const { t } = useTranslation();
|
||||
const [filterStatus, setFilterStatus] = useState('all');
|
||||
const [filterType, setFilterType] = useState(undefined);
|
||||
const [searchName, setSearchName] = useState('');
|
||||
@@ -61,7 +54,7 @@ const RealTimeMonitorPage = () => {
|
||||
const cardStyle = { borderRadius: 12, border: '1px solid #f0f0f0', boxShadow: '0 2px 8px rgba(0,0,0,0.04)' };
|
||||
|
||||
const getStatusTag = (status) => {
|
||||
const color = status === '正常' ? '#52c41a' : status === '告警' ? '#faad14' : '#999';
|
||||
const color = status === t('roles.normal') ? '#52c41a' : status === t('constants.sourceAlert') ? '#faad14' : '#999';
|
||||
return (
|
||||
<Space size={4}>
|
||||
<span style={{ width: 8, height: 8, borderRadius: '50%', background: color, display: 'inline-block' }} />
|
||||
@@ -72,18 +65,18 @@ const RealTimeMonitorPage = () => {
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '设备名称', dataIndex: 'name', key: 'name',
|
||||
title: t('devices.deviceName'), dataIndex: 'name', key: 'name',
|
||||
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 }} />}
|
||||
{record.type === t('home.inverter') ? <ThunderboltOutlined style={{ fontSize: 14 }} /> : <BranchesOutlined style={{ fontSize: 14 }} />}
|
||||
</div>
|
||||
<span style={{ fontSize: 13 }}>{text}</span>
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
{ title: '类型', dataIndex: 'type', render: (t) => <span style={{ fontSize: 13, color: '#666' }}>{t}</span> },
|
||||
{ title: '当前状态', dataIndex: 'status', render: getStatusTag },
|
||||
{ title: t('common.type'), dataIndex: 'type', render: (t) => <span style={{ fontSize: 13, color: '#666' }}>{t}</span> },
|
||||
{ title: t('workOrder.currentStatus'), dataIndex: 'status', render: getStatusTag },
|
||||
{ title: '实时功率/数据', dataIndex: 'data', render: (d) => <span style={{ fontSize: 13, fontWeight: 500 }}>{d}</span> },
|
||||
{
|
||||
title: '通讯状态', dataIndex: 'communication',
|
||||
@@ -94,7 +87,17 @@ const RealTimeMonitorPage = () => {
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
{ title: '更新时间', dataIndex: 'updateTime', render: (t) => <span style={{ fontSize: 12, color: '#999' }}>{t}</span> }
|
||||
{ title: t('common.updateTime'), dataIndex: 'updateTime', render: (t) => <span style={{ fontSize: 12, color: '#999' }}>{t}</span> }
|
||||
];
|
||||
const deviceList = [
|
||||
{ id: 1, name: '逆变器 INV-01', type: t('home.inverter'), status: t('roles.normal'), data: '164.2 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 2, name: '逆变器 INV-02', type: t('home.inverter'), status: t('roles.normal'), data: '166.8 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 3, name: '逆变器 INV-03', type: t('home.inverter'), status: t('roles.normal'), data: '162.1 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 4, name: '逆变器 INV-04', type: t('home.inverter'), status: t('roles.normal'), data: '159.7 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 5, name: '逆变器 INV-05', type: t('home.inverter'), status: t('constants.sourceAlert'), data: '159.8 KW', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 6, name: '汇流箱 01', type: t('home.combinerBox'), status: t('roles.normal'), data: '32 组 / 32 组', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 7, name: '汇流箱 02', type: t('home.combinerBox'), status: t('roles.normal'), data: '32 组 / 32 组', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
{ id: 8, name: '气象站', type: '气象站', status: t('roles.normal'), data: '28.0 ℃ / 815W/m²', communication: '通讯正常', updateTime: '2025-05-25 10:24:15' },
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -112,9 +115,9 @@ const RealTimeMonitorPage = () => {
|
||||
title={<span style={{ fontWeight: 800, fontSize: 13 }}>电站拓扑图 (实时)</span>}
|
||||
extra={
|
||||
<div style={{ display: 'flex', gap: 12, fontSize: 11 }}>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#52c41a', marginRight: 4 }}></span>正常</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#faad14', marginRight: 4 }}></span>告警</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#888', marginRight: 4 }}></span>离线</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#52c41a', marginRight: 4 }}></span>roles.normal</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#faad14', marginRight: 4 }}></span>constants.sourceAlert</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#888', marginRight: 4 }}></span>devices.offline</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ color: '#1890ff', marginLeft: 4 }}>•• 通讯中</span></span>
|
||||
</div>
|
||||
}
|
||||
@@ -185,7 +188,7 @@ const RealTimeMonitorPage = () => {
|
||||
{ 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: '4,752', unit: t('home.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) => (
|
||||
@@ -268,18 +271,18 @@ const RealTimeMonitorPage = () => {
|
||||
</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' },
|
||||
{ name: '逆变器 INV-01', status: t('roles.normal'), color: '#52c41a' },
|
||||
{ name: '逆变器 INV-02', status: t('roles.normal'), color: '#52c41a' },
|
||||
{ name: '逆变器 INV-03', status: t('roles.normal'), color: '#52c41a' },
|
||||
{ name: '逆变器 INV-04', status: t('roles.normal'), color: '#52c41a' },
|
||||
{ name: '逆变器 INV-05', status: t('constants.sourceAlert'), color: '#faad14' },
|
||||
{ name: '气象站', status: t('roles.normal'), color: '#52c41a' },
|
||||
{ name: '无人机机场', status: t('roles.normal'), color: '#52c41a' },
|
||||
{ name: t('home.inspectionRobot'), status: t('roles.normal'), 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 }} />}
|
||||
{item.name.includes(t('home.inverter')) ? <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>
|
||||
@@ -300,17 +303,17 @@ const RealTimeMonitorPage = () => {
|
||||
outerRadius={65}
|
||||
data={[
|
||||
{
|
||||
name: '在线',
|
||||
name: t('devices.online'),
|
||||
value: 52,
|
||||
color: '#52c41a',
|
||||
},
|
||||
{
|
||||
name: '离线',
|
||||
name: t('devices.offline'),
|
||||
value: 3,
|
||||
color: '#d9d9d9',
|
||||
},
|
||||
{
|
||||
name: '告警',
|
||||
name: t('constants.sourceAlert'),
|
||||
value: 1,
|
||||
color: '#faad14',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user