中英文切换 初始化
This commit is contained in:
@@ -27,10 +27,12 @@ import { addWorkOrder } from '../api/workOrder';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { getAlarmList } from '../api/alarmApi';
|
||||
import { RootState } from '../store';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
export default function StationDashboard() {
|
||||
const { t } = useTranslation();
|
||||
// 👇 消息提示(修复缺失)
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
|
||||
@@ -86,10 +88,10 @@ export default function StationDashboard() {
|
||||
|
||||
|
||||
const deviceStatus = [
|
||||
{ name: "汇流箱", count: "2/2", status: "异常 1" },
|
||||
{ name: "逆变器", count: "3/3", status: "异常 1" },
|
||||
{ name: "电表", count: "1/1", status: "正常" },
|
||||
{ name: "巡检机器人", count: "1/1", status: "正常" }
|
||||
{ name: t('home.combinerBox'), count: "2/2", status: "异常 1" },
|
||||
{ name: t('home.inverter'), count: "3/3", status: "异常 1" },
|
||||
{ name: "电表", count: "1/1", status: t('roles.normal') },
|
||||
{ name: t('home.inspectionRobot'), count: "1/1", status: t('roles.normal') }
|
||||
];
|
||||
|
||||
const patrolRecords = [
|
||||
@@ -100,8 +102,8 @@ export default function StationDashboard() {
|
||||
|
||||
const aiAnalysis = [
|
||||
{ type: "AI分析", content: "AI发现逆变器温度与组串电流存在轻微异常,建议优先复核A区设备。", desc: "发现2处组件存在异常热斑" },
|
||||
{ type: "严重", content: "INV-A02散热检修建议:建议检查INV-A02散热风扇、风道和运行负载,持续高温时转维修工单。", desc: "3个组串存在发电异常" },
|
||||
{ type: "严重", content: "A05阵列热斑处置建议:建议现场复核PV-A05-018至PV-A05-020组件接线和旁路二极管状态,必要时更换异常组件。", desc: "整体发电偏差-2.8%" }
|
||||
{ type: t('constants.critical'), content: "INV-A02散热检修建议:建议检查INV-A02散热风扇、风道和运行负载,持续高温时转维修工单。", desc: "3个组串存在发电异常" },
|
||||
{ type: t('constants.critical'), content: "A05阵列热斑处置建议:建议现场复核PV-A05-018至PV-A05-020组件接线和旁路二极管状态,必要时更换异常组件。", desc: "整体发电偏差-2.8%" }
|
||||
];
|
||||
|
||||
// 图表数据
|
||||
@@ -141,10 +143,10 @@ export default function StationDashboard() {
|
||||
];
|
||||
|
||||
const taskProgressData = [
|
||||
{ name: '已完成', value: 40, color: '#1890ff' },
|
||||
{ name: t('workOrder.completed'), value: 40, color: '#1890ff' },
|
||||
{ name: '进行中', value: 35, color: '#52c41a' },
|
||||
{ name: '待开始', value: 20, color: '#faad14' },
|
||||
{ name: '异常', value: 5, color: '#ff4d4f' },
|
||||
{ name: t('home.abnormal'), value: 5, color: '#ff4d4f' },
|
||||
];
|
||||
|
||||
const cardStyle = { borderRadius: 12, border: '1px solid #f0f0f0', boxShadow: '0 2px 8px rgba(0,0,0,0.04)' };
|
||||
@@ -157,7 +159,7 @@ export default function StationDashboard() {
|
||||
// ==============================================
|
||||
const handleaddOrder = async () => {
|
||||
if (!currentStation) {
|
||||
messageApi.warning('请先选择电站');
|
||||
messageApi.warning(t('home.pleaseSelectStation'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -239,12 +241,12 @@ export default function StationDashboard() {
|
||||
{/* 顶部统计卡片 */}
|
||||
<Row gutter={[8, 8]} style={{ margin: '0 4px 0px 4px' }}>
|
||||
{[
|
||||
{ title: '今日发电量', value: '4,752', unit: 'kWh', sub: '日目标 5,000 kWh', color: '#00B42A', bg: '#E8FFEA', icon: <ThunderboltOutlined /> },
|
||||
{ title: '当前功率', value: '812.6', unit: 'kW', sub: '装机容量 1,000 kWp', color: '#165DFF', bg: '#E8F3FF', icon: <DashboardOutlined /> },
|
||||
{ title: t('home.todayGeneration'), value: '4,752', unit: t('home.kWh'), sub: '日目标 5,000 kWh', color: '#00B42A', bg: '#E8FFEA', icon: <ThunderboltOutlined /> },
|
||||
{ title: t('home.currentPower'), value: '812.6', unit: 'kW', sub: '装机容量 1,000 kWp', color: '#165DFF', bg: '#E8F3FF', icon: <DashboardOutlined /> },
|
||||
{ title: 'Performance Ratio', value: '82.6%', unit: '', sub: '昨日 81.3% ↑1.3%', color: '#00B42A', bg: '#E8FFEA', icon: <BarChartOutlined /> },
|
||||
{ title: '系统可用率', value: '99.35%', unit: '', sub: '昨日 99.12% ↑0.23%', color: '#165DFF', bg: '#E8F3FF', icon: <RiseOutlined /> },
|
||||
{ title: '告警数量', value: alarmList.length, unit: '', sub: `未处理 ${alarmList.filter(item => item.handleStatus == 1).length} / 已关闭 ${alarmList.filter(item => item.handleStatus == 2).length}`, color: '#F53F3F', bg: '#FFF1F0', icon: <BellOutlined /> },
|
||||
{ title: '节省运维成本', value: '¥ 36,540', unit: '', sub: '本月累计节省', color: '#FF7D00', bg: '#FFF7E8', icon: <MoneyCollectOutlined /> },
|
||||
{ title: t('home.systemAvailability'), value: '99.35%', unit: '', sub: '昨日 99.12% ↑0.23%', color: '#165DFF', bg: '#E8F3FF', icon: <RiseOutlined /> },
|
||||
{ title: t('home.alertCount'), value: alarmList.length, unit: '', sub: `未处理 ${alarmList.filter(item => item.handleStatus == 1).length} / 已关闭 ${alarmList.filter(item => item.handleStatus == 2).length}`, color: '#F53F3F', bg: '#FFF1F0', icon: <BellOutlined /> },
|
||||
{ title: t('home.costSaving'), value: '¥ 36,540', unit: '', sub: t('home.monthlyAccumulated'), color: '#FF7D00', bg: '#FFF7E8', icon: <MoneyCollectOutlined /> },
|
||||
].map((item, idx) => (
|
||||
<Col key={idx} style={{
|
||||
flex: '1 1 auto',
|
||||
@@ -280,7 +282,7 @@ export default function StationDashboard() {
|
||||
{/* 左侧图表 */}
|
||||
<Col xs={24} xl={6}>
|
||||
<Space direction="vertical" size={8} style={{ width: '100%' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>发电趋势</span>} extra={<Space><SyncOutlined /><FullscreenOutlined /></Space>} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.generationTrend')}</span>} extra={<Space><SyncOutlined /><FullscreenOutlined /></Space>} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}>
|
||||
<div style={{ fontSize: 11, color: '#666', marginBottom: 8 }}>今日发电功率趋势 (kW)</div>
|
||||
<UniversalLineChart
|
||||
data={powerTrendData}
|
||||
@@ -290,12 +292,12 @@ export default function StationDashboard() {
|
||||
dot
|
||||
backgroundColor="transparent"
|
||||
series={[
|
||||
{ key: 'actual', name: '实际', color: '#165DFF', strokeWidth: 3 },
|
||||
{ key: 'predict', name: '预测', color: '#00B42A', strokeWidth: 2 },
|
||||
{ key: 'actual', name: t('home.actual'), color: '#165DFF', strokeWidth: 3 },
|
||||
{ key: 'predict', name: t('home.predict'), color: '#00B42A', strokeWidth: 2 },
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>辐照度与温度趋势</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.irradianceTempTrend')}</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}>
|
||||
<UniversalLineChart
|
||||
data={irradianceData}
|
||||
xKey="time"
|
||||
@@ -304,12 +306,12 @@ export default function StationDashboard() {
|
||||
dot
|
||||
backgroundColor="transparent"
|
||||
series={[
|
||||
{ key: 'irradiance', name: '辐照度', color: '#165DFF', strokeWidth: 3 },
|
||||
{ key: 'temperature', name: '温度', color: '#00B42A', strokeWidth: 2 },
|
||||
{ key: 'irradiance', name: t('home.irradiance'), color: '#165DFF', strokeWidth: 3 },
|
||||
{ key: 'temperature', name: t('home.temperature'), color: '#00B42A', strokeWidth: 2 },
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>逆变器效率对比</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.inverterEfficiency')}</span>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<UniversalBarChart
|
||||
data={invEfficiencyData}
|
||||
xKey="device"
|
||||
@@ -320,7 +322,7 @@ export default function StationDashboard() {
|
||||
series={[{ key: 'efficiency', name: '效率', color: '#165DFF' }]}
|
||||
/>
|
||||
</Card>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>运维任务进度</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.maintenanceProgress')}</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<UniversalPieChart
|
||||
data={taskProgressData}
|
||||
@@ -347,11 +349,11 @@ export default function StationDashboard() {
|
||||
<Card
|
||||
title={
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<span style={{ fontWeight: 800 }}>电站概览</span>
|
||||
<span style={{ fontWeight: 800 }}>{t('home.stationOverview')}</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: '#52c41a', marginRight: 4 }}></span>roles.normal</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#ff4d4f', marginRight: 4 }}></span>constants.sourceAlert</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#888', marginRight: 4 }}></span>devices.offline</span>
|
||||
<span style={{ display: 'flex', alignItems: 'center' }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#faad14', marginRight: 4 }}></span>维护中</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -376,7 +378,7 @@ export default function StationDashboard() {
|
||||
|
||||
<Row gutter={16}>
|
||||
<Col span={12}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>近期巡检记录</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={{ ...cardStyle, height: "100%" }} bodyStyle={{ padding: '0 12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.recentInspection')}</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={{ ...cardStyle, height: "100%" }} bodyStyle={{ padding: '0 12px' }}>
|
||||
<Table
|
||||
dataSource={patrolRecords}
|
||||
pagination={false}
|
||||
@@ -385,13 +387,13 @@ export default function StationDashboard() {
|
||||
{ title: '巡检类型', dataIndex: 'name', key: 'name', ellipsis: true },
|
||||
{ title: '巡检时间', dataIndex: 'time', key: 'time' },
|
||||
{ title: '巡检人员', dataIndex: 'person', key: 'person', render: (t) => t.substring(0, 10) },
|
||||
{ title: '状态', dataIndex: 'status', key: 'status', render: () => <span style={{ color: '#52c41a', fontSize: 12 }}>● 已完成</span> },
|
||||
{ title: t('roles.status'), dataIndex: 'status', key: 'status', render: () => <span style={{ color: '#52c41a', fontSize: 12 }}>● 已完成</span> },
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>AI 分析摘要</span>} bordered={false} style={{ ...cardStyle, height: "100%" }} bodyStyle={{ padding: '12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.aiAnalysisSummary')}</span>} bordered={false} style={{ ...cardStyle, height: "100%" }} bodyStyle={{ padding: '12px' }}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
@@ -403,7 +405,7 @@ export default function StationDashboard() {
|
||||
<div style={{ fontSize: 14, color: '#4E5969', marginTop: 4 }}>发现 <span style={{ color: '#165DFF', fontWeight: 600 }}>2</span> 处组件存在异常热斑</div>
|
||||
</div>
|
||||
</div>
|
||||
<Button type="link" size="small" style={{ color: '#165DFF' }}>查看详情</Button>
|
||||
<Button type="link" size="small" style={{ color: '#165DFF' }}>{t('common.viewDetail')}</Button>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
@@ -415,7 +417,7 @@ export default function StationDashboard() {
|
||||
<div style={{ fontSize: 14, color: '#4E5969', marginTop: 4 }}><span style={{ color: '#165DFF', fontWeight: 600 }}>3</span> 个组串存在发电异常</div>
|
||||
</div>
|
||||
</div>
|
||||
<Button type="link" size="small" style={{ color: '#165DFF' }}>查看详情</Button>
|
||||
<Button type="link" size="small" style={{ color: '#165DFF' }}>{t('common.viewDetail')}</Button>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
@@ -427,7 +429,7 @@ export default function StationDashboard() {
|
||||
<div style={{ fontSize: 14, color: '#4E5969', marginTop: 4 }}>整体发电偏差 <span style={{ color: '#165DFF', fontWeight: 600 }}>-2.8%</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<Button type="link" size="small" style={{ color: '#165DFF' }}>查看详情</Button>
|
||||
<Button type="link" size="small" style={{ color: '#165DFF' }}>{t('common.viewDetail')}</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -439,7 +441,7 @@ export default function StationDashboard() {
|
||||
{/* 右侧 */}
|
||||
<Col xs={24} xl={6}>
|
||||
<Space direction="vertical" size={8} style={{ width: '100%' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>实时告警</span>} extra={<Button type="link" size="small" onClick={() => navigate('/alerts')}>更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('alerts.realtimeAlert')}</span>} extra={<Button type="link" size="small" onClick={() => navigate('/alerts/all')}>更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 12, padding: '0 4px 8px', borderBottom: '1px solid #f0f0f0', fontSize: 13, color: '#666' }}>
|
||||
<span style={{ flex: 3 }}>告警内容</span>
|
||||
<span style={{ flex: 1, textAlign: 'center' }}>级别</span>
|
||||
@@ -463,17 +465,17 @@ export default function StationDashboard() {
|
||||
})}
|
||||
</Card>
|
||||
|
||||
<Card title={<span style={{ fontWeight: 800 }}>设备在线状态</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.deviceOnlineStatus')}</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<Row gutter={[16, 16]}>
|
||||
{[
|
||||
{ name: '组件阵列', count: '320/320', icon: <AppstoreOutlined /> },
|
||||
{ name: '逆变器', count: '5/5', icon: <ThunderboltOutlined /> },
|
||||
{ name: '汇流箱', count: '20/20', icon: <BranchesOutlined /> },
|
||||
{ name: t('home.inverter'), count: '5/5', icon: <ThunderboltOutlined /> },
|
||||
{ name: t('home.combinerBox'), count: '20/20', icon: <BranchesOutlined /> },
|
||||
{ name: '气象站', count: '1/1', icon: <CloudOutlined /> },
|
||||
{ name: '摄像头', count: '12/12', icon: <VideoCameraOutlined /> },
|
||||
{ name: t('devices.camera'), count: '12/12', icon: <VideoCameraOutlined /> },
|
||||
{ name: '环境传感器', count: '8/8', icon: <ExperimentOutlined /> },
|
||||
{ name: '无人机', count: '1/1', icon: <RocketOutlined /> },
|
||||
{ name: '巡检机器人', count: '1/1', icon: <RobotOutlined /> },
|
||||
{ name: t('constants.uav'), count: '1/1', icon: <RocketOutlined /> },
|
||||
{ name: t('home.inspectionRobot'), count: '1/1', icon: <RobotOutlined /> },
|
||||
].map((item, idx) => (
|
||||
<Col span={6} key={idx} style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<div style={{ width: 20, height: 20, borderRadius: '50%', border: '2px solid #52c41a', display: 'flex', alignItems: 'center', justifyContent: 'center', marginRight: 12, flexShrink: 0 }}>
|
||||
@@ -488,7 +490,7 @@ export default function StationDashboard() {
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
<Card title={<span style={{ fontWeight: 800 }}>天气信息</span>} extra={<Button type="link" size="small">详细 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('home.weatherInfo')}</span>} extra={<Button type="link" size="small">详细 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'start', gap: 20 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<WeatherDisplay type={weatherType} />
|
||||
@@ -508,13 +510,13 @@ export default function StationDashboard() {
|
||||
{/* ====================================== */}
|
||||
{/* 👇 清洗建议 + 生成工单按钮(已完善) */}
|
||||
{/* ====================================== */}
|
||||
<Card title={<span style={{ fontWeight: 800 }}>清洗建议</span>} extra={<Button type="link" size="small">更多 ></Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
|
||||
<Card title={<span style={{ fontWeight: 800 }}>{t('clean.cleaningSuggestion')}</span>} extra={<Button type="link" size="small">更多 ></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' }}>
|
||||
<UniversalPieChart
|
||||
data={[
|
||||
{ name: '清洁度', value: 85, color: '#00B42A' },
|
||||
{ name: '待清洗', value: 15, color: '#E8FFEA' },
|
||||
{ name: t('clean.pending'), value: 15, color: '#E8FFEA' },
|
||||
]}
|
||||
width="100%"
|
||||
height="100%"
|
||||
|
||||
Reference in New Issue
Block a user