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 && (
|
||||
|
||||
@@ -3114,11 +3114,11 @@ export default function DeviceStatusPage() {
|
||||
|
||||
<ConsolePanel
|
||||
|
||||
style={{ flex: 1, minHeight: 300 }}
|
||||
style={{ minHeight: 300, flex: 'none', width: '100%' }}
|
||||
|
||||
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 (
|
||||
<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) => {
|
||||
const isActive = active.has(f.key);
|
||||
return (
|
||||
|
||||
@@ -70,7 +70,6 @@ export default function RobotTaskPage() {
|
||||
const [realtimeMap, setRealtimeMap] = useState<any>({});
|
||||
const [execute, setExecute] = useState(false); // 是否执行任务
|
||||
const [taskList, setTaskList] = useState([]);
|
||||
const [arrivedPoint, setArrivedPoint] = useState(null);//完成点
|
||||
const { modal } = App.useApp();
|
||||
const [polyPoints, setPolyPoints] = useState([]);
|
||||
|
||||
@@ -183,10 +182,19 @@ export default function RobotTaskPage() {
|
||||
|
||||
|
||||
}
|
||||
const handleFinishEdPoint = (point) => {
|
||||
setArrivedPoint(point);
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 根据任务ID获取路径并显示在地图上
|
||||
const loadTaskPath = async (taskId) => {
|
||||
//return;
|
||||
@@ -287,6 +295,9 @@ export default function RobotTaskPage() {
|
||||
console.log('收到 route_post 消息:', 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(() => {
|
||||
fetchAllData();
|
||||
@@ -1112,17 +1112,17 @@ export default function RobotTaskPage() {
|
||||
</Popconfirm>
|
||||
{/*//)}*/}
|
||||
|
||||
{/*{record.taskStaus === 'EXECUTING' && (*/}
|
||||
<Popconfirm
|
||||
title={t('devices.confirmPauseTask')}
|
||||
onConfirm={() => handlePauseTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
||||
{t('video.pause')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
{/*)}/*/}
|
||||
{record.taskStaus === 'EXECUTING' && (
|
||||
<Popconfirm
|
||||
title={t('devices.confirmPauseTask')}
|
||||
onConfirm={() => handlePauseTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
||||
{t('video.pause')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
|
||||
{record.taskStaus === 'PAUSE' && (
|
||||
<Popconfirm
|
||||
@@ -1562,7 +1562,6 @@ export default function RobotTaskPage() {
|
||||
realtimeType="robot"
|
||||
from="devicesTask"
|
||||
drawRealTime={execute}
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
routeMode={routeMode}
|
||||
@@ -1707,12 +1706,12 @@ export default function RobotTaskPage() {
|
||||
fetchTaskPoolList();
|
||||
fetchTaskHistoryList();
|
||||
}} />
|
||||
<Tooltip title={t('devices.createTask')}>
|
||||
{/*<Tooltip title={t('devices.createTask')}>
|
||||
<PlusOutlined
|
||||
style={{ cursor: 'pointer', color: '#165DFF', fontSize: 14 }}
|
||||
onClick={() => setIsTaskModalOpen(true)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Tooltip>*/}
|
||||
</Space>
|
||||
|
||||
}
|
||||
|
||||
@@ -128,7 +128,6 @@ const SteerButton = ({
|
||||
minHeight: 46,
|
||||
padding: '6px 4px',
|
||||
borderRadius: 8,
|
||||
background: pressed ? `${color}30` : '#1e293b',
|
||||
border: `1px solid ${pressed ? color : `${color}55`}`,
|
||||
color,
|
||||
cursor: 'pointer',
|
||||
|
||||
@@ -43,6 +43,7 @@ export default class DeviceController {
|
||||
this.onRequestControlStatusChange = null;
|
||||
this.onPermissionRequest = null;
|
||||
this.onRoutePost = null;
|
||||
this.deviceStatusChangedMsg = null;
|
||||
this.onIsFinished = null;
|
||||
this.onIsExecuting = null;
|
||||
this.handleArrivedPoint = null;
|
||||
@@ -118,34 +119,46 @@ export default class DeviceController {
|
||||
try { msg = JSON.parse(event.data); } catch (e) { return; }
|
||||
|
||||
console.log('[DeviceController] 收到全量设备状态 初始状态', msg);
|
||||
if (msg?.type !== 'mapPush') return;
|
||||
const list = Array.isArray(msg?.data) && msg.data.length
|
||||
? msg.data
|
||||
: [];
|
||||
if (!list.length) return;
|
||||
if (msg?.type == 'mapPush') {
|
||||
const list = Array.isArray(msg?.data) && msg.data.length
|
||||
? msg.data
|
||||
: [];
|
||||
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 = () => {
|
||||
@@ -447,10 +460,10 @@ export default class DeviceController {
|
||||
break;
|
||||
}
|
||||
case "device_task_change": {
|
||||
if (msg.deviceId != this.connectedDeviceSn) return;
|
||||
console.log('task change:', msg);
|
||||
|
||||
if (msg.status == "FINISH") {
|
||||
console.log('task finish');
|
||||
this.onIsFinished?.(true);
|
||||
}
|
||||
if (msg.status == "EXECUTING") {
|
||||
@@ -479,7 +492,6 @@ export default class DeviceController {
|
||||
}
|
||||
|
||||
case 'detectionReport':
|
||||
if (msg.data?.deviceId !== this.connectedDeviceSn) return;
|
||||
const { isSecure, obstacle } = msg.data;
|
||||
if (isSecure) return;
|
||||
const type = obstacle?.type;
|
||||
@@ -500,6 +512,14 @@ export default class DeviceController {
|
||||
|
||||
break;
|
||||
|
||||
case 'device_status_changed':
|
||||
this.deviceStatusChangedMsg?.(msg);
|
||||
break;
|
||||
|
||||
case 'remoteControl':
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ export const UniversalLineChart = ({
|
||||
boxSizing: 'border-box',
|
||||
background: backgroundColor,
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
padding: 4,
|
||||
overflow: 'hidden',
|
||||
...style,
|
||||
}}
|
||||
@@ -334,7 +334,6 @@ export const UniversalPieChart = ({
|
||||
boxSizing: 'border-box',
|
||||
background: backgroundColor,
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
overflow: 'hidden',
|
||||
...style,
|
||||
}}
|
||||
|
||||
@@ -906,6 +906,9 @@
|
||||
|
||||
mapEditor: {
|
||||
returnPoint: 'Return Point',
|
||||
noConfiguredReturnPoints: 'noConfiguredReturnPoints',
|
||||
noConfiguredRegions: 'noConfiguredRegions',
|
||||
noConfiguredObstaclePoints: "noConfiguredObstaclePoints",
|
||||
legend: 'Legend',
|
||||
unbound: 'Unbound',
|
||||
duplicateBindDevice: 'Duplicate Bind Device',
|
||||
@@ -945,6 +948,8 @@
|
||||
mapEditorTitle: 'Map Editor',
|
||||
fillName: 'Please enter route name',
|
||||
needAtLeast2Points: 'At least 2 points required',
|
||||
obstacle: 'Obstacle',
|
||||
|
||||
}, turnSpeed: 'Turn Speed',
|
||||
realtimeVideoMonitor: 'Realtime Video Monitor',
|
||||
rechargeBtn: 'Recharge Btn',
|
||||
@@ -2811,7 +2816,6 @@
|
||||
operationLog: 'Operation Log',
|
||||
errorLog: 'Error Log',
|
||||
systemLog: 'System Log',
|
||||
operator: 'Operator',
|
||||
operationContent: 'Operation Content',
|
||||
operationTime: 'Operation Time',
|
||||
ipAddress: 'IP Address',
|
||||
|
||||
@@ -1559,7 +1559,7 @@ const zh = {
|
||||
pointEmptyHint: '暂无标记点,请在地图上点击添加',
|
||||
routeEmptyHint: '暂无路径点,请在地图上依次点击打点',
|
||||
duplicateBindDevice: '重复绑定设备',
|
||||
bindUpdateSuccess: '绑定设备已更新',
|
||||
bindUpdateSuccess: '绑定设备已更新',
|
||||
|
||||
save: '保存',
|
||||
saveSuccess: '保存成功',
|
||||
@@ -1571,6 +1571,8 @@ const zh = {
|
||||
configuredRegions: '已配置分区',
|
||||
noConfiguredReturnPoints: '暂无已配置返航点',
|
||||
noConfiguredRegions: '暂无已配置分区',
|
||||
obstacle: '障碍点',
|
||||
noConfiguredObstaclePoints: "暂无已配置障碍点",
|
||||
unnamed: '未命名',
|
||||
regionCode: '分区编码',
|
||||
scopeCount: '范围点数',
|
||||
|
||||
Reference in New Issue
Block a user