From 008baf1470f2aaf6fe388a20b9a61069270a1471 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Tue, 15 May 2018 17:19:11 +0800 Subject: [PATCH] 监控坐标编辑功能完善 --- src/app/routes/devices/basic-info/basic-info.component.ts | 74 ++++++++++++++++++++++--------------- 1 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/app/routes/devices/basic-info/basic-info.component.ts b/src/app/routes/devices/basic-info/basic-info.component.ts index 01ff6f5..1d5b1c4 100644 --- a/src/app/routes/devices/basic-info/basic-info.component.ts +++ b/src/app/routes/devices/basic-info/basic-info.component.ts @@ -157,39 +157,53 @@ ); }); } - configCoord(record: Device): void { + configCoord(record: Device): void { + //������ ��������������� ������������������ + if((!!record.latitude||!!record.longitude)&&!!record.monitorPointId){ + this.monitorPointService.getEntity(record.monitorPointId).subscribe( + res => { + if (res != null && res.code === 1 && res.data != null) { + const areaNames = res.data.areaNames; + let adress = ''; + if (areaNames != null) { + adress += !!areaNames.provinceName?areaNames.provinceName:''; + adress += ' '; + adress += !!areaNames.cityName?areaNames.cityName:''; + adress += ' '; + adress += !!areaNames.areaName?areaNames.areaName:''; + adress += ' '; + adress += !!res.data.address?res.data.address:''; + } + this.coorPickerService.data.address = adress; + this.openMap(record); + } + } + ); + }else{ + this.openMap(record); + } + } + private openMap(record: Device){ Object.assign(this.coorPickerService.data, record); const _data = this.coorPickerService.data; - this.monitorPointService.getEntity(record.monitorPointId).subscribe( - res => { - if (res != null && res.code === 1 && res.data != null) { - const areaNames = res.data.areaNames; - let adress = null; - if (areaNames != null) { - adress = areaNames.provinceName + areaNames.cityName + areaNames.areaName + res.data.address; + this.coorPickerService.data['describe'] = '������������'; + this.modalHelper.static(CoordinatesPickerComponent).subscribe( + (staticComp) => { + const data: Device = { + id: record.id, + mac: record.mac, + longitude: _data.longitude, + latitude: _data.latitude, + }; + this.deviceService.save(data).subscribe( + (resp: any) => { + if (resp.code === 1) { + this.load(); + this.msgSrv.success('���������������������'); } - this.coorPickerService.data.address = adress; - this.coorPickerService.data['describe'] = '������������'; - } - this.modalHelper.static(CoordinatesPickerComponent).subscribe( - (staticComp) => { - const data: Device = { - id: record.id, - mac: record.mac, - longitude: _data.longitude, - latitude: _data.latitude, - }; - this.deviceService.save(data).subscribe( - (resp: any) => { - if (resp.code === 1) { - this.load(); - this.msgSrv.success('���������������������'); - } - } - ); } - ); - } - ); + ); + } + ); } } -- Gitblit v1.8.0