From f01d6b7e6bf8132524c1c2821fdcbbc5ca548369 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Fri, 29 Dec 2017 16:57:22 +0800 Subject: [PATCH] 设备型号完成 --- src/app/routes/devices/version/add-or-edit/add-or-edit.component.ts | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/src/app/routes/devices/version/add-or-edit/add-or-edit.component.ts b/src/app/routes/devices/version/add-or-edit/add-or-edit.component.ts index b875876..4e61d6d 100644 --- a/src/app/routes/devices/version/add-or-edit/add-or-edit.component.ts +++ b/src/app/routes/devices/version/add-or-edit/add-or-edit.component.ts @@ -42,8 +42,22 @@ for (const i in this.validateForm.controls) { this.validateForm.controls[ i ].disable(); } + const isModified = Object.keys(value).some( + (key: string) => { + return this.data[key] !== value[key]; + } + ); + // ������������ + if (!isModified) { + this.close(); + return; + } this.isSaving = true; - this.data = value; + Object.keys(this.data).forEach( (key: string) => { + if ( value[key] != null ) { + this.data[key] = value[key]; + } + } ); this.subject.next( this ); }else { for (const i in this.validateForm.controls) { -- Gitblit v1.8.0