From 27cd36be226ca2434f06b1ae9e4d43f1fea639ab Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Mon, 25 Jun 2018 16:40:28 +0800
Subject: [PATCH] 组织配置单位和页面显示

---
 src/app/routes/systems/organization/organization-list/organization-list.component.ts |   69 +++++++++++++++++++++++++++++++---
 1 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/src/app/routes/systems/organization/organization-list/organization-list.component.ts b/src/app/routes/systems/organization/organization-list/organization-list.component.ts
index 24e80c5..3cce5b9 100644
--- a/src/app/routes/systems/organization/organization-list/organization-list.component.ts
+++ b/src/app/routes/systems/organization/organization-list/organization-list.component.ts
@@ -1,18 +1,22 @@
+import { AlarmConfigService } from '@business/services/http/alarm-config.service';
+import { SensorsService } from '@business/services/http/sensors.service';
 import { Router } from '@angular/router';
-import { ModalHelper } from '@delon/theme';
+import { ModalHelper, _HttpClient } from '@delon/theme';
 import { NzModalService, NzMessageService } from 'ng-zorro-antd';
 import { OrganizationService } from '@business/services/http/organization.service';
-import { Grid, Column, PageBean } from '@business/entity/grid';
-import { Organization } from '@business/entity/data';
+import { Grid, Column, PageBean, ResultBean } from '@business/entity/grid';
+import { Organization, OrganizationSensorUnit } from '@business/entity/data';
 import { Component, OnInit } from '@angular/core';
 import { Subject } from 'rxjs/Subject';
 import { Types } from '@business/enum/types.enum';
 import { OrganizationEditComponent } from 'app/routes/systems/organization/organization-edit/organization-edit.component';
+import { zip } from 'rxjs/observable/zip';
 
 @Component({
   selector: 'app-organization-list',
   templateUrl: './organization-list.component.html',
-  styles: []
+  styles: [],
+  providers: [AlarmConfigService]
 })
 export class OrganizationListComponent implements OnInit {
   private organization: Organization;
@@ -89,6 +93,9 @@
     public msgSrv: NzMessageService,
     private modalHelper: ModalHelper,
     private router: Router,
+    private sensorsService: SensorsService,
+    private alarmConfigService: AlarmConfigService,
+    private http: _HttpClient
   ) {}
 
   ngOnInit() {
@@ -204,9 +211,59 @@
      }
      this.load();
   }
-  config(row) {
+   configAlarm(row) {
+        // ������������������ExpressionChangedAfterItHasBeenCheckedError
+        setTimeout(() => {
+          this.grid.loading = true;
+         }, 1);
+    zip(
+      this.sensorsService.getPagingList({pageIndex: 0, pageSize: 0}, null),
+      this.alarmConfigService.getByOid( row.id )
+    ).subscribe(([pageBean, resultBean]) => {
+      this.grid.loading = false;
       this.organizationService.handle = 'config' ;
       this.organizationService.data = row;
-      this.organizationService.title = '������������';
+      this.organizationService.config = {pageBean, resultBean};
+      this.organizationService.title = '������������������';
+    });
+  }
+    configScreenLayout(row) {
+              // ������������������ExpressionChangedAfterItHasBeenCheckedError
+              setTimeout(() => {
+                this.grid.loading = true;
+                }, 1);
+              this.http.get('org-layout/rtd-config', {orgId: row.id}).subscribe(
+                   (res: ResultBean<any>) => {
+                      if ( res.code > 0 ) {
+                        this.grid.loading = false;
+                        this.organizationService.handle = 'screen' ;
+                        this.organizationService.data = row;
+                        this.organizationService.config['resultBean'] = res;
+                        console.log(res);
+                        this.organizationService.title = '������������������';
+                      }
+                   }
+              );
+    }
+    configShowUnit(row) {
+        // ������������������ExpressionChangedAfterItHasBeenCheckedError
+        setTimeout(() => {
+          this.grid.loading = true;
+          }, 1);
+        this.http.get('org-sunit/gets-byoid', {orgId: row.id}).subscribe(
+             (res: ResultBean<any>) => {
+                if ( res.code > 0 ) {
+                  this.grid.loading = false;
+                  this.organizationService.handle = 'unit' ;
+                  this.organizationService.data = row;
+                  this.organizationService.config['resultBean'] = res;
+                  console.log(res);
+                  this.organizationService.title = '������������������';
+                }
+             }
+        );
+    }
+  registration(row) {
+      sessionStorage.setItem('organization', JSON.stringify(row));
   }
 }

--
Gitblit v1.8.0