Browse Source

测试页面压力传感器增加到三个并改为监听模式

master
sige 1 year ago
parent
commit
7e472169bd
  1. 4
      .env
  2. 58
      src/components/Test.vue
  3. 8
      src/store/modules/test.js
  4. 8
      src/store/modules/websocket.js

4
.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/
VITE_BASE_WS1_URL=ws://192.168.8.13:19001/
VITE_BASE_WS2_URL=ws://192.168.8.13:19002/

58
src/components/Test.vue

@ -24,12 +24,12 @@
<p class="title">气密性空压机</p>
<div class="btn_wrap">
<div
:class="sprayAirCompressorPower === 1 ? 'open style-btn mg' : 'close style-btn mg'"
@click="actionSprayAirCompressorPowerCtrl(1)"
:class="airCompressorPowerCtrl === 1 ? 'open style-btn mg' : 'close style-btn mg'"
@click="airTightnessTestAirCompressorPowerCtrl(1)"
>打开</div>
<div
:class="sprayAirCompressorPower == 0 ? 'open style-btn' : 'close style-btn'"
@click="actionSprayAirCompressorPowerCtrl(0)"
:class="airCompressorPowerCtrl == 0 ? 'open style-btn' : 'close style-btn'"
@click="airTightnessTestAirCompressorPowerCtrl(0)"
>关闭</div>
</div>
</div>
@ -95,13 +95,14 @@
</div>
</div>
<div class="common_set update_wrap pressure">
<div class="title"> 压力1 <p class="num">{{ pressureSensor1Value }}</p></div>
<div class="title"> 压力2 <p class="num">{{ pressureSensor2Value }}</p></div>
<div class="title"> 压力1 <p class="num">{{ testStore.pressureSensor1 }}</p></div>
<div class="title"> 压力2 <p class="num">{{ testStore.pressureSensor2 }}</p></div>
<div class="title"> 压力3 <p class="num">{{ testStore.pressureSensor3 }}</p></div>
</div>
<div class="common_set info_wrap">
<p class="title">加热片</p>
<p class="info">电流 {{ heaterReadElectricCurrent }} A</p>
<p class="info">湿度 {{ heaterReadTemperatureData }} </p>
<p class="info">电流 {{ testStore.heatingStripCurrent }} A</p>
<p class="info">湿度 {{ testStore.heatingStripTemperature }} </p>
</div>
<div class="common_set info_wrap">
<p class="title">仓内</p>
@ -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

8
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

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

Loading…
Cancel
Save