| | |
| | | public query: any = {}; |
| | | public sensorOptions = []; |
| | | public typeOptions = [ |
| | | {value: 'year', label: '年', format: 'yyyy', typeFormat: '%Y-%m', timeLength: 12}, |
| | | {value: 'month', label: '月', format: 'yyyy-MM', typeFormat: '%Y-%m-%d', timeLength: 28}, |
| | | {value: 'day', label: '日', format: 'yyyy-MM-dd', typeFormat: '%Y-%m-%d %H', timeLength: 24}, |
| | | {value: 'hour', label: '时', format: 'yyyy-MM-dd HH', typeFormat: '%Y-%m-%d %H:%i', timeLength: 60} |
| | | {value: 'year', label: '年', format: 'YYYY'}, |
| | | {value: 'month', label: '月', format: 'YYYY-MM'}, |
| | | {value: 'day', label: '日', format: 'YYYY-MM-DD'}, |
| | | {value: 'hour', label: '时', format: 'YYYY-MM-DD HH'} |
| | | ]; |
| | | public reportOptions = [ |
| | | {value: 'bar', label: '柱状图'}, |
| | |
| | | } |
| | | queryItem.deviceCount = queryItem.deviceOptions.length; |
| | | delete queryItem.deviceOptions; |
| | | queryItem.formatTime = this.dateSrv.date_format(queryItem.time, this.timeType.format.toUpperCase()); |
| | | queryItem.formatTime = this.dateSrv.date_format(queryItem.time, this.timeType.format); |
| | | delete queryItem.time; |
| | | queryItems.push(queryItem); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | if (validate && this.timeType && query.reportType) { |
| | | query.sensors = null; |
| | | if (query.sensorKey && query.sensorKey.length > 0) { |
| | | const sensors = []; |
| | | query.sensorKey.forEach(sensor => { |
| | | sensors.push(sensor.sensorKey + '-' + sensor.name + '-' + sensor.unit); |
| | | }); |
| | | query.sensors = JSON.stringify(sensors); |
| | | query.sensors = JSON.stringify(query.sensorKey); |
| | | } |
| | | query.items = JSON.stringify(queryItems); |
| | | query.timeType = JSON.stringify(this.timeType); |
| | | query.type = this.timeType.value; |
| | | this.router.navigate(['report'], {queryParams: query}); |
| | | } else { |
| | | this.msgSrv.error('请完善搜索项或删除查询条目'); |