feat(context-menu): 移除前端机器人选择限制并调整导航参数,将机器人选择逻辑完全交由后端控制
This commit is contained in:
parent
a6c642fef4
commit
284fce1873
@ -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);
|
||||
|
||||
@ -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%;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ export async function executeNavigateToPoint(
|
||||
} else {
|
||||
return {
|
||||
success: false,
|
||||
message: result.message || '路径导航任务下发失败',
|
||||
message: '',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user