From 4494f1d92b1fc9106ef56d13f25c867cc04c8f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Wed, 16 Jul 2025 16:44:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=A1=B5=E9=9D=A2=E9=85=8D?= =?UTF-8?q?=E6=96=B9=E5=90=8D=E7=A7=B0=E5=8F=98=E5=8C=96bug=20=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=99=BB=E5=BD=95=E9=85=8D=E6=96=B9=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=8F=98=E5=9B=9E=E9=BB=98=E8=AE=A4bug=20=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=B6=88=E6=AF=92=E7=AD=89=E7=BA=A7=E7=BB=93=E6=9D=9F=E6=B6=88?= =?UTF-8?q?=E6=AF=92=E5=90=8E=E4=B8=8D=E4=B8=BA0bug=20=E6=B6=88=E6=AF=92?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E9=9A=90=E8=97=8F=E5=AE=9E=E6=97=B6=E6=B6=88?= =?UTF-8?q?=E6=AF=92=E7=AD=89=E7=BA=A7label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/home/HomeFormula.vue | 14 ++++++------- src/stores/formulaStore.ts | 42 ++++++------------------------------- src/stores/homeStore.ts | 8 +++++-- 3 files changed, 18 insertions(+), 46 deletions(-) diff --git a/src/components/home/HomeFormula.vue b/src/components/home/HomeFormula.vue index b6cbee6..b5be3c0 100644 --- a/src/components/home/HomeFormula.vue +++ b/src/components/home/HomeFormula.vue @@ -8,8 +8,7 @@ import { useFormulaStore } from '@/stores/formulaStore' const formulaStore = useFormulaStore() const homeStore = useHomeStore() // const gasStore = useGasStore() -const formulaInfo = ref() -const rate = ref() +// const rate = ref() const log = ref() // const selectChannel = (channel: string, event: any) => { // FtMessageBox.warning(`请确认打开${event.target.textContent}?`).then(() => { @@ -18,13 +17,12 @@ const log = ref() // } watchEffect(async () => { if (['idle', 'finished'].includes(homeStore.disinfectionState.state)) { - formulaInfo.value = formulaStore.selectedFormulaInfo - rate.value = formulaStore.selectedFormulaInfo?.injection_pump_speed + // rate.value = formulaStore.selectedFormulaInfo?.injection_pump_speed log.value = formulaStore.selectedFormulaInfo?.loglevel } else { const realForm = (await formulaStore.getRealtimeConfig()).rely - rate.value = homeStore.realRate || realForm?.injection_pump_speed + // rate.value = homeStore.realRate || realForm?.injection_pump_speed log.value = homeStore.realLog || realForm?.loglevel } }) @@ -34,9 +32,9 @@ watchEffect(async () => {
- +
- {{ formulaInfo?.name || '默认' }} + {{ formulaStore.selectedFormulaInfo?.name || '默认' }}
@@ -58,7 +56,7 @@ watchEffect(async () => { - + {{ parseInt(homeStore.disinfectionState.nlog?.toString()) diff --git a/src/stores/formulaStore.ts b/src/stores/formulaStore.ts index d50b5dd..d37820c 100644 --- a/src/stores/formulaStore.ts +++ b/src/stores/formulaStore.ts @@ -16,39 +16,6 @@ const PRESSURE_TYPES = [ { name: '正压', value: 'positivePressure' }, { name: '负压', value: 'negativePressure' }, ] - -// 默认配方函数 -// const createDefaultFormulaInfo = (): Formula.FormulaItem => ({ -// continued_gs: 200, -// continued_humi: 60, -// continued_satur: 60, -// injection_pump_speed: 10, -// loglevel: 6, -// max_humidity: 90, -// pre_heat_time_s: 120, -// proportional_valve_default_value: 10, -// stoped_gs: 300, -// stoped_humi: 85, -// stoped_satur: 85, -// dvalue_correct_coefficient: 0 -// name: '默认配方', -// }) -// 清空配方函数 -// const createResetFormulaInfo = (): Formula.FormulaItem => ({ -// continued_gs: '', -// continued_humi: '', -// continued_satur: '', -// injection_pump_speed: '', -// loglevel: '', -// max_humidity: '', -// pre_heat_time_s: '', -// proportional_valve_default_value: '', -// stoped_gs: '', -// stoped_humi: '', -// stoped_satur: '', -// name: '', -// }) - export const useFormulaStore = defineStore('formula', () => { // 状态定义 const logEnums = LOG_ITEMS @@ -58,7 +25,7 @@ export const useFormulaStore = defineStore('formula', () => { // const resetFormulaInfo = ref(createResetFormulaInfo()) const pressurOptionList = ref(['10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%']) const currentSelectedFormulaInfo = ref(cloneDeep(defaultFormulaInfo.value)) // 当前列表选中的配方信息 - const selectedFormulaInfo = ref(defaultFormulaInfo.value) // 选中执行的配方信息 + const selectedFormulaInfo = ref() // 选中执行的配方信息 const formulaConfigList = ref([]) const formulaList = ref([]) const loglevel = ref('') @@ -113,7 +80,10 @@ export const useFormulaStore = defineStore('formula', () => { // const visibleConfig = data.filter(item => item.is_visible_in_formula_page) formulaConfigList.value = data defaultFormulaInfo.value = mapConfigToFormula(data) - if (!selectedFormulaInfo.value?.name) { + if (!selectedFormulaInfo.value) { + selectedFormulaInfo.value = defaultFormulaInfo.value + } + else if (!selectedFormulaInfo.value?.name) { selectedFormulaInfo.value = defaultFormulaInfo.value } } @@ -378,4 +348,4 @@ export const useFormulaStore = defineStore('formula', () => { getRealtimeConfig, setRealtimeConfig, } -}) +}, { persist: true }) diff --git a/src/stores/homeStore.ts b/src/stores/homeStore.ts index 9a5486d..1a2deaf 100644 --- a/src/stores/homeStore.ts +++ b/src/stores/homeStore.ts @@ -1,7 +1,7 @@ import { syncSendCmd } from 'apis/system' import { PARSSURE_DATA } from 'libs/constant' import { defineStore } from 'pinia' -import { computed, ref } from 'vue' +import { computed, ref, watch } from 'vue' import { DEVICE_STATES } from '@/libs/utils' @@ -172,7 +172,11 @@ export const useHomeStore = defineStore('home', () => { const setLog = (data: any) => { realLog.value = data } - + watch(() => disinfectionState.value.state, () => { + if (disinfectionState.value.state === 'idle' || disinfectionState.value.state === 'finished') { + disinfectionState.value.nlog = 0 + } + }) /** * @function updateHomeData * @param {Home.DisplayrelyMgr[]} data - 当前设备所有环境数据(仓内、探头)