feat(context-menu): 移除前端机器人选择限制并调整导航参数,将机器人选择逻辑完全交由后端控制

This commit is contained in:
xudan 2025-12-08 11:18:11 +08:00
parent a6c642fef4
commit 284fce1873
3 changed files with 9 additions and 31 deletions

View File

@ -114,7 +114,7 @@ const handleRobotSelected = async (data: { robot: RobotInfo; targetPointName: st
const result = await executeNavigateToPoint(
pointInfo.value.id,
pointInfo.value.name,
data.robot.id,
data.robot.label,
data.robot.label
);
@ -129,12 +129,7 @@ const handleRobotSelected = async (data: { robot: RobotInfo; targetPointName: st
//
if (result.success) {
message.success(`已为机器人 ${data.robot.label} 下发导航任务到 ${data.targetPointName}`);
} else {
// API
if (!result.message) {
message.error('导航任务下发失败');
}
}
}
} catch (error) {
console.error('导航操作失败:', error);

View File

@ -14,9 +14,8 @@
v-for="robot in robotList"
:key="robot.id"
class="robot-item"
:class="{ disabled: !isRobotSelectable(robot) }"
>
<a-radio :value="robot.id" :disabled="!isRobotSelectable(robot)">
<a-radio :value="robot.id">
<div class="robot-info">
<div class="robot-name">{{ robot.label }}</div>
<div class="robot-details">
@ -113,21 +112,10 @@ const loadRobotList = async () => {
}
};
//
const isRobotSelectable = (robot: RobotInfo): boolean => {
//
// 1. 线 (isConnected === true)
// 2. (canOrder === true)
// 3. (state === RobotState.)
// 4.
return (
robot.isConnected === true &&
robot.canOrder === true &&
robot.state === RobotState.空闲中 &&
!robot.targetPoint //
);
};
//
// const isRobotSelectable = (robot: RobotInfo): boolean => {
// return true;
// };
//
const getRobotStatusText = (state?: RobotState): string => {
@ -222,16 +210,11 @@ onMounted(() => {
transition: all 0.3s;
}
.robot-item:hover:not(.disabled) {
.robot-item:hover {
border-color: #1890ff;
background-color: #f5f5f5;
}
.robot-item.disabled {
opacity: 0.6;
cursor: not-allowed;
}
.robot-info {
width: 100%;
}

View File

@ -62,7 +62,7 @@ export async function executeNavigateToPoint(
} else {
return {
success: false,
message: result.message || '路径导航任务下发失败',
message: '',
};
}