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 ++++++++++++++++++++++---------------
src/app/routes/reports/query/query.component.ts | 2
src/app/routes/devices/monitor-point/monitor-point.component.ts | 10 ++++-
src/app/routes/reports/query/query.component.html | 6 +-
src/app/routes/map/coordinates-picker/coordinates-picker.component.ts | 8 ++-
5 files changed, 61 insertions(+), 39 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('���������������������');
- }
- }
- );
}
- );
- }
- );
+ );
+ }
+ );
}
}
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 9b1a017..9d69db9 100644
--- a/src/app/routes/devices/monitor-point/monitor-point.component.ts
+++ b/src/app/routes/devices/monitor-point/monitor-point.component.ts
@@ -181,9 +181,15 @@
Object.assign(this.coorPickerService.data, record);
const _data = this.coorPickerService.data;
const areaNames = record.areaNames;
- let adress = null;
+ let adress = '';
if (areaNames != null) {
- adress = areaNames.provinceName + areaNames.cityName + areaNames.areaName + record.address;
+ adress += !!areaNames.provinceName?areaNames.provinceName:'';
+ adress += ' ';
+ adress += !!areaNames.cityName?areaNames.cityName:'';
+ adress += ' ';
+ adress += !!areaNames.areaName?areaNames.areaName:'';
+ adress += ' ';
+ adress += !!record.address?record.address:'';
}
this.coorPickerService.data.address = adress;
this.coorPickerService.data['describe'] = '������������������';
diff --git a/src/app/routes/map/coordinates-picker/coordinates-picker.component.ts b/src/app/routes/map/coordinates-picker/coordinates-picker.component.ts
index 146c9c7..2bc9ec9 100644
--- a/src/app/routes/map/coordinates-picker/coordinates-picker.component.ts
+++ b/src/app/routes/map/coordinates-picker/coordinates-picker.component.ts
@@ -91,11 +91,13 @@
this._localSearch = new this._BMap.LocalSearch(map, {
renderOptions: {map: map}
});
- if (this.data.latitude === this.Default_LAT && this.data.longitude === this.Default_LNG
- && this.data.address != null) {
+ debugger;
+ if (this.data.latitude === this.Default_LAT
+ && this.data.longitude === this.Default_LNG
+ && !!this.data.address
+ && !!this.data.address.trim()) {
this._localSearch.search(this.data.address);
}
-
}
queryTest: string;
mapSearch(param: any) {
diff --git a/src/app/routes/reports/query/query.component.html b/src/app/routes/reports/query/query.component.html
index c9a8156..cae4d8e 100644
--- a/src/app/routes/reports/query/query.component.html
+++ b/src/app/routes/reports/query/query.component.html
@@ -41,7 +41,7 @@
</div>
<div nz-col [nzSpan]="9" class="mb-md">
<div nz-form-item class="d-flex">
- <div [ngStyle]="{'width': '120px'}" nz-form-label>
+ <div [ngStyle]="{'width': '128px'}" nz-form-label>
<label>������������</label>
</div>
<div nz-form-control class="flex-1">
@@ -88,7 +88,7 @@
</div>
<div nz-col [nzSpan]="9" class="mb-md">
<div nz-form-item class="d-flex">
- <div [ngStyle]="{'width': '120px'}" nz-form-label>
+ <div [ngStyle]="{'width': '128px'}" nz-form-label>
<label>
<nz-dropdown>
<button nz-button nz-dropdown ><span>{{dimensionItem.label}}</span> <i class="anticon anticon-down"></i></button>
@@ -115,7 +115,7 @@
<label>��� ���</label>
</div>
<div nz-form-control class="flex-1">
- <nz-select name="device" style="width: 100%;" [(ngModel)]="device" nzAllowClear [nzPlaceHolder]="'��������� ������������(������������������)'" nzShowSearch
+ <nz-select name="device" style="width: 100%;" [(ngModel)]="device" nzAllowClear [nzPlaceHolder]="'��������� '+ dimensionItem.label +'(������������������������)'" nzShowSearch
(nzSearchChange)="devicesChange($event)" [nzNotFoundContent]="'������������'">
<nz-option *ngFor="let option of deviceOptions" [nzLabel]="option.name" [nzValue]="option">
</nz-option>
diff --git a/src/app/routes/reports/query/query.component.ts b/src/app/routes/reports/query/query.component.ts
index 2d04368..a01c9bd 100644
--- a/src/app/routes/reports/query/query.component.ts
+++ b/src/app/routes/reports/query/query.component.ts
@@ -333,7 +333,7 @@
{label:"������������",value:DeviceDimension.PROFESSION}
];
public get otherDimensions():{label: string,value: DeviceDimension}[] {
- return this.dimensions.filter(
+ return this.dimensions.filter(
item => {
return item.value != this.dimensionItem.value;
}
--
Gitblit v1.8.0