From 4f65f8c746fced7bce54a1073e7cbfaf3b104713 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Tue, 02 Jan 2018 15:51:29 +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