From 574f76126c9a6915cd24fc37557d97553faa37d8 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Mon, 20 Nov 2023 10:43:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=AD=A3=E8=B4=9F=E5=8E=8B?= =?UTF-8?q?=E5=BC=80=E5=90=88=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Setting/components/Device.vue | 74 ++++++++++++++++++++++++++++ src/store/modules/setting.js | 8 +++ src/store/modules/websocket.js | 1 - 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/components/Setting/components/Device.vue b/src/components/Setting/components/Device.vue index 9f5f59f..b5d2027 100644 --- a/src/components/Setting/components/Device.vue +++ b/src/components/Setting/components/Device.vue @@ -105,6 +105,20 @@ />

+
+

正负压默认开合比例

+

+ +

+

允许消毒最大湿度(%RH)

@@ -233,6 +247,16 @@ :show="continued_humiShow" @blur="continued_humiShow = false" /> +

@@ -274,6 +298,7 @@ const { continued_humi, allSettingList, pre_heat_time_s, + proportionalValveDefaultValue, } = storeToRefs(settingStore) const props = defineProps({ @@ -282,6 +307,7 @@ const props = defineProps({ }, }) +const proportionalValveDefaultValueShow = ref(false) const pre_heat_time_sShow = ref(false) const addLiquidConfigValShow = ref(false) const sprayLiquidConfigValShow = ref(false) @@ -337,6 +363,9 @@ const hideClickKey = flag => { if (flag == 10) { continued_humiShow.value = true } + if (flag == 11) { + proportionalValveDefaultValueShow.value = true + } } const handleInput = (value, index) => { @@ -391,6 +420,11 @@ const handleInput = (value, index) => { continued_humi.value = value + '' }) } + if (index == 11) { + setTimeout(() => { + proportionalValveDefaultValue.value = value + '' + }) + } isFirstClick.value = false } } @@ -456,6 +490,27 @@ const formatter3 = value => { return value.replace(/^0+/gi, '') } +const formatter11 = value => { + if (parseInt(value) == 0) { + return '0' + } + let arr = settingStore.allSettingList.filter( + item => item.name == 'proportional_valve_default_value', + ) + if (arr && arr.length > 0) { + if (parseInt(value) > arr[0].val_upper_limit) { + return arr[0].val_upper_limit + '' + } + if (parseInt(value) < arr[0].val_lower_limit) { + return arr[0].val_lower_limit + '' + } + } + if (value == '') { + return '0' + } + return value.replace(/^0+/gi, '') +} + const formatter4 = value => { if (parseInt(value) == 0) { return '0' @@ -739,6 +794,25 @@ const setcontinued_humiVal = () => { showSuccessToast('设置成功') } +const setProportionalValveDefaultValue = () => { + const val = parseInt(proportionalValveDefaultValue.value) + if (isNaN(val)) { + showFailToast('设置失败,请填写正确参数') + return + } + if (props.runInfection) { + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('proportional_valve_default_value', val), + ) + } else { + settingStore.updateProportionalValveDefaultValue(val) + webSocketStore.sendCommandMsg( + setSettingValJSON('proportional_valve_default_value', val), + ) + } + showSuccessToast('设置成功') +} + const setSprayLiquidVal = () => { const val = parseInt(sprayLiquidConfigVal.value) if (isNaN(val)) { diff --git a/src/store/modules/setting.js b/src/store/modules/setting.js index 2dd8391..0deaf77 100644 --- a/src/store/modules/setting.js +++ b/src/store/modules/setting.js @@ -34,10 +34,14 @@ export const useSettingStore = defineStore({ // 导出记录的loading exportLoading: false, exportText: '', + proportionalValveDefaultValue: 0, } }, // actions actions: { + updateProportionalValveDefaultValue(proportionalValveDefaultValue) { + this.proportionalValveDefaultValue = proportionalValveDefaultValue + }, updateExportText(exportText) { this.exportText = exportText }, @@ -107,6 +111,10 @@ export const useSettingStore = defineStore({ const pre_heat_time_sOBj = allSettingList.filter( item => item.name == 'pre_heat_time_s', )[0] + const proportionalValveDefaultValueObj = allSettingList.filter( + item => item.name == 'proportional_valve_default_value', + )[0] + this.proportionalValveDefaultValue = proportionalValveDefaultValueObj.val this.pre_heat_time_s = pre_heat_time_sOBj.val this.max_humidity = max_humidityObj.val this.continued_satur = continued_saturObj.val diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js index b02403c..39fc654 100644 --- a/src/store/modules/websocket.js +++ b/src/store/modules/websocket.js @@ -297,7 +297,6 @@ export const useWebSocketStore = defineStore({ break case 'getAllSetting': const { dbval: allSetting } = JSON.parse(ev.data) - console.log(JSON.parse(ev.data)) settingStore.updateAllSettingList(allSetting) break default: