| | |
| | | // 监测项目 tree click 事件 |
| | | this.treeClickStream.debounceTime(1).subscribe( event => { |
| | | const data = event.node.data; |
| | | console.log(data); |
| | | // console.log(data); |
| | | if (data.id === -1) { |
| | | const children = data.children; |
| | | // 全选状态 |
| | |
| | | this.reloadSensorNames(); |
| | | } |
| | | private reloadSensorNames(): void { |
| | | // 异步提升展现速度 |
| | | setTimeout(() => { |
| | | this._sensorNames = ''; |
| | | this.sensorOptions[0].children.forEach( |
| | | sensor => { |
| | | const hasSensor = Object.keys(this._sensors).some( |
| | | id => Number(id) === Number(sensor.id) |
| | | ); |
| | | if (hasSensor) { |
| | | this._sensorNames += sensor.name + ','; |
| | | } |
| | | const sensorNameList = Object.keys(this._sensors).map( |
| | | id => { |
| | | const sensor = this.sensorOptions[0].children.find(item => { |
| | | return Number(id) === Number(item.id) ; |
| | | }); |
| | | return sensor.name; |
| | | } |
| | | ); |
| | | this._sensorNames = sensorNameList.join(','); |
| | | }, 1); |
| | | } |
| | | public setTimeUnit(val: {label: string, value: TimeUnits} ) { |
| | | switch (val.value) { |