diff --git a/src/components/AutoDataForm/components/NestedField.vue b/src/components/AutoDataForm/components/NestedField.vue index d57dc56bb..3a1a05816 100644 --- a/src/components/AutoDataForm/components/NestedField.vue +++ b/src/components/AutoDataForm/components/NestedField.vue @@ -1,10 +1,13 @@ @@ -37,6 +40,9 @@ export default { }, data() { return { + loading: false, + iForm: Object.assign({}, this.value), + formJson: JSON.stringify(this.value), kwargs: { hasReset: false, hasSaveContinue: false, @@ -45,6 +51,16 @@ export default { } }, computed: { + form: { + get() { + return this.iForm + }, + set(val) { + this.iForm = Object.assign(this.iForm, val) + this.formJson = JSON.stringify(this.iForm) + this.$emit('input', this.iForm) + } + }, iFields() { const fields = this.fields if (this.errors && typeof this.errors === 'object') { @@ -65,6 +81,21 @@ export default { return fields } }, + watch: { + value: { + handler(val) { + const valJson = JSON.stringify(val) + if (valJson !== this.formJson) { + this.loading = true + this.form = val + setTimeout(() => { + this.loading = false + }) + } + }, + deep: true + } + }, methods: { objectToString(obj) { let data = ''