From 7cd24a8444c2a967a4c1be00c8ab6564448d5430 Mon Sep 17 00:00:00 2001 From: sige Date: Fri, 24 May 2024 21:13:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=95=8C=E9=9D=A2=E5=96=B7?= =?UTF-8?q?=E6=B6=B2=E6=B3=B5=E8=BD=AC=E9=80=9F=E6=95=B0=E5=80=BC=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E4=B8=8D=E6=89=A7=E8=A1=8C=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E8=BD=AC=E9=80=9F=E8=B0=83=E6=95=B4=EF=BC=8C=E7=94=B1=E6=AD=A3?= =?UTF-8?q?=E8=BD=AC=E5=8F=8D=E8=BD=AC=E6=89=93=E5=BC=80=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Test.vue | 154 +++++++++++++--------------------------------- src/store/modules/test.js | 15 +++-- 2 files changed, 53 insertions(+), 116 deletions(-) diff --git a/src/components/Test.vue b/src/components/Test.vue index 3ec70d7..000a6aa 100644 --- a/src/components/Test.vue +++ b/src/components/Test.vue @@ -5,29 +5,29 @@

喷液泵

g/min

+
正转
反转
打开
关闭
@@ -49,20 +49,17 @@

风机

- +

%

打开
关闭
@@ -229,32 +226,39 @@ function actionSetExtChannelActiveName( name ) { } // 风机控制 -function actionMiniPwmBlowerCtrl(power=null) { - if ( null === power ) { - power = miniPwmBlowerCtrlValue.value; +function actionMiniPwmBlowerCtrlEnableChange( enable ) { + testStore.miniPwmBlowerCtrlEnable = enable; + if ( !enable ) { + websocketStore.call('DBDBTestPage__miniPwmBlowerCtrl',{power100:0}); + return ; } - miniPwmBlowerCtrlValue.value = power; - testStore.miniPwmBlowerCtrl = power; + let power = testStore.miniPwmBlowerCtrl; websocketStore.call('DBDBTestPage__miniPwmBlowerCtrl',{power100:power}); } -// 喷液泵GPM值变化 -function actionSprayLiquidPumpGPMValueChange( action=null ) { - let value = sprayLiquidPumpGPMValue.value; - if ( null === action ) { - // nothing to do here - } if ( 'start' === action ) { - value = 20; - } else if ( 'stop' === action ) { - value = 0; - } else if ( 'forward' === action ) { - value = value > 0 ? value : value * -1; - } else if ( 'backward' === action ) { - value = value < 0 ? value : value * -1; +// 喷液泵旋转方向变化 +function actionSprayLiquidPumpRotationChange( rotation ) { + testStore.sprayLiquidPumpRotation = rotation; + testStore.sprayLiquidPumpEnable = true; + let value = testStore.sprayLiquidPumpGPM; + if ( 'backward' === rotation ) { + value = value * -1; } + websocketStore.call('DBDBTestPage__sprayLiquidPump_run',{gpm:value}); +} - sprayLiquidPumpGPMValue.value = value; - testStore.sprayLiquidPumpGPM = sprayLiquidPumpGPMValue.value; +// 喷液泵启用变化 +function actionSprayLiquidPumpEnableChange( enable ) { + testStore.sprayLiquidPumpEnable = enable; + if ( !enable ) { + websocketStore.call('DBDBTestPage__sprayLiquidPump_run',{gpm:0}); + return ; + } + + let value = testStore.sprayLiquidPumpGPM; + if ( 'backward' === testStore.sprayLiquidPumpRotation ) { + value = value * -1; + } websocketStore.call('DBDBTestPage__sprayLiquidPump_run',{gpm:value}); } @@ -337,80 +341,6 @@ const handleInput = (value, index) => { } } -const setAddLiquidConfig = flag => { - if (flag == 1) { - websocketStore.sendCommandMsg( - // 正传 - test_replenishingFluidsPumpCtrJSON(1, 300), - ) - showSuccessToast('设置成功') - return - } else if (flag == 2) { - websocketStore.sendCommandMsg( - sprayLiquidPump_open_for_testJSON(1, addLiquidVal2.value), - ) - showSuccessToast('设置成功') - return - } else if (flag == 3) { - // 关闭 - websocketStore.sendCommandMsg(test_replenishingFluidsPumpCtrJSON(0, 0)) - showSuccessToast('关闭加液蠕动泵成功') - return - } else if (flag == 5) { - // 反转 - websocketStore.sendCommandMsg(test_replenishingFluidsPumpCtrJSON(-1, 300)) - showSuccessToast('设置成功') - } else if (flag == 6) { - websocketStore.sendCommandMsg( - sprayLiquidPump_open_for_testJSON(-1, addLiquidVal2.value), - ) - showSuccessToast('设置成功') - } else { - websocketStore.sendCommandMsg( - sprayLiquidPump_open_for_testJSON(0, addLiquidVal2.value), - ) - showSuccessToast('关闭注射蠕动泵成功') - return - } -} - -const handleUpdate = () => { - websocketStore.sendCommandMsg(getStateJSON) -} - -const changeFeedingStatus = flag => { - if (flag == 1) { - if (!testStore.feedingPeristalticPumpStatus) { - // 发送打开指令 - websocketStore.sendCommandMsg( - liquidpumpctrlJSON(1, settingStore.addLiquidConfigVal), - ) - testStore.updateFeedingPeristalticPumpStatus(true) - } - } else { - if (testStore.feedingPeristalticPumpStatus) { - websocketStore.sendCommandMsg(liquidpumpctrlJSON(1, 0)) - testStore.updateFeedingPeristalticPumpStatus(false) - } - } -} - -const changeSprayStatus = flag => { - if (flag == 1) { - if (!testStore.sprayPeristalticPump) { - websocketStore.sendCommandMsg( - liquidpumpctrlJSON(2, settingStore.sprayLiquidConfigVal), - ) - testStore.updateSprayPeristalticPump(true) - } - } else { - if (testStore.sprayPeristalticPump) { - websocketStore.sendCommandMsg(liquidpumpctrlJSON(2, 0)) - testStore.updateSprayPeristalticPump(false) - } - } -} - const changeHeatingStatus = flag => { if (flag == 1) { if (!testStore.heatingStrip) { diff --git a/src/store/modules/test.js b/src/store/modules/test.js index 82f0859..1fe208d 100644 --- a/src/store/modules/test.js +++ b/src/store/modules/test.js @@ -24,13 +24,20 @@ export const useTestStore = defineStore({ waterImmersionSensor1: false, waterImmersionSensor2: false, + // 喷液泵 + sprayLiquidPumpGPM : 0, + // 喷液泵方向 + sprayLiquidPumpRotation : 'forward', + // 喷液泵使能 + sprayLiquidPumpEnable : false, - // -外部通道控制 - extChannelActiveName : '', // 风机控制 miniPwmBlowerCtrl : 0, - // 喷液泵 - sprayLiquidPumpGPM : 0, + // 风机使能 + miniPwmBlowerCtrlEnable : false, + + // -外部通道控制 + extChannelActiveName : '', // 气密性空压机 airCompressorPowerCtrl : 0, // 加热器