From 982c169f5425f58db17a20076b96e3779a9e5b49 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Tue, 6 May 2025 15:39:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E8=AF=95=E6=8C=87=E4=BB=A4?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useApiData.ts | 29 ++++++ src/stores/debugStore.ts | 7 +- src/types/debug.d.ts | 8 +- src/views/debug/index.vue | 238 ++++++++++++++++++++++++++++++++-------------- 4 files changed, 208 insertions(+), 74 deletions(-) create mode 100644 src/hooks/useApiData.ts diff --git a/src/hooks/useApiData.ts b/src/hooks/useApiData.ts new file mode 100644 index 0000000..ab3d27a --- /dev/null +++ b/src/hooks/useApiData.ts @@ -0,0 +1,29 @@ +import http from 'libs/http' +import { ref } from 'vue' + +export default function useApiData(url: string, params?: any, init?: boolean) { + const data = ref(null) + const loading = ref(false) + const error = ref(null) + const fetchData = async () => { + loading.value = true + error.value = null + try { + const response = await http.post(url, params) + data.value = response.data + } + catch (err) { + error.value = err + } + finally { + loading.value = false + } + } + init && fetchData().then(() => {}) + return { + data, + loading, + error, + fetchData, + } +} diff --git a/src/stores/debugStore.ts b/src/stores/debugStore.ts index 23aec00..7412dad 100644 --- a/src/stores/debugStore.ts +++ b/src/stores/debugStore.ts @@ -17,7 +17,9 @@ export const useDebugStore = defineStore('debug', { // 加液泵 liquidPumpData: { index: undefined, - rate: undefined, + direction: 'forward', + volume: 20, + velocity: 3, }, // 摇匀速度 shakeSpeed: { @@ -33,6 +35,9 @@ export const useDebugStore = defineStore('debug', { heatTemperature: { temperature: undefined, }, + coldTrap: { + temperature: undefined, + }, }, // 转运模组 transferModule: { diff --git a/src/types/debug.d.ts b/src/types/debug.d.ts index a582734..d799b09 100644 --- a/src/types/debug.d.ts +++ b/src/types/debug.d.ts @@ -19,7 +19,9 @@ declare namespace Debug { interface LiquidPumpData { index: number | undefined - rate: number | undefined + velocity: number | undefined + direction: 'forward' | 'backward' + volume: number | undefined } interface ShakeSpeed { @@ -34,11 +36,15 @@ declare namespace Debug { interface HeatTemperature { temperature: number | undefined } + interface ColdTrap { + temperature: number | undefined + } interface HeatArea { index: number | undefined heatMotorData: HeatMotorData heatTemperature: HeatTemperature + coldTrap: ColdTrap } interface XMotorData { diff --git a/src/views/debug/index.vue b/src/views/debug/index.vue index abec626..fd87532 100644 --- a/src/views/debug/index.vue +++ b/src/views/debug/index.vue @@ -22,7 +22,7 @@ const receiveMessage = (data: Socket.NotificationData) => { data.commandId === currentCommandId && systemStore.pushSystemList(data) } -const pallet_elevator_lift_up = async () => { +const debug_pallet_elevator_lift_up = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -35,7 +35,7 @@ const pallet_elevator_lift_up = async () => { await debugStore.sendControl(params) } -const pallet_elevator_lift_down = async () => { +const debug_pallet_elevator_lift_down = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -48,7 +48,7 @@ const pallet_elevator_lift_down = async () => { await debugStore.sendControl(params) } -const pallet_elevator_stop = async () => { +const debug_pallet_elevator_stop = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -60,7 +60,7 @@ const pallet_elevator_stop = async () => { await debugStore.sendControl(params) } -const heater_start = async () => { +const debug_heater_start = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -72,7 +72,7 @@ const heater_start = async () => { } await debugStore.sendControl(params) } -const heater_stop = async () => { +const debug_heater_stop = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -84,24 +84,24 @@ const heater_stop = async () => { await debugStore.sendControl(params) } -const debug_heater_start_heat_maintaining = async () => { +const debug_cold_trap_start_refrigeration = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, - command: 'debug_heater_start_heat_maintaining', + command: 'debug_cold_trap_start_refrigeration', params: { index: debugStore.formData.heatArea.index, - ...debugStore.formData.heatArea.heatTemperature, + ...debugStore.formData.heatArea.coldTrap, }, } await debugStore.sendControl(params) } -const debug_heater_stop_heat_maintaining = async () => { +const debug_cold_trap_stop_refrigeration = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, - command: 'debug_heater_stop_heat_maintaining', + command: 'debug_cold_trap_stop_refrigeration', params: { index: debugStore.formData.heatArea.index, }, @@ -109,6 +109,55 @@ const debug_heater_stop_heat_maintaining = async () => { await debugStore.sendControl(params) } +const debug_cold_trap_start_recycle = async () => { + currentCommandId = Date.now().toString() + const params = { + commandId: currentCommandId, + command: 'debug_cold_trap_start_recycle', + params: { + index: debugStore.formData.heatArea.index, + }, + } + await debugStore.sendControl(params) +} + +const debug_cold_trap_stop_recycle = async () => { + currentCommandId = Date.now().toString() + const params = { + commandId: currentCommandId, + command: 'debug_cold_trap_stop_recycle', + params: { + index: debugStore.formData.heatArea.index, + }, + } + await debugStore.sendControl(params) +} + +// const debug_heater_start_heat_maintaining = async () => { +// currentCommandId = Date.now().toString() +// const params = { +// commandId: currentCommandId, +// command: 'debug_heater_start_heat_maintaining', +// params: { +// index: debugStore.formData.heatArea.index, +// ...debugStore.formData.heatArea.heatTemperature, +// }, +// } +// await debugStore.sendControl(params) +// } +// +// const debug_heater_stop_heat_maintaining = async () => { +// currentCommandId = Date.now().toString() +// const params = { +// commandId: currentCommandId, +// command: 'debug_heater_stop_heat_maintaining', +// params: { +// index: debugStore.formData.heatArea.index, +// }, +// } +// await debugStore.sendControl(params) +// } + const debug_fan_start = async () => { currentCommandId = Date.now().toString() const params = { @@ -177,7 +226,7 @@ const debug_cover_elevator_stop = async () => { await debugStore.sendControl(params) } -const liquid_arm_reset = async () => { +const debug_liquid_arm_reset = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -189,7 +238,7 @@ const liquid_arm_reset = async () => { await debugStore.sendControl(params) } -const liquid_arm_rotation = async () => { +const debug_liquid_arm_rotation = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -201,7 +250,7 @@ const liquid_arm_rotation = async () => { await debugStore.sendControl(params) } -const liquid_arm_stop = async () => { +const debug_liquid_arm_stop = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -213,31 +262,31 @@ const liquid_arm_stop = async () => { await debugStore.sendControl(params) } -const liquid_pump_pre_filling = async () => { - currentCommandId = Date.now().toString() - const params = { - commandId: currentCommandId, - command: 'debug_liquid_pump_pre_filling', - params: { - index: debugStore.formData.liquidPumpData.index, - }, - } - await debugStore.sendControl(params) -} - -const liquid_pump_pre_evacuation = async () => { - currentCommandId = Date.now().toString() - const params = { - commandId: currentCommandId, - command: 'debug_liquid_pump_pre_evacuation', - params: { - index: debugStore.formData.liquidPumpData.index, - }, - } - await debugStore.sendControl(params) -} - -const liquid_pump_start = async () => { +// const liquid_pump_pre_filling = async () => { +// currentCommandId = Date.now().toString() +// const params = { +// commandId: currentCommandId, +// command: 'debug_liquid_pump_pre_filling', +// params: { +// index: debugStore.formData.liquidPumpData.index, +// }, +// } +// await debugStore.sendControl(params) +// } +// +// const liquid_pump_pre_evacuation = async () => { +// currentCommandId = Date.now().toString() +// const params = { +// commandId: currentCommandId, +// command: 'debug_liquid_pump_pre_evacuation', +// params: { +// index: debugStore.formData.liquidPumpData.index, +// }, +// } +// await debugStore.sendControl(params) +// } + +const debug_liquid_pump_start = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -249,7 +298,7 @@ const liquid_pump_start = async () => { await debugStore.sendControl(params) } -const liquid_pump_stop = async () => { +const debug_liquid_pump_stop = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -261,7 +310,7 @@ const liquid_pump_stop = async () => { await debugStore.sendControl(params) } -const shaker_start = async () => { +const debug_shaker_start = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -273,7 +322,7 @@ const shaker_start = async () => { await debugStore.sendControl(params) } -const shaker_stop = async () => { +const debug_shaker_stop = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -353,7 +402,7 @@ const debug_holding_jaw_pause = async () => { await debugStore.sendControl(params) } -const door_open = async () => { +const debug_door_open = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -363,7 +412,7 @@ const door_open = async () => { await debugStore.sendControl(params) } -const door_close = async () => { +const debug_door_close = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -373,7 +422,7 @@ const door_close = async () => { await debugStore.sendControl(params) } -const door_stop = async () => { +const debug_door_stop = async () => { currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, @@ -515,13 +564,13 @@ const door_stop = async () => {
- + 开门 - + 关门 - + 停止
@@ -567,21 +616,38 @@ const door_stop = async () => { - + 复位 - + 开始 - + 停止 加液泵
+ + + + 正转 + + + 反转 + + + + + + + + - + @@ -592,19 +658,19 @@ const door_stop = async () => { + + + + + + + + - - 预充 - - - 排空 - - - - + 启动 - + 停止 @@ -621,10 +687,10 @@ const door_stop = async () => { - + 开始 - + 停止
@@ -701,13 +767,13 @@ const door_stop = async () => { - + 上升 - + 下降 - + 停止 @@ -722,19 +788,47 @@ const door_stop = async () => { - + 开始加热 - + 停止加热 + + + + + + + + + + + 冷阱 +
+ + + + + + + + + 启动制冷 + + + 停止制冷 + + - - 开始恒温 + + 启动循环 - - 停止恒温 + + 停止循环