xufenglei
2018-03-16 92381eb59bd9b182e5bc8f2f82833806a3496a31
src/app/routes/reports/demo/demo.component.ts
@@ -26,7 +26,10 @@
    time: null,
    formatTime: null,
    monitorPointName: '',
    deviceName: ''
    deviceName: '',
    monitorPointAddress: '',
    deviceCount: ''
  }];
  public sensorOptions = [];
@@ -54,13 +57,15 @@
  addItem() {
    const id = (this.items.length > 0) ? this.items[this.items.length - 1].id + 1 : 0;
    const index = this.items.push({
      id,
      id: id,
      monitorPoint: null,
      mac: '',
      time: null,
      formatTime: null,
      monitorPointName: '',
      deviceName: ''
      deviceName: '',
      monitorPointAddress: '',
      deviceCount: ''
    });
  }
@@ -86,6 +91,7 @@
      this.monitorPointOptions.forEach(monitorPoint => {
        if (monitorPoint.id === value) {
          this.items[i].monitorPointName = monitorPoint.name;
          this.items[i].monitorPointAddress = monitorPoint.address;
        }
      });
      this.http.get(environment.SERVER_BASH_URL + 'device/monitorPointId', {params: {monitorPointId: value}}).subscribe((res: any) => {
@@ -93,6 +99,7 @@
          this.msgSrv.error(res.message);
        } else {
          this.deviceOptions = res.data;
          this.items[i].deviceCount = res.data.length;
        }
      });
    } else {
@@ -146,12 +153,9 @@
      }
    }
    if (validate && query.type) {
      query.format = this.timeType.format;
      query.typeFormat = this.timeType.typeFormat;
      query.xAxisName = this.timeType.xAxisName;
      query.label = this.timeType.label;
      query.timeLength = this.timeType.timeLength;
      query.timeType = JSON.stringify(this.timeType);
      query.items = JSON.stringify(this.items);
      console.info(this.items);
      this.router.navigate(['report'], {queryParams: query});
    } else {
      this.msgSrv.error('请完善搜索项或删除查询条目');