fengxiang
2018-07-13 7a9cedc65c1a9f2d8ca4513206767cdd4dd94246
查询条件 默认设置 token 过期替换
2 files modified
39 ■■■■ changed files
src/app/app.component.ts 2 ●●● patch | view | raw | blame | history
src/app/routes/reports/query/query.component.ts 37 ●●●● patch | view | raw | blame | history
src/app/app.component.ts
@@ -29,7 +29,7 @@
  ngOnInit() {
    // 设置Token信息
    this.tokenService.set({
      token: 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsIm9pZCI6NSwibW9kZSI6IldlYiIsInNjb3BlcyI6WyJ0ZW1wIl0sImlzcyI6Imh0dHA6Ly9tb25pdG9yLjdkcmxiLmNvbSIsImlhdCI6MTUzMTM4MTIyMiwiZXhwIjoxNTMxMzgxNTIyfQ.iIlgjuDQP1C2mOWUSd0DT6sKxg7Wavsu3oOiHxGf58BZmrwl3OEIFH71yHo9DbXTRWnm5QzEeyjdxLXcWBA3mQ',
      token: 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsIm9pZCI6NSwibW9kZSI6IldlYiIsInNjb3BlcyI6WyJ0ZW1wIl0sImlzcyI6Imh0dHA6Ly9tb25pdG9yLjdkcmxiLmNvbSIsImlhdCI6MTUzMTQ0ODcwMCwiZXhwIjoxNTMyNzQ0NzAwfQ.a2o1-bruQKjgvYDkA4fdhDmqpwJSbqdlKmK5spz5bk_15VvP0TN1rl1j8nQD7bJxgFQerVT3iouYVBXf3zN67A',
      name: 'admin',
      email: `admin@qq.com`,
      id: 10000,
src/app/routes/reports/query/query.component.ts
@@ -100,14 +100,12 @@
         this.actualTime.setFullYear(Number(year));
     }
     dimensionsChange(text?: string) {
        // switch (this.dimensionItem.value) {
        //     case DeviceDimension.MONITORPOINT:
        //     this.monitorPointsChange(text); break;
        //     case DeviceDimension.PROFESSION:
        //     this.professionsChange(text); break;
        // }
         this.monitorPointsChange(text);
        switch (this.dimensionItem.value) {
            case DeviceDimension.MONITORPOINT:
            this.monitorPointsChange(text); break;
            case DeviceDimension.PROFESSION:
            this.professionsChange(text); break;
        }
     }
     professionsChange(text?: string) {
        this.http.get<ResultBean<any[]>>('profession/getall').subscribe(
@@ -177,6 +175,25 @@
    public onChartInit(e): void {
        this.echartsIntance = e;
    }
    /**
     * 放在 sensor 选项加载完后调用
     * @param sensorKeys
     */
    private mockSelectSensors(sensorKeys: string[]) {
        // 模拟选择 aqi 6个参数
        // Object.keys(this.aqiSort)
        sensorKeys.forEach( key => {
            const sensor =  this.sensorOptions[0].children.find(
                 sen => sen.sensorKey === key
            )
            if (!!sensor) {
             sensor['halfChecked'] = false;
             sensor['checked'] = true;
             const event = {node: {data: sensor}};
             this.onSensorSelect(event);
            }
         });
    }
    constructor(
    private http: _HttpClient,
    private sensorsService: SensorsService,
@@ -234,6 +251,7 @@
        this.sensorsService.getPagingList(null, null).subscribe(
            (res: PageBean) => {
                this.sensorOptions.push({id: -1, name: '全部', isExpanded: true, children: res.data});
                this.mockSelectSensors(Object.keys(this.aqiSort));
            }
        );
        this.actualYearOptions = this.newArray(this.actualYear - 9, 10).map(item => Number(item)).reverse();
@@ -391,6 +409,7 @@
          this.treeClickStream.next(event);
    }
    public onSensorSelect(event): void {
        debugger;
        const data = event.node.data;
        if (data.id === -1 && data.halfChecked === false) {
            if (!!data.checked) {
@@ -481,6 +500,7 @@
    public loadGrid(): void {
        // 数据检查
        const sensors = Object.values(this._sensors);
        debugger;
        if ( sensors.length === 0 ) {
            this.msg.error(' 监测项目 不能为空');
            return ;
@@ -627,6 +647,7 @@
        //  if ( this.chartSelectedIndex < this.grid.data.length ) {
        //     series = [{type: 'line', data: this.grid.data[this.chartSelectedIndex]}];
        //  }
         this.initOpton({ xAxis : [{data : timeList}]});
         this.chartLoading = true;
      }