fengxiang
2018-01-25 8570af7c6051c3d9a516f39d597ff49e1e1e2840
src/app/routes/devices/monitor-point/monitor-point.component.ts
@@ -1,3 +1,4 @@
import { CoorPickerService } from 'app/routes/map/coordinates-picker/coordinates-picker.service';
import {  AreaNames, MonitorPoint } from '@business/entity/data';
import { Version, ValueTransformer } from '@angular/compiler/src/util';
import { Subject } from 'rxjs/Subject';
@@ -12,6 +13,7 @@
import { filter } from 'rxjs/operators/filter';
import { MonitorPointEditComponent } from 'app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component';
import { MonitorPointService } from '@business/services/http/monitor-point.service';
import { CoordinatesPickerComponent } from 'app/routes/map/coordinates-picker/coordinates-picker.component';
@Component({
@@ -55,6 +57,7 @@
    this.grid.pageSize = 10;
  }
  constructor(
    private coorPickerService:CoorPickerService,
    private monitorPointService: MonitorPointService,
    
    private confirmServ: NzModalService,
@@ -174,4 +177,33 @@
     }
     this.load();
  }
  configCoord(record: MonitorPoint): void {
    Object.assign(this.coorPickerService.data, record);
    let _data = this.coorPickerService.data;
    const areaNames = record.areaNames;
    let adress = null;
    if (areaNames != null) {
      adress = areaNames.provinceName + areaNames.cityName + areaNames.areaName + record.address;
    }
    this.coorPickerService.data.address = adress;
    this.coorPickerService.data['describe'] = '监控点名称';
    this.modalHelper.static(CoordinatesPickerComponent).subscribe(
      (staticComp) => {
        const data: MonitorPoint = {
          id: record.id,
          longitude: _data.longitude,
          latitude: _data.latitude,
        }
        this.monitorPointService.save(data).subscribe(
          (res: any) => {
            if (res.code === 1) {
              this.load();
              this.msgSrv.success('坐标配置成功!');
            }
          }
        );
      }
    );
  }
}