refactor(robot): 将机器人载货状态字段从isCarrying统一为isLoading以保持数据一致性
This commit is contained in:
parent
f6cebf903d
commit
4d1b423ab7
@ -24,7 +24,7 @@ export type RobotPen = Pen & {
|
|||||||
isWaring?: boolean;
|
isWaring?: boolean;
|
||||||
isFault?: boolean;
|
isFault?: boolean;
|
||||||
isCharging?: boolean; // 是否充电中
|
isCharging?: boolean; // 是否充电中
|
||||||
isCarrying?: boolean; // 是否载货
|
isLoading?: 0 | 1; // 是否载货
|
||||||
path?: { x: number; y: number }[];
|
path?: { x: number; y: number }[];
|
||||||
angle?: number;
|
angle?: number;
|
||||||
};
|
};
|
||||||
@ -46,7 +46,6 @@ export interface RobotInfo {
|
|||||||
targetPoint?: string; // 目标点位(名称)
|
targetPoint?: string; // 目标点位(名称)
|
||||||
isLoading?: 0 | 1; // 载货状态:1载货,0空载(实时数据透传)
|
isLoading?: 0 | 1; // 载货状态:1载货,0空载(实时数据透传)
|
||||||
isCharging?: boolean; // 是否充电中
|
isCharging?: boolean; // 是否充电中
|
||||||
isCarrying?: boolean; // 是否载货
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RobotDetail extends RobotInfo {
|
export interface RobotDetail extends RobotInfo {
|
||||||
@ -69,7 +68,7 @@ export interface RobotRealtimeInfo extends RobotInfo {
|
|||||||
isWaring?: boolean; // 是否告警
|
isWaring?: boolean; // 是否告警
|
||||||
isFault?: boolean; // 是否故障
|
isFault?: boolean; // 是否故障
|
||||||
isCharging?: boolean; // 是否充电中
|
isCharging?: boolean; // 是否充电中
|
||||||
isCarrying?: boolean; // 是否载货
|
isLoading?: 0 | 1; // 是否载货
|
||||||
}
|
}
|
||||||
|
|
||||||
// AMR Redis状态接口 - 更新为实际返回的数据结构
|
// AMR Redis状态接口 - 更新为实际返回的数据结构
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
{{ getRobotStatusText((robotInfo.state as any) || 'offline') }}
|
{{ getRobotStatusText((robotInfo.state as any) || 'offline') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="robot-extra-statuses">
|
<div class="robot-extra-statuses">
|
||||||
<span v-if="robotInfo.isCarrying" class="extra-status-tag">载货中</span>
|
<span v-if="robotInfo.isLoading" class="extra-status-tag">载货中</span>
|
||||||
<span v-if="!robotInfo.canOrder" class="extra-status-tag">不接单</span>
|
<span v-if="!robotInfo.canOrder" class="extra-status-tag">不接单</span>
|
||||||
<span v-if="robotInfo.isCharging" class="extra-status-tag">充电中</span>
|
<span v-if="robotInfo.isCharging" class="extra-status-tag">充电中</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export function useRobotRenderer(editorService: ShallowRef<EditorService | undef
|
|||||||
isWaring,
|
isWaring,
|
||||||
isFault,
|
isFault,
|
||||||
isCharging = 0,
|
isCharging = 0,
|
||||||
isCarrying = 0,
|
isLoading = 0,
|
||||||
canOrder,
|
canOrder,
|
||||||
...rest
|
...rest
|
||||||
} = data;
|
} = data;
|
||||||
@ -41,7 +41,7 @@ export function useRobotRenderer(editorService: ShallowRef<EditorService | undef
|
|||||||
editor.updateRobot(id, {
|
editor.updateRobot(id, {
|
||||||
...rest,
|
...rest,
|
||||||
isCharging: isCharging as any,
|
isCharging: isCharging as any,
|
||||||
isCarrying: isCarrying as any,
|
isLoading: isLoading as any,
|
||||||
canOrder: canOrder as any,
|
canOrder: canOrder as any,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ export function useRobotRenderer(editorService: ShallowRef<EditorService | undef
|
|||||||
if (isWaring !== undefined) robotState.isWaring = isWaring;
|
if (isWaring !== undefined) robotState.isWaring = isWaring;
|
||||||
if (isFault !== undefined) robotState.isFault = isFault;
|
if (isFault !== undefined) robotState.isFault = isFault;
|
||||||
if (isCharging !== undefined) robotState.isCharging = isCharging;
|
if (isCharging !== undefined) robotState.isCharging = isCharging;
|
||||||
if (isCarrying !== undefined) robotState.isCarrying = isCarrying;
|
if (isLoading !== undefined) robotState.isLoading = isLoading;
|
||||||
if (canOrder !== undefined) robotState.canOrder = canOrder;
|
if (canOrder !== undefined) robotState.canOrder = canOrder;
|
||||||
|
|
||||||
if (Object.keys(robotState).length > 0) {
|
if (Object.keys(robotState).length > 0) {
|
||||||
|
|||||||
@ -442,11 +442,11 @@ export class EditorRobotService {
|
|||||||
const r1: any = pen.robot ?? {};
|
const r1: any = pen.robot ?? {};
|
||||||
const r2 = this.getRobotById(pen.id || '');
|
const r2 = this.getRobotById(pen.id || '');
|
||||||
const toBool = (v: any) => v === true || v === 1 || v === '1';
|
const toBool = (v: any) => v === true || v === 1 || v === '1';
|
||||||
const isCarrying = toBool(r1?.isCarrying ?? r2?.isCarrying);
|
const isLoading = toBool(r1?.isLoading ?? r2?.isLoading);
|
||||||
const canOrder = toBool(r1?.canOrder ?? r2?.canOrder);
|
const canOrder = toBool(r1?.canOrder ?? r2?.canOrder);
|
||||||
const isCharging = toBool(r1?.isCharging ?? r2?.isCharging);
|
const isCharging = toBool(r1?.isCharging ?? r2?.isCharging);
|
||||||
|
|
||||||
if (isCarrying) return cargoIcon;
|
if (isLoading) return cargoIcon;
|
||||||
if (!canOrder) return notAcceptingOrdersIcon;
|
if (!canOrder) return notAcceptingOrdersIcon;
|
||||||
if (isCharging) return chargingIcon;
|
if (isCharging) return chargingIcon;
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user