From 702fc77644e4f881583bd21bbeb9387722fdd2ed Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Mon, 13 Nov 2023 18:06:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SealTest.vue | 8 ++++++-- src/mock/command.js | 5 +++++ src/store/modules/websocket.js | 13 +++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/SealTest.vue b/src/components/SealTest.vue index 6358b90..76d0268 100644 --- a/src/components/SealTest.vue +++ b/src/components/SealTest.vue @@ -86,6 +86,7 @@ import StopTest from '@/assets/img/seal/stoptest.png' import { someAirSwitchJSON, airCompressor_setStateJSON, + airCompressorGetPressureDirectIntervalJSON, airCompressor_channelCtrlJSON, AirInletProportionalValve_setStateJSON, AirOutletProportionalValve_setStateJSON, @@ -300,9 +301,9 @@ const newStartTest = async flag => { } const timer = ref(null) +const timerData = ref(null) onBeforeUnmount(() => { - timer.value = null - timerStart.value = null + clearInterval(timerData.value) clearInterval(timer.value) clearInterval(timerStart.value) }) @@ -379,6 +380,9 @@ onMounted(() => { }, 1000) websocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON) websocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON) + timerData.value = setInterval(() => { + websocketStore.sendCommandMsg(airCompressorGetPressureDirectIntervalJSON) + }, 100) }) diff --git a/src/mock/command.js b/src/mock/command.js index 6e22f07..304f831 100644 --- a/src/mock/command.js +++ b/src/mock/command.js @@ -409,3 +409,8 @@ export const airCompressorGetPressureDirectJSON = { command: 'DeviceIOControlService.airCompressor_getPressureDirect', messageId: 'airCompressor_getPressureDirect', } + +export const airCompressorGetPressureDirectIntervalJSON = { + command: 'DeviceIOControlService.airCompressor_getPressureDirect', + messageId: 'airCompressor_getPressureDirect_interval', +} diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js index 5e26df2..b02403c 100644 --- a/src/store/modules/websocket.js +++ b/src/store/modules/websocket.js @@ -108,7 +108,6 @@ export const useWebSocketStore = defineStore({ operatorStore.updateStopReady(false) } sealStore.updateAllPressure(pressure) - sealStore.updateCurrentAirPressure(pressure[1]) settingStore.updateSprinklerPumpGPM(sprinklerPumpGPM) settingStore.updateChargingPumpRPM(chargingPumpRPM) settingStore.updateSprinklerPumpRPM(sprinklerPumpRPM) @@ -189,10 +188,20 @@ export const useWebSocketStore = defineStore({ ) if (getPressureCode == 0) { // 值初始化 - console.log('pressureAck', pressureAck) + console.log('pressureAck[0]', pressureAck[0].toFixed(1)) sealStore.updateOldAirPressure(pressureAck[0].toFixed(1) || 0) } break + case 'airCompressor_getPressureDirect_interval': + const { ackcode: getPressureInterCode, ack: pressureIntervalAck } = + JSON.parse(ev.data) + if (getPressureInterCode == 0) { + // 值初始化 + sealStore.updateCurrentAirPressure( + pressureIntervalAck[0].toFixed(1) || 0, + ) + } + break case 'chpasswd': const { ackcode: chpasswdCode } = JSON.parse(ev.data) if (chpasswdCode != 0) {