From 6efb2a0076a544b5714bccba214d81904264540d Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Tue, 12 Jun 2018 08:49:31 +0800
Subject: [PATCH] 报表展示 增加镇村选项
---
src/app/routes/devices/basic-info/basic-info.component.ts | 95 +++++++++++++++++++++++++++--------------------
1 files changed, 55 insertions(+), 40 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 b468826..526253c 100644
--- a/src/app/routes/devices/basic-info/basic-info.component.ts
+++ b/src/app/routes/devices/basic-info/basic-info.component.ts
@@ -23,10 +23,10 @@
{ title: '������', index: 'name' },
{ title: 'mac', index: 'mac' },
{ title: '������', index: 'deviceVersion.name' },
- { title: '���������', index: 'monitorPoint.name' },
+ { title: '������������', index: 'monitorPoint.name' },
{ title: '���������', index: 'operateUser.name' },
- { title: '������������',width: '100px', type: 'date', index: 'createTime' },
- { title: '������������', width: '100px',type: 'date', index: 'installTime' },
+ { title: '������������', width: '100px', type: 'date', index: 'createTime' },
+ { title: '������������', width: '100px', type: 'date', index: 'installTime' },
{
title: '���������',
buttons: [
@@ -46,7 +46,7 @@
{
text: `���������������`,
type: 'static',
- component:AdjustConfigComponent,
+ component: AdjustConfigComponent,
format: (record: any) => `<i class="anticon anticon-setting"></i>���������������`
},
{
@@ -62,12 +62,12 @@
];
queryTextStream: Subject<string> = new Subject<string>();
constructor(
- private monitorPointService:MonitorPointService,
+ private monitorPointService: MonitorPointService,
private deviceService: DeviceService,
private confirmServ: NzModalService,
public msgSrv: NzMessageService,
private modalHelper: ModalHelper,
- private coorPickerService:CoorPickerService
+ private coorPickerService: CoorPickerService
) { }
ngOnInit() {
@@ -80,7 +80,7 @@
});
}
get listUrl() {
- return this.deviceService.getListUrl();;
+ return this.deviceService.getListUrl();
}
extraParams = { queryParams: null };
queryText: string;
@@ -126,7 +126,7 @@
}
addOrModify(d) {
const data = {};
- if (d != null) {
+ if (d != null) {
Object.assign(data, d);
}
this.modalHelper.static(DeviceEditComponent, { data }).subscribe(
@@ -157,39 +157,54 @@
);
});
}
- configCoord(record:Device):void {
- Object.assign(this.coorPickerService.data,record);
- let _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;
+ configCoord(record: Device): void {
+ // ������������������������������������������adress������������
+ Object.assign(this.coorPickerService.data, record);
+ this.coorPickerService.data['describe'] = '������������';
+ // ������ ��������������� ������������������
+ 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);
}
- this.coorPickerService.data.address = adress;
- this.coorPickerService.data['describe'] = '������������';
- }
- this.modalHelper.static(CoordinatesPickerComponent).subscribe(
- (staticComp) => {
- const data:Device = {
- id:record.id,
- longitude:_data.longitude,
- latitude:_data.latitude,
- }
- this.deviceService.save(data).subscribe(
- (res: any) => {
- if (res.code === 1) {
- this.load();
- this.msgSrv.success('���������������������');
- }
- }
- );
-
}
- );
- }
- )
+ );
+ }else {
+ this.openMap(record);
+ }
+ }
+ private openMap(record: Device) {
+ const _data = this.coorPickerService.data;
+ 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