diff --git a/src/components/LiquidHandle.vue b/src/components/LiquidHandle.vue index 64b4b69..1dfc15e 100644 --- a/src/components/LiquidHandle.vue +++ b/src/components/LiquidHandle.vue @@ -6,9 +6,10 @@ type="number" v-model="addLiquidVal" :clickable="true" + :maxlength="3" + readonly + @touchstart.stop="numberKeyboardShow = true" class="add_liquid_input" - :maxlength="5" - :formatter="formatter" />

设置加液

@@ -75,6 +76,12 @@ :startPopFlag="startPopFlag" :isPopLiquidStatus="isPopLiquidStatus" /> + @@ -89,13 +96,15 @@ import { stopDrainingJSON, } from '@/mock/command' +const numberKeyboardShow = ref(false) + const props = defineProps({ tabType: { type: Number, }, }) -const addLiquidVal = ref(0) +const addLiquidVal = ref(1) const tipModalVisible = ref(false) const webSocketStore = useWebSocketStore() @@ -105,11 +114,9 @@ const isPopLiquidStatus = ref(false) const startAdd = () => { if (!isAddLiquidStatus.value) { isAddLiquidStatus.value = true - console.log( - startReplenishingFluidsJSON(parseInt(addLiquidVal.value.slice(0, -2))), - ) + console.log(startReplenishingFluidsJSON(parseInt(addLiquidVal.value))) webSocketStore.sendCommandMsg( - startReplenishingFluidsJSON(parseInt(addLiquidVal.value.slice(0, -2))), + startReplenishingFluidsJSON(parseInt(addLiquidVal.value)), ) } } diff --git a/src/components/Setting/components/Device.vue b/src/components/Setting/components/Device.vue index aae44a2..1844239 100644 --- a/src/components/Setting/components/Device.vue +++ b/src/components/Setting/components/Device.vue @@ -1,89 +1,145 @@ @@ -106,123 +162,60 @@ const { sprayLiquidConfigVal, } = storeToRefs(settingStore) -const hPFormatter = value => { - if (value > 100) { - return '100%RS' - } - if (value != 0) { - var newVal = value.replace(/\b(0+)/gi, '') - return newVal + '%RS' - } - return '0%RS' -} - -const hP1Formatter = value => { - if (value > 2000) { - return '2000ppm' - } - if (value != 0) { - var newVal = value.replace(/\b(0+)/gi, '') - return newVal + 'ppm' - } - return '0ppm' -} - -const humidityFormatter = value => { - if (value > 100) { - return '100%RH' - } - if (value != 0) { - var newVal = value.replace(/\b(0+)/gi, '') - return newVal + '%RH' - } - return '0%RH' -} - -const formatter = value => { - if (value > 2000) { - return '2000/g' - } - if (value != 0) { - var newVal = value.replace(/\b(0+)/gi, '') - return newVal + '/g' - } - return '0/g' -} +const addLiquidConfigValShow = ref(false) +const sprayLiquidConfigValShow = ref(false) +const stoped_gsShow = ref(false) +const continued_gsShow = ref(false) +const stoped_saturShow = ref(false) +const continued_saturShow = ref(false) +const max_humidityShow = ref(false) const setAddliquidVal = () => { - const val = parseInt( - addLiquidConfigVal.value.substring(0, addLiquidConfigVal.value.length - 2), - ) + const val = parseInt(addLiquidConfigVal.value) settingStore.changeAddLiquidConfigVal(val) - webSocketStore.sendCommandMsg( - setSettingValJSON('drainage_pump_speed', addLiquidConfigVal.value), - ) + webSocketStore.sendCommandMsg(setSettingValJSON('drainage_pump_speed', val)) showSuccessToast('设置成功') } const setStopedGsVal = () => { - const val = parseInt(stoped_gs.value.substring(0, stoped_gs.value.length - 3)) + const val = parseInt(stoped_gs.value) settingStore.updateStopedGs(val) - webSocketStore.sendCommandMsg(setSettingValJSON('stoped_gs', stoped_gs.value)) + webSocketStore.sendCommandMsg(setSettingValJSON('stoped_gs', val)) showSuccessToast('设置成功') } const setcontinuedGsVal = () => { - const val = parseInt( - continued_gs.value.substring(0, continued_gs.value.length - 3), - ) + const val = parseInt(continued_gs.value) settingStore.updateContinuedGs(val) - webSocketStore.sendCommandMsg( - setSettingValJSON('continued_gs', continued_gs.value), - ) + webSocketStore.sendCommandMsg(setSettingValJSON('continued_gs', val)) showSuccessToast('设置成功') } const setstopedSaturVal = () => { - const val = parseInt( - stoped_satur.value.substring(0, stoped_satur.value.length - 3), - ) + const val = parseInt(stoped_satur.value) settingStore.updateStopedSatur(val) - webSocketStore.sendCommandMsg( - setSettingValJSON('stoped_satur', stoped_satur.value), - ) + webSocketStore.sendCommandMsg(setSettingValJSON('stoped_satur', val)) showSuccessToast('设置成功') } const setContinuedSaturVal = () => { - const val = parseInt( - continued_satur.value.substring(0, continued_satur.value.length - 3), - ) + const val = parseInt(continued_satur.value) settingStore.updateContinuedSatur(val) - webSocketStore.sendCommandMsg( - setSettingValJSON('continued_satur', continued_satur.value), - ) + webSocketStore.sendCommandMsg(setSettingValJSON('continued_satur', val)) showSuccessToast('设置成功') } const setMaxHumidityVal = () => { - const val = parseInt( - max_humidity.value.substring(0, max_humidity.value.length - 3), - ) + const val = parseInt(max_humidity.value) settingStore.updateMaxHumidity(val) - webSocketStore.sendCommandMsg( - setSettingValJSON('max_humidity', max_humidity.value), - ) + webSocketStore.sendCommandMsg(setSettingValJSON('max_humidity', val)) showSuccessToast('设置成功') } const setSprayLiquidVal = () => { - const val = parseInt( - sprayLiquidConfigVal.value.substring( - 0, - sprayLiquidConfigVal.value.length - 2, - ), - ) + const val = parseInt(sprayLiquidConfigVal.value) settingStore.changeSprayLiquidConfigVal(val) - webSocketStore.sendCommandMsg( - setSettingValJSON('injection_pump_speed', sprayLiquidConfigVal.value), - ) + webSocketStore.sendCommandMsg(setSettingValJSON('injection_pump_speed', val)) showSuccessToast('设置成功') }