fix(device): use local driverInfo/pointInfo object in loadFormData callback

This commit is contained in:
pnoker
2023-04-17 22:30:03 +08:00
parent e8767f5ef2
commit 960643bfb9
+8 -8
View File
@@ -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))
}