From 2611ec753d5ecad1e26de4e09f7c9bd1a1df8c7d Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Wed, 12 Jul 2023 16:11:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/component/dialog.vue | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/views/component/dialog.vue b/src/views/component/dialog.vue index beb4f7c..845b2ea 100644 --- a/src/views/component/dialog.vue +++ b/src/views/component/dialog.vue @@ -95,9 +95,10 @@ export default { [this.getEventType(i.edit_input)]: (e) => { if (i.field==='name') { this.openRecords() + this.form = Object.assign({}, this.form); }else{ this.form[i.field] = e; - // this.form = Object.assign({}, this.form); + } }, @@ -218,6 +219,7 @@ export default { this.$refs.recordModal.isShow = true }, getRecordInfo(e){ + console.log(e) for(var k in e){ for(var m in this.form){ if(m == k){ @@ -373,13 +375,16 @@ export default { console.log("formInfo",this.formInfo) this.formInfo.forEach((i) => { if (i && i.edit_input === "file") { - this.file[i.field] = [ - { - name: res[i._relations.link_with_name]?.original_name, - url: res[i._relations.link_with_name]?.url, - response: res[i._relations.link_with_name], - }, - ]; + if(res[i._relations.link_with_name]){ + this.file[i.field] = [ + { + name: res[i._relations.link_with_name]?.original_name, + url: res[i._relations.link_with_name]?.url, + response: res[i._relations.link_with_name], + }, + ]; + } + } }); }, @@ -407,7 +412,10 @@ export default { ); } if (info.edit_input === "file") { - this.form[info.field] = this.file[info.field][0]?.response?.id; + if(this.file[info.field]){ + this.form[info.field] = this.file[info.field][0]?.response?.id; + } + } }); console.log(this.form);