控制模式 割刀速度 加入 支持删除 返航点和障碍物点
This commit is contained in:
@@ -2570,11 +2570,39 @@ export default function DeviceStatusPage() {
|
||||
|
||||
<ConsoleRow icon={<DashboardOutlined />} label={t('devices.rtMainTemp')} value={(runningStatus?.main_temperature ?? runningStatus?.chipTemp) !== undefined ? formatTemperature(Number(runningStatus?.main_temperature ?? runningStatus?.chipTemp), 1).label : '-'} />
|
||||
|
||||
<ConsoleRow icon={<ControlOutlined />} label={t('devices.rtMode')} value={(runningStatus?.control_mode ?? runningStatus?.controlMode) !== undefined ? ((runningStatus?.control_mode ?? runningStatus?.controlMode) === '1' ? t('devices.localMode') : (runningStatus?.control_mode ?? runningStatus?.controlMode) === '3' ? t('devices.remoteMode') : t('constants.locationUnknown')) : '-'} />
|
||||
<ConsoleRow
|
||||
icon={<ControlOutlined />}
|
||||
label={t('devices.rtMode')}
|
||||
value={
|
||||
(runningStatus?.control_mode ?? runningStatus?.controlMode) !== undefined
|
||||
? (() => {
|
||||
const mode =
|
||||
runningStatus?.control_mode ?? runningStatus?.controlMode;
|
||||
|
||||
switch (mode) {
|
||||
case '0':
|
||||
case 0:
|
||||
return t('devices.controlOff');
|
||||
case '1':
|
||||
case 1:
|
||||
return t('devices.localCpntrol');
|
||||
case '2':
|
||||
case 2:
|
||||
return t('devices.autoTask');
|
||||
case '3':
|
||||
case 3:
|
||||
return t('devices.remoteControl');
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
})()
|
||||
: '-'
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<ConsoleRow icon={<EnvironmentOutlined />} label={t('devices.motionStatus')} value={runningStatus?.motion === 'moving' ? t('devices.motionMoving') : runningStatus?.motion === 'stopped' ? t('devices.motionStopped') : runningStatus?.motion === 'blocked' ? t('devices.motionBlocked') : '-'} />
|
||||
<ConsoleRow icon={<EnvironmentOutlined />} label={t('devices.cutterSpedd')} value={runningStatus?.cutter_speed ?? "-"} />
|
||||
|
||||
<ConsoleRow icon={<SafetyOutlined />} label={t('devices.rtEmergency')} value={runningStatus?.emergency_stop === true ? t('devices.estopTriggered') : runningStatus?.emergency_stop === false ? t('devices.estopNormal') : '-'} />
|
||||
|
||||
|
||||
@@ -823,7 +823,94 @@ export default function MapEditorPage() {
|
||||
console.error('[MapEditor] preview route failed:', e);
|
||||
}
|
||||
};
|
||||
// 修改已配置障碍物点的半径
|
||||
|
||||
// ========== 删除已配置的返航点 / 障碍物点 ==========
|
||||
const handleDeleteMapPoint = (item: any, index: number) => {
|
||||
const isReturnPoint = activeType === 'returnPoint';
|
||||
const isObstaclePoint = activeType === 'obstaclePoint';
|
||||
|
||||
if (!isReturnPoint && !isObstaclePoint) return;
|
||||
|
||||
const pointName = isReturnPoint
|
||||
? item.alias || `返航点-${index + 1}`
|
||||
: item.name || item.alias || `障碍物点-${index + 1}`;
|
||||
|
||||
modal.confirm({
|
||||
title: '确认删除',
|
||||
content: `确定删除「${pointName}」吗?`,
|
||||
okText: '删除',
|
||||
cancelText: '取消',
|
||||
okButtonProps: { danger: true },
|
||||
|
||||
onOk: async () => {
|
||||
try {
|
||||
let payload: any;
|
||||
|
||||
if (isReturnPoint) {
|
||||
// 删除当前返航点,保留其他返航点
|
||||
const nextPoints = returnPointConfigList
|
||||
.filter((_: any, i: number) => i !== index);
|
||||
|
||||
payload = {
|
||||
restPoints: nextPoints.map((p: any) => ({
|
||||
alias: p.alias || '',
|
||||
position: p.position,
|
||||
bindDeviceId: p.bindDeviceId || null,
|
||||
})),
|
||||
siteId: stationId,
|
||||
orgId: currentStation?.orgId,
|
||||
};
|
||||
} else {
|
||||
// 删除当前障碍物点,保留其他障碍物点
|
||||
const nextPoints = obstaclePointConfigList.filter(
|
||||
(point: any) =>
|
||||
String(point.id) !== String(item.id)
|
||||
);
|
||||
|
||||
payload = {
|
||||
tempObstaclePoints: nextPoints.map((point: any) => ({
|
||||
position: {
|
||||
lat: Number(
|
||||
point.position?.lat ?? point.lat ?? 0
|
||||
),
|
||||
lng: Number(
|
||||
point.position?.lng ??
|
||||
point.position?.lon ??
|
||||
point.lon ??
|
||||
0
|
||||
),
|
||||
},
|
||||
radius: Number(point.radius) || 2,
|
||||
alias: point.name ?? point.alias ?? '',
|
||||
})),
|
||||
siteId: stationId,
|
||||
orgId: currentStation?.orgId,
|
||||
};
|
||||
}
|
||||
|
||||
// 更新已有站点地图信息时,带上后端返回的主键 ID
|
||||
if (siteMapInfoId != null) {
|
||||
payload.id = siteMapInfoId;
|
||||
}
|
||||
|
||||
const res: any = await saveSiteMapInfo(payload);
|
||||
|
||||
if (res?.code === 200) {
|
||||
messageApi.success('删除成功');
|
||||
|
||||
// 刷新服务端数据及地图覆盖物
|
||||
await getSiteMapInfoFn();
|
||||
setOverlayRefreshKey((k) => k + 1);
|
||||
} else {
|
||||
messageApi.error(res?.msg || '删除失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[MapEditor] 删除返航点/障碍物点失败:', error);
|
||||
messageApi.error('删除失败,请稍后重试');
|
||||
}
|
||||
},
|
||||
});
|
||||
}; // 修改已配置障碍物点的半径
|
||||
const handleUpdateObstacleRadius = async (
|
||||
item: any,
|
||||
radius: number
|
||||
@@ -1951,6 +2038,22 @@ export default function MapEditorPage() {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 返航点 / 障碍物点:增加删除按钮 */}
|
||||
{(isReturnPoint || isObstaclePoint) && (
|
||||
<Button
|
||||
size="small"
|
||||
type="text"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
title={t('common.delete')}
|
||||
onClick={(e) => {
|
||||
// 防止触发行项目的地图聚焦事件
|
||||
e.stopPropagation();
|
||||
handleDeleteMapPoint(item, idx);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1596,11 +1596,41 @@ export default function RobotTaskPage() {
|
||||
|
||||
<span>
|
||||
{t('devices.controlMode')}
|
||||
{robotRealtimePosition?.controlMode == '1' ? (
|
||||
<span style={{ color: '#ff6f6f' }}>{t('devices.localMode')}</span>
|
||||
) : (
|
||||
<span style={{ color: '#9eff9e' }}>{t('devices.remoteMode')}</span>
|
||||
)}
|
||||
{(() => {
|
||||
const mode = robotRealtimePosition?.controlMode || robotRealtimePosition?.control_mode;
|
||||
|
||||
const modeConfig: Record<string, { label: string; color: string }> = {
|
||||
'0': {
|
||||
label: t('devices.controlOff'),
|
||||
color: '#999999',
|
||||
},
|
||||
'1': {
|
||||
label: t('devices.localCpntrol'),
|
||||
color: '#ff6f6f',
|
||||
},
|
||||
'2': {
|
||||
label: t('devices.autoTask'),
|
||||
color: '#9eff9e',
|
||||
},
|
||||
'3': {
|
||||
label: t('devices.remoteControl'),
|
||||
color: '#9eff9e',
|
||||
},
|
||||
};
|
||||
|
||||
const config =
|
||||
mode !== undefined && mode !== null
|
||||
? modeConfig[String(mode)]
|
||||
: undefined;
|
||||
|
||||
return config ? (
|
||||
<span style={{ color: config.color }}>{config.label}</span>
|
||||
) : (
|
||||
<span style={{ color: '#999999' }}>
|
||||
-
|
||||
</span>
|
||||
);
|
||||
})()}
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user