From 1bf1750a2c2cafdbd7413fe18d16915a7f71ff52 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Thu, 05 Jul 2018 11:54:46 +0800
Subject: [PATCH] 设备保存bug修复

---
 src/app/business/services/http/organization.service.ts |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/app/business/services/http/organization.service.ts b/src/app/business/services/http/organization.service.ts
index da161a8..ba9f9c1 100644
--- a/src/app/business/services/http/organization.service.ts
+++ b/src/app/business/services/http/organization.service.ts
@@ -1,4 +1,4 @@
-import { Organization } from '@business/entity/data';
+import { Organization, AlarmConfig, OrganizationSensorUnit, SensorUnit } from '@business/entity/data';
 import { ExampleService } from '@business/services/util/example.service';
 import { _HttpClient } from '@delon/theme';
 import { environment } from 'environments/environment';
@@ -6,22 +6,23 @@
 import { Injectable } from '@angular/core';
 import { equal } from 'assert';
 import { Observable } from 'rxjs/Observable';
-import {  PageBean } from '@business/entity/grid';
+import {  PageBean, ResultBean } from '@business/entity/grid';
 
 
 @Injectable()
 export class OrganizationService {
-  handle: 'list'|'config' = 'list';
-  
+  handle: 'list'|'config'|'unit'|'screen' = 'list';
+  config: {pageBean?: PageBean, resultBean?: ResultBean<AlarmConfig|any>} = {};
   data: Organization;
-  title: '������������'|'������������' = '������������';
+  title: '������������'|'������������������'|'������������������'|'������������������' = '������������';
   private urls = {
-      edit: environment.SERVER_BASH_URL + '/organization/page-list',
+      list: environment.SERVER_BASH_URL + '/organization/page-list',
       save: environment.SERVER_BASH_URL + '/organization/add-or-modify',
       delete: environment.SERVER_BASH_URL + '/organization/delete-by-ids'
   };
   constructor(private http: _HttpClient) { }
    public getPagingList(page: PageBean, queryText: string): Observable<PageBean> {
+    queryText = !!queryText && !!queryText.trim() ? queryText : null;
     const example = new ExampleService();
     if (queryText != null && queryText !== '') {
       example.or().andLike({name: 'name', value: '%' + queryText + '%'});
@@ -32,7 +33,7 @@
     }
     const param: PageBean = {pageSize: page.pageSize, pageIndex: page.pageIndex, 
         queryParams: example.getSqlParam(), orderByClause: orderByClause};
-        return this.http.get(this.urls.edit, param);
+        return this.http.get(this.urls.list, param);
   }
   public save(data: any): Observable<any> {
         return this.http.post(this.urls.save, data);
@@ -40,4 +41,12 @@
   public delete(...ids: number[]): Observable<any> {             
         return this.http.post(this.urls.delete, ids);
   }
+  public getResultBeanData(key: string) {
+        if (!!this.config.resultBean 
+          && !!this.config.resultBean.code 
+          && !!this.config.resultBean.data) {
+          return this.config.resultBean.data[key];
+       }
+       return null;
+  }
 }

--
Gitblit v1.8.0