From 34331335fbd6bd5b684f252b85253d0fb416da5a Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Thu, 9 Nov 2023 16:08:33 +0800 Subject: [PATCH] ceshi --- .env | 8 +++--- src/components/SealTest.vue | 32 +++++++++++++----------- src/mock/command.js | 36 +++++++++++++++++++++++++++ src/pages/Home.vue | 56 +++++++++++++++++++++--------------------- src/store/modules/websocket.js | 2 ++ 5 files changed, 88 insertions(+), 46 deletions(-) diff --git a/.env b/.env index c4ae906..fe3f0dd 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ -# VITE_BASE_WS1_URL=ws://192.168.8.10:19001/ -# VITE_BASE_WS2_URL=ws://192.168.8.10:19002/ +VITE_BASE_WS1_URL=ws://192.168.8.10:19001/ +VITE_BASE_WS2_URL=ws://192.168.8.10:19002/ -VITE_BASE_WS1_URL=ws://127.0.0.1:19001/ -VITE_BASE_WS2_URL=ws://127.0.0.1:19002/ \ No newline at end of file +# VITE_BASE_WS1_URL=ws://127.0.0.1:19001/ +# VITE_BASE_WS2_URL=ws://127.0.0.1:19002/ \ No newline at end of file diff --git a/src/components/SealTest.vue b/src/components/SealTest.vue index 195043e..ddf1188 100644 --- a/src/components/SealTest.vue +++ b/src/components/SealTest.vue @@ -94,7 +94,11 @@ import TestIcon from '@/assets/img/seal/test.png' import StartTest from '@/assets/img/seal/starttest.png' import StopTest from '@/assets/img/seal/stoptest.png' import StopAir from '@/assets/img/seal/stop.png' -import { someAirSwitchJSON } from '@/mock/command' +import { + someAirSwitchJSON, + airCompressor_setStateJSON, + airCompressor_channelCtrlJSON, +} from '@/mock/command' import { useSealStore, useTestStore, useWebSocketStore } from '@/store' const sealStore = useSealStore() @@ -220,6 +224,8 @@ const stopTimer = () => { n_min.value = 0 n_hour.value = 0 sealStore.updateIsStartTest(false) + // 结束测试时打开空压机通道 + websocketStore.sendCommandMsg(airCompressor_channelCtrlJSON([1])) } const timerFunc = () => { @@ -231,17 +237,15 @@ const timerFunc = () => { const changeAirStatus = flag => { if (flag == 1) { - if (!testStore.airCompressor) { - websocketStore.sendCommandMsg(someAirSwitchJSON(0, 1)) - websocketStore.sendCommandMsg(someAirSwitchJSON(1, 1)) - testStore.updateAirCompressor(true) - } - } else { if (testStore.airCompressor) { - websocketStore.sendCommandMsg(someAirSwitchJSON(0, 0)) - websocketStore.sendCommandMsg(someAirSwitchJSON(1, 0)) + websocketStore.sendCommandMsg(airCompressor_setStateJSON([0])) testStore.updateAirCompressor(false) } + } else { + if (!testStore.airCompressor) { + websocketStore.sendCommandMsg(airCompressor_setStateJSON([1])) + testStore.updateAirCompressor(true) + } } } @@ -251,11 +255,11 @@ const handleStartTest = flag => { // 也就是将getState中获取的当前值currentAirPressure赋予 // 开始测试需要记录时间 timerFunc() - // 开始测试时关闭空压机 - // 关闭一个阀门 - // websocketStore.sendCommandMsg(someAirSwitchJSON(0, 0)) - // websocketStore.sendCommandMsg(someAirSwitchJSON(1, 0)) - // testStore.updateAirCompressor(false) + // 关闭空压机通道 + websocketStore.sendCommandMsg(airCompressor_channelCtrlJSON([0])) + // 停止冲入空气,即关闭空压机 + websocketStore.sendCommandMsg(airCompressor_setStateJSON([0])) + testStore.updateAirCompressor(false) sealStore.updateOldAirPressure(sealStore.currentAirPressure) sealStore.updateIsStartTest(true) } diff --git a/src/mock/command.js b/src/mock/command.js index 42b4fe8..7f5e461 100644 --- a/src/mock/command.js +++ b/src/mock/command.js @@ -318,3 +318,39 @@ export const getDetailInfoById = id => { disinfectionLogName: id, } } + +// 新空压机接口 +export const airCompressor_setStateJSON = params => { + return { + command: 'DeviceIOControlService.airCompressor_setState', + messageId: 'airCompressor_setState', + params, + } +} + +// 空压机通道 +export const airCompressor_channelCtrlJSON = params => { + return { + command: 'DeviceIOControlService.airCompressor_channelCtrl', + messageId: 'airCompressor_channelCtrl', + params, + } +} + +// 空气阀入口 +export const AirInletProportionalValve_setStateJSON = params => { + return { + command: 'DeviceIOControlService.AirInletProportionalValve_setState', + messageId: 'AirInletProportionalValve_setState', + params, + } +} + +// 空气阀出口 +export const AirOutletProportionalValve_setStateJSON = params => { + return { + command: 'DeviceIOControlService.AirOutletProportionalValve_setState', + messageId: 'AirOutletProportionalValve_setState', + params, + } +} diff --git a/src/pages/Home.vue b/src/pages/Home.vue index 26ef2cf..845f3c8 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -80,6 +80,34 @@
+ + + + + + + +

密封测试

+
+

审计

-
- - - - - - - -

密封测试

-