Compare commits
3 Commits
648d27d196
...
f14e3a68ad
Author | SHA1 | Date | |
---|---|---|---|
f14e3a68ad | |||
358f213eac | |||
6033553196 |
@ -16,6 +16,7 @@ export enum RobotType {
|
||||
export const ROBOT_TYPE_OPTIONS = <Array<[string, RobotType]>>Object.entries(RobotType).filter(([, v]) => isNumber(v));
|
||||
|
||||
export enum RobotState {
|
||||
未知 = 0,
|
||||
任务执行中 = 1,
|
||||
充电中,
|
||||
停靠中,
|
||||
|
@ -147,7 +147,7 @@ const getDoInfo = (information: AmrRedisState['information'] | undefined) => {
|
||||
|
||||
<a-tag v-if="robot.state !== undefined">
|
||||
<i class="dot mr-4" :class="stateDot" />
|
||||
<span>{{ $t(RobotState[robot.state]) }}</span>
|
||||
<span>{{ RobotState[robot.state] || '未知' }}</span>
|
||||
</a-tag>
|
||||
</a-space>
|
||||
</a-col>
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { message } from 'ant-design-vue';
|
||||
import { type Ref, ref, type ShallowRef, shallowRef } from 'vue';
|
||||
|
||||
import type { RobotRealtimeInfo } from '../apis/robot';
|
||||
import { type RobotRealtimeInfo, RobotState } from '../apis/robot';
|
||||
import type { EditorService } from '../services/editor.service';
|
||||
import { useViewState } from '../services/useViewState';
|
||||
import ws from '../services/ws';
|
||||
@ -166,7 +166,9 @@ export function usePlaybackWebSocket(editorService: ShallowRef<EditorService | u
|
||||
updates.forEach(({ id, data }) => {
|
||||
const robotExists = editor.checkRobotById(id);
|
||||
if (robotExists) {
|
||||
const { x, y, angle, ...rest } = data;
|
||||
const { x, y, angle, state, ...rest } = data;
|
||||
const pen = editor.getPenById(id);
|
||||
const currentState = pen?.robot?.state;
|
||||
// 将业务数据和位置数据合并到一个对象中,通过 setValue 一次性更新
|
||||
editor.setValue(
|
||||
{
|
||||
@ -175,7 +177,11 @@ export function usePlaybackWebSocket(editorService: ShallowRef<EditorService | u
|
||||
y: y - 60,
|
||||
rotate: -angle! + 180,
|
||||
visible: true,
|
||||
robot: rest, // 将业务数据挂载到图元的 robot 属性上
|
||||
robot: {
|
||||
...rest,
|
||||
// 增加更严格的校验:确保 state 的值存在于 RobotState 枚举中
|
||||
state: RobotState[state] ? state : currentState ?? RobotState.未知,
|
||||
}, // 将业务数据挂载到图元的 robot 属性上
|
||||
},
|
||||
{ render: false },
|
||||
);
|
||||
|
@ -384,6 +384,10 @@ onMounted(async () => {
|
||||
await monitorScene();
|
||||
} else {
|
||||
playback.connect(props.sid);
|
||||
// [调试代码] 自动设置回放日期和时间
|
||||
const debugDate = dayjs('2025-09-28 09:00:00');
|
||||
selectedDate.value = debugDate;
|
||||
playback.seek(debugDate.valueOf());
|
||||
}
|
||||
|
||||
await editor.value?.initRobots();
|
||||
|
Loading…
x
Reference in New Issue
Block a user