中英文切换 初始化

This commit is contained in:
mmc
2026-08-12 11:29:44 +08:00
parent 541e16f742
commit a8af55a856
76 changed files with 5847 additions and 1962 deletions

View File

@@ -11,18 +11,11 @@ import {
SelectOutlined, FireOutlined, WarningOutlined, ExclamationCircleOutlined
} from '@ant-design/icons';
import { Line, Area } from '@ant-design/charts';
import { useTranslation } from 'react-i18next';
import { UniversalLineChart } from "../components/recharts"
const { Title, Text } = Typography;
// 模拟数据
const aiSummaryData = [
{ key: '1', diagnosis: '热斑检测', status: '异常', confidence: '92%', impact: '高', conclusion: '检测到 36 处热斑疑似点' },
{ key: '2', diagnosis: '组串失配', status: '异常', confidence: '90%', impact: '高', conclusion: '8 串组串存在异常' },
{ key: '3', diagnosis: '遮挡风险', status: '轻微', confidence: '78%', impact: '中', conclusion: '局部遮挡影响 2% 发电量' },
{ key: '4', diagnosis: '组件衰减', status: '异常', confidence: '86%', impact: '中', conclusion: '平均衰减率 -5.32%' },
{ key: '5', diagnosis: '逆变器效率异常', status: '正常', confidence: '93%', impact: '低', conclusion: '所有逆变器运行正常' },
];
const aiRecommendations = [
{ key: '1', measure: '处理热斑组件', priority: '高', expectedGain: '+2.15%', confidence: '92%' },
@@ -137,6 +130,7 @@ const generationPerformanceData = [
export default function AIDiagnosisPage() {
const { t } = useTranslation();
const cardStyle = {
borderRadius: 12,
border: '1px solid #f0f0f0',
@@ -146,9 +140,9 @@ export default function AIDiagnosisPage() {
const renderStatusTag = (status: string) => {
let color = '';
if (status === '异常') color = '#ff4d4f';
if (status === t('home.abnormal')) color = '#ff4d4f';
else if (status === '轻微') color = '#1677ff';
else if (status === '正常') color = '#52c41a';
else if (status === t('roles.normal')) color = '#52c41a';
return <Tag color={color} style={{ margin: 0, fontWeight: 600 }}>{status}</Tag>;
};
@@ -214,7 +208,7 @@ export default function AIDiagnosisPage() {
{ title: '异常组串数量', value: '8', trend: '较昨日 +2 ↑', icon: <AppstoreOutlined />, color: '#1D2129', bg: '#F5F7FA', trendColor: '#F53F3F', direction: 'up' },
{ title: '热斑疑似数量', value: '36', trend: '较昨日 +5 ↑', icon: <BellOutlined />, color: '#F53F3F', bg: '#FFF1F0', trendColor: '#F53F3F', direction: 'up' },
{ title: '电站健康度评分', value: '86.3', unit: '分', trend: '较昨日 -1.7', icon: <CheckCircleOutlined />, color: '#00B42A', bg: '#E8FFEA', trendColor: '#F53F3F', direction: 'down' },
{ title: '预测发电量', value: '4,821', unit: 'kWh', trend: '较昨日 +2.6% ↑', icon: <ThunderboltOutlined />, color: '#165DFF', bg: '#E8F3FF', trendColor: '#00B42A', direction: 'up' },
{ title: '预测发电量', value: '4,821', unit: t('home.kWh'), trend: '较昨日 +2.6% ↑', icon: <ThunderboltOutlined />, color: '#165DFF', bg: '#E8F3FF', trendColor: '#00B42A', direction: 'up' },
].map((item, index) => (
<Col key={index} xs={24} sm={12} md={8} xl={4}>
<Card
@@ -478,8 +472,8 @@ export default function AIDiagnosisPage() {
/> </div>
<div style={{ width: 120, display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 16, flexShrink: 0, paddingLeft: 16, borderLeft: '1px solid #f0f0f0' }}>
{[
{ label: '当日实际发电', value: '4,752', unit: 'kWh', color: '#165DFF' },
{ label: '当日预测发电', value: '4,960', unit: 'kWh', color: '#00B42A' },
{ label: '当日实际发电', value: '4,752', unit: t('home.kWh'), color: '#165DFF' },
{ label: '当日预测发电', value: '4,960', unit: t('home.kWh'), color: '#00B42A' },
{ label: '发电偏差率', value: '-4.35%', unit: '', color: '#F53F3F' },
{ label: '实时 PR 值', value: '82.6%', unit: '', color: '#1D2129' },
].map(item => (
@@ -508,17 +502,17 @@ export default function AIDiagnosisPage() {
<Table
columns={[
{ title: '诊断项', dataIndex: 'diagnosis', width: 78 },
{ title: '状态', dataIndex: 'status', render: renderStatusTag, width: 52 },
{ title: '置信度', dataIndex: 'confidence', width: 60 },
{ title: t('roles.status'), dataIndex: 'status', render: renderStatusTag, },
{ title: t('aiAnalysis.confidence'), dataIndex: 'confidence', },
{ title: '影响', dataIndex: 'impact', render: renderImpactTag, width: 52 },
{ title: '详情', dataIndex: 'detail', ellipsis: true },
]}
dataSource={[
{ key: '1', diagnosis: '热斑检测', status: '异常', confidence: '92%', impact: '高', detail: '检测到 36 处热斑疑似点' },
{ key: '2', diagnosis: '组串失配', status: '异常', confidence: '90%', impact: '高', detail: '8 串组串存在异常' },
{ key: '1', diagnosis: t('aiAnalysis.hotspotDetection'), status: t('home.abnormal'), confidence: '92%', impact: '高', detail: '检测到 36 处热斑疑似点' },
{ key: '2', diagnosis: '组串失配', status: t('home.abnormal'), confidence: '90%', impact: '高', detail: '8 串组串存在异常' },
{ key: '3', diagnosis: '遮挡风险', status: '轻微', confidence: '78%', impact: '中', detail: '局部遮挡影响 2% 发电量' },
{ key: '4', diagnosis: '组件衰减', status: '异常', confidence: '86%', impact: '中', detail: '平均衰减率 -5.32%' },
{ key: '5', diagnosis: '逆变器异常', status: '正常', confidence: '93%', impact: '低', detail: '所有逆变器运行正常' },
{ key: '4', diagnosis: '组件衰减', status: t('home.abnormal'), confidence: '86%', impact: '中', detail: '平均衰减率 -5.32%' },
{ key: '5', diagnosis: '逆变器异常', status: t('roles.normal'), confidence: '93%', impact: '低', detail: '所有逆变器运行正常' },
]}
pagination={false}
size="small"
@@ -536,11 +530,11 @@ export default function AIDiagnosisPage() {
<Table
columns={[
{ title: '建议措施', dataIndex: 'measure', ellipsis: true },
{ title: '优先级', dataIndex: 'priority', render: renderPriorityTag, width: 58 },
{ title: t('workOrder.priority'), dataIndex: 'priority', render: renderPriorityTag, width: 58 },
{ title: '收益', dataIndex: 'gain', render: g => <span style={{ color: '#00B42A', fontWeight: 600 }}>{g}</span>, width: 68 },
{ title: '置信度', dataIndex: 'confidence', width: 60 },
{ title: t('aiAnalysis.confidence'), dataIndex: 'confidence', width: 60 },
{
title: '操作',
title: t('roles.actions'),
key: 'action',
width: 76,
render: (_, record) => (
@@ -549,7 +543,7 @@ export default function AIDiagnosisPage() {
size="small"
style={{ fontSize: 11, borderRadius: 4, height: 22, padding: '0 6px' }}
>
{record.isView ? '详情' : '派单'}
{record.isView ? '详情' : t('workOrder.dispatch')}
</Button>
)
},
@@ -581,9 +575,9 @@ export default function AIDiagnosisPage() {
<Row gutter={[16, 16]}>
{[
{ title: '无人机载荷热成像', time: '2025-05-20 09:30', icon: <ScanOutlined />, status: '同步中' },
{ title: 'SCADA 实时遥测数据', time: '2025-05-20 09:45:12', icon: <DatabaseOutlined />, status: '正常' },
{ title: '云端气象分析站', time: '2025-05-20 09:45:00', icon: <CloudOutlined />, status: '正常' },
{ title: '电站运维资产库', time: '最近更新: 2025-05-18', icon: <RestOutlined />, status: '正常' },
{ title: 'SCADA 实时遥测数据', time: '2025-05-20 09:45:12', icon: <DatabaseOutlined />, status: t('roles.normal') },
{ title: '云端气象分析站', time: '2025-05-20 09:45:00', icon: <CloudOutlined />, status: t('roles.normal') },
{ title: '电站运维资产库', time: '最近更新: 2025-05-18', icon: <RestOutlined />, status: t('roles.normal') },
].map((source, idx) => (
<Col xs={24} sm={12} md={6} key={idx}>
<div style={{ background: '#f8fafc', padding: '16px', borderRadius: 12, display: 'flex', alignItems: 'center', gap: 16, border: '1px solid #f0f0f0', transition: 'all 0.3s' }} className="thermal-card">
@@ -593,8 +587,8 @@ export default function AIDiagnosisPage() {
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{source.title}</div>
<div style={{ fontSize: 12, color: '#86909C', marginTop: 4, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>数据点: {source.time}</div>
<div style={{ fontSize: 11, color: source.status === '正常' ? '#00B42A' : '#165DFF', marginTop: 6, display: 'flex', alignItems: 'center', gap: 6 }}>
<div style={{ width: 6, height: 6, background: source.status === '正常' ? '#00B42A' : '#165DFF', borderRadius: '50%' }}></div>
<div style={{ fontSize: 11, color: source.status === t('roles.normal') ? '#00B42A' : '#165DFF', marginTop: 6, display: 'flex', alignItems: 'center', gap: 6 }}>
<div style={{ width: 6, height: 6, background: source.status === t('roles.normal') ? '#00B42A' : '#165DFF', borderRadius: '50%' }}></div>
状态: {source.status}
</div>
</div>

View File

@@ -23,36 +23,39 @@ import {
getTargetDemo
} from '../api/aiAnalysis';
import utils from '../lib/utils';
import { useTranslation } from 'react-i18next';
const { Title, Text } = Typography;
const { Dragger } = Upload;
const { Option } = Select;
// 算法列表定义
const algorithmList = [
{
id: 'detect',
name: '目标检测',
alias: 'waterway-trt',
desc: '图片/视频检测,创建任务后轮询结果。',
icon: <AimOutlined />,
status: '运行中'
},
{
id: 'segmentation',
name: '热成像分割',
alias: 'v1.0.0',
desc: '热成像热点、面板分区和温度统计。',
icon: <FireOutlined />,
status: '运行中'
}
];
export default function Agri() {
const { t } = useTranslation();
const [activeAlgo, setActiveAlgo] = useState('detect');
const [models, setModels] = useState([]);
const [loadingModels, setLoadingModels] = useState(false);
const [history, setHistory] = useState([]);
const algorithmList = [
{
id: 'detect',
name: '目标检测',
alias: 'waterway-trt',
desc: '图片/视频检测,创建任务后轮询结果。',
icon: <AimOutlined />,
status: t('devices.running')
},
{
id: 'segmentation',
name: '热成像分割',
alias: 'v1.0.0',
desc: '热成像热点、面板分区和温度统计。',
icon: <FireOutlined />,
status: t('devices.running')
}
];
// 检测任务状态
const [detectForm, setDetectForm] = useState({
@@ -4390,7 +4393,7 @@ export default function Agri() {
} else if (['failed', 'cancelled'].includes(statusRes.status)) {
clearInterval(pollTimer.current);
setPolling(false);
utils.message.error(`任务执行${statusRes.status === 'failed' ? '失败' : '被取消'}`);
utils.message.error(`任务执行${statusRes.status === 'failed' ? t('common.failure') : '被取消'}`);
}
} catch (err) {
console.error('轮询失败', err);
@@ -4575,7 +4578,7 @@ export default function Agri() {
size="small"
>
<Radio.Button value="image">图片</Radio.Button>
<Radio.Button value="video">视频</Radio.Button>
<Radio.Button value="video">{t('constants.sourceVideo')}</Radio.Button>
</Radio.Group>
</Col>
<Col span={12}>
@@ -4586,7 +4589,7 @@ export default function Agri() {
size="small"
>
<Radio.Button value="quality">质量</Radio.Button>
<Radio.Button value="speed">速度</Radio.Button>
<Radio.Button value="speed">{t('devices.speed')}</Radio.Button>
</Radio.Group>
</Col>
</Row>
@@ -4962,7 +4965,7 @@ export default function Agri() {
bodyStyle={{ padding: '12px 8px' }}
>
<Statistic
title={<span style={{ fontSize: 15, color: '#86909C' }}>最高温度</span>}
title={<span style={{ fontSize: 15, color: '#86909C' }}>{t('aiAnalysis.maxTemperature')}</span>}
value={hasResult ? `${segResult.summary?.max_temp_c || 0}℃` : '-'}
titleStyle={{ fontSize: 12, color: '#333', marginBottom: 4 }}
valueStyle={{ fontSize: 18, fontWeight: 600, color: '#FF7D00' }}
@@ -5101,7 +5104,7 @@ export default function Agri() {
</div>
{[
{ label: '温度', value: `${selectedPoint.peak_temp_c}℃` },
{ label: t('home.temperature'), value: `${selectedPoint.peak_temp_c}℃` },
{ label: '块号', value: selectedPoint.panel_id || '-' },
{ label: 'GPS', value: selectedPoint.gps?.text || '-' },
{ label: '原图像素', value: `${selectedPoint.peak_x}, ${selectedPoint.peak_y}` },

View File

@@ -11,6 +11,7 @@ import AlarmHistory from '../components/alerts/AlarmHistory';
import AlarmStatistics from '../components/alerts/AlarmStatistics';
import AlarmRules from '../components/alerts/AlarmRules';
import AlarmSubscription from '../components/alerts/AlarmSubscription';
import { useTranslation } from 'react-i18next';
@@ -18,6 +19,7 @@ const { Header, Content } = Layout;
const { Text } = Typography;
export default function AlarmCenterPage() {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState('overview');
@@ -36,7 +38,7 @@ export default function AlarmCenterPage() {
<Layout style={{ minHeight: '100vh', overflow: 'hidden' }}>
<div style={{ display: 'flex', paddingBottom: "4px" }}>
<div style={{ padding: '8px 12px 0' }}>
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>告警中心</Typography.Title>
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>{t('router.alerts')}</Typography.Title>
<Text type="secondary" style={{ fontSize: '12px' }}>告警处置闭环、规则管理与事件中心</Text>
</div>

View File

@@ -30,6 +30,7 @@ import {
Leaf
} from 'lucide-react';
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts';
import { useTranslation } from 'react-i18next';
const { Title, Text } = Typography;
const { RangePicker } = DatePicker;
@@ -62,12 +63,7 @@ const pollutionLineData = [
{ date: '05-24', pollution: 68.5, threshold: 75 },
];
const pieChartData = [
{ name: '灰尘积累', value: 6120, color: '#165DFF' },
{ name: '鸟粪遮挡', value: 1480, color: '#F53F3F' },
{ name: '沙尘沉积', value: 1120, color: '#F7BA1E' },
{ name: '其他', value: 600, color: '#86909C' },
];
const dualAxesData = [
[
@@ -109,6 +105,7 @@ const compareChartData = [
export default function CleanOptimizationPage() {
const { t } = useTranslation();
const cardStyle = {
borderRadius: 12,
border: '1px solid #f0f0f0',
@@ -116,6 +113,13 @@ export default function CleanOptimizationPage() {
overflow: 'hidden'
};
const pieChartData = [
{ name: '灰尘积累', value: 6120, color: '#165DFF' },
{ name: '鸟粪遮挡', value: 1480, color: '#F53F3F' },
{ name: '沙尘沉积', value: 1120, color: '#F7BA1E' },
{ name: t('constants.others'), value: 600, color: '#86909C' },
];
const renderPriorityTag = (priority: string) => {
const config: Record<string, any> = {
'高': { color: '#ff4d4f', bg: '#fff1f0' },
@@ -185,7 +189,7 @@ export default function CleanOptimizationPage() {
{
title: '预计发电提升',
value: '12,850',
unit: 'kWh',
unit: t('home.kWh'),
trend: '占当前日发电量 14.2%',
icon: <TrendingUp />,
color: '#1890ff',
@@ -336,7 +340,7 @@ export default function CleanOptimizationPage() {
<div style={{ position: 'absolute', left: '30%', top: '50%', transform: 'translate(-50%, -50%)', textAlign: 'center' }}>
<div style={{ fontSize: 10, color: '#86909C' }}>总损失电量</div>
<div style={{ fontSize: 16, fontWeight: 800, color: '#1D2129' }}>9,320</div>
<div style={{ fontSize: 10, color: '#86909C' }}>kWh</div>
<div style={{ fontSize: 10, color: '#86909C' }}>{t('home.kWh')}</div>
</div>
</div>
</Card>
@@ -366,7 +370,7 @@ export default function CleanOptimizationPage() {
<Row gutter={[16, 16]}>
<Col span={12}>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>预计发电提升</div>
<div style={{ fontSize: 15, fontWeight: 800 }}>12,850 <span style={{ fontSize: 11, fontWeight: 400 }}>kWh</span></div>
<div style={{ fontSize: 15, fontWeight: 800 }}>12,850 <span style={{ fontSize: 11, fontWeight: 400 }}>{t('home.kWh')}</span></div>
</Col>
<Col span={12}>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>电价 (含税)</div>
@@ -457,12 +461,12 @@ export default function CleanOptimizationPage() {
<Table
columns={[
{ title: '区块', dataIndex: 'area', key: 'area' },
{ title: '优先级', dataIndex: 'priority', key: 'priority', render: renderPriorityTag },
{ title: t('workOrder.priority'), dataIndex: 'priority', key: 'priority', render: renderPriorityTag },
{ title: '预计工时', dataIndex: 'duration', key: 'duration' },
{ title: '负责人', dataIndex: 'handler', key: 'handler' },
{ title: t('systemSetting.leader'), dataIndex: 'handler', key: 'handler' },
{ title: '计划时间', dataIndex: 'planTime', key: 'planTime' },
{ title: '状态', dataIndex: 'status', key: 'status', render: (s) => <Tag color="blue" variant="outline" style={{ borderRadius: 4 }}>{s}</Tag> },
{ title: '操作', key: 'action', render: () => <Button type="primary" size="small" style={{ borderRadius: 4 }}>创建工单</Button> },
{ title: t('roles.status'), dataIndex: 'status', key: 'status', render: (s) => <Tag color="blue" variant="outline" style={{ borderRadius: 4 }}>{s}</Tag> },
{ title: t('roles.actions'), key: 'action', render: () => <Button type="primary" size="small" style={{ borderRadius: 4 }}>创建工单</Button> },
]}
dataSource={workOrderPreviewData}
pagination={false}
@@ -481,7 +485,7 @@ export default function CleanOptimizationPage() {
<Table
columns={[
{ title: '推荐计划', dataIndex: 'id', key: 'id', width: 85 },
{ title: '优先级', dataIndex: 'priority', key: 'priority', render: (p) => <span style={{ color: p === '高' ? '#F53F3F' : '#F7BA1E', fontWeight: 600 }}>{p}</span>, width: 65 },
{ title: t('workOrder.priority'), dataIndex: 'priority', key: 'priority', render: (p) => <span style={{ color: p === '高' ? '#F53F3F' : '#F7BA1E', fontWeight: 600 }}>{p}</span>, width: 65 },
{ title: '建议区块', dataIndex: 'area', key: 'area' },
{ title: '预计提升', dataIndex: 'boost', key: 'boost', render: (b) => <span style={{ color: '#00B42A', fontWeight: 600 }}>{b}</span> },
{ title: '天气适宜度', dataIndex: 'weather', key: 'weather', render: (w) => <Space size={4}>{w} <SunOutlined style={{ color: '#F7BA1E' }} /></Space> },
@@ -562,7 +566,7 @@ export default function CleanOptimizationPage() {
{ icon: <Droplets size={18} color="#165DFF" />, bg: '#E8F3FF', label: '预计用水量', value: '18 吨', sub: '节水 30% (机器人)', subColor: '#00B42A' },
{ icon: <Calendar size={18} color="#165DFF" />, bg: '#E8F3FF', label: '预计总耗时', value: '12 小时', sub: '并行作业 2 组', subColor: '#86909C' },
{ icon: <Leaf size={18} color="#00B42A" />, bg: '#E8FFEA', label: '碳减排贡献', value: '6.85 吨', sub: 'CO₂ 减排量', subColor: '#86909C' },
{ icon: <ShieldCheck size={18} color="#F7BA1E" />, bg: '#FFF7E8', label: '作业风险评估', value: '低风险', valueColor: '#00B42A', sub: '安全可控', subColor: '#86909C' },
{ icon: <ShieldCheck size={18} color="#F7BA1E" />, bg: '#FFF7E8', label: '作业风险评估', value: t('aiAnalysis.lowRisk'), valueColor: '#00B42A', sub: '安全可控', subColor: '#86909C' },
].map((item, idx) => (
<Col span={12} key={idx}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>

View File

@@ -8,12 +8,14 @@ import { useSelector } from 'react-redux';
import { RootState } from '../store';
import WayLinePage from '../components/devices/WayLinePage';
import RobotTaskPage from '../components/devices/RobotTaskPage';
import { useTranslation } from 'react-i18next';
const { Content } = Layout;
const { Text } = Typography;
export default function DeviceIndexPage() {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState('overview');
const [selectedSn, setSelectedSn] = useState(null);
const { stationId } = useSelector((state: RootState) => state.station);
@@ -24,9 +26,9 @@ export default function DeviceIndexPage() {
const menuItems = [
{ key: 'overview', label: '装备总览', icon: <AppstoreOutlined /> },
{ key: 'status', label: '设备状态', icon: <SettingOutlined /> },
{ key: 'wayLineTask', label: '航线任务', icon: <AimOutlined /> },
{ key: 'robotTask', label: '机器人任务', icon: <BranchesOutlined /> },
{ key: 'status', label: t('devices.deviceStatus'), icon: <SettingOutlined /> },
{ key: 'wayLineTask', label: t('devices.waylineTask'), icon: <AimOutlined /> },
{ key: 'robotTask', label: t('devices.robotTask'), icon: <BranchesOutlined /> },
];

View File

@@ -1,4 +1,5 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import {
Table,
Button,
@@ -21,6 +22,7 @@ const { Text, Title } = Typography;
const { RangePicker } = DatePicker;
export default function Downloads() {
const { t } = useTranslation();
const columns = [
{
title: '文件详情',
@@ -61,7 +63,7 @@ export default function Downloads() {
render: (text: string) => <Text type="secondary" style={{ fontSize: 12 }}>{text}</Text>,
},
{
title: '操作',
title: t('roles.actions'),
key: 'action',
align: 'right' as const,
render: () => (

View File

@@ -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">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Card title={<span style={{ fontWeight: 800 }}>{t('home.maintenanceProgress')}</span>} extra={<Button type="link" size="small">更多 &gt;</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">更多 &gt;</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">更多 &gt;</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')}>更多 &gt;</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')}>更多 &gt;</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">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Card title={<span style={{ fontWeight: 800 }}>{t('home.deviceOnlineStatus')}</span>} extra={<Button type="link" size="small">更多 &gt;</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">详细 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Card title={<span style={{ fontWeight: 800 }}>{t('home.weatherInfo')}</span>} extra={<Button type="link" size="small">详细 &gt;</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">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<Card title={<span style={{ fontWeight: 800 }}>{t('clean.cleaningSuggestion')}</span>} extra={<Button type="link" size="small">更多 &gt;</Button>} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 16, marginBottom: 16 }}>
<div style={{ width: 80, height: 80, position: 'relative' }}>
<UniversalPieChart
data={[
{ name: '清洁度', value: 85, color: '#00B42A' },
{ name: '待清洗', value: 15, color: '#E8FFEA' },
{ name: t('clean.pending'), value: 15, color: '#E8FFEA' },
]}
width="100%"
height="100%"

View File

@@ -19,11 +19,13 @@ import logincard from '../assets/logincard.png';
import { userLogin } from '../store/userSlice';
import { useAppDispatch } from '../store';
import Cookies from 'js-cookie';
import { useTranslation } from 'react-i18next';
const { Text, Title } = Typography;
const AntdCard = Card as any;
export default function Login() {
const { t } = useTranslation();
const navigate = useNavigate();
const dispatch = useAppDispatch();
const { message } = App.useApp();
@@ -42,7 +44,7 @@ export default function Login() {
// loginResult 就是你 userLogin 里 return 的 res
if (loginResult.code == 200) {
message.success('登录成功');
message.success(t('login.loginSuccess'));
const searchParams = new URLSearchParams(window.location.search);
const goRemote = searchParams.get('goRemote');
if (Number(goRemote) == 1) {
@@ -91,18 +93,18 @@ export default function Login() {
</Title>
<Form name="login" layout="vertical" onFinish={onFinish} autoComplete="off" size="large">
<Form.Item name="username" rules={[{ required: true, message: '请输入账号' }]}>
<Form.Item name="username" rules={[{ required: true, message: t('login.accountRequired') }]}>
<Input
prefix={<UserOutlined style={{ color: '#999' }} />}
placeholder="请输入账号"
placeholder={t('login.accountRequired')}
style={{ borderRadius: 8, height: 52, fontSize: 15, borderColor: '#e5e7eb' }}
/>
</Form.Item>
<Form.Item name="password" rules={[{ required: true, message: '请输入密码' }]}>
<Form.Item name="password" rules={[{ required: true, message: t('login.passwordRequired') }]}>
<Input.Password
prefix={<LockOutlined style={{ color: '#999' }} />}
placeholder="请输入密码"
placeholder={t('login.passwordRequired')}
style={{ borderRadius: 8, height: 52, fontSize: 15, borderColor: '#e5e7eb' }}
/>
</Form.Item>
@@ -111,11 +113,11 @@ export default function Login() {
<Form.Item
name="agreement"
valuePropName="checked"
rules={[{ validator: (_, value) => value ? Promise.resolve() : Promise.reject(new Error('请阅读并同意用户协议')) }]}
rules={[{ validator: (_, value) => value ? Promise.resolve() : Promise.reject(new Error(t('login.agreeRequired'))) }]}
>
<Checkbox>
<p style={{ fontSize: 14, color: '#666' }}>
我已阅读并同意 <span type="link" style={{ padding: 0, color: '#1677ff' }}>用户协议</span> 和 <span type="link" style={{ padding: 0, color: '#1677ff' }}>隐私政策</span>
我已阅读并同意 <span type="link" style={{ padding: 0, color: '#1677ff' }}>{t('login.userAgreement')}</span> 和 <span type="link" style={{ padding: 0, color: '#1677ff' }}>{t('login.privacyPolicy')}</span>
</p>
</Checkbox>
</Form.Item>

View File

@@ -32,6 +32,7 @@ import { setUserInfo } from '../store/userSlice';
import { getUserProfile, updateUserProfile, updateUserPwd, uploadAvatar } from '../api/user';
import envConfig from '../../env';
import utils from '../lib/utils';
import { useTranslation } from 'react-i18next';
const { TabPane } = Tabs;
const { Title } = Typography;
@@ -53,7 +54,7 @@ const Profile: React.FC = () => {
form.setFieldsValue(res.data);
}
} catch (error) {
message.error('获取个人信息失败');
message.error(t('profile.getProfileFailed'));
}
};
@@ -71,12 +72,12 @@ const Profile: React.FC = () => {
};
const res: any = await updateUserProfile(updateData);
if (res.code === 200) {
message.success('修改成功');
message.success(t('profile.modifySuccess'));
const newUserInfo = { ...userInfo, ...values };
dispatch(setUserInfo(newUserInfo));
fetchProfile();
} else {
message.error(res.msg || '修改失败');
message.error(res.msg || t('profile.modifyFailed'));
}
} catch (error) {
message.error('请求失败');
@@ -87,17 +88,17 @@ const Profile: React.FC = () => {
const handleUpdatePwd = async (values: any) => {
if (values.newPassword !== values.confirmPassword) {
message.error('两次输入的密码不一致');
message.error(t('profile.passwordMismatch'));
return;
}
setLoading(true);
try {
const res: any = await updateUserPwd(values.oldPassword, values.newPassword);
if (res.code === 200) {
message.success('密码修改成功');
message.success(t('profile.passwordChanged'));
pwdForm.resetFields();
} else {
message.error(res.msg || '修改失败');
message.error(res.msg || t('profile.modifyFailed'));
}
} catch (error) {
message.error('请求失败');
@@ -114,15 +115,15 @@ const Profile: React.FC = () => {
try {
const res: any = await uploadAvatar(formData);
if (res.code === 200) {
message.success('头像上传成功');
message.success(t('profile.avatarUploadSuccess'));
const newUserInfo = { ...userInfo, avatar: res.imgUrl };
dispatch(setUserInfo(newUserInfo));
fetchProfile();
} else {
message.error(res.msg || '上传失败');
message.error(res.msg || t('profile.avatarUploadFailed'));
}
} catch (error) {
message.error('上传失败');
message.error(t('profile.avatarUploadFailed'));
}
};
@@ -193,20 +194,20 @@ const Profile: React.FC = () => {
<div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>
<PhoneOutlined style={{ marginRight: 12, color: '#165DFF', fontSize: 16 }} />
<span style={{ color: '#666' }}>手机号码:</span>
<strong style={{ marginLeft: 4, color: '#333' }}>{profileData?.phonenumber || '未设置'}</strong>
<strong style={{ marginLeft: 4, color: '#333' }}>{profileData?.phonenumber || t('profile.notSet')}</strong>
</div>
<div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>
<MailOutlined style={{ marginRight: 12, color: '#165DFF', fontSize: 16 }} />
<span style={{ color: '#666' }}>用户邮箱:</span>
<strong style={{ marginLeft: 4, color: '#333' }}>{profileData?.email || '未设置'}</strong>
<strong style={{ marginLeft: 4, color: '#333' }}>{profileData?.email || t('profile.notSet')}</strong>
</div>
<div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>
<SafetyOutlined style={{ marginRight: 12, color: '#165DFF', fontSize: 16 }} />
<span style={{ color: '#666' }}>所属角色:</span>
<strong style={{ marginLeft: 4, color: '#333' }}>
{profileData?.roles?.map((r: any) => r.roleName).join(', ') || '未设置'}
{profileData?.roles?.map((r: any) => r.roleName).join(', ') || t('profile.notSet')}
</strong>
</div>
</Space>
@@ -243,7 +244,7 @@ const Profile: React.FC = () => {
size="large"
>
<Form.Item
label="用户名称"
label={t('profile.username')}
name="userName"
>
<Input
@@ -254,19 +255,19 @@ const Profile: React.FC = () => {
</Form.Item>
<Form.Item
label="用户昵称"
label={t('users.nicknameLabel')}
name="nickName"
rules={[{ required: true, message: '请输入用户昵称' }]}
rules={[{ required: true, message: t('profile.nicknamePlaceholder') }]}
>
<Input
prefix={<UserOutlined />}
placeholder="请输入用户昵称"
placeholder={t('profile.nicknamePlaceholder')}
style={{ borderRadius: 6 }}
/>
</Form.Item>
<Form.Item
label="性别"
label={t('users.genderLabel')}
name="sex"
>
<Radio.Group>
@@ -276,19 +277,19 @@ const Profile: React.FC = () => {
</Form.Item>
<Form.Item
label="手机号码"
label={t('users.phoneLabel')}
name="phonenumber"
rules={[{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码' }]}
>
<Input
prefix={<PhoneOutlined />}
placeholder="请输入手机号码"
placeholder={t('profile.phonePlaceholder')}
style={{ borderRadius: 6 }}
/>
</Form.Item>
<Form.Item
label="邮箱"
label={t('users.email')}
name="email"
rules={[{ type: 'email', message: '请输入正确的邮箱格式' }]}
>
@@ -300,7 +301,7 @@ const Profile: React.FC = () => {
</Form.Item>
<Form.Item
label="备注"
label={t('roles.remark')}
name="remark"
>
<Input.TextArea
@@ -339,7 +340,7 @@ const Profile: React.FC = () => {
size="large"
>
<Form.Item
label="旧密码"
label={t('profile.oldPassword')}
name="oldPassword"
rules={[{ required: true, message: '请输入旧密码' }]}
>
@@ -351,7 +352,7 @@ const Profile: React.FC = () => {
</Form.Item>
<Form.Item
label="新密码"
label={t('profile.newPassword')}
name="newPassword"
rules={[
{ required: true, message: '请输入新密码' },
@@ -366,7 +367,7 @@ const Profile: React.FC = () => {
</Form.Item>
<Form.Item
label="确认密码"
label={t('profile.confirmPassword')}
name="confirmPassword"
rules={[{ required: true, message: '请确认新密码' }]}
>

View File

@@ -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',
},

View File

@@ -19,6 +19,7 @@ import { Line, Column, Pie, Area, DualAxes, Bar } from '@ant-design/charts';
import dayjs from 'dayjs';
import { ChevronRight } from 'lucide-react';
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts';
import { useTranslation } from 'react-i18next';
const { TabPane } = Tabs;
const { RangePicker } = DatePicker;
@@ -142,15 +143,10 @@ const reportTemplates = [
{ name: '巡检与机器人作业报告', desc: '巡检与机器人作业统计模板', color: '#722ED1', bg: '#F9F0FF', icon: <RobotOutlined /> },
];
const generationRecord = [
{ name: '电站月报', time: '2025-05-31 08:15', operator: '张运维', type: '发电报表', status: '已生成' },
{ name: '告警周报', time: '2025-05-26 09:10', operator: '系统自动', type: '告警报表', status: '已生成' },
{ name: 'AI诊断日报', time: '2025-05-31 07:30', operator: '系统自动', type: 'AI分析报告', status: '生成中' },
{ name: '运维汇总报表', time: '2025-05-31 09:00', operator: '李工程师', type: '运维报表', status: '已生成' },
{ name: '清洗效果报告', time: '2025-05-28 10:20', operator: '王运维', type: '运维报表', status: '已生成' },
];
export default function ReportCenterPage() {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState('overview');
const [reportCycle, setReportCycle] = useState('month');
const [reportType, setReportType] = useState('all');
@@ -162,6 +158,13 @@ export default function ReportCenterPage() {
boxShadow: '0 4px 12px rgba(0,0,0,0.05)',
overflow: 'hidden'
};
const generationRecord = [
{ name: '电站月报', time: '2025-05-31 08:15', operator: '张运维', type: '发电报表', status: '已生成' },
{ name: '告警周报', time: '2025-05-26 09:10', operator: '系统自动', type: t('report.alertReport'), status: '已生成' },
{ name: 'AI诊断日报', time: '2025-05-31 07:30', operator: '系统自动', type: 'AI分析报告', status: '生成中' },
{ name: '运维汇总报表', time: '2025-05-31 09:00', operator: '李工程师', type: '运维报表', status: '已生成' },
{ name: '清洗效果报告', time: '2025-05-28 10:20', operator: '王运维', type: '运维报表', status: '已生成' },
];
return (
<div style={{ padding: '4px 0px', background: '#f5f7fa', minHeight: '100vh', boxSizing: 'border-box' }}>
@@ -198,14 +201,14 @@ export default function ReportCenterPage() {
`}
</style>
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8 }}>
<Typography.Title level={4} style={{ margin: '0 32px 0 0', }}>报表中心</Typography.Title>
<Typography.Title level={4} style={{ margin: '0 32px 0 0', }}>{t('router.table')}</Typography.Title>
{/* 页面头部标签 */}
<Tabs activeKey={activeTab} onChange={setActiveTab} className="report-tabs">
<TabPane tab="报表总览" key="overview" />
<TabPane tab="发电报表" key="power" />
<TabPane tab="运维报表" key="operation" />
<TabPane tab="告警报表" key="alarm" />
<TabPane tab={t('report.alertReport')} key="alarm" />
<TabPane tab="AI分析报告" key="ai" />
</Tabs>
</div>
@@ -269,18 +272,18 @@ export default function ReportCenterPage() {
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">报表周期:</span>
<Select value={reportCycle} onChange={setReportCycle} style={{ width: 100 }} size="small">
<Option value="day">日报</Option>
<Option value="week">周报</Option>
<Option value="month">月报</Option>
<Option value="day">{t('report.daily')}</Option>
<Option value="week">{t('report.weekly')}</Option>
<Option value="month">{t('report.monthly')}</Option>
</Select>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">报表类型:</span>
<Select value={reportType} onChange={setReportType} style={{ width: 120 }} size="small">
<Option value="all">全部</Option>
<Option value="all">{t('common.all')}</Option>
<Option value="power">发电报表</Option>
<Option value="operation">运维报表</Option>
<Option value="alarm">告警报表</Option>
<Option value="alarm">{t('report.alertReport')}</Option>
<Option value="ai">AI分析报告</Option>
</Select>
</div>
@@ -295,7 +298,7 @@ export default function ReportCenterPage() {
</div>
<div style={{ marginLeft: 'auto' }}>
<Space size={12}>
<Button type="primary" icon={<FileTextOutlined />} size="small" style={{ borderRadius: 6, height: 32, padding: '0 16px' }}>生成报表</Button>
<Button type="primary" icon={<FileTextOutlined />} size="small" style={{ borderRadius: 6, height: 32, padding: '0 16px' }}>{t('report.generateReport')}</Button>
<Button icon={<FilePdfOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#F53F3F', borderColor: '#F53F3F' }}>导出PDF</Button>
<Button icon={<FileExcelOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#00B42A', borderColor: '#00B42A' }}>导出Excel</Button>
</Space>
@@ -382,8 +385,8 @@ export default function ReportCenterPage() {
height={200}
series={[
{ key: 'generation', name: '发电量', color: '#1890ff' },
{ key: 'irradiance', name: '辐照度', color: '#52c41a' },
{ key: 'temp', name: '温度', color: '#fa8c16' },
{ key: 'irradiance', name: t('home.irradiance'), color: '#52c41a' },
{ key: 'temp', name: t('home.temperature'), color: '#fa8c16' },
]}
/>
</Card>
@@ -399,7 +402,7 @@ export default function ReportCenterPage() {
<div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}>
<Space size={8} wrap>
<Badge color="#165DFF" text="新增工单" style={{ fontSize: 10 }} />
<Badge color="#00B42A" text="完成工单" style={{ fontSize: 10 }} />
<Badge color="#00B42A" text={t('workOrder.completeOrder')} style={{ fontSize: 10 }} />
<Badge color="#722ED1" text="闭环率 (%)" style={{ fontSize: 10 }} />
</Space>
</div>
@@ -409,7 +412,7 @@ export default function ReportCenterPage() {
height={200}
series={[
{ key: 'newOrder', name: '新增工单', color: '#1890ff' },
{ key: 'completed', name: '完成工单', color: '#52c41a' },
{ key: 'completed', name: t('workOrder.completeOrder'), color: '#52c41a' },
{ key: 'alarmCount', name: '告警数', color: '#fa8c16' },
{ key: 'closedRate', name: '闭环率', color: '#722ed1' },
]}
@@ -515,7 +518,7 @@ export default function ReportCenterPage() {
<CalendarOutlined style={{ color: '#165DFF' }} />
<span style={{ fontSize: 13, fontWeight: 700 }}>每周一 09:00 自动发送</span>
</Space>
<Button type="link" size="small" icon={<EditOutlined />} style={{ fontSize: 12, whiteSpace: 'nowrap' }}>编辑</Button>
<Button type="link" size="small" icon={<EditOutlined />} style={{ fontSize: 12, whiteSpace: 'nowrap' }}>{t('roles.edit')}</Button>
</div>
</Col>
</Row>
@@ -534,15 +537,15 @@ export default function ReportCenterPage() {
render: (text) => <Space size={8}><FilePdfOutlined style={{ color: '#F53F3F' }} />{text}</Space>
},
{
title: '状态', dataIndex: 'status', width: 80,
title: t('roles.status'), dataIndex: 'status', width: 80,
render: (v) => <Tag color={v === '已生成' ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
},
{
title: '操作', width: 120,
title: t('roles.actions'), width: 120,
render: () => (
<Space split={<Divider type="vertical" />}>
<Button type="link" size="small" icon={<EyeOutlined />} style={{ fontSize: 12, padding: 0 }}>查看</Button>
<Button type="link" size="small" icon={<DownloadOutlined />} style={{ fontSize: 12, padding: 0 }}>下载</Button>
<Button type="link" size="small" icon={<EyeOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.view')}</Button>
<Button type="link" size="small" icon={<DownloadOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.download')}</Button>
</Space>
)
}
@@ -581,13 +584,13 @@ export default function ReportCenterPage() {
{ title: '报表名称', dataIndex: 'name', width: 100, ellipsis: true },
{ title: '生成时间', dataIndex: 'time', width: 130 },
{ title: '生成人', dataIndex: 'operator', width: 80 },
{ title: '类型', dataIndex: 'type', width: 80 },
{ title: t('common.type'), dataIndex: 'type', width: 80 },
{
title: '状态', dataIndex: 'status', width: 70,
title: t('roles.status'), dataIndex: 'status', width: 70,
render: (v) => <Tag color={v === '已生成' ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
},
{
title: '操作', width: 90,
title: t('roles.actions'), width: 90,
render: () => (
<Space size={8}>
<Button type="text" icon={<EyeOutlined />} size="small" />

View File

@@ -11,11 +11,13 @@ import { getMenuList } from '../api/mune';
import { buildPermTree, buildTreeFromFlat } from '../lib/utils';
import { addRole, deleteRole, editRoleApi, getRoleList } from '../api/role';
import EmptyData from '../components/Empty';
import { useTranslation } from 'react-i18next';
const { Text } = Typography;
const AntdCard = Card as any;
export default function Roles() {
const { t } = useTranslation();
const [roles, setRoles] = useState([]);
const [menuTree, setMenuTree] = useState([]);
const [checkedKeys, setCheckedKeys] = useState<number[]>([]);
@@ -107,13 +109,13 @@ export default function Roles() {
const handleDeleteRole = (roleId) => {
deleteRole([roleId]).then(res => {
if (res.code == 200) {
messageApi.success('删除成功');
messageApi.success(t('common.deleteSuccess'));
getRole();
} else {
messageApi.error(res.msg || '删除失败');
messageApi.error(res.msg || t('common.deleteFail'));
}
}).catch(() => {
messageApi.error('删除失败');
messageApi.error(t('common.deleteFail'));
})
};
@@ -134,10 +136,10 @@ export default function Roles() {
getRole();
setRoleModalVisible(false);
} else {
messageApi.error(res.msg || "编辑失败");
messageApi.error(res.msg || t('common.editFail'));
}
}).catch(() => {
messageApi.error("编辑失败");
messageApi.error(t('common.editFail'));
});
} else {
const params = {
@@ -152,10 +154,10 @@ export default function Roles() {
getRole();
setRoleModalVisible(false);
} else {
messageApi.error(res.msg || "新增失败");
messageApi.error(res.msg || t('common.addFail'));
}
}).catch(() => {
messageApi.error("新增失败");
messageApi.error(t('common.addFail'));
});
}
});
@@ -166,7 +168,7 @@ export default function Roles() {
{contextHolder}
{/* 统一卡片容器(和菜单管理一致) */}
<AntdCard title="角色管理" style={{ borderRadius: 8 }}>
<AntdCard title={t('router.roles')} style={{ borderRadius: 8 }}>
{/* 顶部操作栏(和菜单管理统一) */}
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between' }}>
<Button
@@ -224,7 +226,7 @@ export default function Roles() {
<Space direction="vertical" size={2} style={{ width: '100%' }}>
<Text type="secondary">权限标识:{role.roleKey}</Text>
<Text type="secondary">
状态:{role.status == 1 ? '正常' : '停用'}
状态:{role.status == 1 ? t('roles.normal') : t('roles.stopped')}
</Text>
<Text type="secondary">
{role.admin && '【超级管理员】'}
@@ -238,7 +240,7 @@ export default function Roles() {
))
) : (
<Col span={24}>
<EmptyData height={260} description="暂无数据" />
<EmptyData height={260} description={t('common.noData')} />
</Col>
)}
</Row>
@@ -257,7 +259,7 @@ export default function Roles() {
{/* 新增/编辑弹窗 */}
<Modal
title={editRole ? '编辑角色' : '新增角色'}
title={editRole ? '编辑角色' : t('roles.addRole')}
open={roleModalVisible}
onCancel={() => setRoleModalVisible(false)}
onOk={handleSaveRole}
@@ -265,7 +267,7 @@ export default function Roles() {
maskClosable={false}
>
<Form form={roleForm} layout="vertical">
<Form.Item name="roleName" label="角色名称" rules={[{ required: true }]}>
<Form.Item name="roleName" label={t('roles.roleName')} rules={[{ required: true }]}>
<Input placeholder="请输入角色名称" />
</Form.Item>
@@ -280,8 +282,8 @@ export default function Roles() {
{/* 状态 Switch */}
<Row gutter={16}>
<Col span={8}>
<Form.Item name="status" label="状态" valuePropName="checked">
<Switch checkedChildren="正常" unCheckedChildren="停用" />
<Form.Item name="status" label={t('roles.status')} valuePropName="checked">
<Switch checkedChildren={t('roles.normal')} unCheckedChildren={t('roles.stopped')} />
</Form.Item>
</Col>
</Row>

View File

@@ -28,6 +28,7 @@ import ErrorManagement from '../components/SystemSetting/ErrorManagement';
import AlarmSettingsManagement from '../components/SystemSetting/AlarmSettingsManagement';
import WorkOrderSettingsManagement from '../components/SystemSetting/WorkOrderSettingsManagement';
import { Outlet } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
const { Header, Content } = Layout;
const { Text } = Typography;
@@ -41,6 +42,7 @@ const AntdCard = Card as any;
// 主页面
// ======================
export default function SystemSettings() {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState('basic');
const [rawMenuList, setRawMenuList] = useState([]);
const [showTabs, setShowTabs] = useState([]);
@@ -53,15 +55,15 @@ export default function SystemSettings() {
const NoticePage = () => <div style={{ padding: 20 }}><h2>通知策略页面</h2></div>;
const DataSafetyPage = () => <div style={{ padding: 20 }}><h2>数据与安全页面</h2></div>;
const DefaultPage = () => <div style={{ padding: 20 }}><h2>请选择菜单</h2></div>;
const NoticePage = () => <div style={{ padding: 20 }}><h2>{t('router.noticePolicy')}</h2></div>;
const DataSafetyPage = () => <div style={{ padding: 20 }}><h2>{t('router.dataSafety')}</h2></div>;
const DefaultPage = () => <div style={{ padding: 20 }}><h2>{t('router.pleaseSelectMenu')}</h2></div>;
return (
<Layout style={{ minHeight: '100vh', overflow: 'hidden' }}>
{/*<div style={{ padding: '4px 0px 0' }}>
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>系统设置</Typography.Title>
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>{t('router.systemSetting')}</Typography.Title>
<Text type="secondary" style={{ fontSize: '12px' }}>告警规则配置、用户角色、通知管理与系统参数设置</Text>
</div>*/}

View File

@@ -8,11 +8,13 @@ import {
} from '@ant-design/icons';
import { addUser, deleteUser, editUser, getUser } from '../api/user';
import { getRoleList } from '../api/role';
import { useTranslation } from 'react-i18next';
const { Title } = Typography;
const { Option } = Select;
export default function UserList() {
const { t } = useTranslation();
const [userList, setUserList] = useState([]);
const [modalVisible, setModalVisible] = useState(false);
const [form] = Form.useForm();
@@ -91,13 +93,13 @@ export default function UserList() {
const handleDelete = (userId) => {
deleteUser(userId).then(res => {
if (res.code === 200) {
messageApi.success('删除成功');
messageApi.success(t('common.deleteSuccess'));
getUserList();
} else {
messageApi.error(res.msg || '删除失败');
messageApi.error(res.msg || t('common.deleteFail'));
}
}).catch(() => {
messageApi.error('删除失败');
messageApi.error(t('common.deleteFail'));
})
};
@@ -113,26 +115,26 @@ export default function UserList() {
params.userId = currentUser.userId;
editUser(params).then(res => {
if (res.code === 200) {
messageApi.success('编辑成功');
messageApi.success(t('common.editSuccess'));
getUserList();
setModalVisible(false);
} else {
messageApi.error(res.msg || '编辑失败');
messageApi.error(res.msg || t('common.editFail'));
}
}).catch(() => {
messageApi.error('编辑失败');
messageApi.error(t('common.editFail'));
});
} else {
addUser(params).then(res => {
if (res.code === 200) {
messageApi.success('新增成功');
messageApi.success(t('common.addSuccess'));
getUserList();
setModalVisible(false);
} else {
messageApi.error(res.msg || '新增失败');
messageApi.error(res.msg || t('common.addFail'));
}
}).catch(() => {
messageApi.error('新增失败');
messageApi.error(t('common.addFail'));
})
}
});
@@ -140,37 +142,37 @@ export default function UserList() {
// 表格列(支持多角色展示)
const columns = [
{ title: '用户账号', dataIndex: 'userName' },
{ title: '用户昵称', dataIndex: 'nickName' },
{ title: '手机号', dataIndex: 'phonenumber' },
{ title: '邮箱', dataIndex: 'email' },
{ title: t('users.usernameLabel'), dataIndex: 'userName' },
{ title: t('users.nicknameLabel'), dataIndex: 'nickName' },
{ title: t('users.phone'), dataIndex: 'phonenumber' },
{ title: t('users.email'), dataIndex: 'email' },
{
title: '角色',
title: t('users.role'),
render: (_, record) => {
const roles = record.roles || [];
if (roles.length === 0) return <Tag>未分配</Tag>;
return roles.map(item => (
<Tag color="blue" key={item.roleId}>
{item.roleName || item.roleKey || '角色'}
{item.roleName || item.roleKey || t('users.role')}
</Tag>
));
}
},
{
title: '状态',
title: t('roles.status'),
dataIndex: 'status',
render: (s) => s === '0' ?
<Tag color="green">正常</Tag> :
<Tag color="red">停用</Tag>
<Tag color="green">{t('roles.normal')}</Tag> :
<Tag color="red">{t('roles.stopped')}</Tag>
},
{
title: '操作',
title: t('roles.actions'),
render: (_, r) => (
<Space>
<Button type="text" icon={<EditOutlined />} onClick={() => handleEdit(r)}>编辑</Button>
<Popconfirm title="确定删除?" onConfirm={() => handleDelete(r.userId)}>
<Button type="text" danger>删除</Button>
<Button type="text" icon={<EditOutlined />} onClick={() => handleEdit(r)}>{t('roles.edit')}</Button>
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(r.userId)}>
<Button type="text" danger>roles.delete</Button>
</Popconfirm>
</Space>
)
@@ -180,7 +182,7 @@ export default function UserList() {
return (
<div style={{ padding: 20 }}>
{contextHolder}
<Card title="用户管理">
<Card title={t('router.users')}>
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between' }}>
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>
新增用户
@@ -205,7 +207,7 @@ export default function UserList() {
{/* 新增/编辑弹窗 */}
<Modal
title={currentUser ? '编辑用户' : '新增用户'}
title={currentUser ? t('systemSetting.editUser') : t('users.addUser')}
open={modalVisible}
width={650}
onCancel={() => setModalVisible(false)}
@@ -215,12 +217,12 @@ export default function UserList() {
<Form form={form} layout="vertical">
<Row gutter={16}>
<Col span={12}>
<Form.Item name="userName" label="用户账号" rules={[{ required: true }]}>
<Form.Item name="userName" label={t('users.usernameLabel')} rules={[{ required: true }]}>
<Input />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="nickName" label="用户昵称" rules={[{ required: true }]}>
<Form.Item name="nickName" label={t('users.nicknameLabel')} rules={[{ required: true }]}>
<Input />
</Form.Item>
</Col>
@@ -228,12 +230,12 @@ export default function UserList() {
<Row gutter={16}>
<Col span={12}>
<Form.Item name="phonenumber" label="手机号码">
<Form.Item name="phonenumber" label={t('users.phoneLabel')}>
<Input />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="email" label="用户邮箱">
<Form.Item name="email" label={t('profile.email')}>
<Input />
</Form.Item>
</Col>
@@ -241,15 +243,15 @@ export default function UserList() {
<Row gutter={16}>
<Col span={12}>
<Form.Item name="password" label="密码">
<Input.Password placeholder="不填则不修改" />
<Form.Item name="password" label={t('users.passwordLabel')}>
<Input.Password placeholder={t('users.passwordPlaceholder')} />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="language" label="语言">
<Form.Item name="language" label={t('users.languageLabel')}>
<Select placeholder="请选择语言">
<Option value="zh-CN">中文</Option>
<Option value="en">英语</Option>
<Option value="zh-CN">{t('users.chinese')}</Option>
<Option value="en">{t('users.english')}</Option>
</Select>
</Form.Item>
</Col>
@@ -258,7 +260,7 @@ export default function UserList() {
<Row gutter={16}>
<Col span={12}>
{/* 多角色选择 */}
<Form.Item name="roleIds" label="分配角色">
<Form.Item name="roleIds" label={t('users.assignRoleLabel')}>
<Select mode="multiple" placeholder="请选择角色">
{roles.map(item => (
<Option key={item.roleId} value={item.roleId}>
@@ -269,10 +271,10 @@ export default function UserList() {
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="status" label="状态" initialValue="0">
<Form.Item name="status" label={t('roles.status')} initialValue="0">
<Select>
<Option value="0">正常</Option>
<Option value="1">停用</Option>
<Option value="0">{t('roles.normal')}</Option>
<Option value="1">{t('roles.stopped')}</Option>
</Select>
</Form.Item>
</Col>
@@ -282,11 +284,11 @@ export default function UserList() {
<Input />
</Form.Item>
<Form.Item name="sex" label="性别" initialValue="2">
<Form.Item name="sex" label={t('users.genderLabel')} initialValue="2">
<Select>
<Option value="0">男</Option>
<Option value="1">女</Option>
<Option value="2">未知</Option>
<Option value="2">{t('constants.locationUnknown')}</Option>
</Select>
</Form.Item>
</Form>

View File

@@ -12,11 +12,13 @@ import {
ExpandOutlined, SettingOutlined, SearchOutlined, MoreOutlined
} from '@ant-design/icons';
import { Fence, Monitor, HardDrive, BellRing, History, Eye, Play, Square, Volume2, ChevronRight } from 'lucide-react';
import { useTranslation } from 'react-i18next';
const { Text, Title } = Typography;
const { Option } = Select;
export default function VideoMonitorPage() {
const { t } = useTranslation();
const cardStyle = {
borderRadius: 12,
border: '1px solid #f0f0f0',
@@ -25,26 +27,26 @@ export default function VideoMonitorPage() {
};
const [camList] = useState([
{ key: '1', name: 'CAM-01 1#阵列区球机', position: '1#阵列区', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:45' },
{ key: '2', name: 'CAM-02 2#逆变器室', position: '逆变器室', status: '在线', recStatus: '录制中', time: '2025-05-20 10:24:10' },
{ key: '3', name: 'CAM-03 3#电站大门', position: '电站大门', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:58' },
{ key: '4', name: 'CAM-04 4#周界北侧', position: '周界北侧', status: '在线', recStatus: '录制中', time: '2025-05-20 10:24:01' },
{ key: '5', name: 'CAM-05 5#气象站', position: '气象站', status: '在线', recStatus: '录制中', time: '2025-05-20 10:24:05' },
{ key: '6', name: 'CAM-06 6#设备区', position: '设备区', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:50' },
{ key: '7', name: 'CAM-07 7#储能电池舱', position: '储能区', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:47' },
{ key: '8', name: 'CAM-08 8#周界南侧', position: '周界南侧', status: '离线', recStatus: '停止', time: '2025-05-20 09:12:31' },
{ key: '9', name: 'CAM-09 9#阵列区西侧', position: '1#阵列区西侧', status: '离线', recStatus: '停止', time: '2025-05-20 08:55:02' },
{ key: '1', name: 'CAM-01 1#阵列区球机', position: '1#阵列区', status: t('devices.online'), recStatus: '录制中', time: '2025-05-20 10:23:45' },
{ key: '2', name: 'CAM-02 2#逆变器室', position: '逆变器室', status: t('devices.online'), recStatus: '录制中', time: '2025-05-20 10:24:10' },
{ key: '3', name: 'CAM-03 3#电站大门', position: '电站大门', status: t('devices.online'), recStatus: '录制中', time: '2025-05-20 10:23:58' },
{ key: '4', name: 'CAM-04 4#周界北侧', position: '周界北侧', status: t('devices.online'), recStatus: '录制中', time: '2025-05-20 10:24:01' },
{ key: '5', name: 'CAM-05 5#气象站', position: '气象站', status: t('devices.online'), recStatus: '录制中', time: '2025-05-20 10:24:05' },
{ key: '6', name: 'CAM-06 6#设备区', position: '设备区', status: t('devices.online'), recStatus: '录制中', time: '2025-05-20 10:23:50' },
{ key: '7', name: 'CAM-07 7#储能电池舱', position: '储能区', status: t('devices.online'), recStatus: '录制中', time: '2025-05-20 10:23:47' },
{ key: '8', name: 'CAM-08 8#周界南侧', position: '周界南侧', status: t('devices.offline'), recStatus: t('video.stop'), time: '2025-05-20 09:12:31' },
{ key: '9', name: 'CAM-09 9#阵列区西侧', position: '1#阵列区西侧', status: t('devices.offline'), recStatus: t('video.stop'), time: '2025-05-20 08:55:02' },
]);
const camColumns = [
{ title: '摄像头名称', dataIndex: 'name', key: 'name', width: 200 },
{ title: '位置', dataIndex: 'position', key: 'position', width: 120 },
{ title: t('aiAnalysis.location'), dataIndex: 'position', key: 'position', width: 120 },
{
title: '状态', dataIndex: 'status', key: 'status', width: 100,
title: t('roles.status'), dataIndex: 'status', key: 'status', width: 100,
render: (text: string) => (
<Space size={4}>
<div style={{ width: 6, height: 6, borderRadius: '50%', background: text === '在线' ? '#00B42A' : '#F53F3F' }}></div>
<span style={{ color: text === '在线' ? '#00B42A' : '#F53F3F' }}>{text}</span>
<div style={{ width: 6, height: 6, borderRadius: '50%', background: text === t('devices.online') ? '#00B42A' : '#F53F3F' }}></div>
<span style={{ color: text === t('devices.online') ? '#00B42A' : '#F53F3F' }}>{text}</span>
</Space>
)
},
@@ -59,7 +61,7 @@ export default function VideoMonitorPage() {
},
{ title: '最后事件时间', dataIndex: 'time', key: 'time', width: 180 },
{
title: '操作', key: 'action', width: 60,
title: t('roles.actions'), key: 'action', width: 60,
render: () => (
<Button type="text" icon={<PlayCircleOutlined />} size="small" />
)
@@ -197,7 +199,7 @@ export default function VideoMonitorPage() {
extra={
<Space size={16}>
<Button type="link" size="small" icon={<ExpandOutlined />}>自定义布局</Button>
<Button type="link" size="small" icon={<FullscreenOutlined />}>全屏</Button>
<Button type="link" size="small" icon={<FullscreenOutlined />}>{t('video.fullScreen')}</Button>
</Space>
}
bordered={false}
@@ -220,10 +222,10 @@ export default function VideoMonitorPage() {
<ScissorOutlined style={{ color: '#fff', fontSize: 18, cursor: 'pointer' }} />
<CameraOutlined style={{ color: '#fff', fontSize: 18, cursor: 'pointer' }} />
<ExpandOutlined style={{ color: '#fff', fontSize: 18, cursor: 'pointer' }} />
<Select defaultValue="高清" size="small" style={{ width: 80 }} bordered={false} className="video-select">
<Option value="超清">超清</Option>
<Option value="高清">高清</Option>
<Option value="标清">标清</Option>
<Select defaultValue={t('video.high')} size="small" style={{ width: 80 }} bordered={false} className="video-select">
<Option value={t('video.super')}>{t('video.super')}</Option>
<Option value={t('video.high')}>{t('video.high')}</Option>
<Option value={t('video.standard')}>{t('video.standard')}</Option>
</Select>
</Space>
<div style={{ color: '#fff', cursor: 'pointer' }}><MoreOutlined style={{ fontSize: 20 }} /></div>
@@ -302,8 +304,8 @@ export default function VideoMonitorPage() {
<Input placeholder="搜索摄像头名称/位置" prefix={<SearchOutlined />} style={{ width: 200 }} size="small" />
<Select defaultValue="全部状态" size="small" style={{ width: 120 }}>
<Option value="全部状态">全部状态</Option>
<Option value="在线">在线</Option>
<Option value="离线">离线</Option>
<Option value={t('devices.online')}>{t('devices.online')}</Option>
<Option value={t('devices.offline')}>{t('devices.offline')}</Option>
</Select>
</Space>
}
@@ -380,8 +382,8 @@ export default function VideoMonitorPage() {
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'center', gap: 8, marginTop: 10 }}>
<Tooltip title="播放"><Button type="text" icon={<PlayCircleOutlined />} size="small" /></Tooltip>
<Tooltip title="下载"><Button type="text" icon={<DownloadOutlined />} size="small" /></Tooltip>
<Tooltip title={t('video.play')}><Button type="text" icon={<PlayCircleOutlined />} size="small" /></Tooltip>
<Tooltip title={t('common.download')}><Button type="text" icon={<DownloadOutlined />} size="small" /></Tooltip>
<Tooltip title="详情"><Button type="text" icon={<Eye />} size="small" /></Tooltip>
</div>
</div>

View File

@@ -49,6 +49,7 @@ import { RootState } from '../store';
import { getUser } from '../api/user';
import utils, { errorLevelOptions, getWorkOrderTypeText, levelColorMap, levelNum2Text, levelText2Num, workOrderTypeOptions } from '../lib/utils';
import { getAlarmList } from '../api/alarmApi';
import { useTranslation } from 'react-i18next';
const { Option } = Select;
const { Search } = Input;
@@ -66,14 +67,9 @@ const priorityConfig = {
// 工单状态数字映射
const orderStatusConfig = {
1: { label: '待处理', textColor: '#1890ff' },
2: { label: '执行中', textColor: '#1890ff' },
4: { label: '挂起', textColor: '#faad14' },
3: { label: '已完成', textColor: '#52c41a' },
};
const WorkOrderPage = () => {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState('1');
const [selectedRowKeys, setSelectedRowKeys] = useState<string[]>([]); // 批量选中
const [selectedRowKey, setSelectedRowKey] = useState('');
@@ -112,13 +108,20 @@ const WorkOrderPage = () => {
{ value: 2, label: '中' },
{ value: 3, label: '低' }
];
const orderStatusConfig = {
1: { label: t('constants.pending'), textColor: '#1890ff' },
2: { label: t('workOrder.inProgress'), textColor: '#1890ff' },
4: { label: t('workOrder.suspend'), textColor: '#faad14' },
3: { label: t('workOrder.completed'), textColor: '#52c41a' },
};
// 状态选项
const statusOptions = [
{ value: 1, label: '待处理' },
{ value: 2, label: '执行中' },
{ value: 3, label: '已完成' },
{ value: 4, label: '已挂起' }
{ value: 1, label: t('constants.pending') },
{ value: 2, label: t('workOrder.inProgress') },
{ value: 3, label: t('workOrder.completed') },
{ value: 4, label: t('workOrder.suspended') }
];
// 分页状态
@@ -397,7 +400,7 @@ const WorkOrderPage = () => {
latitude: item.latitude || 0,
},
deviceAlias: item.drone_callsign || item.device_sn
|| '无人机',
|| t('constants.uav'),
}));
@@ -467,15 +470,15 @@ const WorkOrderPage = () => {
const getOrderStatusPieData = () => {
const statusMap = {
1: '待处理',
2: '执行中',
3: '已完成',
4: '已挂起',
1: t('constants.pending'),
2: t('workOrder.inProgress'),
3: t('workOrder.completed'),
4: t('workOrder.suspended'),
};
const countMap: Record<string, number> = {};
workOrderList.forEach((item: any) => {
const label = statusMap[item.orderStatus] || '其他';
const label = statusMap[item.orderStatus] || t('constants.others');
countMap[label] = (countMap[label] || 0) + 1;
});
@@ -770,10 +773,10 @@ const WorkOrderPage = () => {
if (!record?.id) return messageApi.warning('无效工单');
try {
await deleteWorkOrder(record.id);
messageApi.success('删除成功');
messageApi.success(t('common.deleteSuccess'));
getWorkOrderList();
} catch (e) {
messageApi.error('删除失败');
messageApi.error(t('common.deleteFail'));
console.error(e);
}
};
@@ -819,23 +822,23 @@ const WorkOrderPage = () => {
// 表格列
const columns = [
{ title: '工单编号', dataIndex: 'orderNo', key: 'orderNo', width: 150 },
{ title: '工单标题', dataIndex: 'orderTitle', key: 'orderTitle', width: 200, ellipsis: true },
{ title: t('workOrder.orderTitle'), dataIndex: 'orderTitle', key: 'orderTitle', width: 200, ellipsis: true },
{
title: '来源',
title: t('workOrder.source'),
dataIndex: 'sourceType',
key: 'sourceType',
width: 90,
render: (t) => sourceTypeMap[t] || t
},
{
title: '类型',
title: t('common.type'),
dataIndex: 'orderType',
key: 'orderType',
width: 80,
render: (val) => getWorkOrderTypeText(val)
},
{
title: '优先级',
title: t('workOrder.priority'),
dataIndex: 'priorityLevel',
key: 'priorityLevel',
width: 80,
@@ -846,9 +849,9 @@ const WorkOrderPage = () => {
)
},
{ title: '设备', dataIndex: 'deviceId', key: 'deviceId', width: 160, ellipsis: true },
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', width: 160 },
{ title: t('common.createTime'), dataIndex: 'createTime', key: 'createTime', width: 160 },
{
title: '状态',
title: t('roles.status'),
dataIndex: 'orderStatus',
key: 'orderStatus',
width: 100,
@@ -860,15 +863,15 @@ const WorkOrderPage = () => {
)
},
{
title: '操作',
title: t('roles.actions'),
key: 'action',
width: 180,
fixed: "right",
render: (_, record) => (
<Space size={4}>
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => handleRowSelect(record)}>查看</Button>
<Button type="link" size="small" icon={<EditOutlined />} onClick={() => { handleRowSelect(record); openEditModal(); }}>修改</Button>
<Popconfirm title="确定删除?" onConfirm={() => handleDelete(record)}>
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => handleRowSelect(record)}>{t('common.view')}</Button>
<Button type="link" size="small" icon={<EditOutlined />} onClick={() => { handleRowSelect(record); openEditModal(); }}>{t('workOrder.modify')}</Button>
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(record)}>
<Button type="link" size="small" danger icon={<DeleteOutlined />}>
删除
</Button>
@@ -942,11 +945,11 @@ const WorkOrderPage = () => {
<Form form={queryForm} layout="inline" initialValues={{
orderStatus: 1
}}>
<Form.Item name="orderType" label="工单类型">
<Form.Item name="orderType" label={t('workOrder.orderType')}>
<Select style={{ width: 120 }} size="small" options={workOrderTypeOptions} allowClear showSearch optionFilterProp="label" filterOption={(input, option) => option.label.toLowerCase().includes(input.toLowerCase())} />
</Form.Item>
<Form.Item name="priorityLevel" label="优先级">
<Form.Item name="priorityLevel" label={t('workOrder.priority')}>
<Select style={{ width: 120 }} size="small" options={errorLevelOptions} allowClear />
</Form.Item>
@@ -954,7 +957,7 @@ const WorkOrderPage = () => {
<RangePicker style={{ width: 320 }} size="small" />
</Form.Item>
<Form.Item name="orderStatus" label="状态" >
<Form.Item name="orderStatus" label={t('roles.status')} >
<Select style={{ width: 120 }} size="small" options={statusOptions} allowClear />
</Form.Item>
@@ -963,8 +966,8 @@ const WorkOrderPage = () => {
</Form.Item>
<Form.Item>
<Space>
<Button size="small" onClick={handleReset}>重置</Button>
<Button type="primary" size="small" icon={<SearchOutlined />} onClick={handleQuery}>查询</Button>
<Button size="small" onClick={handleReset}>{t('common.reset')}</Button>
<Button type="primary" size="small" icon={<SearchOutlined />} onClick={handleQuery}>{t('common.search2')}</Button>
</Space>
</Form.Item>
</Form>
@@ -1168,14 +1171,14 @@ const WorkOrderPage = () => {
size="small"
columns={[
{ title: '工单编号', dataIndex: 'orderNo', width: 260 },
{ title: '工单标题', dataIndex: 'orderTitle', ellipsis: true },
{ title: t('workOrder.orderTitle'), dataIndex: 'orderTitle', ellipsis: true },
{
title: '计划执行时间',
dataIndex: 'planStartTime',
render: t => dayjs(t).format('YYYY-MM-DD HH:mm')
},
{
title: '优先级',
title: t('workOrder.priority'),
dataIndex: 'priorityLevel',
render: p => (
<Tag
@@ -1190,7 +1193,7 @@ const WorkOrderPage = () => {
)
},
{
title: '状态',
title: t('roles.status'),
dataIndex: 'orderStatus',
render: s => orderStatusConfig[s]?.label
},
@@ -1314,10 +1317,10 @@ const WorkOrderPage = () => {
const status = currentDetail?.orderStatus;
// 流程节点
const steps = [
{ label: '已创建', step: 1 },
{ label: '执行中', step: 2 },
{ label: '已挂起', step: 3 },
{ label: '已完成', step: 4 },
{ label: t('workOrder.created'), step: 1 },
{ label: t('workOrder.inProgress'), step: 2 },
{ label: t('workOrder.suspended'), step: 3 },
{ label: t('workOrder.completed'), step: 4 },
];
// 判断节点是否激活
@@ -1433,11 +1436,11 @@ const WorkOrderPage = () => {
</Button>
</div>
<div style={{ flex: 1 }}>
<Button icon={<EditOutlined />} block onClick={openEditModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>修改</Button>
<Button icon={<EditOutlined />} block onClick={openEditModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>{t('workOrder.modify')}</Button>
</div>
<div style={{ flex: 1 }}>
<Popconfirm title="确定挂起?" onConfirm={handleSuspend}>
<Button icon={<PauseOutlined />} danger ghost block style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>挂起</Button>
<Popconfirm title={t('workOrder.confirmSuspend')} onConfirm={handleSuspend}>
<Button icon={<PauseOutlined />} danger ghost block style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>{t('workOrder.suspend')}</Button>
</Popconfirm>
</div>
<div style={{ flex: 1 }}>
@@ -1446,7 +1449,9 @@ const WorkOrderPage = () => {
style={{ background: '#00B42A', color: '#fff', border: 'none', borderRadius: 8, height: 36, fontWeight: 600 }}
block
onClick={openCompleteModal}
>完成</Button>
>
{t('workOrder.complete')}
</Button>
</div>
{isShowDispatch && (
<div style={{ flex: 1 }}>
@@ -1456,7 +1461,7 @@ const WorkOrderPage = () => {
onClick={openDispatchUserModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}
icon={<PlayCircleFilled />}
>
派单
{t('workOrder.dispatch')}
</Button>
</div>
)}
@@ -1465,7 +1470,7 @@ const WorkOrderPage = () => {
</Card>
<Card bordered={false} title={<Text strong style={{ fontSize: 14, color: '#1D2129' }}>AI 建议与关联信息</Text>}
<Card bordered={false} title={<Text strong style={{ fontSize: 14, color: '#1D2129' }}>{t('workOrder.aiSuggestion')}</Text>}
style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '16px' }}>
<Row gutter={12} style={{ marginBottom: 16 }}>
<Col span={8}>
@@ -1473,8 +1478,8 @@ const WorkOrderPage = () => {
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(114,46,209,0.1)' }}>
<RobotOutlined style={{ fontSize: 18, color: '#722ED1' }} />
</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>建议携带</div>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>红外热像设备</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>{t('workOrder.suggestedEquipment')}</div>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>{t('workOrder.thermalCamera')}</div>
</div>
</Col>
<Col span={8}>
@@ -1482,7 +1487,7 @@ const WorkOrderPage = () => {
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(0,180,42,0.1)' }}>
<ThunderboltOutlined style={{ fontSize: 18, color: '#00B42A' }} />
</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>优先复检组件</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>{t('workOrder.priorityInspect')}</div>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>B-12-03 / B-12-05</div>
</div>
</Col>
@@ -1491,7 +1496,7 @@ const WorkOrderPage = () => {
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(247,186,30,0.1)' }}>
<RiseOutlined style={{ fontSize: 18, color: '#F7BA1E' }} />
</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>预计影响发电</div>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>{t('workOrder.estimatedImpact')}</div>
<div style={{ fontSize: 13, fontWeight: 800, color: '#1D2129' }}>2.1%</div>
</div>
</Col>
@@ -1499,7 +1504,7 @@ const WorkOrderPage = () => {
<Row gutter={12}>
<Col span={13}>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129', marginBottom: 12 }}>关联告警趋势 <Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}>(近 7 天)</Text></div>
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129', marginBottom: 12 }}>{t('workOrder.relatedAlertTrend')} <Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}>{t('workOrder.near7Days')}</Text></div>
<UniversalLineChart
data={alarmChartData}
xKey="date"
@@ -1511,9 +1516,9 @@ const WorkOrderPage = () => {
smooth
dot
series={[
{ key: 'ERROR', name: '高告警', color: '#FF4D4F', strokeWidth: 2 },
{ key: 'WARNING', name: '中告警', color: '#FA8C16', strokeWidth: 2 },
{ key: 'INFO', name: '低告警', color: '#52c41a', strokeWidth: 2 },
{ key: 'ERROR', name: t('workOrder.highAlarm'), color: '#FF4D4F', strokeWidth: 2 },
{ key: 'WARNING', name: t('workOrder.midAlarm'), color: '#FA8C16', strokeWidth: 2 },
{ key: 'INFO', name: t('workOrder.lowAlarm'), color: '#52c41a', strokeWidth: 2 },
]}
/>
</Col>
@@ -1532,7 +1537,7 @@ const WorkOrderPage = () => {
)} </div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
{latestThreeAlarm.length === 0 ? (
<Text type="secondary" style={{ fontSize: 11 }}>近7天无告警记录</Text>
<Text type="secondary" style={{ fontSize: 11 }}>{t('workOrder.noAlerts7d')}</Text>
) : (
<>
{latestThreeAlarm.map((item, idx) => (
@@ -1588,36 +1593,36 @@ const WorkOrderPage = () => {
</Row>
{/* 修改工单弹窗 */}
<Modal title="修改工单" open={editModalVisible} onCancel={() => setEditModalVisible(false)} footer={null} width={520}>
<Modal title={t('workOrder.modifyOrder')} open={editModalVisible} onCancel={() => setEditModalVisible(false)} footer={null} width={520}>
<Form form={form} layout="vertical" onFinish={submitEdit}>
<FormItem name="orderTitle" label="工单标题" rules={[{ required: true, message: '请输入工单标题' }]}>
<Input placeholder="请输入工单标题" />
<FormItem name="orderTitle" label={t('workOrder.orderTitle')} rules={[{ required: true, message: t('workOrder.pleaseInputTitle') }]}>
<Input placeholder={t('workOrder.pleaseInputTitle')} />
</FormItem>
<FormItem name="orderType" label="工单类型" rules={[{ required: true, message: '请选择工单类型' }]}>
<Select placeholder="请选择工单类型" options={workOrderTypeOptions} />
<FormItem name="orderType" label={t('workOrder.orderType')} rules={[{ required: true, message: t('workOrder.pleaseSelectType') }]}>
<Select placeholder={t('workOrder.pleaseSelectType')} options={workOrderTypeOptions} />
</FormItem>
<FormItem name="priorityLevel" label="优先级" rules={[{ required: true, message: '请选择优先级' }]}>
{/*<Select placeholder="请选择优先级">
<FormItem name="priorityLevel" label={t('workOrder.priority')} rules={[{ required: true, message: t('workOrder.pleaseSelectPriority') }]}>
{/*<Select placeholder={t('workOrder.pleaseSelectPriority')}>
<Option value={1}>ERROR(高)</Option><Option value={2}>WARNING</Option><Option value={3}>INFO</Option>
</Select>*/}
<Form.Item name="priorityLevel" label="优先级">
<Form.Item name="priorityLevel" label={t('workOrder.priority')}>
<Select options={errorLevelOptions} allowClear />
</Form.Item>
</FormItem>
<FormItem name="taskDescription" label="任务描述" rules={[{ required: true, message: '请输入任务描述' }]}>
<FormItem name="taskDescription" label={t('workOrder.taskDescription')} rules={[{ required: true, message: '请输入任务描述' }]}>
<Input.TextArea rows={4} placeholder="请输入任务描述" />
</FormItem>
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
<Button onClick={() => setEditModalVisible(false)}>取消</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认修改</Button>
<Button onClick={() => setEditModalVisible(false)}>{t('common.cancel')}</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('profile.confirmChange')}</Button>
</FormItem>
</Form>
</Modal>
{/* 派单弹窗:选择人员 */}
<Modal
title="工单派单"
title={t('workOrder.dispatchOrder')}
open={dispatchUserModalVisible}
onCancel={() => setDispatchUserModalVisible(false)}
footer={null}
@@ -1641,8 +1646,8 @@ const WorkOrderPage = () => {
</FormItem>
<FormItem
name="assignUserId"
label="选择接收人员"
rules={[{ required: true, message: '请选择派单人员' }]}
label={t('workOrder.selectReceiver')}
rules={[{ required: true, message: t('workOrder.pleaseSelectDispatcher') }]}
>
<Select
placeholder="请选择人员"
@@ -1659,15 +1664,15 @@ const WorkOrderPage = () => {
/>
</FormItem>
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
<Button onClick={() => setDispatchUserModalVisible(false)}>取消</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认派单</Button>
<Button onClick={() => setDispatchUserModalVisible(false)}>{t('common.cancel')}</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('workOrder.confirmDispatch')}</Button>
</FormItem>
</Form>
</Modal>
{/* 执行工单弹窗 */}
<Modal title="执行工单" open={dispatchModalVisible} onCancel={() => setDispatchModalVisible(false)} footer={null} width={550}>
<Modal title={t('workOrder.executeOrder')} open={dispatchModalVisible} onCancel={() => setDispatchModalVisible(false)} footer={null} width={550}>
<Form form={form} layout="vertical" onFinish={submitExecute}>
<FormItem name="orderIds" label="工单ID" hidden><Input /></FormItem>
<FormItem label="选中工单">
@@ -1693,7 +1698,7 @@ const WorkOrderPage = () => {
</FormItem>
<FormItem
name="deviceId"
label="选择执行设备"
label={t('workOrder.selectDevice')}
>
{/*<Select
style={{ width: "80%", marginBottom: 8 }}
@@ -1708,8 +1713,8 @@ const WorkOrderPage = () => {
String(option?.label || "").toLowerCase().includes(input.toLowerCase())
}
options={[
{ label: <span>机器人</span>, options: devices.map(item => ({ value: item.device_sn || item.serialNumber, label: item.deviceAlias || item.deviceName || '未知设备' })) },
{ label: <span>无人机</span>, options: planedevices.map(item => ({ value: item.device_sn, label: item.drone_callsign || item.callsign || '未知设备' })) },
{ label: <span>devices.robot</span>, options: devices.map(item => ({ value: item.device_sn || item.serialNumber, label: item.deviceAlias || item.deviceName || '未知设备' })) },
{ label: <span>constants.uav</span>, options: planedevices.map(item => ({ value: item.device_sn, label: item.drone_callsign || item.callsign || '未知设备' })) },
]}
/>*/}
@@ -1724,7 +1729,7 @@ const WorkOrderPage = () => {
}}
>
{/* 机器人设备分组 */}
<Select.OptGroup label="机器人">
<Select.OptGroup label={t('devices.robot')}>
{deviceAll
.filter(item => item.serialNumber)
.map(device => (
@@ -1738,7 +1743,7 @@ const WorkOrderPage = () => {
</Select.OptGroup>
{/* 无人机分组 */}
<Select.OptGroup label="无人机">
<Select.OptGroup label={t('constants.uav')}>
{deviceAll
.filter(item => item.device_sn)
.map(device => (
@@ -1755,7 +1760,7 @@ const WorkOrderPage = () => {
{/*<FormItem
name="startTime"
label="执行开始时间"
label={t('workOrder.execStartTime')}
>
<DatePicker
showTime
@@ -1765,33 +1770,33 @@ const WorkOrderPage = () => {
/>
</FormItem>*/}
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
<Button onClick={() => setDispatchModalVisible(false)}>取消</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认执行</Button>
<Button onClick={() => setDispatchModalVisible(false)}>{t('common.cancel')}</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('workOrder.confirmExecute')}</Button>
</FormItem>
</Form>
</Modal>
{/* 完成工单弹窗 */}
<Modal title="完成工单" open={completeModalVisible} onCancel={() => setCompleteModalVisible(false)} footer={null} width={500}>
<Modal title={t('workOrder.completeOrder')} open={completeModalVisible} onCancel={() => setCompleteModalVisible(false)} footer={null} width={500}>
<Form form={completeForm} layout="vertical" onFinish={submitComplete}>
<Form.Item name="id" hidden><Input /></Form.Item>
<Form.Item name="orderNo" label="工单编号"><Input disabled /></Form.Item>
<Form.Item name="handleResult" label="处理结果" rules={[{ required: true, message: '请输入处理结果' }]}>
<Form.Item name="handleResult" label={t('alerts.handleResult')} rules={[{ required: true, message: '请输入处理结果' }]}>
<Select placeholder="请选择处理结果">
<Option value="已处理完成">已处理完成</Option><Option value="已修复">已修复</Option><Option value="无需处理">无需处理</Option><Option value="问题已闭环">问题已闭环</Option>
</Select>
</Form.Item>
<Form.Item name="handleRemark" label="处理备注"><Input.TextArea rows={4} placeholder="请填写处理详情、备注信息" /></Form.Item>
<Form.Item name="handleRemark" label={t('alerts.handleRemark')}><Input.TextArea rows={4} placeholder="请填写处理详情、备注信息" /></Form.Item>
<Form.Item style={{ textAlign: 'right', marginBottom: 0 }}>
<Button onClick={() => setCompleteModalVisible(false)}>取消</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认完成</Button>
<Button onClick={() => setCompleteModalVisible(false)}>{t('common.cancel')}</Button>
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('workOrder.confirmComplete')}</Button>
</Form.Item>
</Form>
</Modal>
{/* 近7天全部告警弹窗 */}
<Modal
title="近7天全部关联告警"
title={t('workOrder.relatedAlerts7d')}
open={alarmAllModalVisible}
onCancel={() => setAlarmAllModalVisible(false)}
width={900}
@@ -1816,33 +1821,33 @@ const WorkOrderPage = () => {
ellipsis: true
},
{
title: '告警级别',
title: t('alerts.alertLevel'),
dataIndex: 'alarmLevel',
width: 90,
render: (level) => {
const color = levelColorMap[level] || '#86909C';
const label = priorityConfig[level]?.label || '未知';
const label = priorityConfig[level]?.label || t('constants.locationUnknown');
return <Tag color={color}>{label}</Tag>;
}
},
{
title: '告警时间',
title: t('alerts.alertTime'),
dataIndex: 'alarmTime',
width: 170,
render: (t) => dayjs(t).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '设备名称',
title: t('devices.deviceName'),
dataIndex: 'deviceName',
ellipsis: true,
width: 200
},
{
title: '处理状态',
title: t('alerts.handleStatus'),
dataIndex: 'handleStatus',
width: 100,
render: (s) => {
const map = { 1: '待处理', 2: '已关闭', };
const map = { 1: t('constants.pending'), 2: t('constants.closed'), };
let tagColor = 'default';
if (s === 1) tagColor = 'orange';
if (s === 2) tagColor = 'green';