Browse Source

fix: 指令名称匹配

feature/three
guoapeng 3 months ago
parent
commit
540a181b6a
  1. 3
      src/components/common/FTStream/index.vue
  2. 71
      src/libs/utils.ts
  3. 9
      src/stores/debugStore.ts

3
src/components/common/FTStream/index.vue

@ -12,7 +12,8 @@ defineProps({
const systemStore = useSystemStore()
const title = computed(() => {
return cmdNameMap[systemStore.systemList[0]?.command as keyof typeof cmdNameMap] || systemStore.systemList[0]?.command
const commandKey = systemStore.systemList[0]?.command.replace(/^debug_/, '')
return cmdNameMap[commandKey as keyof typeof cmdNameMap] || systemStore.systemList[0]?.command
})
const maskBodyRef = ref<HTMLElement | null>(null)

71
src/libs/utils.ts

@ -1,40 +1,39 @@
export const cmdNameMap = {
debug_door_open: '开门',
debug_door_close: '关门',
debug_door_stop: '停止开关门',
debug_liquid_arm_rotation: '加液机械臂启动',
debug_liquid_arm_reset: '加液机械臂复位',
debug_liquid_arm_stop: '加液机械臂停止',
debug_liquid_pump_start: '启动加液泵',
debug_liquid_pump_stop: '停止加液泵',
debug_liquid_pump_pre_filling: '预充加液头',
debug_liquid_pump_pre_evacuation: '排空加液头',
debug_shaker_start: '摇匀',
debug_shaker_stop: '停止摇匀',
debug_pallet_elevator_lift_up: '托盘上升',
debug_pallet_elevator_lift_down: '托盘下降',
debug_pallet_elevator_stop: '托盘停止',
debug_heater_start: '开始加热',
debug_heater_stop: '停止加热',
debug_heater_start_heat_maintaining: '启动恒温',
debug_heater_stop_heat_maintaining: '停止恒温',
debug_cold_trap_start_refrigeration: '启动制冷',
debug_cold_trap_stop_refrigeration: '停止制冷',
debug_fan_start: '打开风扇',
debug_fan_stop: '关闭风扇',
debug_transportation_arm_move: '龙门架机械臂移动',
debug_transportation_arm_stop: '龙门架机械臂停止移动',
debug_transportation_arm_reset: '龙门架机械臂复位',
debug_holding_jaw_open: '打开夹爪',
debug_holding_jaw_pause: '暂停夹爪',
debug_holding_jaw_close: '闭合夹爪',
debug_cover_elevator_lift_up: '拍子抬升',
debug_cover_elevator_stop: '拍子停止',
debug_cover_elevator_reset: '拍子复位',
debug_cover_elevator_lift_down: '拍子下降',
debug_cold_trap_start_recycle: '开启循环',
debug_cold_trap_stop_recycle: '停止循环',
door_open: '开门',
door_close: '关门',
door_stop: '停止开关门',
liquid_arm_rotation: '加液机械臂启动',
liquid_arm_reset: '加液机械臂复位',
liquid_arm_stop: '加液机械臂停止',
liquid_pump_start: '启动加液泵',
liquid_pump_stop: '停止加液泵',
liquid_pump_pre_filling: '预充加液头',
liquid_pump_pre_evacuation: '排空加液头',
shaker_start: '摇匀',
shaker_stop: '停止摇匀',
pallet_elevator_lift_up: '托盘上升',
pallet_elevator_lift_down: '托盘下降',
pallet_elevator_stop: '托盘停止',
heater_start: '开始加热',
heater_stop: '停止加热',
heater_start_heat_maintaining: '启动恒温',
heater_stop_heat_maintaining: '停止恒温',
cold_trap_start_refrigeration: '启动制冷',
cold_trap_stop_refrigeration: '停止制冷',
fan_start: '打开风扇',
fan_stop: '关闭风扇',
transportation_arm_move: '龙门架机械臂移动',
transportation_arm_stop: '龙门架机械臂停止移动',
transportation_arm_reset: '龙门架机械臂复位',
holding_jaw_open: '打开夹爪',
holding_jaw_pause: '暂停夹爪',
holding_jaw_close: '闭合夹爪',
cover_elevator_lift_up: '拍子抬升',
cover_elevator_stop: '拍子停止',
cover_elevator_reset: '拍子复位',
cover_elevator_lift_down: '拍子下降',
cold_trap_start_recycle: '开启循环',
cold_trap_stop_recycle: '停止循环',
}
export const generateColors = (count: number): string[] => {

9
src/stores/debugStore.ts

@ -27,7 +27,7 @@ export const useDebugStore = defineStore('debug', {
},
// 加热区
heatArea: {
index: 1,
index: 'heat_module_01',
heatMotorData: {
distance: undefined,
velocity: undefined,
@ -75,8 +75,11 @@ export const useDebugStore = defineStore('debug', {
}
const systemStore = useSystemStore()
systemStore.systemList = []
const cmdName = cmdNameMap[params.command as keyof typeof cmdNameMap] || params.command
// 提取 params.command 中的 xxx 部分
const commandKey = params.command.replace(/^debug_/, '')
// 使用提取的 key 匹配 cmdNameMap
const cmdName = cmdNameMap[commandKey as keyof typeof cmdNameMap] || params.command
await debugControl(params)
systemStore.updateStreamVisible(true)

Loading…
Cancel
Save