10 changed files with 652 additions and 9 deletions
-
4src/components/DisinfectionSetting.vue
-
598src/components/Setting/components/RunInfectionSetting.vue
-
1src/components/UpdatePreSetting.vue
-
4src/components/dialogs/ClearAuditModal.vue
-
4src/components/dialogs/ClearRecordModal.vue
-
9src/mock/command.js
-
2src/pages/Home.vue
-
2src/store/index.js
-
30src/store/modules/running.js
-
7src/store/modules/websocket.js
@ -0,0 +1,598 @@ |
|||
<template> |
|||
<div class="device_container"> |
|||
<div class="row_wrap"> |
|||
<p class="title">注射蠕动泵速率(g/min)</p> |
|||
<p class="num"> |
|||
<van-field |
|||
type="number" |
|||
v-model="sprayLiquidConfigVal" |
|||
:clickable="true" |
|||
:formatter="formatter7" |
|||
readonly |
|||
@click.stop="hideClickKey(2)" |
|||
/> |
|||
</p> |
|||
</div> |
|||
<div class="row_wrap"> |
|||
<p class="title">消毒停止过氧化氢浓度(ppm)</p> |
|||
<p class="num"> |
|||
<van-field |
|||
type="number" |
|||
v-model="stoped_gs" |
|||
:clickable="true" |
|||
:formatter="formatter1" |
|||
readonly |
|||
@click.stop="hideClickKey(3)" |
|||
/> |
|||
</p> |
|||
</div> |
|||
<div class="row_wrap"> |
|||
<p class="title">消毒继续过氧化氢浓度(ppm)</p> |
|||
<p class="num"> |
|||
<van-field |
|||
type="number" |
|||
v-model="continued_gs" |
|||
:clickable="true" |
|||
:formatter="formatter2" |
|||
readonly |
|||
@click.stop="hideClickKey(4)" |
|||
/> |
|||
</p> |
|||
</div> |
|||
<div class="row_wrap"> |
|||
<p class="title">消毒停止相对湿度(%RH)</p> |
|||
<p class="num"> |
|||
<van-field |
|||
type="number" |
|||
v-model="stoped_humi" |
|||
:clickable="true" |
|||
: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" |
|||
:formatter="formatter10" |
|||
readonly |
|||
@click.stop="hideClickKey(10)" |
|||
/> |
|||
</p> |
|||
</div> |
|||
<div class="row_wrap"> |
|||
<p class="title">消毒停止过氧化氢相对饱和度(%RS)</p> |
|||
<p class="num"> |
|||
<van-field |
|||
type="number" |
|||
:formatter="formatter3" |
|||
v-model="stoped_satur" |
|||
:clickable="true" |
|||
readonly |
|||
@click.stop="hideClickKey(5)" |
|||
/> |
|||
</p> |
|||
</div> |
|||
<div class="row_wrap"> |
|||
<p class="title">消毒继续过氧化氢相对饱和度(%RS)</p> |
|||
<p class="num"> |
|||
<van-field |
|||
type="number" |
|||
:formatter="formatter4" |
|||
v-model="continued_satur" |
|||
:clickable="true" |
|||
readonly |
|||
@click.stop="hideClickKey(6)" |
|||
/> |
|||
</p> |
|||
</div> |
|||
<van-number-keyboard |
|||
v-model="sprayLiquidConfigVal" |
|||
@input="val => handleInput(val, 2)" |
|||
:title="sprayLiquidConfigVal" |
|||
:show="sprayLiquidConfigValShow" |
|||
theme="custom" |
|||
@close="setSprayLiquidVal" |
|||
close-button-text="配置" |
|||
@blur="sprayLiquidConfigValShow = false" |
|||
/> |
|||
<van-number-keyboard |
|||
v-model="stoped_gs" |
|||
@input="val => handleInput(val, 3)" |
|||
:title="stoped_gs" |
|||
:show="stoped_gsShow" |
|||
theme="custom" |
|||
@close="setStopedGsVal" |
|||
close-button-text="配置" |
|||
@blur="stoped_gsShow = false" |
|||
/> |
|||
<van-number-keyboard |
|||
v-model="continued_gs" |
|||
@input="val => handleInput(val, 4)" |
|||
:title="continued_gs" |
|||
@close="setcontinuedGsVal" |
|||
:show="continued_gsShow" |
|||
theme="custom" |
|||
close-button-text="配置" |
|||
@blur="continued_gsShow = false" |
|||
/> |
|||
<van-number-keyboard |
|||
v-model="stoped_satur" |
|||
@input="val => handleInput(val, 5)" |
|||
:title="stoped_satur" |
|||
@close="setstopedSaturVal" |
|||
:show="stoped_saturShow" |
|||
theme="custom" |
|||
close-button-text="配置" |
|||
@blur="stoped_saturShow = false" |
|||
/> |
|||
<van-number-keyboard |
|||
v-model="continued_satur" |
|||
@input="val => handleInput(val, 6)" |
|||
:title="continued_satur" |
|||
@close="setContinuedSaturVal" |
|||
:show="continued_saturShow" |
|||
theme="custom" |
|||
close-button-text="配置" |
|||
@blur="continued_saturShow = false" |
|||
/> |
|||
<van-number-keyboard |
|||
@input="val => handleInput(val, 9)" |
|||
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" |
|||
@input="val => handleInput(val, 10)" |
|||
close-button-text="配置" |
|||
@close="setcontinued_humiVal" |
|||
v-model="continued_humi" |
|||
:title="continued_humi" |
|||
:show="continued_humiShow" |
|||
@blur="continued_humiShow = false" |
|||
/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import { ref } from 'vue' |
|||
import { showSuccessToast, showFailToast } from 'vant' |
|||
import { |
|||
useSettingStore, |
|||
useWebSocketStore, |
|||
useOperatorStore, |
|||
useRunningStore, |
|||
} from '@/store' |
|||
import { storeToRefs } from 'pinia' |
|||
import { |
|||
setSettingValJSON, |
|||
changeDisinfectionParameterJSON, |
|||
updateSettingInRunInfectionJSON, |
|||
} from '@/mock/command' |
|||
|
|||
const settingStore = useSettingStore() |
|||
const webSocketStore = useWebSocketStore() |
|||
const operatorStore = useOperatorStore() |
|||
const runningStore = useRunningStore() |
|||
const { |
|||
sprayLiquidConfigVal, |
|||
stoped_humi, |
|||
continued_humi, |
|||
continued_satur, |
|||
stoped_satur, |
|||
continued_gs, |
|||
stoped_gs, |
|||
} = storeToRefs(runningStore) |
|||
|
|||
const props = defineProps({ |
|||
runInfection: { |
|||
type: Boolean, |
|||
}, |
|||
}) |
|||
|
|||
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 stoped_humiShow = ref(false) |
|||
const continued_humiShow = ref(false) |
|||
|
|||
const isFirstClick = ref(true) |
|||
|
|||
const hideClickKey = flag => { |
|||
isFirstClick.value = true |
|||
stoped_humiShow.value = false |
|||
continued_humiShow.value = false |
|||
sprayLiquidConfigValShow.value = false |
|||
stoped_gsShow.value = false |
|||
continued_gsShow.value = false |
|||
stoped_saturShow.value = false |
|||
continued_saturShow.value = false |
|||
if (flag == 2) { |
|||
sprayLiquidConfigValShow.value = true |
|||
} |
|||
if (flag == 3) { |
|||
stoped_gsShow.value = true |
|||
} |
|||
if (flag == 4) { |
|||
continued_gsShow.value = true |
|||
} |
|||
if (flag == 5) { |
|||
stoped_saturShow.value = true |
|||
} |
|||
if (flag == 6) { |
|||
continued_saturShow.value = true |
|||
} |
|||
if (flag == 9) { |
|||
stoped_humiShow.value = true |
|||
} |
|||
if (flag == 10) { |
|||
continued_humiShow.value = true |
|||
} |
|||
} |
|||
|
|||
const handleInput = (value, index) => { |
|||
if (isFirstClick.value) { |
|||
if (index == 2) { |
|||
setTimeout(() => { |
|||
sprayLiquidConfigVal.value = value + '' |
|||
}) |
|||
} |
|||
if (index == 3) { |
|||
setTimeout(() => { |
|||
stoped_gs.value = value + '' |
|||
}) |
|||
} |
|||
if (index == 4) { |
|||
setTimeout(() => { |
|||
continued_gs.value = value + '' |
|||
}) |
|||
} |
|||
if (index == 5) { |
|||
setTimeout(() => { |
|||
stoped_satur.value = value + '' |
|||
}) |
|||
} |
|||
if (index == 6) { |
|||
setTimeout(() => { |
|||
continued_satur.value = value + '' |
|||
}) |
|||
} |
|||
if (index == 9) { |
|||
setTimeout(() => { |
|||
stoped_humi.value = value + '' |
|||
}) |
|||
} |
|||
if (index == 10) { |
|||
setTimeout(() => { |
|||
continued_humi.value = value + '' |
|||
}) |
|||
} |
|||
isFirstClick.value = false |
|||
} |
|||
} |
|||
|
|||
const formatter1 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
let arr = settingStore.allSettingList.filter(item => item.name == 'stoped_gs') |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const formatter2 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
let arr = settingStore.allSettingList.filter( |
|||
item => item.name == 'continued_gs', |
|||
) |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const formatter3 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
let arr = settingStore.allSettingList.filter( |
|||
item => item.name == 'stoped_satur', |
|||
) |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const formatter4 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
let arr = settingStore.allSettingList.filter( |
|||
item => item.name == 'continued_satur', |
|||
) |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const formatter6 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
let arr = settingStore.allSettingList.filter( |
|||
item => item.name == 'drainage_pump_speed', |
|||
) |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const formatter7 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
let arr = settingStore.allSettingList.filter( |
|||
item => item.name == 'injection_pump_speed', |
|||
) |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const formatter9 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const formatter10 = value => { |
|||
if (parseInt(value) == 0) { |
|||
return '0' |
|||
} |
|||
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.replace(/^0+/gi, '') |
|||
} |
|||
|
|||
const setStopedGsVal = () => { |
|||
const val = parseInt(stoped_gs.value) |
|||
if (isNaN(val)) { |
|||
showFailToast('设置失败,请填写正确参数') |
|||
return |
|||
} |
|||
if (props.runInfection) { |
|||
webSocketStore.sendCommandMsg( |
|||
updateSettingInRunInfectionJSON('stoped_gs', val), |
|||
) |
|||
} else { |
|||
webSocketStore.sendCommandMsg(setSettingValJSON('stoped_gs', val)) |
|||
} |
|||
showSuccessToast('设置成功') |
|||
} |
|||
|
|||
const setcontinuedGsVal = () => { |
|||
const val = parseInt(continued_gs.value) |
|||
if (isNaN(val)) { |
|||
showFailToast('设置失败,请填写正确参数') |
|||
return |
|||
} |
|||
if (props.runInfection) { |
|||
webSocketStore.sendCommandMsg( |
|||
updateSettingInRunInfectionJSON('continued_gs', val), |
|||
) |
|||
} else { |
|||
webSocketStore.sendCommandMsg(setSettingValJSON('continued_gs', val)) |
|||
} |
|||
|
|||
showSuccessToast('设置成功') |
|||
} |
|||
|
|||
const setstopedSaturVal = () => { |
|||
const val = parseInt(stoped_satur.value) |
|||
if (isNaN(val)) { |
|||
showFailToast('设置失败,请填写正确参数') |
|||
return |
|||
} |
|||
if (props.runInfection) { |
|||
webSocketStore.sendCommandMsg( |
|||
updateSettingInRunInfectionJSON('stoped_satur', val), |
|||
) |
|||
} else { |
|||
webSocketStore.sendCommandMsg(setSettingValJSON('stoped_satur', val)) |
|||
} |
|||
showSuccessToast('设置成功') |
|||
} |
|||
|
|||
const setContinuedSaturVal = () => { |
|||
const val = parseInt(continued_satur.value) |
|||
if (isNaN(val)) { |
|||
showFailToast('设置失败,请填写正确参数') |
|||
return |
|||
} |
|||
if (props.runInfection) { |
|||
webSocketStore.sendCommandMsg( |
|||
updateSettingInRunInfectionJSON('continued_satur', val), |
|||
) |
|||
} else { |
|||
webSocketStore.sendCommandMsg(setSettingValJSON('continued_satur', val)) |
|||
} |
|||
showSuccessToast('设置成功') |
|||
} |
|||
|
|||
const setstoped_humiVal = () => { |
|||
const val = parseInt(stoped_humi.value) |
|||
if (isNaN(val)) { |
|||
showFailToast('设置失败,请填写正确参数') |
|||
return |
|||
} |
|||
if (props.runInfection) { |
|||
webSocketStore.sendCommandMsg( |
|||
updateSettingInRunInfectionJSON('stoped_humi', val), |
|||
) |
|||
} else { |
|||
webSocketStore.sendCommandMsg(setSettingValJSON('stoped_humi', val)) |
|||
} |
|||
showSuccessToast('设置成功') |
|||
} |
|||
|
|||
const setcontinued_humiVal = () => { |
|||
const val = parseInt(continued_humi.value) |
|||
if (isNaN(val)) { |
|||
showFailToast('设置失败,请填写正确参数') |
|||
return |
|||
} |
|||
if (props.runInfection) { |
|||
webSocketStore.sendCommandMsg( |
|||
updateSettingInRunInfectionJSON('continued_humi', val), |
|||
) |
|||
} else { |
|||
webSocketStore.sendCommandMsg(setSettingValJSON('continued_humi', val)) |
|||
} |
|||
showSuccessToast('设置成功') |
|||
} |
|||
|
|||
const setSprayLiquidVal = () => { |
|||
const val = parseInt(sprayLiquidConfigVal.value) |
|||
if (isNaN(val)) { |
|||
showFailToast('设置失败,请填写正确参数') |
|||
return |
|||
} |
|||
if (props.runInfection) { |
|||
webSocketStore.sendCommandMsg( |
|||
updateSettingInRunInfectionJSON('injection_pump_speed', val), |
|||
) |
|||
} else { |
|||
settingStore.changeSprayLiquidConfigVal(val) |
|||
webSocketStore.sendCommandMsg( |
|||
setSettingValJSON('injection_pump_speed', val), |
|||
) |
|||
} |
|||
showSuccessToast('设置成功') |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.device_container { |
|||
box-sizing: border-box; |
|||
width: 100%; |
|||
height: 580px; |
|||
padding: 20px; |
|||
display: grid; |
|||
overflow: scroll; |
|||
grid-template-columns: repeat(1, 1fr); |
|||
row-gap: 20px; |
|||
padding-bottom: 20px; |
|||
.row_wrap { |
|||
// width: 726px; |
|||
height: 80px; |
|||
border-radius: 14px; |
|||
background: #f6f6f6; |
|||
box-sizing: border-box; |
|||
padding: 0 18px 0 40px; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
.title { |
|||
font-family: Zona Pro; |
|||
font-size: 20px; |
|||
font-weight: normal; |
|||
letter-spacing: 0.06em; |
|||
color: #000000; |
|||
} |
|||
.num { |
|||
font-family: Source Han Sans CN; |
|||
font-size: 14px; |
|||
font-weight: 500; |
|||
letter-spacing: 0.1em; |
|||
color: #000000; |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
.btn { |
|||
width: 87px; |
|||
height: 45px; |
|||
border-radius: 23px; |
|||
background: #06518b; |
|||
font-family: Source Han Sans CN; |
|||
font-size: 14px; |
|||
font-weight: normal; |
|||
letter-spacing: 0.1em; |
|||
color: #ffffff; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,30 @@ |
|||
import { defineStore } from 'pinia' |
|||
export const useRunningStore = defineStore({ |
|||
id: 'running', // id必填,且需要唯一
|
|||
// state
|
|||
state: () => { |
|||
return { |
|||
sprayLiquidConfigVal: '0', |
|||
stoped_humi: '0', |
|||
continued_humi: '0', |
|||
continued_satur: '0', |
|||
stoped_satur: '0', |
|||
continued_gs: '0', |
|||
stoped_gs: '0', |
|||
disinfectionConfig: {}, |
|||
} |
|||
}, |
|||
// actions
|
|||
actions: { |
|||
updateDisinfectionConfig(disinfectionConfig) { |
|||
this.sprayLiquidConfigVal = disinfectionConfig.injection_pump_speed + '' |
|||
this.stoped_humi = disinfectionConfig.stoped_humi + '' |
|||
this.continued_humi = disinfectionConfig.continued_humi + '' |
|||
this.continued_satur = disinfectionConfig.continued_satur + '' |
|||
this.stoped_satur = disinfectionConfig.stoped_satur + '' |
|||
this.continued_gs = disinfectionConfig.continued_gs + '' |
|||
this.stoped_gs = disinfectionConfig.stoped_gs + '' |
|||
this.disinfectionConfig = disinfectionConfig |
|||
}, |
|||
}, |
|||
}) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue