Browse Source

fix: 调试指令参数变更

feature/three
guoapeng 3 months ago
parent
commit
982c169f54
  1. 29
      src/hooks/useApiData.ts
  2. 7
      src/stores/debugStore.ts
  3. 8
      src/types/debug.d.ts
  4. 238
      src/views/debug/index.vue

29
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,
}
}

7
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: {

8
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 {

238
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 () => {
</div>
</template>
<div class="card-box">
<ft-button type="primary" :click-handle="door_open">
<ft-button type="primary" :click-handle="debug_door_open">
开门
</ft-button>
<ft-button type="primary" :click-handle="door_close">
<ft-button type="primary" :click-handle="debug_door_close">
关门
</ft-button>
<ft-button :click-handle="door_stop">
<ft-button :click-handle="debug_door_stop">
停止
</ft-button>
</div>
@ -567,21 +616,38 @@ const door_stop = async () => {
</el-form-item>
</el-form>
<ft-button type="primary" :click-handle="liquid_arm_reset">
<ft-button type="primary" :click-handle="debug_liquid_arm_reset">
复位
</ft-button>
<ft-button type="primary" :click-handle="liquid_arm_rotation">
<ft-button type="primary" :click-handle="debug_liquid_arm_rotation">
开始
</ft-button>
<ft-button :click-handle="liquid_arm_stop">
<ft-button :click-handle="debug_liquid_arm_stop">
停止
</ft-button>
</div>
<el-divider>加液泵</el-divider>
<div class="card-box">
<el-form>
<el-form-item label="方向">
<el-radio-group v-model="debugStore.formData.liquidPumpData.direction">
<el-radio-button value="forward">
正转
</el-radio-button>
<el-radio-button value="backward">
反转
</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="加液容量">
<el-input v-model.number="debugStore.formData.liquidPumpData.volume" type="number" placeholder="请输入速度">
<template #append>
ml
</template>
</el-input>
</el-form-item>
<el-form-item label="加液速度">
<el-input v-model.number="debugStore.formData.liquidPumpData.rate" type="number" placeholder="请输入速度">
<el-input v-model.number="debugStore.formData.liquidPumpData.velocity" type="number" placeholder="请输入速度">
<template #append>
mm/s
</template>
@ -592,19 +658,19 @@ const door_stop = async () => {
<el-option v-for="item in 8" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<!-- <el-form-item> -->
<!-- <ft-button type="primary" :click-handle="liquid_pump_pre_filling"> -->
<!-- 预充 -->
<!-- </ft-button> -->
<!-- <ft-button :click-handle="liquid_pump_pre_evacuation"> -->
<!-- 排空 -->
<!-- </ft-button> -->
<!-- </el-form-item> -->
<el-form-item>
<ft-button type="primary" :click-handle="liquid_pump_pre_filling">
预充
</ft-button>
<ft-button :click-handle="liquid_pump_pre_evacuation">
排空
</ft-button>
</el-form-item>
<el-form-item>
<ft-button type="primary" :click-handle="liquid_pump_start">
<ft-button type="primary" :click-handle="debug_liquid_pump_start">
启动
</ft-button>
<ft-button :click-handle="liquid_pump_stop">
<ft-button :click-handle="debug_liquid_pump_stop">
停止
</ft-button>
</el-form-item>
@ -621,10 +687,10 @@ const door_stop = async () => {
</el-input>
</el-form-item>
</el-form>
<ft-button type="primary" :click-handle="shaker_start">
<ft-button type="primary" :click-handle="debug_shaker_start">
开始
</ft-button>
<ft-button :click-handle="shaker_stop">
<ft-button :click-handle="debug_shaker_stop">
停止
</ft-button>
</div>
@ -701,13 +767,13 @@ const door_stop = async () => {
</el-input>
</el-form-item>
</el-form>
<ft-button type="primary" :click-handle="pallet_elevator_lift_up">
<ft-button type="primary" :click-handle="debug_pallet_elevator_lift_up">
上升
</ft-button>
<ft-button type="primary" :click-handle="pallet_elevator_lift_down">
<ft-button type="primary" :click-handle="debug_pallet_elevator_lift_down">
下降
</ft-button>
<ft-button :click-handle="pallet_elevator_stop">
<ft-button :click-handle="debug_pallet_elevator_stop">
停止
</ft-button>
</div>
@ -722,19 +788,47 @@ const door_stop = async () => {
</el-input>
</el-form-item>
<el-form-item>
<ft-button type="primary" :click-handle="heater_start">
<ft-button type="primary" :click-handle="debug_heater_start">
开始加热
</ft-button>
<ft-button :click-handle="heater_stop">
<ft-button :click-handle="debug_heater_stop">
停止加热
</ft-button>
</el-form-item>
<!-- <el-form-item> -->
<!-- <ft-button type="primary" :click-handle="debug_heater_start_heat_maintaining"> -->
<!-- 开始恒温 -->
<!-- </ft-button> -->
<!-- <ft-button :click-handle="debug_heater_stop_heat_maintaining"> -->
<!-- 停止恒温 -->
<!-- </ft-button> -->
<!-- </el-form-item> -->
</el-form>
</div>
<el-divider>冷阱</el-divider>
<div class="card-box">
<el-form>
<el-form-item label="温度">
<el-input v-model.number="debugStore.formData.heatArea.coldTrap.temperature" type="number" placeholder="请输入温度">
<template #append>
</template>
</el-input>
</el-form-item>
<el-form-item>
<ft-button type="primary" :click-handle="debug_cold_trap_start_refrigeration">
启动制冷
</ft-button>
<ft-button :click-handle="debug_cold_trap_stop_refrigeration">
停止制冷
</ft-button>
</el-form-item>
<el-form-item>
<ft-button type="primary" :click-handle="debug_heater_start_heat_maintaining">
开始恒温
<ft-button type="primary" :click-handle="debug_cold_trap_start_recycle">
启动循环
</ft-button>
<ft-button :click-handle="debug_heater_stop_heat_maintaining">
停止恒温
<ft-button :click-handle="debug_cold_trap_stop_recycle">
停止循环
</ft-button>
</el-form-item>
</el-form>

Loading…
Cancel
Save