From 8924ddb98072a5621d5cf01ed26e2cb424d71908 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Tue, 12 Jun 2018 10:38:49 +0800
Subject: [PATCH] 监控点 增加镇村选项

---
 src/app/business/entity/data.ts                                                         |    5 +++++
 src/app/routes/devices/monitor-point/monitor-point.component.ts                         |    7 ++++++-
 src/app/routes/reports/demo/demo.component.ts                                           |    1 -
 src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts |   15 +++++++++++++++
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/app/business/entity/data.ts b/src/app/business/entity/data.ts
index 81fa665..c44c39f 100644
--- a/src/app/business/entity/data.ts
+++ b/src/app/business/entity/data.ts
@@ -6,6 +6,8 @@
     provinceName?: string;
     cityName?: string;
     areaName?: string;
+    townName?: string;
+    villageName?: string;
 }
 // ���������
 export interface Sensor {
@@ -61,6 +63,9 @@
     provinceCode?: any|Column;
     areaNames?: AreaNames|any ;
     organization?: Organization;
+    townCode?: any|Column;
+    villageCode?: any|Column;
+
   }
 
  // ������������
diff --git a/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts b/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts
index faa04fe..6cee432 100644
--- a/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts
+++ b/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts
@@ -77,6 +77,7 @@
      }
   }
   areaLazyLoad(event: { option: CascaderOption, index: number, resolve: (children: CascaderOption[]) => void, reject: () => void }) {
+    console.info(event);
     const index = event['index'];
     const option = event.option;  
     switch (index) {
@@ -98,12 +99,26 @@
              event.resolve( res );
          }
        ); break;
+       case 2:
+       this.areacodeService.getTowns(option.value).subscribe(
+         (res: {label: string, value: string}[]) => {
+             event.resolve( res );
+         }
+       ); break;
+       case 3:
+       this.areacodeService.getVillages(option.value).subscribe(
+         (res: {label: string, value: string}[]) => {
+             event.resolve( res );
+         }
+       ); break;
     }
   }
   setAreaCodes(codes: string[]) {
       this.data.provinceCode = codes[0];
       this.data.cityCode = codes[1];
       this.data.areaCode = codes[2];
+      this.data.townCode = codes[3];
+      this.data.villageCode = codes[4];
   }
   OrgSelectChange(text) {
       const pageBean: PageBean = {pageIndex: 0, pageSize: 20};
diff --git a/src/app/routes/devices/monitor-point/monitor-point.component.ts b/src/app/routes/devices/monitor-point/monitor-point.component.ts
index 9d69db9..37af735 100644
--- a/src/app/routes/devices/monitor-point/monitor-point.component.ts
+++ b/src/app/routes/devices/monitor-point/monitor-point.component.ts
@@ -40,7 +40,12 @@
         format: (value: any, col: Column, row: any) => {
           value = value == null ? '' : value;
           if (row['areaNames'] != null) {
-            return row['areaNames']['provinceName'] + row['areaNames']['cityName'] + row['areaNames']['areaName'] + value;
+            return row['areaNames']['provinceName'] 
+              + (!!row['areaNames']['cityName'] ? row['areaNames']['cityName'] : '')
+              + (!!row['areaNames']['areaName'] ? row['areaNames']['areaName'] : '')
+              + (!!row['areaNames']['townName'] ? row['areaNames']['townName'] : '')
+              + (!!row['areaNames']['villageName'] ? row['areaNames']['villageName'] : '')
+              + value;
           } else {
             return value;
           }
diff --git a/src/app/routes/reports/demo/demo.component.ts b/src/app/routes/reports/demo/demo.component.ts
index 6622aef..547e6a1 100644
--- a/src/app/routes/reports/demo/demo.component.ts
+++ b/src/app/routes/reports/demo/demo.component.ts
@@ -221,7 +221,6 @@
   }
 
   public regionChange(event: {option: CascaderOption, index: number}, i) {
-        console.info(event);
 
     let name = '';
     let areaName = '';

--
Gitblit v1.8.0