From 904bca110bbd3cd7775c7dcbfabf0447f03e4c91 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Mon, 08 Jan 2018 11:55:21 +0800
Subject: [PATCH] 账户 管理

---
 src/app/routes/systems/account/account-edit/account-edit.component.ts |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/app/routes/systems/account/account-edit/account-edit.component.ts b/src/app/routes/systems/account/account-edit/account-edit.component.ts
index d91dcc6..4101709 100644
--- a/src/app/routes/systems/account/account-edit/account-edit.component.ts
+++ b/src/app/routes/systems/account/account-edit/account-edit.component.ts
@@ -63,11 +63,17 @@
   }
 
   check(accountName) {
-    this.http.get(environment.SERVER_BASH_URL + '/account/' + accountName).subscribe((res: any) => {
-      if (res.data > 0) {
-        this.validateForm.controls.accountName.setErrors({unique: true});
-      }
-    });
+    if (accountName) {
+      this.http.get(environment.SERVER_BASH_URL + '/account/' + accountName).subscribe((res: any) => {
+        if (res.data > 0) {
+          this.validateForm.controls.accountName.setErrors({unique: true});
+        } else {
+          this.validateForm.controls.accountName.reset;
+        }
+      });
+    } else {
+      this.validateForm.controls.accountName.setErrors({required: true});
+    }
   }
 
   searchChange(searchText) {

--
Gitblit v1.8.0