From 051a77599ca8b7972df8728ff46822d308627cbc Mon Sep 17 00:00:00 2001 From: xufenglei <xufenglei> Date: Wed, 28 Mar 2018 14:32:32 +0800 Subject: [PATCH] 报表 优化 --- src/app/routes/reports/demo/demo.component.ts | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/app/routes/reports/demo/demo.component.ts b/src/app/routes/reports/demo/demo.component.ts index c64baca..37cf5ed 100644 --- a/src/app/routes/reports/demo/demo.component.ts +++ b/src/app/routes/reports/demo/demo.component.ts @@ -16,10 +16,10 @@ 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: '���������'}, @@ -122,7 +122,7 @@ } 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 { @@ -131,16 +131,11 @@ } } 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('���������������������������������������'); -- Gitblit v1.8.0