From 6f1ab8e489e791734a2c63550b63ad1cb74b4f57 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Wed, 04 Jul 2018 17:19:29 +0800
Subject: [PATCH] 设备页面bug 修复
---
src/app/business/services/http/areacode.service.ts | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/src/app/business/services/http/areacode.service.ts b/src/app/business/services/http/areacode.service.ts
index 51254b2..c6e9d7d 100644
--- a/src/app/business/services/http/areacode.service.ts
+++ b/src/app/business/services/http/areacode.service.ts
@@ -1,10 +1,5 @@
import { Injectable } from '@angular/core';
import { _HttpClient } from '@delon/theme/services/http/http.client';
-// Statics
-import 'rxjs/add/observable/throw';
-// Operators
-import 'rxjs/add/operator/catch';
-import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Observable';
import { environment } from 'environments/environment';
@@ -39,17 +34,44 @@
}
);
}
- getAreas(cityCode: string): Observable<{label: string, value: string}[]> {
+ getAreas(cityCode: string, isLeaf ?: Boolean): Observable<{label: string, value: string}[]> {
return this.http.get( this.baseUrl + '/area/get-areas', {cityCode: cityCode}).map(
(res: {code: number, data: any}) => {
let areas = [];
if (res !== null && res['code'] === 1 ) {
areas = res['data'].map((item) => {
- return {label: item.areaName , value: item.areaCode , isLeaf: true};
+ return {label: item.areaName , value: item.areaCode, isLeaf: isLeaf === undefined ? true : isLeaf};
});
}
return areas;
}
);
}
+
+ getTowns(areaCode: string): Observable<{label: string, value: string}[]> {
+ return this.http.get( this.baseUrl + '/area/get-towns', {areaCode: areaCode}).map(
+ (res: {code: number, data: any}) => {
+ let towns = [];
+ if (res !== null && res['code'] === 1 ) {
+ towns = res['data'].map((item) => {
+ return {label: item.townName , value: item.townCode};
+ });
+ }
+ return towns;
+ }
+ );
+ }
+ getVillages(townCode: string): Observable<{label: string, value: string}[]> {
+ return this.http.get( this.baseUrl + '/area/get-villages', {townCode: townCode}).map(
+ (res: {code: number, data: any}) => {
+ let villages = [];
+ if (res !== null && res['code'] === 1 ) {
+ villages = res['data'].map((item) => {
+ return {label: item.villageName , value: item.villageCode , isLeaf: true};
+ });
+ }
+ return villages;
+ }
+ );
+ }
}
--
Gitblit v1.8.0