diff --git a/src/components/Setting/components/Device.vue b/src/components/Setting/components/Device.vue index 05be91d..16784e7 100644 --- a/src/components/Setting/components/Device.vue +++ b/src/components/Setting/components/Device.vue @@ -228,6 +228,7 @@ import { storeToRefs } from 'pinia' import { setSettingValJSON, changeDisinfectionParameterJSON, + updateSettingInRunInfectionJSON, } from '@/mock/command' const settingStore = useSettingStore() @@ -550,24 +551,8 @@ const setAddliquidVal = () => { showFailToast('设置失败,请填写正确参数') return } - if (props.runInfection) { - // 运行中消毒 - settingStore.changeAddLiquidConfigVal(val) - console.log(settingStore.sprayLiquidConfigVal) - const data = { - injection_pump_speed: settingStore.sprayLiquidConfigVal.value, - stoped_gs: stoped_gs, - continued_gs: continued_gs.value, - stoped_satur: settingStore.stoped_satur.value, - continued_satur: settingStore.continued_satur.value, - stoped_humi: settingStore.stoped_humi.value, - continued_humi: settingStore.continued_humi.value, - } - webSocketStore.sendCommandMsg(changeDisinfectionParameterJSON(data)) - } else { - settingStore.changeAddLiquidConfigVal(val) - webSocketStore.sendCommandMsg(setSettingValJSON('drainage_pump_speed', val)) - } + settingStore.changeAddLiquidConfigVal(val) + webSocketStore.sendCommandMsg(setSettingValJSON('drainage_pump_speed', val)) showSuccessToast('设置成功') } @@ -578,22 +563,14 @@ const setStopedGsVal = () => { return } if (props.runInfection) { - settingStore.changeAddLiquidConfigVal(val) - const data = { - injection_pump_speed: sprayLiquidConfigVal, - stoped_gs, - continued_gs, - stoped_satur, - continued_satur, - stoped_humi, - continued_humi, - } - webSocketStore.sendCommandMsg(changeDisinfectionParameterJSON(data)) + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('stoped_gs', val), + ) } else { settingStore.updateStopedGs(val) webSocketStore.sendCommandMsg(setSettingValJSON('stoped_gs', val)) - showSuccessToast('设置成功') } + showSuccessToast('设置成功') } const setcontinuedGsVal = () => { @@ -602,8 +579,15 @@ const setcontinuedGsVal = () => { showFailToast('设置失败,请填写正确参数') return } - settingStore.updateContinuedGs(val) - webSocketStore.sendCommandMsg(setSettingValJSON('continued_gs', val)) + if (props.runInfection) { + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('continued_gs', val), + ) + } else { + settingStore.updateContinuedGs(val) + webSocketStore.sendCommandMsg(setSettingValJSON('continued_gs', val)) + } + showSuccessToast('设置成功') } @@ -613,8 +597,14 @@ const setstopedSaturVal = () => { showFailToast('设置失败,请填写正确参数') return } - settingStore.updateStopedSatur(val) - webSocketStore.sendCommandMsg(setSettingValJSON('stoped_satur', val)) + if (props.runInfection) { + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('stoped_satur', val), + ) + } else { + settingStore.updateStopedSatur(val) + webSocketStore.sendCommandMsg(setSettingValJSON('stoped_satur', val)) + } showSuccessToast('设置成功') } @@ -624,8 +614,14 @@ const setContinuedSaturVal = () => { showFailToast('设置失败,请填写正确参数') return } - settingStore.updateContinuedSatur(val) - webSocketStore.sendCommandMsg(setSettingValJSON('continued_satur', val)) + if (props.runInfection) { + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('continued_satur', val), + ) + } else { + settingStore.updateContinuedSatur(val) + webSocketStore.sendCommandMsg(setSettingValJSON('continued_satur', val)) + } showSuccessToast('设置成功') } @@ -657,8 +653,14 @@ const setstoped_humiVal = () => { showFailToast('设置失败,请填写正确参数') return } - settingStore.updateStopedHumi(val) - webSocketStore.sendCommandMsg(setSettingValJSON('stoped_humi', val)) + if (props.runInfection) { + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('stoped_humi', val), + ) + } else { + settingStore.updateStopedHumi(val) + webSocketStore.sendCommandMsg(setSettingValJSON('stoped_humi', val)) + } showSuccessToast('设置成功') } @@ -668,8 +670,14 @@ const setcontinued_humiVal = () => { showFailToast('设置失败,请填写正确参数') return } - settingStore.updateContinuedHumi(val) - webSocketStore.sendCommandMsg(setSettingValJSON('continued_humi', val)) + if (props.runInfection) { + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('continued_humi', val), + ) + } else { + settingStore.updateContinuedHumi(val) + webSocketStore.sendCommandMsg(setSettingValJSON('continued_humi', val)) + } showSuccessToast('设置成功') } @@ -679,8 +687,16 @@ const setSprayLiquidVal = () => { showFailToast('设置失败,请填写正确参数') return } - settingStore.changeSprayLiquidConfigVal(val) - webSocketStore.sendCommandMsg(setSettingValJSON('injection_pump_speed', val)) + if (props.runInfection) { + webSocketStore.sendCommandMsg( + updateSettingInRunInfectionJSON('injection_pump_speed', val), + ) + } else { + settingStore.changeSprayLiquidConfigVal(val) + webSocketStore.sendCommandMsg( + setSettingValJSON('injection_pump_speed', val), + ) + } showSuccessToast('设置成功') } diff --git a/src/mock/command.js b/src/mock/command.js index 2be236d..f32cc71 100644 --- a/src/mock/command.js +++ b/src/mock/command.js @@ -281,3 +281,12 @@ export const addFormulaJSON = data => { export const startFormulaJSON = id => { return { command: 'startFormula', messageId: 'startFormula', id } } + +export const updateSettingInRunInfectionJSON = (column, val) => { + return { + command: 'updateFormula', + messageId: 'updateFormula', + column, + val, + } +} diff --git a/src/pages/Home.vue b/src/pages/Home.vue index 2c738ec..4747eab 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -83,6 +83,10 @@ activeTab == 7 ? 'tab_btn style-btn active_btn' : 'style-btn tab_btn' " @click="changeTab(7)" + v-if=" + userStore.loginUserPermission != 3 && + [0, 5].includes(operatorStore.disinfectStatus) + " > - + />