Browse Source

湿度

master
maochaoying 2 years ago
parent
commit
131d16b301
  1. 102
      src/components/Setting/components/Device.vue
  2. 18
      src/store/modules/setting.js

102
src/components/Setting/components/Device.vue

@ -57,6 +57,34 @@
</p> </p>
</div> </div>
<div class="row_wrap"> <div class="row_wrap">
<p class="title">消毒停止相对湿度(%RH)</p>
<p class="num">
<van-field
type="number"
v-model="stoped_humi"
:clickable="true"
:maxlength="3"
:formatter="formatter9"
readonly
@click.stop="hideClickKey(9)"
/>
</p>
</div>
<div class="row_wrap">
<p class="title">消毒继续相对湿度(%RH)</p>
<p class="num">
<van-field
type="number"
v-model="continued_humi"
:clickable="true"
:maxlength="3"
:formatter="formatter10"
readonly
@click.stop="hideClickKey(10)"
/>
</p>
</div>
<div class="row_wrap">
<p class="title">消毒停止过氧化氢相对饱和度(%RS)</p> <p class="title">消毒停止过氧化氢相对饱和度(%RS)</p>
<p class="num"> <p class="num">
<van-field <van-field
@ -190,6 +218,24 @@
:show="pre_heat_time_sShow" :show="pre_heat_time_sShow"
@blur="pre_heat_time_sShow = false" @blur="pre_heat_time_sShow = false"
/> />
<van-number-keyboard
theme="custom"
close-button-text="配置"
@close="setstoped_humiVal"
v-model="stoped_humi"
:title="stoped_humi"
:show="stoped_humiShow"
@blur="stoped_humiShow = false"
/>
<van-number-keyboard
theme="custom"
close-button-text="配置"
@close="setcontinued_humiVal"
v-model="continued_humi"
:title="continued_humi"
:show="continued_humiShow"
@blur="continued_humiShow = false"
/>
</div> </div>
</template> </template>
@ -210,6 +256,8 @@ const {
stoped_gs, stoped_gs,
addLiquidConfigVal, addLiquidConfigVal,
sprayLiquidConfigVal, sprayLiquidConfigVal,
stoped_humi,
continued_humi,
allSettingList, allSettingList,
pre_heat_time_s, pre_heat_time_s,
} = storeToRefs(settingStore) } = storeToRefs(settingStore)
@ -222,8 +270,12 @@ const continued_gsShow = ref(false)
const stoped_saturShow = ref(false) const stoped_saturShow = ref(false)
const continued_saturShow = ref(false) const continued_saturShow = ref(false)
const max_humidityShow = ref(false) const max_humidityShow = ref(false)
const stoped_humiShow = ref(false)
const continued_humiShow = ref(false)
const hideClickKey = flag => { const hideClickKey = flag => {
stoped_humiShow.value = false
continued_humiShow.value = false
pre_heat_time_sShow.value = false pre_heat_time_sShow.value = false
addLiquidConfigValShow.value = false addLiquidConfigValShow.value = false
sprayLiquidConfigValShow.value = false sprayLiquidConfigValShow.value = false
@ -256,6 +308,12 @@ const hideClickKey = flag => {
if (flag == 8) { if (flag == 8) {
pre_heat_time_sShow.value = true pre_heat_time_sShow.value = true
} }
if (flag == 9) {
stoped_humiShow.value = true
}
if (flag == 10) {
continued_humiShow.value = true
}
} }
const formatter1 = value => { const formatter1 = value => {
@ -376,6 +434,36 @@ const formatter8 = value => {
return value return value
} }
const formatter9 = value => {
let arr = settingStore.allSettingList.filter(
item => item.name == 'stoped_humi',
)
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 + ''
}
}
return value
}
const formatter10 = value => {
let arr = settingStore.allSettingList.filter(
item => item.name == 'continued_humi',
)
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 + ''
}
}
return value
}
const setAddliquidVal = () => { const setAddliquidVal = () => {
const val = parseInt(addLiquidConfigVal.value) const val = parseInt(addLiquidConfigVal.value)
settingStore.changeAddLiquidConfigVal(val) settingStore.changeAddLiquidConfigVal(val)
@ -425,6 +513,20 @@ const setHeat_timeVal = () => {
showSuccessToast('设置成功') showSuccessToast('设置成功')
} }
const setstoped_humiVal = () => {
const val = parseInt(stoped_humi.value)
settingStore.updateStopedHumi(val)
webSocketStore.sendCommandMsg(setSettingValJSON('stoped_humi', val))
showSuccessToast('设置成功')
}
const setcontinued_humiVal = () => {
const val = parseInt(continued_humi.value)
settingStore.updateContinuedHumi(val)
webSocketStore.sendCommandMsg(setSettingValJSON('continued_humi', val))
showSuccessToast('设置成功')
}
const setSprayLiquidVal = () => { const setSprayLiquidVal = () => {
const val = parseInt(sprayLiquidConfigVal.value) const val = parseInt(sprayLiquidConfigVal.value)
settingStore.changeSprayLiquidConfigVal(val) settingStore.changeSprayLiquidConfigVal(val)

18
src/store/modules/setting.js

@ -19,6 +19,10 @@ export const useSettingStore = defineStore({
pre_heat_time_s: 0, pre_heat_time_s: 0,
continued_gs: 0, continued_gs: 0,
stoped_gs: 0, stoped_gs: 0,
// 消毒停止相对湿度
stoped_humi: 0,
// 消毒继续相对湿度
continued_humi: 0,
// 首屏初始化 // 首屏初始化
initLoading: true, initLoading: true,
// 所有setting的对象数据 // 所有setting的对象数据
@ -28,6 +32,12 @@ export const useSettingStore = defineStore({
}, },
// actions // actions
actions: { actions: {
updateStopedHumi(stoped_humi) {
this.stoped_humi = stoped_humi
},
updateContinuedHumi(continued_humi) {
this.continued_humi = continued_humi
},
updatePre_heat_time_s(pre_heat_time_s) { updatePre_heat_time_s(pre_heat_time_s) {
this.pre_heat_time_s = pre_heat_time_s this.pre_heat_time_s = pre_heat_time_s
}, },
@ -50,6 +60,14 @@ export const useSettingStore = defineStore({
this.stoped_gs = stoped_gs this.stoped_gs = stoped_gs
}, },
updateAllSettingList(allSettingList) { updateAllSettingList(allSettingList) {
const stoped_humiObj = allSettingList.filter(
item => item.name == 'stoped_humi',
)[0]
const continued_humiObj = allSettingList.filter(
item => item.name == 'continued_humi',
)[0]
this.stoped_humi = stoped_humiObj.val
this.continued_humi = continued_humiObj.val
const stoped_gsObj = allSettingList.filter( const stoped_gsObj = allSettingList.filter(
item => item.name == 'stoped_gs', item => item.name == 'stoped_gs',
)[0] )[0]

Loading…
Cancel
Save