diff --git a/.env b/.env index 5bd684a..cac6361 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -VITE_BASE_WS1_URL=ws://192.168.8.10:19001/ -VITE_BASE_WS2_URL=ws://192.168.8.10:19002/ \ No newline at end of file +VITE_BASE_WS1_URL=ws://192.168.8.13:19001/ +VITE_BASE_WS2_URL=ws://192.168.8.13:19002/ \ No newline at end of file diff --git a/src/components/Test.vue b/src/components/Test.vue index 1f07616..95dbb34 100644 --- a/src/components/Test.vue +++ b/src/components/Test.vue @@ -24,12 +24,12 @@

气密性空压机

打开
关闭
@@ -95,13 +95,14 @@
-
压力1

{{ pressureSensor1Value }}

-
压力2

{{ pressureSensor2Value }}

+
压力1

{{ testStore.pressureSensor1 }}

+
压力2

{{ testStore.pressureSensor2 }}

+
压力3

{{ testStore.pressureSensor3 }}

加热片

-

电流 {{ heaterReadElectricCurrent }} A

-

湿度 {{ heaterReadTemperatureData }} ℃

+

电流 {{ testStore.heatingStripCurrent }} A

+

湿度 {{ testStore.heatingStripTemperature }} ℃

仓内

@@ -197,25 +198,12 @@ const { extChannelActiveName, // 外部通道名称 miniPwmBlowerCtrl, // 风机控制 sprayLiquidPumpGPM, // 喷液泵GPM值 - sprayAirCompressorPower, // 气密性空压机 + airCompressorPowerCtrl, // 气密性空压机 heaterCtrl, // 加热片 heaterCtrlSafeValve, // 加热空压机安全电磁阀控制 sprayAirCompressorPowerCtrl, // 喷液空压机控制 } = storeToRefs(testStore); const sprayLiquidPumpGPMValue = ref(sprayLiquidPumpGPM); -const pressureSensor1Value = ref(0); -const pressureSensor2Value = ref(0); -const heaterReadElectricCurrent = ref(0); -const heaterReadTemperatureData = ref(0); - -let refreshTimer = null; -onMounted(() => { - refresh(); -}); -onUnmounted(() => { - clearTimeout(refreshTimer); -}); - // 外部通道控制 function actionSetExtChannelActiveName( name ) { @@ -236,9 +224,9 @@ function actionSprayLiquidPumpGPMValueChange() { } // 气密性空压机 -function actionSprayAirCompressorPowerCtrl(value) { - testStore.sprayAirCompressorPower = value; - websocketStore.call('DBDBTestPage__sprayAirCompressorPowerCtrl',{power:value}); +function airTightnessTestAirCompressorPowerCtrl(value) { + testStore.airCompressorPowerCtrl = value; + websocketStore.call('DBDBTestPage__airTightnessTestAirCompressorPowerCtrl',{power:value}); } // 加热片 @@ -259,26 +247,6 @@ function actionSprayAirCompressorPowerCtrlUpdate( value ) { websocketStore.call('DBDBTestPage__sprayAirCompressorPowerCtrl',{power:value}); } -// 刷新状态 -async function refresh() { - let response = await websocketStore.call('DBDBTestPage__readPressureSensor', {index:1}); - pressureSensor1Value.value = response.ack.pressure; - console.log(response); - - response = await websocketStore.call('DBDBTestPage__readPressureSensor', {index:2}); - pressureSensor2Value.value = response.ack.pressure; - - response = await websocketStore.call('DBDBTestPage__heaterReadElectricCurrent'); - heaterReadElectricCurrent.value = response.ack.current; - - response = await websocketStore.call('DBDBTestPage__heaterReadTemperatureData'); - heaterReadTemperatureData.value = response.ack.temperature; - - refreshTimer = setTimeout(refresh, 1000); -} - - - const isFirstClick = ref(true) const hideAllKeyboards = flag => { isFirstClick.value = true diff --git a/src/store/modules/test.js b/src/store/modules/test.js index b60369b..82f0859 100644 --- a/src/store/modules/test.js +++ b/src/store/modules/test.js @@ -32,13 +32,19 @@ export const useTestStore = defineStore({ // 喷液泵 sprayLiquidPumpGPM : 0, // 气密性空压机 - sprayAirCompressorPower : 0, + airCompressorPowerCtrl : 0, // 加热器 heaterCtrl : 0, // 加热器安全阀 heaterCtrlSafeValve : 0, // 喷液空压机控制 sprayAirCompressorPowerCtrl : 0, + + pressureSensor1 : 0, // 压力传感器1 + pressureSensor2 : 0, // 压力传感器2 + pressureSensor3 : 0, // 压力传感器3 + heatingStripCurrent : 0, // 加热器电流 + heatingStripTemperature : 0, // 加热器温度 } }, // actions diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js index dc5e400..b8b9042 100644 --- a/src/store/modules/websocket.js +++ b/src/store/modules/websocket.js @@ -382,7 +382,13 @@ export const useWebSocketStore = defineStore({ const { command, timeStamp } = JSON.parse(ev.data) switch (command) { case 'RealtimeSensorDataReport': - const { sensor_data } = JSON.parse(ev.data) + const { sensor_data } = JSON.parse(ev.data); + testStore.pressureSensor1 = sensor_data.draw_bar_box_disinfection.pressure[0]; + testStore.pressureSensor2 = sensor_data.draw_bar_box_disinfection.pressure[1]; + testStore.pressureSensor3 = sensor_data.draw_bar_box_disinfection.pressure[2]; + testStore.heatingStripCurrent = sensor_data.draw_bar_box_disinfection.heatingStrip.current; + testStore.heatingStripTemperature = sensor_data.draw_bar_box_disinfection.heatingStrip.temperature; + const { h2o2_1, h2o2_2,