From 2d4cbcc4f92edbc4f926d9710bdda64520039c2b Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 05 Jan 2018 11:21:44 +0800
Subject: [PATCH] Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop

---
 src/app/routes/systems/account/account-edit/account-edit.component.ts |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 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 b4999f5..692a055 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
@@ -4,7 +4,9 @@
 import {HttpClient} from '@angular/common/http';
 import {environment} from '../../../../../environments/environment';
 import {DateService} from '../../../../core/services/date.service';
-import {FormGroup, FormBuilder, Validators} from '@angular/forms';
+import {FormGroup, FormBuilder, Validators, FormControl} from '@angular/forms';
+import {Jsonp} from '@angular/http';
+import {Observable} from 'rxjs';
 
 @Component({
   selector: 'app-account-edit',
@@ -15,6 +17,7 @@
 
   account: any;
   validateForm: FormGroup;
+  searchOptions = [];
 
   constructor(private modalHelper: ModalHelper,
     private subject: NzModalSubject,
@@ -34,7 +37,7 @@
       weixin: [this.account.weixin],
       organizationId: [this.account.organizationId],
       expireTime: [this.account.expireTime],
-      id:[this.account.id]
+      id: [this.account.id]
     });
   }
 
@@ -58,4 +61,18 @@
     this.subject.destroy();
   }
 
+  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});
+      }
+    });
+  }
+
+  searchChange(searchText) {
+    const query = encodeURI(searchText);
+    this.http.get(environment.SERVER_BASH_URL + '/organization/list/' + query).subscribe((res: any) => {
+      this.searchOptions = res.data;
+    });
+  }
 }

--
Gitblit v1.8.0