map中 增加显示障碍物代码 未测试,优化显示实时路径,完善返航点、分区的绘制显示 障碍物 支持拖动半径显示 地图增加图例,优化机器人任务界面的逻辑 无需收到刷新接口,根据传输任务完成情况 调用接口,已测试
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2796,7 +2796,7 @@ export default function DeviceStatusPage() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div style={{ position: 'relative', flex: 1, minHeight: 0, borderRadius: 8, overflow: 'hidden', background: '#0a0e1a', }}>
|
<div style={{ position: 'relative', flex: 1, minHeight: 0, borderRadius: 8, overflow: 'hidden', }}>
|
||||||
|
|
||||||
{isVideoPlaying && (
|
{isVideoPlaying && (
|
||||||
|
|
||||||
@@ -3114,11 +3114,11 @@ export default function DeviceStatusPage() {
|
|||||||
|
|
||||||
<ConsolePanel
|
<ConsolePanel
|
||||||
|
|
||||||
style={{ flex: 1, minHeight: 300 }}
|
style={{ minHeight: 300, flex: 'none', width: '100%' }}
|
||||||
|
|
||||||
title={<><SafetyOutlined style={{ color: '#fa541c' }} /> {t('devices.features.title')}</>}
|
title={<><SafetyOutlined style={{ color: '#fa541c' }} /> {t('devices.features.title')}</>}
|
||||||
|
|
||||||
bodyStyle={{ padding: 10, display: 'flex', }}
|
bodyStyle={{ padding: 10, display: 'flex', flex: "auto" }}
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ const RobotFeatureButtons: React.FC<RobotFeatureButtonsProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`flex gap-2 w-full ${className}`}>
|
<div className={`flex w-full ${className} flex-wrap content-start items-start gap-x-2 gap-y-2 justify-start self-start`}>
|
||||||
{list.map((f) => {
|
{list.map((f) => {
|
||||||
const isActive = active.has(f.key);
|
const isActive = active.has(f.key);
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ export default function RobotTaskPage() {
|
|||||||
const [realtimeMap, setRealtimeMap] = useState<any>({});
|
const [realtimeMap, setRealtimeMap] = useState<any>({});
|
||||||
const [execute, setExecute] = useState(false); // 是否执行任务
|
const [execute, setExecute] = useState(false); // 是否执行任务
|
||||||
const [taskList, setTaskList] = useState([]);
|
const [taskList, setTaskList] = useState([]);
|
||||||
const [arrivedPoint, setArrivedPoint] = useState(null);//完成点
|
|
||||||
const { modal } = App.useApp();
|
const { modal } = App.useApp();
|
||||||
const [polyPoints, setPolyPoints] = useState([]);
|
const [polyPoints, setPolyPoints] = useState([]);
|
||||||
|
|
||||||
@@ -183,10 +182,19 @@ export default function RobotTaskPage() {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const handleFinishEdPoint = (point) => {
|
const fetchAllData = async () => {
|
||||||
setArrivedPoint(point);
|
if (!stationId) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const deviceRes = await getSiteDevice({ siteId: stationId, pageSize: 9999, pageNum: 1, orgId: currentStation?.orgId });
|
||||||
|
const devData = deviceRes?.code === 200 ? (deviceRes.rows || []) : [];
|
||||||
|
setDevices(devData);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('数据请求失败', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 根据任务ID获取路径并显示在地图上
|
// 根据任务ID获取路径并显示在地图上
|
||||||
const loadTaskPath = async (taskId) => {
|
const loadTaskPath = async (taskId) => {
|
||||||
//return;
|
//return;
|
||||||
@@ -287,6 +295,9 @@ export default function RobotTaskPage() {
|
|||||||
console.log('收到 route_post 消息:', msg);
|
console.log('收到 route_post 消息:', msg);
|
||||||
setProPoints(msg);
|
setProPoints(msg);
|
||||||
};
|
};
|
||||||
|
controller.deviceStatusChangedMsg = () => {
|
||||||
|
fetchAllData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -459,17 +470,6 @@ export default function RobotTaskPage() {
|
|||||||
|
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const fetchAllData = async () => {
|
|
||||||
if (!stationId) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const deviceRes = await getSiteDevice({ siteId: stationId, pageSize: 9999, pageNum: 1, orgId: currentStation?.orgId });
|
|
||||||
const devData = deviceRes?.code === 200 ? (deviceRes.rows || []) : [];
|
|
||||||
setDevices(devData);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('数据请求失败', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchAllData();
|
fetchAllData();
|
||||||
@@ -1112,17 +1112,17 @@ export default function RobotTaskPage() {
|
|||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
{/*//)}*/}
|
{/*//)}*/}
|
||||||
|
|
||||||
{/*{record.taskStaus === 'EXECUTING' && (*/}
|
{record.taskStaus === 'EXECUTING' && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={t('devices.confirmPauseTask')}
|
title={t('devices.confirmPauseTask')}
|
||||||
onConfirm={() => handlePauseTask(record)}
|
onConfirm={() => handlePauseTask(record)}
|
||||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||||
>
|
>
|
||||||
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
||||||
{t('video.pause')}
|
{t('video.pause')}
|
||||||
</Button>
|
</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
{/*)}/*/}
|
)}
|
||||||
|
|
||||||
{record.taskStaus === 'PAUSE' && (
|
{record.taskStaus === 'PAUSE' && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
@@ -1562,7 +1562,6 @@ export default function RobotTaskPage() {
|
|||||||
realtimeType="robot"
|
realtimeType="robot"
|
||||||
from="devicesTask"
|
from="devicesTask"
|
||||||
drawRealTime={execute}
|
drawRealTime={execute}
|
||||||
finishPoint={arrivedPoint}
|
|
||||||
ifClearNavLine={clearNavLine}
|
ifClearNavLine={clearNavLine}
|
||||||
ifClearPlanLine={clearPlanLine}
|
ifClearPlanLine={clearPlanLine}
|
||||||
routeMode={routeMode}
|
routeMode={routeMode}
|
||||||
@@ -1707,12 +1706,12 @@ export default function RobotTaskPage() {
|
|||||||
fetchTaskPoolList();
|
fetchTaskPoolList();
|
||||||
fetchTaskHistoryList();
|
fetchTaskHistoryList();
|
||||||
}} />
|
}} />
|
||||||
<Tooltip title={t('devices.createTask')}>
|
{/*<Tooltip title={t('devices.createTask')}>
|
||||||
<PlusOutlined
|
<PlusOutlined
|
||||||
style={{ cursor: 'pointer', color: '#165DFF', fontSize: 14 }}
|
style={{ cursor: 'pointer', color: '#165DFF', fontSize: 14 }}
|
||||||
onClick={() => setIsTaskModalOpen(true)}
|
onClick={() => setIsTaskModalOpen(true)}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>*/}
|
||||||
</Space>
|
</Space>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ const SteerButton = ({
|
|||||||
minHeight: 46,
|
minHeight: 46,
|
||||||
padding: '6px 4px',
|
padding: '6px 4px',
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
background: pressed ? `${color}30` : '#1e293b',
|
|
||||||
border: `1px solid ${pressed ? color : `${color}55`}`,
|
border: `1px solid ${pressed ? color : `${color}55`}`,
|
||||||
color,
|
color,
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export default class DeviceController {
|
|||||||
this.onRequestControlStatusChange = null;
|
this.onRequestControlStatusChange = null;
|
||||||
this.onPermissionRequest = null;
|
this.onPermissionRequest = null;
|
||||||
this.onRoutePost = null;
|
this.onRoutePost = null;
|
||||||
|
this.deviceStatusChangedMsg = null;
|
||||||
this.onIsFinished = null;
|
this.onIsFinished = null;
|
||||||
this.onIsExecuting = null;
|
this.onIsExecuting = null;
|
||||||
this.handleArrivedPoint = null;
|
this.handleArrivedPoint = null;
|
||||||
@@ -118,34 +119,46 @@ export default class DeviceController {
|
|||||||
try { msg = JSON.parse(event.data); } catch (e) { return; }
|
try { msg = JSON.parse(event.data); } catch (e) { return; }
|
||||||
|
|
||||||
console.log('[DeviceController] 收到全量设备状态 初始状态', msg);
|
console.log('[DeviceController] 收到全量设备状态 初始状态', msg);
|
||||||
if (msg?.type !== 'mapPush') return;
|
if (msg?.type == 'mapPush') {
|
||||||
const list = Array.isArray(msg?.data) && msg.data.length
|
const list = Array.isArray(msg?.data) && msg.data.length
|
||||||
? msg.data
|
? msg.data
|
||||||
: [];
|
: [];
|
||||||
if (!list.length) return;
|
if (!list.length) return;
|
||||||
|
|
||||||
|
const next = {};
|
||||||
|
list.forEach((it) => {
|
||||||
|
const key = String(it?.id ?? '');
|
||||||
|
if (!key) return;
|
||||||
|
next[key] = {
|
||||||
|
id: key,
|
||||||
|
lng: String(it?.lng ?? it?.lon ?? it?.longitude),
|
||||||
|
lat: String(it?.lat ?? it?.latitude),
|
||||||
|
yaw: it?.y,
|
||||||
|
fix: it?.f !== undefined ? String(it.f) : undefined,
|
||||||
|
fixStatus: it?.f !== undefined ? String(it.f) : undefined,
|
||||||
|
altitude: it?.a !== undefined ? String(it.a) : undefined,
|
||||||
|
status: it?.s ?? it?.status,
|
||||||
|
taskId: it?.t ?? it?.taskId ?? null,
|
||||||
|
battery: it?.b !== undefined ? Number(it.b) : (it?.batteryLevel !== undefined ? Number(it.batteryLevel) : undefined),
|
||||||
|
hasAlarm: !!it?.ha || !!it?.hasAlarm,
|
||||||
|
updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
controlMode: it?.cm ?? it?.controlMode,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
console.log('[DeviceController] 收到全量设备状态', next);
|
||||||
|
this.onMapPush?.(next);
|
||||||
|
}
|
||||||
|
if (msg?.type == 'device_task_change') {
|
||||||
|
if (msg.status == "FINISH") {
|
||||||
|
console.log('task finish');
|
||||||
|
this.onIsFinished?.(true);
|
||||||
|
}
|
||||||
|
if (msg.status == "EXECUTING" || msg.status == "CANCELLED" || msg.status == "FAILED") {
|
||||||
|
this.onIsExecuting?.(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const next = {};
|
|
||||||
list.forEach((it) => {
|
|
||||||
const key = String(it?.id ?? '');
|
|
||||||
if (!key) return;
|
|
||||||
next[key] = {
|
|
||||||
id: key,
|
|
||||||
lng: String(it?.lng ?? it?.lon ?? it?.longitude),
|
|
||||||
lat: String(it?.lat ?? it?.latitude),
|
|
||||||
yaw: it?.y,
|
|
||||||
fix: it?.f !== undefined ? String(it.f) : undefined,
|
|
||||||
fixStatus: it?.f !== undefined ? String(it.f) : undefined,
|
|
||||||
altitude: it?.a !== undefined ? String(it.a) : undefined,
|
|
||||||
status: it?.s ?? it?.status,
|
|
||||||
taskId: it?.t ?? it?.taskId ?? null,
|
|
||||||
battery: it?.b !== undefined ? Number(it.b) : (it?.batteryLevel !== undefined ? Number(it.batteryLevel) : undefined),
|
|
||||||
hasAlarm: !!it?.ha || !!it?.hasAlarm,
|
|
||||||
updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
||||||
controlMode: it?.cm ?? it?.controlMode,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
console.log('[DeviceController] 收到全量设备状态', next);
|
|
||||||
this.onMapPush?.(next);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ws.onerror = () => {
|
ws.onerror = () => {
|
||||||
@@ -447,10 +460,10 @@ export default class DeviceController {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "device_task_change": {
|
case "device_task_change": {
|
||||||
if (msg.deviceId != this.connectedDeviceSn) return;
|
|
||||||
console.log('task change:', msg);
|
console.log('task change:', msg);
|
||||||
|
|
||||||
if (msg.status == "FINISH") {
|
if (msg.status == "FINISH") {
|
||||||
|
console.log('task finish');
|
||||||
this.onIsFinished?.(true);
|
this.onIsFinished?.(true);
|
||||||
}
|
}
|
||||||
if (msg.status == "EXECUTING") {
|
if (msg.status == "EXECUTING") {
|
||||||
@@ -479,7 +492,6 @@ export default class DeviceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'detectionReport':
|
case 'detectionReport':
|
||||||
if (msg.data?.deviceId !== this.connectedDeviceSn) return;
|
|
||||||
const { isSecure, obstacle } = msg.data;
|
const { isSecure, obstacle } = msg.data;
|
||||||
if (isSecure) return;
|
if (isSecure) return;
|
||||||
const type = obstacle?.type;
|
const type = obstacle?.type;
|
||||||
@@ -500,6 +512,14 @@ export default class DeviceController {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'device_status_changed':
|
||||||
|
this.deviceStatusChangedMsg?.(msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'remoteControl':
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ export const UniversalLineChart = ({
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
background: backgroundColor,
|
background: backgroundColor,
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
padding: 12,
|
padding: 4,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
...style,
|
...style,
|
||||||
}}
|
}}
|
||||||
@@ -334,7 +334,6 @@ export const UniversalPieChart = ({
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
background: backgroundColor,
|
background: backgroundColor,
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
padding: 12,
|
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
...style,
|
...style,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -906,6 +906,9 @@
|
|||||||
|
|
||||||
mapEditor: {
|
mapEditor: {
|
||||||
returnPoint: 'Return Point',
|
returnPoint: 'Return Point',
|
||||||
|
noConfiguredReturnPoints: 'noConfiguredReturnPoints',
|
||||||
|
noConfiguredRegions: 'noConfiguredRegions',
|
||||||
|
noConfiguredObstaclePoints: "noConfiguredObstaclePoints",
|
||||||
legend: 'Legend',
|
legend: 'Legend',
|
||||||
unbound: 'Unbound',
|
unbound: 'Unbound',
|
||||||
duplicateBindDevice: 'Duplicate Bind Device',
|
duplicateBindDevice: 'Duplicate Bind Device',
|
||||||
@@ -945,6 +948,8 @@
|
|||||||
mapEditorTitle: 'Map Editor',
|
mapEditorTitle: 'Map Editor',
|
||||||
fillName: 'Please enter route name',
|
fillName: 'Please enter route name',
|
||||||
needAtLeast2Points: 'At least 2 points required',
|
needAtLeast2Points: 'At least 2 points required',
|
||||||
|
obstacle: 'Obstacle',
|
||||||
|
|
||||||
}, turnSpeed: 'Turn Speed',
|
}, turnSpeed: 'Turn Speed',
|
||||||
realtimeVideoMonitor: 'Realtime Video Monitor',
|
realtimeVideoMonitor: 'Realtime Video Monitor',
|
||||||
rechargeBtn: 'Recharge Btn',
|
rechargeBtn: 'Recharge Btn',
|
||||||
@@ -2811,7 +2816,6 @@
|
|||||||
operationLog: 'Operation Log',
|
operationLog: 'Operation Log',
|
||||||
errorLog: 'Error Log',
|
errorLog: 'Error Log',
|
||||||
systemLog: 'System Log',
|
systemLog: 'System Log',
|
||||||
operator: 'Operator',
|
|
||||||
operationContent: 'Operation Content',
|
operationContent: 'Operation Content',
|
||||||
operationTime: 'Operation Time',
|
operationTime: 'Operation Time',
|
||||||
ipAddress: 'IP Address',
|
ipAddress: 'IP Address',
|
||||||
|
|||||||
@@ -1559,7 +1559,7 @@ const zh = {
|
|||||||
pointEmptyHint: '暂无标记点,请在地图上点击添加',
|
pointEmptyHint: '暂无标记点,请在地图上点击添加',
|
||||||
routeEmptyHint: '暂无路径点,请在地图上依次点击打点',
|
routeEmptyHint: '暂无路径点,请在地图上依次点击打点',
|
||||||
duplicateBindDevice: '重复绑定设备',
|
duplicateBindDevice: '重复绑定设备',
|
||||||
bindUpdateSuccess: '绑定设备已更新',
|
bindUpdateSuccess: '绑定设备已更新',
|
||||||
|
|
||||||
save: '保存',
|
save: '保存',
|
||||||
saveSuccess: '保存成功',
|
saveSuccess: '保存成功',
|
||||||
@@ -1571,6 +1571,8 @@ const zh = {
|
|||||||
configuredRegions: '已配置分区',
|
configuredRegions: '已配置分区',
|
||||||
noConfiguredReturnPoints: '暂无已配置返航点',
|
noConfiguredReturnPoints: '暂无已配置返航点',
|
||||||
noConfiguredRegions: '暂无已配置分区',
|
noConfiguredRegions: '暂无已配置分区',
|
||||||
|
obstacle: '障碍点',
|
||||||
|
noConfiguredObstaclePoints: "暂无已配置障碍点",
|
||||||
unnamed: '未命名',
|
unnamed: '未命名',
|
||||||
regionCode: '分区编码',
|
regionCode: '分区编码',
|
||||||
scopeCount: '范围点数',
|
scopeCount: '范围点数',
|
||||||
|
|||||||
Reference in New Issue
Block a user