From 84ac860832428d5999696c1f93fccf0d66b37c51 Mon Sep 17 00:00:00 2001 From: sige Date: Sat, 25 May 2024 03:32:05 +0800 Subject: [PATCH] g --- src/components/AddPreSetting.vue | 28 +++- .../Setting/components/RunInfectionSetting.vue | 156 ++++----------------- src/components/UpdatePreSetting.vue | 9 ++ 3 files changed, 64 insertions(+), 129 deletions(-) diff --git a/src/components/AddPreSetting.vue b/src/components/AddPreSetting.vue index 1ffcea2..3b87c0f 100644 --- a/src/components/AddPreSetting.vue +++ b/src/components/AddPreSetting.vue @@ -139,7 +139,7 @@ import { ref, onMounted } from 'vue' import SimpleKeyboard from 'cpns/SimpleKeyboard' import { showSuccessToast, showFailToast } from 'vant' -import { useSettingStore, useWebSocketStore, useOperatorStore } from '@/store' +import { useSettingStore, useWebSocketStore, useOperatorStore, useFormulaStore } from '@/store' import { storeToRefs } from 'pinia' import { setSettingValJSON, @@ -151,6 +151,7 @@ import LogPicker from 'cpns/dialogs/LogPicker' const settingStore = useSettingStore() const webSocketStore = useWebSocketStore() const operatorStore = useOperatorStore() +const formulaStore = useFormulaStore() const max_humidity = ref('0') const continued_satur = ref('0') @@ -183,6 +184,15 @@ const save = () => { showFailToast('配方名称不能为空') return } + + let list = formulaStore?.formulaList; + for (let i = 0; i < list.length; i++) { + if (list[i].formula_id == formula_id.value) { + showFailToast('配方名称已存在') + return + } + } + const data = { formula_id: formula_id.value, loglevel: logVal.value, @@ -620,7 +630,7 @@ const handleShowKeyBoard = () => { showkeyboard.value = true } -onMounted(() => { +onMounted(async () => { document.addEventListener('click', e => { let box = document.getElementById('keyboard_formula') let room = document.getElementById('id_formula') @@ -639,6 +649,20 @@ onMounted(() => { } }) $('#id_formula').virtualkeyboard() + + + // 设置默认值 + let defaultSettings = await webSocketStore.call('getAllSetting'); + defaultSettings = defaultSettings.dbval; + let defaultSettingKV = {}; + defaultSettings.forEach(item => defaultSettingKV[item.name] = item.val); + sprayLiquidConfigVal.value = defaultSettingKV['injection_pump_speed'] || 0; + stoped_gs.value = defaultSettingKV['stoped_gs'] || 0; + continued_gs.value = defaultSettingKV['continued_gs'] || 0; + stoped_satur.value = defaultSettingKV['stoped_satur'] || 0; + continued_satur.value = defaultSettingKV['continued_satur'] || 0; + stoped_humi.value = defaultSettingKV['stoped_humi'] || 0; + continued_humi.value = defaultSettingKV['continued_humi'] || 0; }) diff --git a/src/components/Setting/components/RunInfectionSetting.vue b/src/components/Setting/components/RunInfectionSetting.vue index aa30667..1be1969 100644 --- a/src/components/Setting/components/RunInfectionSetting.vue +++ b/src/components/Setting/components/RunInfectionSetting.vue @@ -10,171 +10,73 @@

注射蠕动泵速率(g/min)

- + @done="setSprayLiquidVal" + >

消毒停止过氧化氢浓度(ppm)

- + @done="setStopedGsVal" + >

消毒继续过氧化氢浓度(ppm)

- + @done="setcontinuedGsVal" + >

消毒停止相对湿度(%RH)

- + @done="setstoped_humiVal" + >

消毒继续相对湿度(%RH)

- + @done="setcontinued_humiVal" + >

消毒停止过氧化氢相对饱和度(%RS)

- + @done="setstopedSaturVal" + >

消毒继续过氧化氢相对饱和度(%RS)

- + @done="setContinuedSaturVal" + >

- - - - - - - @@ -645,7 +547,7 @@ const setSprayLiquidVal = () => { color: #000000; display: flex; align-items: center; - .field_font { + :deep(.field_font) { font-size: 26px; width: 180px; } diff --git a/src/components/UpdatePreSetting.vue b/src/components/UpdatePreSetting.vue index c31591f..55fcf1c 100644 --- a/src/components/UpdatePreSetting.vue +++ b/src/components/UpdatePreSetting.vue @@ -209,6 +209,15 @@ const save = () => { showFailToast('配方名称不能为空') return } + + let list = formulaStore?.formulaList; + for (let i = 0; i < list.length; i++) { + if (list[i].formula_id == formula_id.value && list[i].id != props.formulaInfo.id) { + showFailToast('配方名称已存在') + return + } + } + const data = { id: props.formulaInfo.id, formula_id: formula_id.value,