Browse Source

设置正负压开合比例

master
maochaoying 2 years ago
parent
commit
574f76126c
  1. 74
      src/components/Setting/components/Device.vue
  2. 8
      src/store/modules/setting.js
  3. 1
      src/store/modules/websocket.js

74
src/components/Setting/components/Device.vue

@ -105,6 +105,20 @@
/>
</p>
</div>
<div class="row_wrap">
<p class="title">正负压默认开合比例</p>
<p class="num">
<van-field
class="field_font"
type="number"
:formatter="formatter11"
v-model="proportionalValveDefaultValue"
:clickable="true"
readonly
@click.stop="hideClickKey(11)"
/>
</p>
</div>
<div class="row_wrap" v-if="[0, 5].includes(operatorStore.disinfectStatus)">
<p class="title">允许消毒最大湿度(%RH)</p>
<p class="num">
@ -233,6 +247,16 @@
:show="continued_humiShow"
@blur="continued_humiShow = false"
/>
<van-number-keyboard
theme="custom"
@input="val => handleInput(val, 11)"
close-button-text="配置"
@close="setProportionalValveDefaultValue"
v-model="proportionalValveDefaultValue"
:title="proportionalValveDefaultValue"
:show="proportionalValveDefaultValueShow"
@blur="proportionalValveDefaultValueShow = false"
/>
</div>
</template>
@ -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)) {

8
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

1
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:

Loading…
Cancel
Save