| | |
| | | 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}; |
| | | }); |
| | | } |
| | | 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; |
| | | } |
| | | ); |
| | | } |
| | | } |