From 960643bfb9733e5558d89d128e44b5795df3db32 Mon Sep 17 00:00:00 2001 From: pnoker Date: Mon, 17 Apr 2023 22:30:03 +0800 Subject: [PATCH] fix(device): use local driverInfo/pointInfo object in loadFormData callback --- src/views/device/edit/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/views/device/edit/index.ts b/src/views/device/edit/index.ts index d9cc3986e..bdabb2f20 100644 --- a/src/views/device/edit/index.ts +++ b/src/views/device/edit/index.ts @@ -369,20 +369,20 @@ export default defineComponent({ driverInfo.id ? updateDriverInfo(driverInfo) - .then((res) => loadFormData(res)) + .then((res) => loadFormData(driverInfo)) .catch(() => { // nothing to do }) : addDriverInfo(driverInfo) - .then((res) => loadFormData(res)) + .then((res) => loadFormData(driverInfo)) .catch(() => { // nothing to do }) function loadFormData(res) { driverFormData[attribute.attributeName] = { - id: res.data.data.id, - configValue: res.data.data.configValue, + id: res.id, + configValue: res.configValue, } reactiveData.oldDriverFormData = JSON.parse(JSON.stringify(driverFormData)) } @@ -406,12 +406,12 @@ export default defineComponent({ pointInfo.id ? updatePointInfo(pointInfo) - .then((res) => loadFormData(res)) + .then((res) => loadFormData(pointInfo)) .catch(() => { // nothing to do }) : addPointInfo(pointInfo) - .then((res) => loadFormData(res)) + .then((res) => loadFormData(pointInfo)) .catch(() => { // nothing to do }) @@ -420,8 +420,8 @@ export default defineComponent({ reactiveData.pointInfoData.forEach((pointInfo) => { if (pointInfo.id === reactiveData.pointFormData.id) { pointInfo[attribute.attributeName] = { - id: res.data.data.id, - configValue: res.data.data.configValue, + id: res.id, + configValue: res.configValue, } reactiveData.oldPointFormData = JSON.parse(JSON.stringify(pointInfo)) }