From ce3af046b63ec772aa1e160e9738984b2cbad6d6 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Thu, 3 Jul 2025 21:22:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=83=A8=E5=88=86bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/formula/FormulaConfig.vue | 152 ++++++++++++++++--------------- src/components/home/Environment.vue | 12 ++- src/components/home/HomeLogLevel.vue | 43 ++++++--- src/components/home/LineChart.vue | 8 +- src/components/setting/History.vue | 42 +++------ src/stores/homeStore.ts | 1 - 6 files changed, 136 insertions(+), 122 deletions(-) diff --git a/src/components/formula/FormulaConfig.vue b/src/components/formula/FormulaConfig.vue index 3a93546..502f0e5 100644 --- a/src/components/formula/FormulaConfig.vue +++ b/src/components/formula/FormulaConfig.vue @@ -176,11 +176,15 @@ const getFormData = () => { * 监听表单数据变化,同步更新软键盘输入值 * @param {Record} newValue - 新的表单数据 */ -watch(formData, (newValue) => { - if (focusedInput.value) { - inputValue.value = newValue[focusedInput.value].toString() - } -}, { deep: true }) +watch( + formData, + (newValue) => { + if (focusedInput.value) { + inputValue.value = newValue[focusedInput.value].toString() + } + }, + { deep: true }, +) const formRef = ref(null) /** @@ -229,11 +233,14 @@ const onSaveFormula = () => { const onSaveSetting = async () => { // 修改默认值 const diff = compareJSON(formulaStore.defaultFormulaInfo, formData.value) + console.log(diff) const diffKeys = Object.keys(diff) if (diffKeys.length) { - await Promise.all(diffKeys.map(async (key) => { - await setSettingFormulaConfig(key, diff[key].newVal) - })) + await Promise.all( + diffKeys.map(async (key) => { + await setSettingFormulaConfig(key, diff[key].newVal || diff[key].obj2) + }), + ) FtMessage.success('配方修改成功') } } @@ -250,7 +257,7 @@ const setSettingFormulaConfig = async (settingName: string, settingVal: string) fnName: 'setSettingVal', params: { settingName, - settingVal: settingVal.toString(), + settingVal: settingVal?.toString(), }, }) formulaStore.getFormualDefaultData() @@ -408,21 +415,21 @@ defineExpose({ />