|
@@ -5,29 +5,74 @@
|
5
|
5
|
|
6
|
6
|
$(function () {
|
7
|
7
|
|
|
8
|
+ // 过滤时间
|
|
9
|
+ var _startDate = moment().subtract(1, 'months');
|
|
10
|
+ var _endDate = moment();
|
|
11
|
+ $('#filterTime').daterangepicker({
|
|
12
|
+ autoApply:false,
|
|
13
|
+ singleDatePicker:false,
|
|
14
|
+ showDropdowns:false, // 是否显示年月选择条件
|
|
15
|
+ timePicker: true, // 是否显示小时和分钟选择条件
|
|
16
|
+ timePickerIncrement: 10, // 时间的增量,单位为分钟
|
|
17
|
+ timePicker24Hour : true,
|
|
18
|
+ opens : 'left', //日期选择框的弹出位置
|
|
19
|
+ ranges: {
|
|
20
|
+ //'最近1小时': [moment().subtract(1, 'hours'), moment()],
|
|
21
|
+ '今日': [moment().startOf('day'), moment().endOf('day')],
|
|
22
|
+ '昨日': [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')],
|
|
23
|
+ '最近7日': [moment().subtract(7, 'days'), moment()],
|
|
24
|
+ '最近30日': [moment().subtract(1, 'months'), moment()],
|
|
25
|
+ '本月': [moment().startOf('month'), moment().endOf('month')],
|
|
26
|
+ '上个月': [moment().subtract(1, 'months').startOf('month'), moment().subtract(1, 'months').endOf('month')]
|
|
27
|
+ },
|
|
28
|
+ locale : {
|
|
29
|
+ format: 'YYYY-MM-DD HH:mm:ss',
|
|
30
|
+ separator : ' - ',
|
|
31
|
+ customRangeLabel : '自定义',
|
|
32
|
+ applyLabel : '确定',
|
|
33
|
+ cancelLabel : '取消',
|
|
34
|
+ fromLabel : '起始时间',
|
|
35
|
+ toLabel : '结束时间',
|
|
36
|
+ daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
|
|
37
|
+ monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ],
|
|
38
|
+ firstDay : 1
|
|
39
|
+ },
|
|
40
|
+ startDate:_startDate,
|
|
41
|
+ endDate: _endDate
|
|
42
|
+ }, function (start, end, label) {
|
|
43
|
+ freshChartDate(start, end);
|
|
44
|
+ });
|
|
45
|
+ freshChartDate(_startDate, _endDate);
|
|
46
|
+
|
8
|
47
|
/**
|
|
48
|
+ * 刷新报表
|
9
|
49
|
*
|
|
50
|
+ * @param startDate
|
|
51
|
+ * @param endDate
|
10
|
52
|
*/
|
11
|
|
- $.ajax({
|
12
|
|
- type : 'POST',
|
13
|
|
- url : base_url + '/triggerChartDate',
|
14
|
|
- data : { },
|
15
|
|
- dataType : "json",
|
16
|
|
- success : function(data){
|
17
|
|
- if (data.code == 200) {
|
18
|
|
- lineChartInit(data)
|
19
|
|
- pieChartInit(data);
|
20
|
|
- } else {
|
21
|
|
- layer.open({
|
22
|
|
- title: '系统提示',
|
23
|
|
- content: (data.msg || '调度报表数据加载异常'),
|
24
|
|
- icon: '2'
|
25
|
|
- });
|
|
53
|
+ function freshChartDate(startDate, endDate) {
|
|
54
|
+ $.ajax({
|
|
55
|
+ type : 'POST',
|
|
56
|
+ url : base_url + '/triggerChartDate',
|
|
57
|
+ data : {
|
|
58
|
+ 'startDate':startDate.format('YYYY-MM-DD HH:mm:ss'),
|
|
59
|
+ 'endDate':endDate.format('YYYY-MM-DD HH:mm:ss')
|
|
60
|
+ },
|
|
61
|
+ dataType : "json",
|
|
62
|
+ success : function(data){
|
|
63
|
+ if (data.code == 200) {
|
|
64
|
+ lineChartInit(data)
|
|
65
|
+ pieChartInit(data);
|
|
66
|
+ } else {
|
|
67
|
+ layer.open({
|
|
68
|
+ title: '系统提示',
|
|
69
|
+ content: (data.msg || '调度报表数据加载异常'),
|
|
70
|
+ icon: '2'
|
|
71
|
+ });
|
|
72
|
+ }
|
26
|
73
|
}
|
27
|
|
- }
|
28
|
|
- });
|
29
|
|
-
|
30
|
|
-
|
|
74
|
+ });
|
|
75
|
+ }
|
31
|
76
|
|
32
|
77
|
/**
|
33
|
78
|
* 折线图
|
|
@@ -151,38 +196,4 @@ $(function () {
|
151
|
196
|
pieChart.setOption(option);
|
152
|
197
|
}
|
153
|
198
|
|
154
|
|
- // 过滤时间
|
155
|
|
- /*$('#filterTime').daterangepicker({
|
156
|
|
- autoApply:false,
|
157
|
|
- singleDatePicker:false,
|
158
|
|
- showDropdowns:false, // 是否显示年月选择条件
|
159
|
|
- timePicker: true, // 是否显示小时和分钟选择条件
|
160
|
|
- timePickerIncrement: 10, // 时间的增量,单位为分钟
|
161
|
|
- timePicker24Hour : true,
|
162
|
|
- opens : 'left', //日期选择框的弹出位置
|
163
|
|
- ranges: {
|
164
|
|
- '最近1小时': [moment().subtract(1, 'hours'), moment()],
|
165
|
|
- '今日': [moment().startOf('day'), moment().endOf('day')],
|
166
|
|
- '昨日': [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')],
|
167
|
|
- '最近7日': [moment().subtract(6, 'days'), moment()],
|
168
|
|
- '最近30日': [moment().subtract(29, 'days'), moment()],
|
169
|
|
- '本月': [moment().startOf('month'), moment().endOf('month')],
|
170
|
|
- '上个月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
171
|
|
- },
|
172
|
|
- locale : {
|
173
|
|
- format: 'YYYY-MM-DD HH:mm:ss',
|
174
|
|
- separator : ' - ',
|
175
|
|
- customRangeLabel : '自定义',
|
176
|
|
- applyLabel : '确定',
|
177
|
|
- cancelLabel : '取消',
|
178
|
|
- fromLabel : '起始时间',
|
179
|
|
- toLabel : '结束时间',
|
180
|
|
- daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
|
181
|
|
- monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ],
|
182
|
|
- firstDay : 1,
|
183
|
|
- startDate: moment().startOf('day'),
|
184
|
|
- endDate: moment().endOf('day')
|
185
|
|
- }
|
186
|
|
- });*/
|
187
|
|
-
|
188
|
199
|
});
|