| | |
| | | {value: 'bar', label: '柱状图'}, |
| | | {value: 'line', label: '折线图'} |
| | | ]; |
| | | |
| | | public professionOptions = []; |
| | | public dimensionOptions = [ |
| | | {value: 'monitorPoint', label: '监测站点'}, |
| | | {value: 'profession', label: '行业'} |
| | | ]; |
| | | monitorPointShow = true; |
| | | professionShow = false; |
| | | public items: any[] = [{ |
| | | id: 0, |
| | | profession: null, |
| | | monitorPoint: null, |
| | | device: null, |
| | | time: null, |
| | | time: new Date(), |
| | | monitorPointOptions: [], |
| | | deviceOptions: [] |
| | | }]; |
| | |
| | | ) { |
| | | this.timeType = this.typeOptions[1]; |
| | | this.query.reportType = this.reportOptions[1].value; |
| | | this.query.dimension = this.dimensionOptions[0].value; |
| | | } |
| | | |
| | | ngOnInit() { |
| | |
| | | } |
| | | }); |
| | | |
| | | this.http.get(environment.SERVER_BASH_URL + 'mobile/profession').subscribe((res: any) => { |
| | | if (res.errno !== 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.professionOptions = res.data; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | dimensionChange(value) { |
| | | this.items.forEach((item,index) => { |
| | | item.profession = null; |
| | | item.monitorPoint = null; |
| | | item.device = null; |
| | | }); |
| | | if (value === 'monitorPoint') { |
| | | this.professionShow = false; |
| | | this.monitorPointShow = true; |
| | | } else { |
| | | this.professionShow = true; |
| | | this.monitorPointShow = false; |
| | | } |
| | | } |
| | | |
| | | public onTreeClickSelect(event): void { |
| | |
| | | const id = (this.items.length > 0) ? this.items[this.items.length - 1].id + 1 : 0; |
| | | const index = this.items.push({ |
| | | id: id, |
| | | profession: null, |
| | | monitorPoint: null, |
| | | device: null, |
| | | time: null, |
| | | time: new Date(), |
| | | monitorPointOptions: [], |
| | | deviceOptions: [] |
| | | }); |
| | |
| | | let areaName = ''; |
| | | const option = event.option; |
| | | this.items[i].monitorPoint = null; |
| | | this.items[i].profession = null; |
| | | this.items[i].areaCode = null; |
| | | this.items[i].device = null; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | professionChange(value, i) { |
| | | this.items[i].deviceOptions = []; |
| | | this.items[i].device = null; |
| | | if (value) { |
| | | if (!!this.items[i].areaName) { |
| | | this.items[i].professionId = value.id; |
| | | this.http.get(environment.SERVER_BASH_URL + 'device/professionId', {params: this.items[i]}).subscribe((res: any) => { |
| | | if (res.code === 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.items[i].deviceOptions = res.data; |
| | | } |
| | | }); |
| | | } else { |
| | | this.msgSrv.error('请先选择 省市区!'); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | _disabledDate(current: Date): boolean { |
| | | return current && current.getTime() > Date.now(); |
| | | } |
| | |
| | | let validate = true; |
| | | const queryItems = []; |
| | | for (let i = 0; i < this.items.length; i++) { |
| | | let areaName = ''; |
| | | let item = this.items[i]; |
| | | let queryItem: any = {}; |
| | | if ((!!item.time) && (item.monitorPointOptions.length > 0)) { |
| | | for (var key in item) { |
| | | const areaName = ''; |
| | | const item = this.items[i]; |
| | | const queryItem: any = {}; |
| | | if (item.monitorPointOptions.length > 0) { |
| | | for (const key in item) { |
| | | if (item[key]) { |
| | | queryItem[key] = item[key]; |
| | | } |
| | | } |
| | | if (queryItem.profession) { |
| | | queryItem.professionId = queryItem.profession.id; |
| | | queryItem.professionName = queryItem.profession.name; |
| | | delete queryItem.profession; |
| | | } |
| | | if (queryItem.monitorPoint) { |
| | | queryItem.monitorPointId = queryItem.monitorPoint.id; |
| | | queryItem.monitorPointName = queryItem.monitorPoint.name; |
| | | queryItem.monitorPointAddress = queryItem.monitorPoint.address; |
| | | delete queryItem.monitorPoint; |
| | | } else { |
| | | queryItem.monitorPointName = queryItem.areaName; |
| | | } |
| | | delete queryItem.monitorPointOptions; |
| | | if (queryItem.device) { |
| | |
| | | } |
| | | } |
| | | if (validate && this.timeType && query.reportType) { |
| | | delete query.sensors; |
| | | if (this._sensors) { |
| | | const sensors = []; |
| | | for (var key in this._sensors) { |
| | | for (const key in this._sensors) { |
| | | sensors.push(this._sensors[key]); |
| | | } |
| | | if (sensors.length > 0) { |
| | |
| | | } |
| | | query.items = JSON.stringify(queryItems); |
| | | query.type = this.timeType.value; |
| | | sessionStorage.setItem("queryParams", JSON.stringify(query)); |
| | | sessionStorage.setItem('queryParams', JSON.stringify(query)); |
| | | } else { |
| | | this.msgSrv.error('请完善搜索项或删除查询条目'); |
| | | return false; |