有和机器人总览界面

This commit is contained in:
mmc
2026-11-12 09:59:37 +08:00
parent ce9f52fc52
commit 943d6138cd
14 changed files with 438 additions and 225 deletions

Binary file not shown.

8
env.js
View File

@@ -35,14 +35,14 @@ const envConfig = {
},
[ENV.PROD]: {
//baseURL: 'https://pvcloudservice.satabot.com',
//baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
////baseURL: 'https://serviceri.satabot.com',
//WS_URL: 'ws://1.95.137.212:59017/ws/',
WS_URL: 'ws://1.95.137.212:9002/ws/',
//mqtt_url: "ws://1.95.137.212:8083/mqtt",
//geoserver_url: "http://1.95.137.212:59018/geoserver"
baseURL: 'http://1.95.137.212:59003',//http://192.168.2.56:8081
WS_URL: 'ws://1.95.137.212:59005/ws/',
//baseURL: 'http://1.95.137.212:59003',//http://192.168.2.56:8081
//WS_URL: 'ws://1.95.137.212:59005/ws/',
//baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081

View File

@@ -0,0 +1,64 @@
import React from 'react';
import { Tag } from 'antd';
import { useTranslation } from 'react-i18next';
import { errorLevelOptions, levelColorMap } from '../lib/utils';
interface AlarmLevelTagProps {
/** 接口返回字符串 INFO / WARNING / ERROR */
level?: string;
/** small 表格 | large 详情弹窗 */
size?: 'small' | 'large';
}
/**
* 通用告警级别标签组件
* @param level 接口返回字符串 INFO / WARNING / ERROR
* @param size small表格 | large详情弹窗
*/
const AlarmLevelTag: React.FC<AlarmLevelTagProps> = ({ level, size = 'small' }) => {
const { t } = useTranslation();
const color = (levelColorMap as Record<string, string>)[level as string] || '#86909C';
const item = (errorLevelOptions as Array<{ value: string; label: string }>).find(opt => opt.value === level);
const text = item?.label || t('constants.locationUnknown');
// 详情大标签
if (size === 'large') {
return (
<Tag
color={color}
style={{
border: 'none',
color: '#fff',
padding: '4px 10px',
fontSize: 14,
borderRadius: 4,
display: 'inline-flex',
alignItems: 'center',
gap: 6
}}
>
{text}
</Tag>
);
}
// 表格小标签
return (
<Tag
color={color}
style={{
border: 'none',
color: '#fff',
padding: '2px 6px',
fontSize: 12,
borderRadius: 2,
display: 'inline-flex',
alignItems: 'center',
gap: 4
}}
>
{text}
</Tag>
);
};
export default AlarmLevelTag;

View File

@@ -1115,35 +1115,60 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
}, [markedPoints]);
function resolveDeviceStatus(device) {
const fsRaw = device?.feStatus;
const stRaw = device?.status;
//if (device?.onlineStatus == 0) return 'offline';
if (stRaw !== undefined && stRaw !== null && stRaw !== '') {
const st = Number(stRaw);
if (st === 1) return 'working';
if (st === 2) return 'idle';
if (st === 3) return 'offline';
}
const fsRaw = device?.color;
return fsRaw === 'red' ? 'offline' : fsRaw === 'green' ? 'working' : fsRaw === 'blue' ? 'idle' : 'idle';
////if (device?.onlineStatus == 0) return 'offline';
//if (stRaw !== undefined && stRaw !== null && stRaw !== '') {
// const st = Number(stRaw);
// if (st === 1) return 'working';
// if (st === 2) return 'idle';
// if (st === 3) return 'offline';
//}
// feStatus:0=离线,1=工作中,2=空闲
if (fsRaw !== undefined && fsRaw !== null && fsRaw !== '') {
const fs = Number(fsRaw);
if (fs === 0) return 'offline';
if (fs === 1) return 'working';
if (fs === 2) return 'idle';
}
//// feStatus:0=离线,1=工作中,2=空闲
//if (fsRaw !== undefined && fsRaw !== null && fsRaw !== '') {
// const fs = Number(fsRaw);
// if (fs === 0) return 'offline';
// if (fs === 1) return 'working';
// if (fs === 2) return 'idle';
//}
// status:1=工作中,2=空闲,3=离线
if (stRaw !== undefined && stRaw !== null && stRaw !== '') {
const st = Number(stRaw);
if (st === 1) return 'working';
if (st === 2) return 'idle';
if (st === 3) return 'offline';
}
//// status:1=工作中,2=空闲,3=离线
//if (stRaw !== undefined && stRaw !== null && stRaw !== '') {
// const st = Number(stRaw);
// if (st === 1) return 'working';
// if (st === 2) return 'idle';
// if (st === 3) return 'offline';
//}
return 'idle';
}
// 设备状态视觉统一:工作中蓝 / 空闲绿 / 离线红(底层光圈与悬浮提示共用同一套颜色)
const DEVICE_STATUS_COLORS = {
working: '#1677ff',
idle: '#52c41a',
offline: '#ff4d4f',
};
// 设备类型归一化:统一读 deviceType(I=巡检 / M=割草机 / U=无人机),兼容旧 type 字段
function getDeviceKind(device) {
const dt = String(device?.deviceType || '').toUpperCase();
if (dt === 'U') return 'drone';
if (dt === 'M') return 'mower';
if (dt === 'I') return 'inspection';
// 兼容旧 type 字段值
const legacy = String(device?.type || '').toLowerCase();
if (legacy === 'plane' || legacy === 'drone' || legacy === 'drone-inspect') return 'drone';
if (legacy === 'mower') return 'mower';
if (legacy === 'robot') return 'inspection';
if (legacy === 'camera') return 'camera';
return 'unknown';
}
const isDroneDevice = (d) => getDeviceKind(d) === 'drone';
const isMowerDevice = (d) => getDeviceKind(d) === 'mower';
const isInspectionDevice = (d) => getDeviceKind(d) === 'inspection';
const isCameraDevice = (d) => getDeviceKind(d) === 'camera';
// 光圈颜色:工作中蓝(#1677ff)/ 空闲绿(#52c41a)/ 离线红(#ff4d4f)
function getDeviceHaloColor(device) {
const state = resolveDeviceStatus(device);
@@ -1173,10 +1198,11 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
if (robot) {
const stateKey = resolveDeviceStatus(robot);
// 与底层光圈颜色保持一致:工作中蓝 / 空闲绿 / 离线红
const statusMap = {
working: { text: t('common.working'), color: '#0a40df' },
idle: { text: t('devices.idle'), color: '#12c60e' },
offline: { text: t('devices.offline'), color: '#f01212' }
working: { text: t('common.working'), color: DEVICE_STATUS_COLORS.working },
idle: { text: t('devices.idle'), color: DEVICE_STATUS_COLORS.idle },
offline: { text: t('devices.offline'), color: DEVICE_STATUS_COLORS.offline }
};
const status = statusMap[stateKey] || statusMap.idle;
let deviceValuesHTML = '';
@@ -1204,10 +1230,11 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
${deviceValuesHTML ? `<div style="margin-top:8px;"><strong>${t('devices.deviceData')}:</strong>${deviceValuesHTML}</div>` : ''}
<div>${t('systemSetting.longitude')}:${lonStr}</div>
<div>${t('systemSetting.latitude')}:${latStr}</div>
<div>${t('systemSetting.status')}:
<span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:${status.color};margin-right:4px;"></span>
<span style="color:${status.color};font-weight:bold">${status.text}</span>
</div>`;
`;
//<div>${t('systemSetting.status')}:
// <span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:${status.color};margin-right:4px;"></span>
// <span style="color:${status.color};font-weight:bold">${status.text}</span>
//</div>
} else {
tooltip.innerHTML = `
<div style = "font-weight:600;margin-bottom:4px;" >📍 ${t('systemSetting.longitude')}:${lonStr}</div >
@@ -2796,33 +2823,21 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
if (isIOT) {
image = device?.type === "camera" ? cameraImg : iotImg;
image = isCameraDevice(device) ? cameraImg : iotImg;
width = device?.type === "camera" ? 40 : 20;
height = device?.type === "camera" ? 40 : 20;
width = isCameraDevice(device) ? 40 : 20;
height = isCameraDevice(device) ? 40 : 20;
} else {
image =
device?.type === "plane" ? planeImg : // 飞机
device?.type === "drone" ? planeImg : // 无人机
device?.type === "mower" ? carImg : // 割草
device?.type === "robot" ? carImg : // 巡检
carImg; // 默认车
isDroneDevice(device) ? planeImg : // 无人机/飞机
isMowerDevice(device) ? carImg : // 割草机
carImg; // 巡检/默认车
width =
device?.type === "plane" ||
device?.type === "drone" ||
device?.type === "drone-inspect"
? 30
: carsize;
width = isDroneDevice(device) ? 30 : carsize;
height =
device?.type === "plane" ||
device?.type === "drone" ||
device?.type === "drone-inspect"
? 30
: carsize;
height = isDroneDevice(device) ? 30 : carsize;
}
@@ -2887,12 +2902,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
// 尺寸可根据设备类型微调:车辆类稍大,IOT/相机类稍小
let haloSize = 0.8;
if (isIOT) {
haloSize = device?.type === "camera" ? 0.8 : 0.8;
} else if (
device?.type === "plane" ||
device?.type === "drone" ||
device?.type === "drone-inspect"
) {
haloSize = isCameraDevice(device) ? 0.8 : 0.8;
} else if (isDroneDevice(device)) {
haloSize = 0.1;
} else {
haloSize = 0.8;
@@ -2925,12 +2936,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
let haloSize = 40;
if (isIOT) {
haloSize = device?.type === "camera" ? 35 : 28;
} else if (
device?.type === "plane" ||
device?.type === "drone" ||
device?.type === "drone-inspect"
) {
haloSize = isCameraDevice(device) ? 35 : 28;
} else if (isDroneDevice(device)) {
haloSize = 42;
} else {
haloSize = 38;
@@ -3252,7 +3259,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
// =============================
// 判断是否是无人机模式
// =============================
const isDroneMode = realtimeType === 'plane' || realtimeType === 'drone' || devices.some(d => d.type === 'plane' || d.type === 'drone');
const isDroneMode = realtimeType === 'plane' || realtimeType === 'drone' || devices.some(d => isDroneDevice(d));
// =============================
// 判断实时数据是否合法
@@ -3401,7 +3408,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
const position = Cesium.Cartesian3.fromDegrees(lon, lat, 1);
// 实时光圈颜色:优先取设备状态色,缺省蓝色(工作)
const rtHaloColor = devices?.[0] ? getDeviceHaloColor(devices[0]) : Cesium.Color.fromCssColorString('#1677ff');
const rtHaloColor = Cesium.Color.fromCssColorString('#19cd08');
// ====================================
// 无人机模式:保持原来的逻辑

View File

@@ -11,7 +11,8 @@ import {
ExclamationOutlined
} from '@ant-design/icons';
import dayjs from 'dayjs';
import { alarmHandleResultOptions, errorLevelOptions, exportTable, levelColorMap } from "../../lib/utils.js"
import { alarmHandleResultOptions, errorLevelOptions, exportTable } from "../../lib/utils.js"
import AlarmLevelTag from "../AlarmLevelTag";
// 接口引入
import {
@@ -35,63 +36,6 @@ const { Option } = Select;
// 快速根据 value 获取 label
const getLevelLabel = (val) => {
const { t } = useTranslation();
const item = errorLevelOptions.find(opt => opt.value === val);
return item?.label || t('constants.locationUnknown');
};
/**
* 通用告警级别标签组件
* @param level 接口返回字符串 INFO / WARNING / ERROR
* @param size small表格 | large详情弹窗
*/
const AlarmLevelTag = ({ level, size = 'small' }) => {
const color = levelColorMap[level] || '#86909C';
const text = getLevelLabel(level);
// 详情大标签
if (size === 'large') {
return (
<Tag
color={color}
style={{
border: 'none',
color: '#fff',
padding: '4px 10px',
fontSize: 14,
borderRadius: 4,
display: 'inline-flex',
alignItems: 'center',
gap: 6
}}
>
{text}
</Tag>
);
}
// 表格小标签
return (
<Tag
color={color}
style={{
border: 'none',
color: '#fff',
padding: '2px 6px',
fontSize: 12,
borderRadius: 2,
display: 'inline-flex',
alignItems: 'center',
gap: 4
}}
>
{text}
</Tag>
);
};
export default function AlarmCenterPage() {
const { t } = useTranslation();
const [form] = Form.useForm();

View File

@@ -3,7 +3,8 @@ import {
Layout, Card, Row, Col, Statistic, Tag, Button, Table,
Typography, Space, Progress, Badge, Timeline, message,
Select, Modal, Space as AntSpace,
Input, Tooltip
Input, Tooltip,
Empty
} from 'antd';
import {
EnvironmentOutlined, RobotOutlined, BranchesOutlined,
@@ -28,6 +29,9 @@ import AgrtcRoomRobot from '../AgrtcRoomRobot';
import CesiumMap from '../Map.jsx';
import DeviceParamModal from './DeviceParamModal';
import { getUAVState, getSiteDevice, getSiteUAVList, getsinglePlan, getRobotTaskList, getDeviceTotalData, updateDeviceAliasApi, hasPermission } from '@/api/device.ts';
import { getAlarmList } from '@/api/alarmApi.js';
import dayjs from 'dayjs';
import { useMqtt } from '@/hooks/useMqtt';
import { useSelector } from 'react-redux';
@@ -37,6 +41,8 @@ import utils from '@/lib/utils.ts';
import { useUnitFormatter } from '@/lib/units';
import { useTranslation } from 'react-i18next';
import { sendEmergencyStop } from './emergencyStopControl';
import AlarmLevelTag from '../AlarmLevelTag.tsx';
import { getDeviceTastPool } from '@/api/device.ts';
const { Content } = Layout;
const { Text, Title } = Typography;
@@ -64,6 +70,8 @@ export default function DeviceOverviewPage() {
const [realtimeMap, setRealtimeMap] = useState<any>({});
const controllerRef = useRef<DeviceController | null>(null);
const [messageApi, contextHolder] = message.useMessage();
const [taskList, setTaskList] = useState<any[]>([]);
const [alarmList, setAlarmList] = useState<any[]>([]);
// 编辑机器人弹窗相关
const [editRobotModalOpen, setEditRobotModalOpen] = useState(false);
@@ -77,15 +85,9 @@ export default function DeviceOverviewPage() {
const navigate = useNavigate();
const [robotPlayActive, setRobotPlayActive] = useState<boolean>(false);
const [taskPoolList, setTaskPoolList] = useState<any[]>([]);
const logs = [
{ time: '10:24:35', device: 'UAV-C01', type: '命令', desc: '起飞指令下发,开始作业' },
{ time: '10:21:40', device: 'RBT-01', type: '命令', desc: '开始巡检任务 P-02' },
{ time: '10:20:11', device: 'UAV-C02', type: '命令', desc: '转入待命状态' },
{ time: '10:18:05', device: 'GR-02', type: '命令', desc: '除草作业开始 G-01' },
{ 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: '任务开始' },
@@ -94,6 +96,35 @@ export default function DeviceOverviewPage() {
{ time: '10:12:33', color: 'blue', text: t('devices.uavC01'), status: '返机补给' },
{ time: '09:58:10', color: 'green', text: t('devices.rbt02CompleteFixed2InspectionP01'), status: '任务完成' },
];
const fetchTaskPoolList = async () => {
if (!stationId) return;
try {
const params = {
userId: userInfo?.userId,
siteId: stationId,
orgId: currentStation?.orgId,
pageNum: 1,
pageSize: 10
};
const res = await getDeviceTastPool(params);
if (res.code === 200) {
const list = res.rows || [];
list.map(item => {
return {
time: dayjs(item.createTime).format('HH:mm:ss'),
color: item.taskStaus === 'EXECUTING' ? 'green' : 'blue',
text: item.workName || t('devices.unnamedTask'),
status: item.taskStaus === 'EXECUTING' ? t('devices.executing') : item.taskStaus === 'FAILED' ? t('devices.executeFail') : item.taskStaus === 'COMPLETED' ? t('devices.statusFinished') : item.taskStaus === 'CANCELED' ? t('devices.taskCanceled') : t('devices.taskStatusNew')
}
})
setTaskPoolList(list);
}
} catch (err) {
console.error('获取任务池失败:', err);
}
};
@@ -200,6 +231,8 @@ export default function DeviceOverviewPage() {
useEffect(() => {
fetchAllData();
fetchAlarmList();
fetchTaskPoolList();
}, [stationId]);
useEffect(() => {
fetchTaskStats();
@@ -241,6 +274,7 @@ export default function DeviceOverviewPage() {
try {
const robotRes = await getRobotTaskList({ siteId: String(stationId) });
if (robotRes?.code == 200 && robotRes.data) {
setTaskList(robotRes?.data?.slice(0, 5) ?? []);
const todayRobotTasks = robotRes.data.filter((t: any) => {
// 简单判断是今日的任务
if (t.createTime) {
@@ -268,6 +302,7 @@ export default function DeviceOverviewPage() {
}
};
// 当前选中设备(切换时才变)
const selectedDevice = useMemo(() => {
const sn = currentSelectedRobot || (devicesAll?.[0]?.device_sn || devicesAll?.[0]?.serialNumber);
@@ -472,6 +507,19 @@ export default function DeviceOverviewPage() {
})
}
const fetchAlarmList = async () => {
try {
const res = await getAlarmList({ pageNum: 1, pageSize: 5, siteId: stationId });
if (res.code === 200) {
setAlarmList(res.rows?.slice(0, 5) ?? []);
}
} catch (err) {
messageApi.error(t('common.loadFailed'));
} finally {
}
};
// 顶部统计卡片
//feStatus; 1任务中 / 2空闲
@@ -685,17 +733,26 @@ export default function DeviceOverviewPage() {
<Table rowKey={(record) => record.id || record.serialNumber || record.device_sn} size="small" pagination={false}
columns={[
{ title: t('devices.fixed2EquipmentFixed2NameFixed2'), dataIndex: 'name', width: 180 },
{ title: t('common.type'), dataIndex: 'type', },
{
title: t('workOrder.currentStatus'),
dataIndex: 'onlineStatus',
width: 70,
render: (s) => {
const text = s === 1 ? t('devices.online') : t('devices.offline');
const color = s === 1 ? 'success' : 'default';
return <Tag color={color} style={{ margin: 0 }}>{text}</Tag>;
title: t('common.type'), dataIndex: 'deviceType',
render: (text, record) => {
if (record.deviceType == "U") return t('devices.uav');
if (record.deviceType == "M") return t("devices.mower");
if (record.deviceType == "I") return t("devices.robot");
return record.deviceType || record.type || t('devices.robot');
}
}, {
},
//{
// title: t('workOrder.currentStatus'),
// dataIndex: 'onlineStatus',
// width: 70,
// render: (s) => {
// const text = s === 1 ? t('devices.online') : t('devices.offline');
// const color = s === 1 ? 'success' : 'default';
// return <Tag color={color} style={{ margin: 0 }}>{text}</Tag>;
// }
//},
{
title: t('workOrder.currentStatus'), dataIndex: 'feStatus', width: 70, render: (text) => {
let color;
if (text == '1') color = 'processing';
@@ -757,19 +814,100 @@ export default function DeviceOverviewPage() {
scroll={{ x: 'max-content', y: 280 }}
/>
</Card>
<Row wrap={false} gutter={16} style={{ width: '100%' }}>
<Col flex="1 1 0">
<Card
title={<>
<SettingOutlined /> <span>{t('devices.TaskLog')}</span>
</>}
variant="borderless"
style={{ borderRadius: 8, height: '100%' }}
>
<Table
rowKey="time"
size="small"
pagination={false}
dataSource={taskList}
scroll={{ x: 'max-content' }}
columns={[
{ title: t('common.createTime'), dataIndex: 'time', width: 90, render: (v) => <span style={{ fontSize: 13 }}>{v}</span> },
{ title: t('devices.deviceId'), dataIndex: 'device', width: 100, render: (v) => <span style={{ fontSize: 13 }}>{v}</span> },
{
title: t('devices.deviceType'),
dataIndex: 'type',
width: 70,
render: (v) => {
let c = '#52c41a';
let text = ''
if (v === 'I') { c = '#fa8c16'; text = t('devices.robot') }
if (v === 'M') { c = '#1890ff'; text = t('devices.mower') }
if (v === 'U') { c = '#1890ff'; text = t('devices.uav') }
return (
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<span style={{ width: 10, height: 10, borderRadius: 2, background: c }} />
<span style={{ fontSize: 13 }}>{text}</span>
</div>
);
}
},
{ title: t('devices.taskName'), dataIndex: 'planName' },
]}
/>
<div style={{ textAlign: 'center', marginTop: 8 }}>
<Button type="link" size="small" style={{ fontSize: 13, color: '#1890ff' }} onClick={() => navigate('/devices/robotTask')}>
{t('devices.viewMoreLogs')}
</Button>
</div>
</Card>
</Col>
<Col flex="1 1 0">
<Card
title={<>
<SettingOutlined /> <span>{t('devices.AlertRecord')}</span>
</>}
variant="borderless"
style={{ borderRadius: 8, height: '100%' }}
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={alarmList}
scroll={{ x: 'max-content' }}
columns={[
{ title: t('common.time'), dataIndex: 'alertTime', width: 90, render: (v) => <span style={{ fontSize: 13 }}>{v}</span> },
{ title: t('devices.device'), dataIndex: 'deviceName', width: 100, render: (v) => <span style={{ fontSize: 13 }}>{v}</span> },
{
title: t('alerts.alarmTitle'),
dataIndex: 'alarmTitle',
width: 70,
},
{
title: t('alerts.alertLevel'), dataIndex: 'alertLevel', render: (l) => <AlarmLevelTag level={l} size="small" />
},
{ title: '', width: 70, render: (_, record) => record.level ? <Tag color="red" style={{ fontSize: 11, margin: 0 }}>{record.level}</Tag> : null }
]}
/>
<div style={{ textAlign: 'center', marginTop: 8 }}>
<Button type="link" size="small" style={{ fontSize: 13, color: '#1890ff' }} onClick={() => navigate('/alerts/all')}>
{t('devices.viewMoreLogs')}
</Button>
</div>
</Card>
</Col>
</Row>
<Card title={<><SettingOutlined /> <span >{t('devices.fixed2ControlFixed2LogDesc6Alert')}</span></>} variant="borderless" 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: 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' }}>{t('devices.viewMoreLogs')}</Button></div>
</Card>
</Col>
<Col xs={24} lg={10}>
@@ -798,7 +936,7 @@ export default function DeviceOverviewPage() {
<Col span={12}>
<div style={{ marginBottom: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 12, flexWrap: "wrap" }}>
{selectedDevice.deviceType === 'drone' || selectedDevice.deviceName?.includes(t('constants.uav')) || selectedDevice.drone_callsign ? (
{String(selectedDevice.deviceType || '').toUpperCase() === 'U' || selectedDevice.deviceName?.includes(t('constants.uav')) || selectedDevice.drone_callsign ? (
<span style={{ fontSize: 20, color: '#1890ff' }}><RocketOutlined /></span>
) : (
<span style={{ fontSize: 20, color: '#1890ff' }}><CarOutlined /></span>
@@ -995,7 +1133,7 @@ export default function DeviceOverviewPage() {
)}
</Card>
<Card title={<><ApiOutlined />{t('devices.fixed2AiActions')}</>} variant="borderless" style={{ borderRadius: 12, marginBottom: 8 }}>
{/*<Card title={<><ApiOutlined />{t('devices.fixed2AiActions')}</>} variant="borderless" 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' }}>{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>
@@ -1023,7 +1161,7 @@ export default function DeviceOverviewPage() {
</div>
</Col>
</Row>
</Card>
</Card>*/}
{(selectedDevice?.productName?.includes(t('constants.uav')) || selectedDevice?.device_sn) && (
<Card title={t('devices.s60')} variant="borderless" style={{ borderRadius: 12, marginBottom: 8 }}>
@@ -1110,15 +1248,20 @@ export default function DeviceOverviewPage() {
)}
<Card title={<><ClockCircleOutlined />{t('devices.fixed2TaskSuspended2Fixed2ExecutionTime')}</>} variant="borderless" 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>}>
<div style={{ fontSize: 13 }}>{item.text}</div>
<div style={{ fontSize: 11, color: '#999' }}>{item.status}</div>
</Timeline.Item>
))}
</Timeline>
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link">{t('devices.viewMore')}</Button></div>
{taskPoolList.length > 0 ? (
<Timeline mode="left">
{taskPoolList.map((item, idx) => (
<Timeline.Item key={idx} color={item.color} label={<div style={{ fontSize: 11, color: '#999' }}>{item.time}</div>}>
<div style={{ fontSize: 13 }}>{item.text}</div>
<div style={{ fontSize: 11, color: '#999' }}>{item.status}</div>
</Timeline.Item>
))}
</Timeline>
) : (
<Empty description={t('common.noData')} style={{ marginTop: 100 }} />
)}
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link" onClick={() => navigate('/devices/robotTask')}>{t('devices.viewMore')}</Button></div>
</Card>
</Col>
</Row>

View File

@@ -236,7 +236,7 @@ const DroneVideoPlayer: React.FC<DroneVideoPlayerProps> = ({
};
const renderVideo = (type: 'drone' | 'station', streamData: any, loading: boolean) => {
const isDrone = type === 'drone';
const isDrone = String(type || '').toUpperCase() === 'U' || type === 'drone';
const currentDisplayType = displayType || type;
const data = statusData;

View File

@@ -45,6 +45,8 @@ type MapEditorExtraMapProps = {
routeMode?: string;
realtimePosition?: any;
realtimeType?: string;
/** 选中机器人的实时状态颜色:green 工作中 / blue 空闲 / red 离线 */
deviceColor?: 'red' | 'green' | 'blue';
ifClearNavLine?: number;
ifClearPlanLine?: number;
focusOverlay?: any;
@@ -180,10 +182,10 @@ export const MapEditorView = React.forwardRef(function MapEditorView(
const selectRobot = useMemo(() => {
if (!Array.isArray(robots)) return [];
return robots.filter(
robot => robot.serialNumber == selectedRobotId
);
}, [selectedRobotId, robots]);
return robots
.filter(robot => robot.serialNumber == selectedRobotId)
.map(robot => (extraMapProps?.deviceColor ? { ...robot, color: extraMapProps.deviceColor } : robot));
}, [selectedRobotId, robots, extraMapProps?.deviceColor]);
useEffect(() => {
if (extraMapProps.polyPoints?.length > 0) {
setPolyPoints(extraMapProps.polyPoints);

View File

@@ -226,7 +226,6 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
const handleFinish = (data) => {
console.log('任务完成回调', data);
setExecute(false);
setShowVideo(false); // 任务完成关闭视频
utils.message.success(t('devices.fixed2TaskSuspended2Fixed2CompletedFixed2', { deviceId: data.deviceId }));
@@ -436,6 +435,14 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
};
}, [realtimeMap, targetRobot]);
// 实时状态 → 地图设备颜色:1 工作中 green / 2 空闲 blue / 其他及无实时数据 red
const robotMapColor = useMemo(() => {
const s = Number(robotRealtimePosition?.status);
if (s === 1) return 'green';
if (s === 2) return 'blue';
return 'red';
}, [robotRealtimePosition]);
const realtimePosition = useMemo(() => {
let lon = robotRealtimePosition?.longitude;
let lat = robotRealtimePosition?.latitude;
@@ -759,6 +766,8 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
return aEmpty ? -1 : bEmpty ? 1 : 0;
});
setTaskPoolList(list);
if (list?.length == 0) setExecute(false);
}
} catch (err) {
console.error('获取任务池失败:', err);
@@ -1699,7 +1708,8 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
polyPoints,
routeMode,
realtimePosition,
realtimeDevice: targetRobot,
realtimeDevice: targetRobot ? { ...targetRobot, color: robotMapColor } : targetRobot,
deviceColor: robotMapColor,
realtimeType: 'robot',
ifClearNavLine: clearNavLine,
ifClearPlanLine: clearPlanLine,

View File

@@ -122,7 +122,7 @@ export default class DeviceController {
let msg = null;
try { msg = JSON.parse(event.data); } catch (e) { return; }
console.log('[DeviceController] 收到全量设备状态 初始状态', msg);
//console.log('[DeviceController] 收到全量设备状态 初始状态', msg);
if (msg?.type == 'mapPush') {
const list = Array.isArray(msg?.data) && msg.data.length
? msg.data
@@ -160,7 +160,7 @@ export default class DeviceController {
console.log('task finish');
this.onIsFinished?.(msg);
}
if (msg.status == "EXECUTING" || msg.status == "CANCELLED" || msg.status == "FAILED") {
if (msg.status == "EXECUTING" || msg.status == "PAUSE" || msg.status == "CANCELLED" || msg.status == "FAILED") {
this.onIsExecuting?.(true);
}
@@ -520,7 +520,7 @@ export default class DeviceController {
console.log('task finish');
this.onIsFinished?.(true);
}
if (msg.status == "EXECUTING") {
if (msg.status == "EXECUTING" || msg.status == "PAUSE") {
this.onIsExecuting?.(true);
}
@@ -545,18 +545,6 @@ export default class DeviceController {
break;
}
case 'detectionReport':
const { isSecure, obstacle } = msg.data;
if (isSecure) return;
const type = obstacle?.type;
const distance = (obstacle?.distance || 0).toFixed(2);
const types = { 0: i18n.t('constants.locationUnknown'), 1: i18n.t('devices.obstaclePerson'), 2: i18n.t('devices.obstacleVehicle'), 3: i18n.t('devices.obstacleFence'), 4: i18n.t('devices.obstaclePothole'), 5: i18n.t('devices.obstacleGrass') };
this.messageApi.warning({
key: 'obstacle-warning',
content: i18n.t('devices.obstacleDetectedReport', { obstacle: types[type] ?? i18n.t('devices.unknownObject'), distance }),
duration: 3,
});
break;
case 'route_post':
console.log('route_post:', msg);

View File

@@ -1189,6 +1189,9 @@
taskCanceledSuccess: 'Task Canceled Success',
taskCompletedMsg: 'Task Completed Msg',
taskCompletionRate: 'Task Completion Rate',
// status: item.status === 'EXECUTING' ? t('devices.taskExecuting') : item.status === 'FAILED' ? t('devices.taskFailed') : item.status === 'COMPLETED' ? t('devices.taskCompleted') : item.status === 'CANCELED' ? t('devices.taskCanceled') : t('devices.taskCreated')
taskContinuous: 'Task Continuous',
taskEndTimeLabel: 'Task End Time Label',
taskEnded: 'Task Ended',
@@ -1470,7 +1473,11 @@
fixed2EquipmentListFixed2: 'Equipment Scheduling List',
fixed2ControlFixed2LogDesc6Alert: 'Control Log / Alert Record',
ControlLog: 'Control Log',
AlertRecord: 'Alert Record',
TaskLog: 'Task Log',
DeviceLog: 'Device Log',
VideoLog: 'Video Log',
fixed2AllLevels: 'All Levels ▼',

View File

@@ -1323,8 +1323,11 @@ const zh = {
fixed2EquipmentListFixed2: '装备调度列表',
fixed2ControlFixed2LogDesc6Alert: '控制日志 / 告警记录',
ControlLog: '控制日志 ',
TaskLog: '任务日志',
DeviceLog: '设备日志',
VideoLog: '视频日志',
AlertRecord: '告警记录',
fixed2AllLevels: '全部级别 ▼',
timeFixed2: '激活时间',

View File

@@ -79,10 +79,11 @@ const taskStatusColor = (status) => {
};
const getDeviceTypeIcon = (type) => {
if (type?.includes?.('ROBOT') || type?.includes?.('CLEANING') || type?.includes?.('INSPECT')) {
const _t = String(type ?? '').toUpperCase();
if (_t == 'I' || _t == 'M' || type?.includes?.('ROBOT') || type?.includes?.('CLEANING') || type?.includes?.('INSPECT')) {
return <RobotOutlined />;
}
if (type?.includes?.('DRONE') || type?.includes?.('UAV')) {
if (_t === 'U' || type?.includes?.('DRONE') || type?.includes?.('UAV')) {
return <RocketOutlined />;
}
if (type?.includes?.('CAMERA')) {
@@ -305,6 +306,7 @@ const RealTimeMonitorPage = () => {
serialNumber: d.device_sn,
device_sn: d.device_sn,
gateway_sn: d.gateway_sn,
deviceType: 'U',
type: 'plane',
category: 'plane',
typeText: t('devices.drone'),
@@ -318,7 +320,7 @@ const RealTimeMonitorPage = () => {
latitude: lat,
lastRunningStatus: (lon && lat) ? { longitude: lon, latitude: lat } : undefined,
batteryLevel: d.battery ? d.battery.capacity_percent : undefined,
raw: Object.assign({}, d, { type: 'plane', deviceAlias: d.drone_callsign || d.device_sn })
raw: Object.assign({}, d, { type: 'plane', deviceType: 'U', deviceAlias: d.drone_callsign || d.device_sn })
};
});
}, [planeDevices, droneMqttMap]);
@@ -328,7 +330,7 @@ const RealTimeMonitorPage = () => {
id: d.id || idx,
name: d.deviceAlias || d.deviceName || `设备-${d.serialNumber?.slice(-4) || idx}`,
serialNumber: d.serialNumber,
type: d.deviceType || 'ROBOT',
type: d.deviceType || (d.type === 'plane' || d.type === 'drone' ? 'U' : 'I'),
category: 'robot',
typeText: d.deviceTypeName || d.deviceType || t('devices.robot'),
status: d.feStatus == 1 ? t('devices.s59') : (d.feStatus == 2 ? t('devices.idle') : t('devices.offline')),
@@ -400,8 +402,8 @@ const RealTimeMonitorPage = () => {
id: rt.id,
name: rt.name || rt.alias || `设备-${String(rt.id).slice(-4)}`,
serialNumber: rt.id,
deviceType: 'ROBOT',
type: 'ROBOT',
//deviceType: 'I',
//type: 'robot',
category: 'robot',
typeText: '机器人',
status: rt.status,
@@ -434,7 +436,7 @@ const RealTimeMonitorPage = () => {
// 仅定位设备(不打开抽屉):用于点击表格行
const handleLocateDevice = (robot) => {
const dev = robot;
const isDroneDevice = dev?.type === 'plane' || !!dev?.gateway_sn;
const isDroneDevice = dev?.type === 'plane' || !!dev?.gateway_sn || String(dev?.deviceType || '').toUpperCase() === 'U';
// 1. 优先使用实时经纬度(realtimeMap)
const rt = pickRealtimeRecord(realtimeMap, dev);
@@ -475,7 +477,7 @@ const RealTimeMonitorPage = () => {
setSelectedDeviceSn(dev.serialNumber || dev.device_sn);
const isMockDevice = dev?.isMock || ['INVERTER', 'COMBINER_BOX', 'WEATHER_STATION', 'METER'].includes(dev?.type);
const isDroneDevice = dev?.type === 'plane' || !!dev?.gateway_sn;
const isDroneDevice = dev?.type === 'plane' || !!dev?.gateway_sn || String(dev?.deviceType || '').toUpperCase() === 'U';
// ---- 地图定位 ----
handleLocateDevice(dev);
@@ -822,7 +824,7 @@ const RealTimeMonitorPage = () => {
messageApi.warning(t('devices.selectExecuteDevice'));
return;
}
const isDroneDevice = selectedDevice?.type === 'plane' || !!selectedDevice?.gateway_sn;
const isDroneDevice = selectedDevice?.type === 'plane' || !!selectedDevice?.gateway_sn || String(selectedDevice?.deviceType || '').toUpperCase() === 'U';
// 无人机:调用接口获取实时位置
if (isDroneDevice) {
@@ -1267,10 +1269,10 @@ const RealTimeMonitorPage = () => {
setDeviceDrawerOpen(false); setMqttDrone(null);
}}
destroyOnClose
extra={(selectedDevice?.gateway_sn || selectedDevice?.type === 'plane') ? null : <Button size="small" icon={<SyncOutlined />} onClick={() => { fetchTaskPoolList(selectedDeviceSn); }}></Button>}
extra={(selectedDevice?.gateway_sn || selectedDevice?.type === 'plane' || String(selectedDevice?.deviceType || '').toUpperCase() === 'U') ? null : <Button size="small" icon={<SyncOutlined />} onClick={() => { fetchTaskPoolList(selectedDeviceSn); }}></Button>}
>
{selectedDevice ? (
(selectedDevice?.type === 'plane' || selectedDevice?.gateway_sn) ? (
(selectedDevice?.type === 'plane' || selectedDevice?.gateway_sn || String(selectedDevice?.deviceType || '').toUpperCase() === 'U') ? (
<Space direction="vertical" size={12} style={{ width: '100%' }}>
<Card

View File

@@ -185,6 +185,14 @@ const TaskMonitorPage: React.FC = () => {
//const timer = setInterval(fetchData, 60000); // 每分钟刷新一次
//return () => clearInterval(timer);
}, [stationId]);
// 实时状态 → 地图设备颜色:1 工作中 green / 2 空闲 blue / 其他(含无实时数据)red
const getRealtimeColor = (status: any) => {
const s = Number(status);
if (s === 1) return 'green';
if (s === 2) return 'blue';
return 'red';
};
const mapDevices = useMemo(() => {
const base = [...devices];
const knownKeys = new Set();
@@ -192,7 +200,9 @@ const TaskMonitorPage: React.FC = () => {
const k = d?.serialNumber ?? d?.device_sn ?? d?.id;
if (k != null && k !== '') knownKeys.add(String(k));
});
const extras = (Array.isArray(realtimeMap) ? realtimeMap : [])
// mapPush 推的是 { [设备id]: 实时记录 },同时兼容数组结构
const rtList: any[] = Array.isArray(realtimeMap) ? realtimeMap : Object.values(realtimeMap || {});
const extras = rtList
.filter((rt: any) =>
Number.isFinite(Number(rt.lng)) &&
Number.isFinite(Number(rt.lat)) &&
@@ -203,12 +213,8 @@ const TaskMonitorPage: React.FC = () => {
id: rt.id,
name: rt.name || rt.alias || `设备-${String(rt.id).slice(-4)}`,
serialNumber: rt.id,
deviceType: 'ROBOT',
type: 'ROBOT',
category: 'robot',
typeText: '机器人',
status: rt.status,
onlineStatus: rt.status,
color: getRealtimeColor(rt.status),
longitude: rt.lng,
latitude: rt.lat,
heading: rt.yaw,
@@ -222,7 +228,42 @@ const TaskMonitorPage: React.FC = () => {
lastRunningStatus: { longitude: rt.lng, latitude: rt.lat, heading: rt.yaw, batteryLevel: rt.battery },
raw: { ...rt },
}));
const all = [...base, ...extras];
// 关键:把静态列表中已有设备的位置/状态用实时数据覆盖,
// 否则 base 里的设备永远只有接口返回的旧坐标,地图实体不会实时动
const rtMapDict: any = Array.isArray(realtimeMap)
? realtimeMap.reduce((acc: any, r: any, i: number) => { acc[String(r?.id ?? i)] = r; return acc; }, {})
: (realtimeMap || {});
const baseOverridden = base.map((d) => {
const k = String(d?.serialNumber ?? d?.device_sn ?? d?.id ?? "");
const rt = rtMapDict[k];
if (!rt) return { ...d, color: 'red' };
return {
...d,
longitude: rt.lng ?? d.longitude,
latitude: rt.lat ?? d.latitude,
heading: rt.yaw ?? d.heading,
batteryLevel: rt.battery ?? d.batteryLevel,
feStatus: rt.feStatus ?? d.feStatus,
status: rt.status ?? d.status,
color: getRealtimeColor(rt.status),
hasAlarm: !!rt.hasAlarm,
taskId: rt.t ?? rt.taskId ?? d.taskId,
updateTime: rt.updateTime ?? d.updateTime,
locationMessage: {
longitude: rt.lng ?? d.locationMessage?.longitude,
latitude: rt.lat ?? d.locationMessage?.latitude,
heading: rt.yaw ?? d.locationMessage?.heading,
batteryLevel: rt.battery ?? d.locationMessage?.batteryLevel,
},
lastRunningStatus: {
longitude: rt.lng ?? d.lastRunningStatus?.longitude,
latitude: rt.lat ?? d.lastRunningStatus?.latitude,
heading: rt.yaw ?? d.lastRunningStatus?.heading,
batteryLevel: rt.battery ?? d.lastRunningStatus?.batteryLevel,
},
};
});
const all = [...baseOverridden, ...extras];
return all.filter((d: any) =>
(d?.lastRunningStatus?.latitude && d?.lastRunningStatus?.longitude) ||
@@ -230,6 +271,7 @@ const TaskMonitorPage: React.FC = () => {
(d?.longitude && d?.latitude)
);
}, [devices, realtimeMap]);
//console.log(mapDevices, "mapDevices")
// 计算统计数据
const taskSummary = useMemo(() => {
@@ -250,7 +292,7 @@ const TaskMonitorPage: React.FC = () => {
// feStatus: 1=作业中, 2=空闲
const working = devices.filter(d => String(d.feStatus) === '1').length;
const idle = devices.filter(d => String(d.feStatus) === '2').length;
console.log(realtimeMap, "realtimeMap")
// 告警车辆数量以实时数据里的 hasAlarm 为准
const alarmDevices = devices.filter(d => !!pickRealtimeRecord(realtimeMap, d)?.hasAlarm);
const alarm = alarmDevices.length;
@@ -347,14 +389,15 @@ const TaskMonitorPage: React.FC = () => {
{taskPoolList.slice(0, 2).map((task, idx) => (
<div key={idx} style={{ background: '#f8faff', padding: '10px 12px', borderRadius: 8, marginBottom: 8, border: '1px solid #e6f7ff' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 13, marginBottom: 4 }}>
<span style={{ fontWeight: 500, color: '#262626' }}>{task.planName}</span>
<span style={{ color: '#1890ff', fontWeight: 600 }}>{Math.floor(Math.random() * 40 + 60)}%</span>
<span style={{ fontWeight: 500, color: '#262626' }}>{task.workName}</span>
{/*<span style={{ color: '#1890ff', fontWeight: 600 }}>{task.progress}%</span>*/}
</div>
<Progress percent={Math.floor(Math.random() * 40 + 60)} size="small" showInfo={false} strokeColor="#1890ff" />
<div style={{ fontSize: 11, color: '#8c8c8c', marginTop: 4 }}>
<Clock size={10} style={{ marginRight: 4 }} />
{dayjs(task.createTime).format('YY-MM-DD HH:mm:ss')} 下发
{/*<Progress percent={task.progress} size="small" showInfo={false} strokeColor="#1890ff" />*/}
<div style={{ fontSize: 11, color: '#8c8c8c', marginTop: 4, display: 'inline-flex', alignItems: 'center', gap: 4 }}>
<Clock size={10} />
<span>{dayjs(task.createTime).format('YY-MM-DD HH:mm:ss')} 下发</span>
</div>
</div>
))}
</div>
@@ -486,7 +529,7 @@ const TaskMonitorPage: React.FC = () => {
<div className="vehicle-map-popup" role="dialog" aria-label="车辆详情">
<div className="vehicle-map-popup__header">
<div className="vehicle-map-popup__identity">
<Avatar size={38} shape="square" icon={selectedDevice.deviceType === 'UAV' ? <RocketOutlined /> : <RobotOutlined />} style={{ background: '#e6f7ff', color: '#0788ed', borderRadius: 10 }} />
<Avatar size={38} shape="square" icon={String(selectedDevice.deviceType || '').toUpperCase() === 'U' ? <RocketOutlined /> : <RobotOutlined />} style={{ background: '#e6f7ff', color: '#0788ed', borderRadius: 10 }} />
<div><div className="vehicle-map-popup__title">{selectedDevice.deviceAlias || selectedDevice.deviceName || '车辆'}</div><div className="vehicle-map-popup__serial">{selectedDevice.serialNumber || '--'}</div></div>
</div>
<Button type="text" size="small" aria-label="关闭车辆详情" icon={<X size={18} />} onClick={() => setSelectedDeviceSerial(null)} />
@@ -528,7 +571,7 @@ const TaskMonitorPage: React.FC = () => {
<MonitorCard title="实时车辆状态" icon={<Activity size={18} color="#1890ff" />} height="35%">
<List
size="small"
dataSource={devices.filter(d => d.deviceType !== 'CAMERA')}
dataSource={devices.filter(d => { const dt = String(d.deviceType || '').toUpperCase(); return dt !== 'CAMERA' && dt !== 'SENSOR' && dt !== 'GATEWAY'; })}
renderItem={(item: any) => {
const rt = realtimeMap[item.serialNumber] || {};
const battery = getDeviceBattery(item);
@@ -547,7 +590,7 @@ const TaskMonitorPage: React.FC = () => {
setFocusLocation({
lon,
lat,
type: item.deviceType === 'UAV' ? 'drone' : 'robot',
type: String(item.deviceType || '').toUpperCase() === 'U' ? 'drone' : 'robot',
height: 1000, // 增加高度以实现飞入效果
heading: 0,
pitch: -45
@@ -556,10 +599,10 @@ const TaskMonitorPage: React.FC = () => {
}}
aria-pressed={selectedDeviceSerial === item.serialNumber}
tabIndex={0}
onKeyDown={(event: any) => { if (event.key === 'Enter' || event.key === ' ') { setSelectedDeviceSerial(item.serialNumber); const pos = item.lastRunningStatus || item.locationMessage || {}; const lon = Number(pos.longitude ?? pos.lng); const lat = Number(pos.latitude ?? pos.lat); if (Number.isFinite(lon) && Number.isFinite(lat)) setFocusLocation({ lon, lat, type: item.deviceType === 'UAV' ? 'drone' : 'robot', height: 800 }); } }}
onKeyDown={(event: any) => { if (event.key === 'Enter' || event.key === ' ') { setSelectedDeviceSerial(item.serialNumber); const pos = item.lastRunningStatus || item.locationMessage || {}; const lon = Number(pos.longitude ?? pos.lng); const lat = Number(pos.latitude ?? pos.lat); if (Number.isFinite(lon) && Number.isFinite(lat)) setFocusLocation({ lon, lat, type: String(item.deviceType || '').toUpperCase() === 'U' ? 'drone' : 'robot', height: 800 }); } }}
>
<div style={{ display: 'flex', gap: 12, width: '100%' }}>
<Avatar shape="square" size={44} icon={item.deviceType === 'UAV' ? <RocketOutlined /> : <RobotOutlined />} style={{ background: '#f0f7ff', color: '#1890ff' }} />
<Avatar shape="square" size={44} icon={String(item.deviceType || '').toUpperCase() === 'U' ? <RocketOutlined /> : <RobotOutlined />} style={{ background: '#f0f7ff', color: '#1890ff' }} />
<div style={{ flex: 1, minWidth: 0 }}>
<div
style={{
@@ -665,7 +708,7 @@ const TaskMonitorPage: React.FC = () => {
marginBottom: 8
}}>
<VideoPlayer
deviceId={devices.find(d => d.deviceType === 'ROBOT' || d.deviceType === 'CLEANING')?.serialNumber}
deviceId={devices.find(d => { const dt = String(d.deviceType || '').toUpperCase(); return dt === 'I' || dt === 'M'; })?.serialNumber}
idx={videoView === 'back' ? 2 : videoView === 'left' ? 3 : videoView === 'right' ? 4 : 1}
className="w-full h-full object-cover"
/>