calcDetailMonthly.html
15.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<style type="text/css">
.table-bordered {
border: 1px solid; }
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > th,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > th,
.table-bordered > tfoot > tr > td {
border: 1px solid;
text-align: center; }
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td {
border-bottom-width: 2px; }
.table > tbody + tbody {
border-top: 1px solid; }
#analy_body tr> td >span{
word-break: keep-all;white-space:nowrap;
}
#analy_body td{
min-width: 100px;
max-width: 100px;
width: 100px;
}
#analy_body{
margin-top: 20px;
height: 620px;
width: 100%
}
.table_head::-webkit-scrollbar {
display:none
}
.table_head{
min-width: 906px;
width: 100%;
overflow: hidden;
}
.table_body{
width:101%;
height:580px;
overflow: auto;
margin-top: -20px;
}
</style>
<div class="page-head">
<div class="page-title">
<h1>路单线路明细月报表</h1>
</div>
</div>
<!--<div class="row">-->
<div class=" row col-md-12 portlet light bordered" style="height:calc(100% - 38px)">
<div class="">
<form class="form-inline" >
<div style="display: inline-block; margin-left: 13px;" id="gsdmDiv_daily">
<span class="item-label" style="width: 80px;">  公司: </span>
<select class="form-control" name="company" id="gsdm" style="width: 150px;"></select>
</div>
<div style="display: inline-block; margin-left: 13px;" id="fgsdmDiv_daily">
<span class="item-label" style="width: 80px;"> 分公司: </span>
<select class="form-control" name="fgsdm" id="fgsdm" style="width: 150px;"></select>
</div>
<!--<div style="display: inline-block;margin-left: 33px;">
<span class="item-label" style="width: 80px;">  线路: </span>
<select class="form-control" name="line" id="line" style="width: 180px;"></select>
</div>-->
<div style="display: inline-block;margin-left: 13px;" class="date-picker">
<span class="item-label" style="width: 80px;">  时间: </span>
<input class="form-control" type="text" id="startDate" style="width: 150px;" /> -
<input class="form-control" type="text" id="endDate" style="width: 150px;" />
<!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->
<!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->
</div>
<div style="margin-top: 2px"></div>
<div style="display: inline-block; margin-left: 13px;">
<span class="item-label" style="width: 80px;">线路性质: </span>
<select class="form-control" name="destroy" id="destroy" style="width: 150px;">
<option value="0,1">全部线路</option>
<option value="0">营运线路</option>
<option value="1">非营运线路</option>
</select>
</div>
<div style="display: inline-block;margin-left: 13px;">
<span class="item-label" style="width: 80px;">统计对象: </span>
<select class="form-control" name="statisticalObj" id="statisticalObj" style="width: 150px;">
<option value="cl">车辆</option>
<option value="jsy">驾驶员</option>
<option value="cwy">乘务员</option>
<option value="xl">线路</option>
</select>
</div>
<div style="display: inline-block; margin-left: 13px;" >
<span class="item-label" style="width: 80px;">统计项目: </span>
<select class="form-control" name="statisticalItem" id="statisticalItem" style="width: 150px;">
<option value="yh">油耗</option>
<option value="dh">电耗</option>
<option value="gl">公里</option>
<option value="bc">班次</option>
</select>
</div>
<div style="display: inline-block; margin-left: 13px;" >
<span class="item-label" style="width: 80px;">项目明细: </span>
<select class="form-control" name="itemDetails" id="itemDetails" style="width: 150px;"></select>
</div>
<div class="form-group" style="display: inline-block;margin-left: 22px;">
<input class="btn btn-default" type="button" id="query" value="筛选"/>
<input class="btn btn-default" type="button" id="export" value="导出"/>
</div>
</form>
</div>
<div id="analy_body">
<div class="table_head" id="table_head">
<table class="table table-bordered table-hover table-checkable " id="forms_head">
<thead>
</thead>
</table>
</div>
<div class="table_body" id="table_body">
<table class="table table-bordered table-hover table-checkable" id="forms_body" style="background-color: white;">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<script >
$(function(){
$('#export').attr('disabled', "true");
// 关闭左侧栏
if (!$('body').hasClass('page-sidebar-closed'))
$('.menu-toggler.sidebar-toggler').click();
var table_body1 = document.getElementById("table_body");
table_body1.onscroll = function(){
var table_body1_left = this.scrollLeft;
document.getElementById("table_head").scrollLeft = table_body1_left;
};
var d = new Date();
d.setTime(d.getTime() - 4*1000*60*60*24);//只能查4天以前的数据
var year = d.getFullYear();
var month = d.getMonth() + 1;
var day = d.getDate();
if(month < 10)
month = "0" + month;
if(day < 10)
day = "0" + day;
//时间
var dateTime=year + "-" + month + "-" + day;
$("#startDate").val(dateTime);
$("#endDate").val(dateTime);
$("#endDate").datetimepicker({
format : 'YYYY-MM-DD',
locale : 'zh-cn',
maxDate : dateTime
});
$("#startDate").datetimepicker({
format : 'YYYY-MM-DD',
locale : 'zh-cn',
maxDate : dateTime
});
var lineAll="";
var datas = {}; //查询条件
/**用户分配的线路*/
$.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
});
var tempData = {};
$.get('/user/companyData', function(result){
var obj = result;
var options = '';
for(var i = 0; i < obj.length; i++){
options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
}
if(obj.length ==0){
$("#gsdmDiv_daily").css('display','none');
}else if(obj.length ==1){
$("#gsdmDiv_daily").css('display','none');
if(obj[0].children.length == 1 || obj[0].children.length == 0){
fage=false;
$('#gsdmDiv_daily').css('display','none');
}
}
$('#gsdm').html(options);
updateCompany();
});
$("#gsdm").on("change",updateCompany);
function updateCompany(){
var company = $('#gsdm').val();
$.get('/user/companyData', function(obj) {
var option = '';
var allC = "";
for (var i = 0; i < obj.length; i++) {
if (obj[i].companyCode == company) {
var children = obj[i].children;
for (var j = 0; j < children.length; j++) {
allC += children[j].code+",";
option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
}
}
}
var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
$('#fgsdm').html(options);
});
}
// 项目明细选项列
// 触发默认选项
updateItem();
$("#statisticalItem").on("change",updateItem);
function updateItem() {
var item = $('#statisticalItem').val();
var options = '';
if(item == "yh"){
options += '<option value="jzlAll">加注量[全部]</option>' +
'<option value="jzl0">加注量[0#]</option>'+
'<option value="jzl-10">加注量[-10#]</option>'+
'<option value="yhl">油耗量</option>'+
'<option value="cccy">出场存油</option>'+
'<option value="jccy">进场存油</option>'+
'<option value="bglyh">百公里油耗</option>';
} else if(item == "gl"){
options += '<option value="zgl">总公里</option>' +
'<option value="jhgl">计划公里</option>';
/*'<option value="jclm">进场路码</option>'+
'<option value="cclm">出场路码</option>'*/
} else if(item == "bc"){
options += '<option value="sjbc">实际班次</option>' +
'<option value="jhbc">计划班次</option>';
} else if(item == "dh"){
options += '<option value="dh">耗电量</option>';
options += '<option value="cdl">充电量</option>';
options += '<option value="cccd">出场存电</option>';
options += '<option value="jccd">进场存电</option>';
options += '<option value="bgldh">百公里电耗</option>';
}
$('#itemDetails').html(options);
}
//线路名称
var lineName = '';
$("#query").on("click",function(){
var gsdm = $("#gsdm").val();
var fgsdm = $("#fgsdm").val();
var startDate = $("#startDate").val();
var endDate = $("#endDate").val();
var statisticalObj = $("#statisticalObj").val();
//开始和结束时间
var startTime = Date.parse(new Date(startDate));
var endTime = Date.parse(new Date(endDate));
datas = {}; // 清空之前数据
datas.gsdm = gsdm;
datas.fgsdm = fgsdm;
datas.lineCode = lineAll;
datas.timeType = "m";
datas.startDate = startDate;
datas.endDate = endDate;
datas.destroy = $("#destroy").val();
datas.statisticalObj = $("#statisticalObj").val();
datas.itemDetails = $("#itemDetails").val();
var itemDetails = datas.itemDetails,
type = "加注量[全部]";
if(itemDetails=="jzl0"){
type = "加注量[0#]"
} else if(itemDetails=="jzl-10"){
type = "加注量[-10#]"
} else if(itemDetails=="yhl"){
type = "油耗量"
} else if(itemDetails=="cccy"){
type = "出场存油"
} else if(itemDetails=="jccy"){
type = "进场存油"
} else if(itemDetails=="bglyh"){
type = "百公里油耗"
} else if(itemDetails=="zgl"){
type = "总公里"
} else if(itemDetails=="jhgl"){
type = "计划公里"
} else if(itemDetails=="jclm"){
type = "进场路码"
} else if(itemDetails=="cclm"){
type = "出场路码"
} else if(itemDetails=="sjbc"){
type = "实际班次"
} else if(itemDetails=="jhbc"){
type = "计划班次"
} else if(itemDetails=="dh"){
type = "耗电量"
} else if(itemDetails=="cdl"){
type = "充电量"
} else if(itemDetails=="cccd"){
type = "出场存电"
} else if(itemDetails=="jccd"){
type = "进场存电"
} else if(itemDetails=="bgldh"){
type = "百公里电耗"
}
datas.name = datas.startDate+"-"+datas.endDate+"-路单线路明细月报表("+type+")";
if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
layer.msg('请选择时间段!');
}else if(endTime<startTime){
layer.msg('结束日期不能小于开始日期!');
}else {
if (endDate.substring(0, 7) != startDate.substring(0, 7)) {
layer.msg("请查询同月份数据!");
return;
} else {
var lodingI = layer.load(2);
$get('/calcWaybill/calcDetailMonthly', datas, function (rs) {
if (rs.length <=0) {
layer.close(lodingI);
layer.open({
title: '提示'
, content: '没有您要查询的数据,请重新选择参数!'
});
$("#export").attr('disabled',"true");
return;
}else
$("#export").removeAttr("disabled");
var htmlHead = "<tr><td colspan='"+rs[0].length+"'>"+datas.name+"</td></tr>", htmlBody = "";
var rsLength = rs.length;
rs.forEach(function (o, i) {
var html = "<tr>"
o.forEach(function (td, j) {
var colspan;
if (i == rsLength - 1 && j == 0) {
colspan = (statisticalObj == "xl" ? "colspan='3'" : "colspan='5'");
if(statisticalObj == "cl")
colspan = "colspan='6'";
}
html += "<td " + colspan + ">" + td + "</td>"
});
html += "</tr>"
if (i == 0) {
htmlHead += html;
} else
htmlBody += html;
});
$('#forms_head thead').html(htmlHead);
$('#forms_body tbody').html(htmlBody);
layer.close(lodingI);
});
}
}
});
$("#export").on("click",function(){
$post("/report/calcDetailMonthlyE",datas,function(result){
window.open("/downloadFile/download?fileName="+datas.name);
});
});
});
</script>
<!--<script type="application/javascript" src="/pages/forms/calc/calcDetailMonthly.js"></script>-->