fengxiang
2018-05-15 008baf1470f2aaf6fe388a20b9a61069270a1471
监控坐标编辑功能完善
5 files modified
100 ■■■■■ changed files
src/app/routes/devices/basic-info/basic-info.component.ts 74 ●●●●● patch | view | raw | blame | history
src/app/routes/devices/monitor-point/monitor-point.component.ts 10 ●●●● patch | view | raw | blame | history
src/app/routes/map/coordinates-picker/coordinates-picker.component.ts 8 ●●●●● patch | view | raw | blame | history
src/app/routes/reports/query/query.component.html 6 ●●●● patch | view | raw | blame | history
src/app/routes/reports/query/query.component.ts 2 ●●● patch | view | raw | blame | history
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('坐标配置成功!');
                        }
                      }
                     );
              }
           );
         }
    );
             );
      }
   );
  }
}
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'] = '监控站点名称';
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) {
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>
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;
             }