Skip to content

Commit

Permalink
fix: 修复模型参数修改后,未清除旧数据
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Oct 30, 2024
1 parent d49a785 commit 44b3aed
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ui/src/components/dynamics-form/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,17 @@ const render = (
formFieldList.value = ok.data
})
}
if (data) {
formValue.value = _.cloneDeep(data)
const form_data = data ? data : {}
if (form_data) {
const value = formFieldList.value
.map((item) => {
if (form_data[item.field] !== undefined) {
return { [item.field]: form_data[item.field] }
}
return { [item.field]: item.default_value }
})
.reduce((x, y) => ({ ...x, ...y }), {})
formValue.value = _.cloneDeep(value)
}
}
/**
Expand Down

0 comments on commit 44b3aed

Please sign in to comment.