From 49ed0a267ad6c0bd3ff2c46d18759f9be997ce80 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Sun, 10 Sep 2023 12:02:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Formula.vue | 9 ++++++- src/components/UpdatePreSetting.vue | 53 +++++++++++++++---------------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/components/Formula.vue b/src/components/Formula.vue index a58c06a..37fa4e3 100644 --- a/src/components/Formula.vue +++ b/src/components/Formula.vue @@ -4,7 +4,10 @@
- +
@@ -137,12 +140,16 @@ const hideDelModal = () => { const isAddPreSettingVisible = ref(false) const isUpdatePreSettingVisible = ref(false) +const formulaInfo = ref({}) const showUpdateSetting = item => { + formulaInfo.value = item + console.log(item) formulaStore.updateCurrentFormula(item) isUpdatePreSettingVisible.value = true } const hideUpdateSettingModal = () => { + formulaInfo.value = {} isUpdatePreSettingVisible.value = false } diff --git a/src/components/UpdatePreSetting.vue b/src/components/UpdatePreSetting.vue index c4dee65..245bcc5 100644 --- a/src/components/UpdatePreSetting.vue +++ b/src/components/UpdatePreSetting.vue @@ -250,17 +250,15 @@ const webSocketStore = useWebSocketStore() const operatorStore = useOperatorStore() const formulaStore = useFormulaStore() -const { currentFormula } = storeToRefs(formulaStore) - const max_humidity = ref('0') -const continued_satur = ref('0') -const stoped_satur = ref('0') -const continued_gs = ref('0') -const stoped_gs = ref('0') +const continued_satur = ref(props.formulaInfo.continued_satur) +const stoped_satur = ref(props.formulaInfo.stoped_satur) +const continued_gs = ref(props.formulaInfo.continued_gs) +const stoped_gs = ref(props.formulaInfo.stoped_gs) const addLiquidConfigVal = ref('0') -const sprayLiquidConfigVal = ref('0') -const stoped_humi = ref('0') -const continued_humi = ref('0') +const sprayLiquidConfigVal = ref(props.formulaInfo.injection_pump_speed) +const stoped_humi = ref(props.formulaInfo.stoped_humi) +const continued_humi = ref(props.formulaInfo.continued_humi) const pre_heat_time_s = ref('0') const pre_heat_time_sShow = ref(false) @@ -275,25 +273,13 @@ const stoped_humiShow = ref(false) const continued_humiShow = ref(false) const logVisible = ref(false) -const logVal = ref('6') -const formula_id = ref('') - -watch(currentFormula, (newValue, oldValue) => { - formula_id.value = newValue.formula_id - logVal.value = newValue.loglevel - stoped_gs.value = newValue?.stoped_gs - continued_gs.value = newValue?.continued_gs - stoped_satur.value = newValue?.stoped_satur - continued_satur.value = newValue?.continued_satur - stoped_humi.value = newValue?.stoped_humi - continued_humi.value = newValue?.continued_humi - injection_pump_speed.value = newValue?.injection_pump_speed -}) +const logVal = ref(props.formulaInfo.loglevel) +const formula_id = ref(props.formulaInfo.formula_id) watch(formula_id, (newValue, oldValue) => { if (newValue != '') { webSocketStore.sendCommandMsg( - updateFormulaJSON('formula_id', newValue, currentFormula.id), + updateFormulaJSON('formula_id', newValue, props.formulaInfo.id), ) } }) @@ -324,7 +310,7 @@ const changeLogVal = val => { logVal.value = val logVisible.value = false webSocketStore.sendCommandMsg( - updateFormulaJSON('loglevel', val, currentFormula.id), + updateFormulaJSON('loglevel', val, props.formulaInfo.id), ) } const hiddenLogVisible = () => { @@ -340,6 +326,9 @@ const props = defineProps({ hideSettingModal: { type: Function, }, + formulaInfo: { + type: Object, + }, }) const hiddleSettingModal = () => { @@ -639,7 +628,7 @@ const setStopedGsVal = () => { return } else { webSocketStore.sendCommandMsg( - updateFormulaJSON('stoped_gs', val, currentFormula.id), + updateFormulaJSON('stoped_gs', val, props.formulaInfo.id), ) } } @@ -651,7 +640,7 @@ const setcontinuedGsVal = () => { return } else { webSocketStore.sendCommandMsg( - updateFormulaJSON('continued_gs', val, currentFormula.id), + updateFormulaJSON('continued_gs', val, props.formulaInfo.id), ) } } @@ -663,7 +652,7 @@ const setstopedSaturVal = () => { return } else { webSocketStore.sendCommandMsg( - updateFormulaJSON('stoped_satur', val, currentFormula.id), + updateFormulaJSON('stoped_satur', val, props.formulaInfo.id), ) } } @@ -675,7 +664,7 @@ const setContinuedSaturVal = () => { return } else { webSocketStore.sendCommandMsg( - updateFormulaJSON('continued_satur', val, currentFormula.id), + updateFormulaJSON('continued_satur', val, props.formulaInfo.id), ) } } @@ -703,7 +692,7 @@ const setstoped_humiVal = () => { return } else { webSocketStore.sendCommandMsg( - updateFormulaJSON('stoped_humi', val, currentFormula.id), + updateFormulaJSON('stoped_humi', val, props.formulaInfo.id), ) } } @@ -715,7 +704,7 @@ const setcontinued_humiVal = () => { return } else { webSocketStore.sendCommandMsg( - updateFormulaJSON('continued_humi', val, currentFormula.id), + updateFormulaJSON('continued_humi', val, props.formulaInfo.id), ) } } @@ -727,7 +716,7 @@ const setSprayLiquidVal = () => { return } else { webSocketStore.sendCommandMsg( - updateFormulaJSON('injection_pump_speed', val, currentFormula.id), + updateFormulaJSON('injection_pump_speed', val, props.formulaInfo.id), ) } }