fengxiang
2018-07-06 309d1f9d649daa08bb9b068af014749f6d4a5bce
src/app/routes/devices/monitor-point/monitor-point.component.ts
@@ -14,6 +14,8 @@
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';
import { OrganizationService } from '@business/services/http/organization.service';
import { ExampleService } from '@business/services/util/example.service';
@Component({
@@ -23,10 +25,10 @@
})
export class MonitorPointComponent implements OnInit {
  public orgOptions = [];
  private monitorPoint: MonitorPoint;
  grid: Grid<MonitorPoint> = new Grid(null);
  queryMap = { text: '请输入名称', value: '' };
  queryMap: { mpointName?: string, organizationId?: number } = { mpointName: null, organizationId: null };
  queryTextStream: Subject<string> = new Subject<string>();
  private initPage() {
    this.monitorPoint = {
@@ -64,10 +66,10 @@
  constructor(
    private coorPickerService: CoorPickerService,
    private monitorPointService: MonitorPointService,
    private confirmServ: NzModalService,
    public msgSrv: NzMessageService,
    private modalHelper: ModalHelper,
    private organizationService: OrganizationService
  ) { }
  ngOnInit() {
@@ -78,9 +80,14 @@
      .subscribe(queryText => {
        this.load();
      });
    this.orgSelectChange();
  }
 public setOrganizationId(orgId) {
    this.queryMap.organizationId = orgId;
    this.load();
  }
  queryTextChanged($event) {
    this.queryTextStream.next(this.queryMap.value);
    this.queryTextStream.next(this.queryMap.mpointName);
  }
  load(reload: boolean = false) {
    if (reload) {
@@ -90,7 +97,13 @@
    setTimeout(() => {
      this.grid.loading = true;
    }, 1);
    this.monitorPointService.getPagingList(this.grid, this.queryMap.value).subscribe(
    const example = new ExampleService();
    const organizationId = !!this.queryMap.organizationId ? this.queryMap.organizationId : null;
    const mpointName = !!this.queryMap.mpointName ? '%' + this.queryMap.mpointName + '%' : null;
    example.or()
    .andEqualTo({name: 'organizationId', value: organizationId })
    .andLike({name: 'name', value: mpointName  });
    this.monitorPointService.getPageByExample(this.grid, example).subscribe(
      (res: PageBean) => {
        this.grid.loading = true;
        if (res != null && res.data != null) {
@@ -110,7 +123,9 @@
    if (d != null) {
      Object.assign(data, d);
    }
    this.modalHelper.static(MonitorPointEditComponent, { data }).subscribe(
    let configMap = {};
    configMap = Object.assign(configMap, this.queryMap);
    this.modalHelper.static(MonitorPointEditComponent, { data, configMap }).subscribe(
      (ret: { data: any, close: Function }) => {
        // 修改状态
        if (ret.data['index'] != null) {
@@ -188,13 +203,13 @@
    const areaNames = record.areaNames;
    let adress = '';
    if (areaNames != null) {
      adress += !!areaNames.provinceName?areaNames.provinceName:'';
      adress += !!areaNames.provinceName ? areaNames.provinceName : '';
      adress += ' ';
      adress += !!areaNames.cityName?areaNames.cityName:'';
      adress += !!areaNames.cityName ? areaNames.cityName : '';
      adress += ' ';
      adress += !!areaNames.areaName?areaNames.areaName:'';
      adress += !!areaNames.areaName ? areaNames.areaName : '';
      adress += ' ';
      adress += !!record.address?record.address:'';
      adress += !!record.address ? record.address : '';
    }
    this.coorPickerService.data.address = adress;
    this.coorPickerService.data['describe'] = '监控站点名称';
@@ -217,4 +232,14 @@
      }
    );
  }
  orgSelectChange(text?: string) {
    const pageBean: PageBean = {pageIndex: 0, pageSize: 20};
    this.organizationService.getPagingList(pageBean, text).subscribe(
      (res: PageBean) => {
           if (res != null && res.data != null) {
               this.orgOptions = res.data;
           }
      }
   );
  }
}