中英文切换

This commit is contained in:
mmc
2026-08-14 09:02:52 +08:00
parent a8af55a856
commit 62b03bba03
94 changed files with 19723 additions and 2766 deletions

View File

@@ -40,14 +40,6 @@ import { useTranslation } from 'react-i18next';
const { Content } = Layout;
const { Text, Title } = Typography;
const taskTimeline = [
{ time: '10:24:18', color: 'blue', text: 'UAV-C01 开始执行清洗航线 C-05', status: '任务开始' },
{ time: '10:21:35', color: 'orange', text: 'RBT-01 开始执行巡检航线 P-02', status: '任务开始' },
{ time: '10:18:02', color: 'green', text: 'GR-02 开始除草作业 G-01', status: '任务开始' },
{ time: '10:15:47', color: 'gray', text: 'UAV-C02 任务待命就绪', status: '待命就绪' },
{ time: '10:12:33', color: 'blue', text: 'UAV-C01 再次返机补水', status: '返机补给' },
{ time: '09:58:10', color: 'green', text: 'RBT-02 完成巡检航线 P-01', status: '任务完成' },
];
export default function DeviceOverviewPage() {
@@ -89,6 +81,15 @@ export default function DeviceOverviewPage() {
{ time: '10:12:35', device: 'UAV-C01', type: t('constants.sourceAlert'), desc: '返航补水' },
{ time: '10:05:22', device: 'RBT-01', type: '事件', desc: '电量较低,建议回充', level: '低电量' },
];
const taskTimeline = [
{ time: '10:24:18', color: 'blue', text: t('devices.uavC01ExecuteFixed2CleaningC05'), status: '任务开始' },
{ time: '10:21:35', color: 'orange', text: t('devices.rbt01ExecuteFixed2InspectionP02'), status: '任务开始' },
{ time: '10:18:02', color: 'green', text: t('devices.gr02G01'), status: '任务开始' },
{ time: '10:15:47', color: 'gray', text: t('devices.uavC02TaskSuspended2'), status: '待命就绪' },
{ time: '10:12:33', color: 'blue', text: t('devices.uavC01'), status: '返机补给' },
{ time: '09:58:10', color: 'green', text: t('devices.rbt02CompleteFixed2InspectionP01'), status: '任务完成' },
];
@@ -143,7 +144,7 @@ export default function DeviceOverviewPage() {
// 仅机器人允许编辑,无人机直接提示
const isRobot = !record.gateway_sn && !record.drone_callsign;
if (!isRobot) {
message.info('仅支持编辑机器人设备别名');
message.info(t('devices.editFixed2RobotFixed2Device'));
return;
}
setCurrentEditRobot(record);
@@ -154,7 +155,7 @@ export default function DeviceOverviewPage() {
// 确认保存别名
const handleSaveRobotAlias = async () => {
if (!currentEditRobot || !editAliasInput.trim()) {
utils.message.warning('设备别名不能为空');
utils.message.warning(t('devices.fixed2Device'));
return;
}
setEditLoading(true);
@@ -167,15 +168,15 @@ export default function DeviceOverviewPage() {
const res = await updateDeviceAliasApi(data);
if (res.code === 200 && res.data == true) {
fetchAllData();
utils.message.success('别名修改成功');
utils.message.success(t('devices.modifiedSuccessfullyFixed2'));
setEditRobotModalOpen(false);
} else {
utils.message.error('修改失败,请重试');
utils.message.error(t('devices.fixed2ModificationFailed'));
}
} catch (err) {
console.error('修改别名报错', err);
utils.message.error('接口异常,修改失败');
utils.message.error(t('devices.fixed2Fixed2AbnormalModificationFailedFixed2'));
} finally {
setEditLoading(false);
}
@@ -438,7 +439,7 @@ export default function DeviceOverviewPage() {
setCurrentParamDevice(data);
setParamModalOpen(true);
} else {
utils.message.error('无权限');
utils.message.error(t('devices.noPermission'));
}
}
})
@@ -470,7 +471,7 @@ export default function DeviceOverviewPage() {
return [
{
title: '无人机机场状态',
title: t('devices.fixed2DroneAirportFixed2StatusFixed2'),
icon: <EnvironmentOutlined style={{ color: '#165DFF', fontSize: 24 }} />,
value: `${onlineDrones} / ${totalDrones}`,
sub: `可调度 ${onlineDrones} 架`,
@@ -486,7 +487,7 @@ export default function DeviceOverviewPage() {
iconBg: '#E6FFFA'
},
{
title: '除草机器人',
title: t('devices.mowingRobot'),
icon: <CarOutlined style={{ color: '#722ED1', fontSize: 24 }} />,
value: `${totalMowers} 台`,
sub: `任务中 ${activeMowers}`,
@@ -494,7 +495,7 @@ export default function DeviceOverviewPage() {
iconBg: '#F9F0FF'
},
{
title: '清洗无人机',
title: t('devices.washDrone'),
icon: <CloudOutlined style={{ color: '#eb2f96', fontSize: 24 }} />,
value: `${totalDrones} 架`,
sub: `待命 ${washDroneStandby}`,
@@ -502,7 +503,7 @@ export default function DeviceOverviewPage() {
iconBg: '#FFF1F3'
},
//{
// title: '设备平均电量',
// title: t('devices.fixed2DeviceBatteryFixed2'),
// icon: <ThunderboltOutlined style={{ color: '#52c41a', fontSize: 24 }} />,
// value: `${finalAvgBattery}%`,
// sub: '',
@@ -510,7 +511,7 @@ export default function DeviceOverviewPage() {
// iconBg: '#E8FFEA'
//},
{
title: '今日任务执行',
title: t('devices.todayTaskExecute'),
icon: <CheckCircleOutlined style={{ color: '#2f54eb', fontSize: 24 }} />,
value: `${completedTasks} / ${totalTasks}`,
sub: `完成率 ${completionRate}%`,
@@ -537,11 +538,11 @@ export default function DeviceOverviewPage() {
})) || [];
}, [devicesAll]);
const handleStart = () => message.success('任务已启动');
const handlePause = () => message.info('任务已暂停');
const handleReturn = () => message.info('返航指令已下发');
const handleRecharge = () => message.info('回充指令已下发');
const handleEmergencyStop = () => message.error('已触发急停!');
const handleStart = () => message.success(t('devices.fixed2TaskSuspended22'));
const handlePause = () => message.info(t('devices.taskPaused'));
const handleReturn = () => message.info(t('devices.fixed2ReturnHomeFixed2CommandIssuedFixed2'));
const handleRecharge = () => message.info(t('devices.commandIssuedFixed2'));
const handleEmergencyStop = () => message.error(t('devices.s73'));
const fix2 = (val) => {
if (val === null || val === undefined || isNaN(val)) return '-';
@@ -578,7 +579,7 @@ export default function DeviceOverviewPage() {
return (
<div style={{ background: '#f5f7fa', minHeight: '100%' }}>
<div style={{ padding: '4px 0px 8px' }}>
<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('devices.fixed2Equipment')}</Typography.Title>
</div>
<Content style={{ margin: '0 8', }}>
<Row gutter={[12, 12]} style={{ marginBottom: 8, flexWrap: 'wrap' }}>
@@ -626,28 +627,28 @@ export default function DeviceOverviewPage() {
<Row gutter={[8, 8]}>
<Col xs={24} lg={14}>
<Card title={<><EnvironmentOutlined /> 装备协同态势图</>} extra={<Button type="text" icon={<SettingOutlined />} />} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 0 }}>
<Card title={<><EnvironmentOutlined />{t('devices.fixed2Equipment')}</>} extra={<Button type="text" icon={<SettingOutlined />} />} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 0 }}>
<div style={{ width: '100%', height: 350, borderRadius: 8, position: 'relative', overflow: 'hidden' }}>
<div style={{ position: 'absolute', zIndex: 9999, top: 12, left: 12, background: 'rgba(255,255,255,0.95)', borderRadius: 6, padding: 8 }}>
<div style={{ fontSize: 11, fontWeight: 60, marginBottom: 4 }}>图例说明</div>
<div style={{ fontSize: 11, fontWeight: 60, marginBottom: 4 }}>{t('devices.s22')}</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, fontSize: 10 }}>
<div><span style={{ color: '#1890ff' }}>———</span> 巡检航线</div>
<div><span style={{ color: '#fa8c16' }}>———</span> 机器人路径</div>
<div><span style={{ color: '#52c41a' }}>———</span> 清洗路径</div>
<div>🚗 机器位置</div>
<div>✈️ 无人机位置</div>
<div><span style={{ color: '#1890ff' }}>●</span> 补给/充电点</div>
<div><span style={{ color: '#ff4d4f' }}>■</span> 障碍/禁入区</div>
<div><span style={{ color: '#1890ff' }}>———</span>{t('devices.fixed2Inspection')}</div>
<div><span style={{ color: '#fa8c16' }}>———</span>{t('devices.robotPath')}</div>
<div><span style={{ color: '#52c41a' }}>———</span>{t('devices.cleaningPath')}</div>
<div>{t('devices.locationFixed2')}</div>
<div>{t('devices.dronePositionFixed2')}</div>
<div><span style={{ color: '#1890ff' }}>●</span>{t('devices.chargePointFixed2')}</div>
<div><span style={{ color: '#ff4d4f' }}>■</span>{t('devices.s9')}</div>
</div>
</div>
<CesiumMap devices={devicesAll} />
</div>
</Card>
<Card title={<><SettingOutlined /> 装备调度列表</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }}>
<Card title={<><SettingOutlined />{t('devices.fixed2EquipmentListFixed2')}</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }}>
<Table rowKey={(record) => record.id || record.serialNumber || record.device_sn} size="small" pagination={false}
columns={[
{ title: '装备名称', dataIndex: 'name', width: 140 },
{ title: t('devices.fixed2EquipmentFixed2NameFixed2'), dataIndex: 'name', width: 140 },
{ title: t('common.type'), dataIndex: 'type', width: 90 },
{
title: t('workOrder.currentStatus'),
@@ -659,7 +660,7 @@ export default function DeviceOverviewPage() {
return <Tag color={color} style={{ margin: 0 }}>{text}</Tag>;
}
}, {
title: '模式', dataIndex: 'mode', width: 70, render: (text) => {
title: t('devices.abMode'), dataIndex: 'mode', width: 70, render: (text) => {
let color = 'default';
if (text === '作业中') color = 'processing';
if (text === t('devices.idle')) color = 'success';
@@ -683,8 +684,8 @@ export default function DeviceOverviewPage() {
/>;
}
}, { title: t('aiAnalysis.location'), dataIndex: 'position', width: 90 },
//{ title: '当前任务', dataIndex: 'task', width: 100 },
{ title: '通讯状态', dataIndex: 'comm', width: 100, render: v => <Badge status={v.includes('-') ? 'warning' : 'success'} text={v} /> },
//{ title: t('devices.fixed2CurrentFixed2TaskSuspended2Fixed2'), dataIndex: 'task', width: 100 },
{ title: t('devices.statusFixed2'), dataIndex: 'comm', width: 100, render: v => <Badge status={v.includes('-') ? 'warning' : 'success'} text={v} /> },
{
title: t('roles.actions'),
key: 'action',
@@ -700,7 +701,7 @@ export default function DeviceOverviewPage() {
onClick={() => openEditRobotModal(record)}
title={t('roles.edit')}
/>
<Tooltip title="设备参数设置">
<Tooltip title={t('devices.deviceParamSetting')}>
<Button
size="small"
type="text"
@@ -719,26 +720,26 @@ export default function DeviceOverviewPage() {
/>
</Card>
<Card title={<><SettingOutlined /> <span >控制日志 / 告警记录</span></>} bordered={false} style={{ borderRadius: 8 }} extra={<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Button size="small" style={{ borderRadius: 4, border: '1px solid #d9d9d9' }}>全部级别 ▼</Button></div>}>
<Card title={<><SettingOutlined /> <span >{t('devices.fixed2ControlFixed2LogDesc6Alert')}</span></>} bordered={false} style={{ borderRadius: 8 }} extra={<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Button size="small" style={{ borderRadius: 4, border: '1px solid #d9d9d9' }}>{t('devices.fixed2AllLevels')}</Button></div>}>
<Table rowKey="time" size="small" pagination={false} dataSource={logs} scroll={{ x: 'max-content' }}
columns={[
{ title: t('common.time'), dataIndex: 'time', width: 90, render: t => <span style={{ fontSize: 13 }}>{t}</span> },
{ title: '设备', dataIndex: 'device', width: 100, render: t => <span style={{ fontSize: 13 }}>{t}</span> },
{ title: t('devices.device'), dataIndex: 'device', width: 100, render: t => <span style={{ fontSize: 13 }}>{t}</span> },
{ title: t('common.type'), dataIndex: 'type', width: 70, render: r => { let c = '#52c41a'; if (r === t('constants.sourceAlert')) c = '#fa8c16'; if (t === 'events') c = '#1890ff'; return <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}><span style={{ width: 10, height: 10, borderRadius: 2, background: c }} /><span style={{ fontSize: 13 }}>{t}</span></div> } },
{ title: t('common.description'), dataIndex: 'desc', render: t => <span style={{ fontSize: 13 }}>{t}</span> },
{ title: '', width: 70, render: (_, r) => r.level ? <Tag color="red" style={{ fontSize: 11, margin: 0 }}>{r.level}</Tag> : null }
]}
/>
<div style={{ textAlign: 'center', marginTop: 8 }}><Button type="link" size="small" style={{ fontSize: 13, color: '#1890ff' }}>查看更多日志</Button></div>
<div style={{ textAlign: 'center', marginTop: 8 }}><Button type="link" size="small" style={{ fontSize: 13, color: '#1890ff' }}>{t('devices.viewMoreLogs')}</Button></div>
</Card>
</Col>
<Col xs={24} lg={10}>
<Card title={<><SettingOutlined style={{ marginRight: 6, }} /> 设备控制面板</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 12, paddingBottom: 0 }}>
<Card title={<><SettingOutlined style={{ marginRight: 6, }} />{t('devices.deviceControlPanel')}</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 12, paddingBottom: 0 }}>
<Select
style={{ width: "80%", marginBottom: 8 }}
placeholder="请选择设备"
placeholder={t('workOrder.selectDeviceFixed2')}
value={selectedDevice?.device_sn || selectedDevice?.serialNumber}
onChange={handleDeviceChange}
size="small"
@@ -772,7 +773,7 @@ export default function DeviceOverviewPage() {
type="primary" size="small" ghost icon={<InfoCircleOutlined />}
style={{ borderRadius: 4, fontSize: 11, marginLeft: 'auto' }}
onClick={() => onViewStatus(selectedDevice.device_sn || selectedDevice.serialNumber)}
>详情</Button>
>{t('common.detail')}</Button>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 4 }}>
@@ -791,40 +792,40 @@ export default function DeviceOverviewPage() {
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 12, maxHeight: "160px", overflow: "auto", scrollbarWidth: 'thin', scrollbarColor: '#ccc transparent' }}>
{selectedDevice.productName && (
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>产品类型</span>
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.productType')}</span>
<span style={{ fontSize: 12 }}>{getVal(selectedDevice.productName)}</span>
</div>
)}
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: 8 }}>
<span style={{ color: '#666', fontSize: 12, whiteSpace: 'nowrap' }}>设备SN</span>
<span style={{ color: '#666', fontSize: 12, whiteSpace: 'nowrap' }}>{t('systemSetting.fixed2DeviceSn')}</span>
<span style={{ fontSize: 12, wordBreak: 'break-all', whiteSpace: 'normal', textAlign: 'right', maxWidth: '70%' }}>
{getVal(selectedDevice.device_sn || selectedDevice.serialNumber)}
</span>
</div>
{selectedDevice.activeTime && (
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>激活时间</span>
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.timeFixed2')}</span>
<span style={{ fontSize: 12 }}>{selectedDevice.activeTime}</span>
</div>
)}
{selectedDevice.firmwareVersion && (
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>固件版本</span>
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.firmwareVersion')}</span>
<span style={{ fontSize: 12 }}>v{selectedDevice.firmwareVersion}</span>
</div>
)}
{(selectedDevice.productName?.includes(t('constants.uav')) || selectedDevice.device_sn) && (
<>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>飞行高度</span>
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.flightAltitude')}</span>
<span style={{ fontSize: 12 }}>{fix2(realtimeDevice?.height)} m</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>飞行风速</span>
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.s21')}</span>
<span style={{ fontSize: 12 }}>{fix2(realtimeDevice?.wind_speed)} m/s</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#666', fontSize: 12 }}>rtk数量</span>
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.rtkQuantityFixed2')}</span>
<span style={{ fontSize: 12 }}>
<Badge
showZero={true}
@@ -838,10 +839,10 @@ export default function DeviceOverviewPage() {
</div>
<div style={{ display: 'flex', justifyContent: "space-between", flexWrap: 'wrap', gap: 6 }}>
<Button type="primary" style={{ borderRadius: 8, flex: 1 }} onClick={handleStart}>启动</Button>
<Button type="primary" style={{ borderRadius: 8, flex: 1 }} onClick={handleStart}>{t('devices.s23')}</Button>
<Button style={{ borderRadius: 8, flex: 1 }} onClick={handlePause}>{t('video.pause')}</Button>
<Button type="primary" style={{ borderRadius: 8, flex: 1 }} onClick={handleReturn}>{t('devices.returnHome')}</Button>
<Button style={{ flex: 1, background: '#52c41a', borderColor: '#52c41a', color: "#fff", borderRadius: 8, }} onClick={handleRecharge}>回充</Button>
<Button style={{ flex: 1, background: '#52c41a', borderColor: '#52c41a', color: "#fff", borderRadius: 8, }} onClick={handleRecharge}>{t('devices.s24')}</Button>
</div>
</div>
</Col>
@@ -849,7 +850,7 @@ export default function DeviceOverviewPage() {
<Col span={12}>
<div style={{ marginBottom: 8 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 }}>
<span style={{ fontSize: 14, fontWeight: 500, color: "#666" }}>实时画面</span>
<span style={{ fontSize: 14, fontWeight: 500, color: "#666" }}>{t('devices.s25')}</span>
{isUAV && (
<Select
size="small"
@@ -857,8 +858,8 @@ export default function DeviceOverviewPage() {
value={videoSource}
onChange={setVideoSource}
options={[
{ label: '机场视频', value: 'station' },
{ label: '无人机视频', value: 'drone' },
{ label: t('devices.videoFixed2'), value: 'station' },
{ label: t('devices.droneVideo'), value: 'drone' },
]}
/>
)}
@@ -886,9 +887,7 @@ export default function DeviceOverviewPage() {
ready={ready}
/>
) : (
<div style={{ color: '#ccc', display: 'flex', height: '100%', alignItems: 'center', justifyContent: 'center' }}>
视频加载中...
</div>
<div style={{ color: '#ccc', display: 'flex', height: '100%', alignItems: 'center', justifyContent: 'center' }}>{t('video.videoLoading')}</div>
)
) : (
// ========== 未点击播放时:显示播放大按钮 ==========
@@ -931,7 +930,7 @@ export default function DeviceOverviewPage() {
onClick={() => {
setRobotPlayActive(false);
}}
>停止视频</Button>
>{t('devices.fixed2StopFixed2VideoFixed2')}</Button>
</div>
)}
@@ -939,66 +938,66 @@ export default function DeviceOverviewPage() {
</div>
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
<Button size="large" style={{ flex: 1, borderRadius: 8 }}>切换手动</Button>
<Button danger size="large" style={{ flex: 1, borderRadius: 8 }} onClick={handleEmergencyStop}>急停</Button>
<Button size="large" style={{ flex: 1, borderRadius: 8 }}>{t('devices.switchManual')}</Button>
<Button danger size="large" style={{ flex: 1, borderRadius: 8 }} onClick={handleEmergencyStop}>{t('devices.s29')}</Button>
</div>
</Col>
</Row>
)}
</Card>
<Card title={<><ApiOutlined /> AI分析与操作建议</>} bordered={false} style={{ borderRadius: 12, marginBottom: 8 }}>
<Card title={<><ApiOutlined />{t('devices.fixed2AiActions')}</>} bordered={false} style={{ borderRadius: 12, marginBottom: 8 }}>
<Row gutter={16} style={{ marginBottom: 8 }}>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(255,77,79,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#ff4d4f', fontSize: 20 }}><span role="img" aria-label="hotspot">🔥</span></div><div><div style={{ fontSize: 11, color: '#666' }}>热斑疑似</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>2 <span style={{ fontSize: 12 }}>处</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(82,196,26,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#52c41a', fontSize: 16 }}><BranchesOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>杂草高发区</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>3 <span style={{ fontSize: 12 }}>块</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(24,144,255,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#1890ff', fontSize: 16 }}><CloudOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>组件风险区</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>4 <span style={{ fontSize: 12 }}>块</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(255,77,79,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#ff4d4f', fontSize: 16 }}><WarningOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>围栏异常</div><div style={{ fontSize: 22, fontWeight: 700, color: '#ff4d4f' }}>1 <span style={{ fontSize: 12 }}>处</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(255,77,79,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#ff4d4f', fontSize: 20 }}><span role="img" aria-label="hotspot">🔥</span></div><div><div style={{ fontSize: 11, color: '#666' }}>{t('devices.hotspotSuspect')}</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>2 <span style={{ fontSize: 12 }}>{t('devices.s32')}</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(82,196,26,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#52c41a', fontSize: 16 }}><BranchesOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>{t('devices.s33')}</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>3 <span style={{ fontSize: 12 }}>{t('devices.s34')}</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(24,144,255,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#1890ff', fontSize: 16 }}><CloudOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>{t('devices.s35')}</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>4 <span style={{ fontSize: 12 }}>{t('devices.s34')}</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(255,77,79,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#ff4d4f', fontSize: 16 }}><WarningOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>{t('devices.fenceAbnormal')}</div><div style={{ fontSize: 22, fontWeight: 700, color: '#ff4d4f' }}>1 <span style={{ fontSize: 12 }}>{t('devices.s32')}</span></div></div></div></Col>
</Row>
<Row gutter={16}>
<Col span={14}>
<div style={{ marginBottom: 12 }}>
<div style={{ fontSize: 16, fontWeight: 600, color: '#1890ff', marginBottom: 8 }}>建议操作</div>
<div style={{ fontSize: 16, fontWeight: 600, color: '#1890ff', marginBottom: 8 }}>{t('devices.suggestAction')}</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, padding: '4px', borderRadius: 12, border: '1px solid #e8e8e8' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>优先执行巡检航线 P-03</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>先行安排除草任务 G-02</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>建议生成清洗工单</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>{t('devices.executeFixed2InspectionP03')}</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>{t('devices.taskSuspended2G02')}</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>{t('devices.generateCleaningOrderFixed2')}</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
</div>
</div>
</Col>
<Col span={10}>
<div style={{ display: 'flex', flexDirection: 'column', paddingBottom: "12px", gap: 16, height: '100%', justifyContent: "end" }}>
<div style={{ display: 'flex', gap: 12, flexWrap: "wrap" }}>
<Button type="primary" size="middle" style={{ flex: 1, borderRadius: 8, fontSize: 14 }}>生成任务</Button>
<Button size="middle" style={{ flex: 1, borderRadius: 8, fontSize: 14, border: '1px solid #1890ff', color: '#1890ff' }}>AI优化路径</Button>
<Button type="primary" size="middle" style={{ flex: 1, borderRadius: 8, fontSize: 14 }}>{t('devices.generateTask')}</Button>
<Button size="middle" style={{ flex: 1, borderRadius: 8, fontSize: 14, border: '1px solid #1890ff', color: '#1890ff' }}>{t('devices.aiOptimizePath')}</Button>
</div>
<Button type="primary" size="middle" style={{ borderRadius: 8, fontSize: 14 }}>一键联动作业</Button>
<Button type="primary" size="middle" style={{ borderRadius: 8, fontSize: 14 }}>{t('devices.s43')}</Button>
</div>
</Col>
</Row>
</Card>
{(selectedDevice?.productName?.includes(t('constants.uav')) || selectedDevice?.device_sn) && (
<Card title="环境与飞行条件" bordered={false} style={{ borderRadius: 12, marginBottom: 8 }}>
<Card title={t('devices.s60')} bordered={false} style={{ borderRadius: 12, marginBottom: 8 }}>
<div style={{ display: "flex", justifyContent: "space-between", gap: 12, alignItems: "center" }}>
<div style={{ display: "flex", border: "1px solid #e8e8e8", borderRadius: 12, overflow: "hidden", flex: 1 }}>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>风速</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{fix2(realtimeDevice?.wind_speed)} m/s</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>{t('devices.s44')}</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{fix2(realtimeDevice?.wind_speed)} m/s</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>{t('home.temperature')}</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{fix2(realtimeDevice?.environment_temperature)}℃</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>降雨</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{getVal(realtimeDevice?.rainfall)}</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>{t('devices.rainfall')}</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{getVal(realtimeDevice?.rainfall)}</div></div>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>RTK</div><div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a', marginTop: 2 }}>{realtimeDevice?.position_state?.is_fixed === 'fixing_successful' ? '固定' : '未固定'}</div></div>
</div>
<div style={{ width: 110, padding: '12px 4px', borderRadius: 8, background: '#f6ffed', border: '1px solid #b7eb8f', textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 4 }}>
<div className="flex items-center gap-1">
<div style={{ fontSize: 12, fontWeight: 700, color: '#52c41a' }}>适宜执行</div>
<div style={{ fontSize: 12, fontWeight: 700, color: '#52c41a' }}>{t('devices.suitableExec')}</div>
<div style={{ width: 18, height: 18, borderRadius: '50%', background: '#52c41a', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><CheckCircleOutlined style={{ fontSize: 12, color: '#fff' }} /></div>
</div>
<div style={{ fontSize: 11, color: '#666' }}>可正常作业</div>
<div style={{ fontSize: 11, color: '#666' }}>{t('devices.normal')}</div>
</div>
</div>
</Card>
)}
{(!selectedDevice?.productName?.includes(t('constants.uav')) && !selectedDevice?.device_sn) && (
<Card title={<div style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 14, fontWeight: 600 }}><RobotOutlined style={{ color: '#165DFF' }} />机器人作业状态</div>} bordered={false} style={{ borderRadius: 12, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }}>
<Card title={<div style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 14, fontWeight: 600 }}><RobotOutlined style={{ color: '#165DFF' }} />{t('devices.fixed2RobotStatusFixed2')}</div>} bordered={false} style={{ borderRadius: 12, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }}>
<Row gutter={16} style={{ alignItems: 'center' }}>
<Col span={8}>
<div style={{ padding: '12px 16px', borderRadius: 10, background: '#F7F8FA', textAlign: 'center', border: '1px solid transparent', transition: 'all 0.2s' }}
@@ -1012,7 +1011,7 @@ export default function DeviceOverviewPage() {
}}
>
<Statistic
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>累计作业里程</span>}
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.statTotalDistance')}</span>}
value={deviceStatistics?.distance ? Number(deviceStatistics.distance).toFixed(2) : Number(deviceStatistics?.workArea / 0.7 || 0).toFixed(2)}
suffix="m"
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
@@ -1031,7 +1030,7 @@ export default function DeviceOverviewPage() {
}}
>
<Statistic
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>累计作业面积</span>}
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s50')}</span>}
value={Number(deviceStatistics?.workArea || 0).toFixed(2)}
suffix="㎡"
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
@@ -1050,7 +1049,7 @@ export default function DeviceOverviewPage() {
}}
>
<Statistic
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>累计作业时长</span>}
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s51')}</span>}
value={Number(deviceStatistics?.time || 0).toFixed(2)}
suffix="min"
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
@@ -1061,7 +1060,7 @@ export default function DeviceOverviewPage() {
</Card>
)}
<Card title={<><ClockCircleOutlined /> 任务执行时间线</>} bordered={false} style={{ borderRadius: 12 }} extra={<div style={{ fontSize: 12, color: '#666' }}></div>}>
<Card title={<><ClockCircleOutlined />{t('devices.fixed2TaskSuspended2Fixed2ExecutionTime')}</>} bordered={false} style={{ borderRadius: 12 }} extra={<div style={{ fontSize: 12, color: '#666' }}></div>}>
<Timeline mode="left">
{taskTimeline.map((item, idx) => (
<Timeline.Item key={idx} color={item.color} label={<div style={{ fontSize: 11, color: '#999' }}>{item.time}</div>}>
@@ -1070,14 +1069,14 @@ export default function DeviceOverviewPage() {
</Timeline.Item>
))}
</Timeline>
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link">查看更多</Button></div>
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link">{t('devices.viewMore')}</Button></div>
</Card>
</Col>
</Row>
{/* 机器人编辑别名弹窗 */}
<Modal
title="编辑机器人设备信息"
title={t('devices.fixed2EditFixed2RobotFixed2DeviceFixed2InfoFixed2')}
open={editRobotModalOpen}
onCancel={() => setEditRobotModalOpen(false)}
confirmLoading={editLoading}
@@ -1087,28 +1086,26 @@ export default function DeviceOverviewPage() {
{currentEditRobot && (
<div style={{ padding: '8px 0' }}>
<div style={{ marginBottom: 16 }}>
<Typography.Text strong>设备SN:</Typography.Text>
<Typography.Text strong>{t('devices.fixed2Fixed2DeviceSn')}</Typography.Text>
<Typography.Text copyable>
{currentEditRobot.device_sn || currentEditRobot.serialNumber}
</Typography.Text>
</div>
<div style={{ marginBottom: 16 }}>
<Typography.Text strong>设备类型:</Typography.Text>
<Typography.Text strong>{t('devices.fixed2DeviceType')}</Typography.Text>
<Typography.Text>{currentEditRobot.productName || t('constants.locationUnknown')}</Typography.Text>
</div>
<div style={{ marginBottom: 8 }}>
<Typography.Text strong>设备别名 <span style={{ color: 'red' }}>*</span></Typography.Text>
<Typography.Text strong>{t('devices.fixed2Device')}<span style={{ color: 'red' }}>*</span></Typography.Text>
</div>
<Input
value={editAliasInput}
onChange={e => setEditAliasInput(e.target.value)}
placeholder="请输入自定义设备别名"
placeholder={t('devices.fixed2PleaseEnterDevice')}
maxLength={30}
allowClear
/>
<div style={{ marginTop: 8, fontSize: 12, color: '#999' }}>
别名用于设备列表、控制面板展示,便于快速区分设备
</div>
<div style={{ marginTop: 8, fontSize: 12, color: '#999' }}>{t('devices.deviceListControlDeviceFixed2')}</div>
</div>
)}
</Modal>