calcjsyspy.html
10.5 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
<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;
text-align: center; }
.table > tbody + tbody {
border-top: 1px solid; }
</style>
<div class="page-head">
<div class="page-title">
<h1>人车班次公里统计</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="portlet light porttlet-fit bordered">
<div class="portlet-title">
<form class="form-inline" action="">
<div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_manth">
<span class="item-label" style="width: 80px;">公司: </span>
<select class="form-control" name="company" id="gsdmManth" style="width: 140px;"></select>
</div>
<div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_manth">
<span class="item-label" style="width: 80px;">分公司: </span>
<select class="form-control" name="subCompany" id="fgsdmManth" style="width: 140px;"></select>
</div>
<div style="display: inline-block;margin-left: 10px">
<span class="item-label" style="width: 150px;">线路: </span>
<select class="form-control" name="line" id="line" style="width: 136px;"></select>
</div>
<div style="margin-top: 10px">
</div>
<div style="display: inline-block;margin-left: 5px;">
<span class="item-label" style="width: 80px;">开始时间: </span>
<input class="form-control" type="text" id="startDate" style="width: 140px;"/>
</div>
<div style="display: inline-block;margin-left: 10px;">
<span class="item-label" style="width: 80px;">结束时间: </span>
<input class="form-control" type="text" id="endDate" style="width: 140px;"/>
</div>
<div style="display: inline-block;margin-left: 10px">
<span class="item-label" style="width: 80px;">统计: </span>
<select class="form-control" style="width: 136px;" id='empnames'>
<option value="驾驶员">驾驶员</option>
<option value="售票员">售票员</option>
<option value="车辆自编号">车辆自编号</option>
</select>
</div>
<div style="display: inline-block;margin-left: 0px">
<span class="item-label" style="width: 150px;">:</span>
<input class="form-control" name="cont" id="cont" style="width: 136px;"></input>
</div>
<div class="form-group">
<input class="btn btn-default" type="button" id="query" value="筛选"/>
<input class="btn btn-default" type="button" id="export" value="导出"/>
</div>
</form>
</div>
<div class="portlet-body">
<div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
<table class="table table-bordered table-hover table-checkable" id="forms">
<thead>
<tr>
<th>序号</th>
<th id='empname'>驾驶员</th>
<th>计划营运班次</th>
<th>实际营运班次</th>
<th>烂班班次</th>
<th>临加班次</th>
<th>计划总里程</th>
<th>计划营运里程</th>
<th>计划空驶里程</th>
<th>实际总里程</th>
<th>实际营运里程</th>
<th>实际空驶里程</th>
<th>烂班里程</th>
<th>临加营运里程</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
$(function(){
// 关闭左侧栏
if (!$('body').hasClass('page-sidebar-closed'))
$('.menu-toggler.sidebar-toggler').click();
var d = new Date();
d.setTime(d.getTime() - 1*1000*60*60*24);
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,#endDate").datetimepicker({
format : 'YYYY-MM-DD',
locale : 'zh-cn',
maxDate : dateTime
});
$("#startDate,#endDate").val(year + "-" + month + "-" + day);
var fage=false;
var obj = [];
var xlList;
$.get('/report/lineList',function(result){
xlList=result;
$.get('/user/companyData', function(result){
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_manth").css('display','none');
$('#fgsdmDiv_manth').css('display','none');
}else if(obj.length ==1){
$("#gsdmDiv_manth").css('display','none');
if(obj[0].children.length == 1 || obj[0].children.length ==0)
$('#fgsdmDiv_manth').css('display','none');
}
$('#gsdmManth').html(options);
updateCompany();
});
})
$("#gsdmManth").on("change",updateCompany);
function updateCompany(){
var company = $('#gsdmManth').val();
var options = '<option value="">全部分公司</option>';
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++){
options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
}
}
}
$('#fgsdmManth').html(options);
}
var tempData = {};
$.get('/report/lineList',function(xlList){
var data = [];
data.push({id: " ", text: "全部线路"});
$.get('/user/companyData', function(result){
for(var i = 0; i < result.length; i++){
var companyCode = result[i].companyCode;
var children = result[i].children;
for(var j = 0; j < children.length; j++){
var code = children[j].code;
for(var k=0;k < xlList.length;k++ ){
if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
}
}
}
}
initPinYinSelect2('#line',data,'');
});
});
$("#line").on("change", function(){
if($("#line").val() == " "){
$("#gsdmManth").attr("disabled", false);
$("#fgsdmManth").attr("disabled", false);
} else {
var temp = tempData[$("#line").val()].split(":");
$("#gsdmManth").val(temp[0]);
updateCompany();
$("#fgsdmManth").val(temp[1]);
$("#gsdmManth").attr("disabled", true);
// $("#fgsdmManth").attr("disabled", true);
}
});
var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = "";
$("#empnames").on("change",function(){
if(cont == "驾驶员"){
cont1 = $("#cont").val();
} else if(cont == "售票员"){
cont2 = $("#cont").val();
} else if(cont == "车辆自编号"){
cont3 = $("#cont").val();
}
cont = $("#empnames").val();
if($("#empnames").val() == "驾驶员"){
$("#cont").val(cont1);
} else if($("#empnames").val() == "售票员"){
$("#cont").val(cont2);
} else if($("#empnames").val() == "车辆自编号"){
$("#cont").val(cont3);
}
});
$("#query").on("click",function(){
if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
layer.msg("请选择时间范围!");
return;
}
if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
layer.msg("请选择时间范围!");
return;
}
$("#empname").html($("#empnames").val())
var params={};
params.empnames=$("#empnames").val();
params.cont = $("#cont").val();
params.line = $("#line").val();
params.startDate = $("#startDate").val();
params.endDate = $("#endDate").val();
params.lpName = $("#lpName").val();
params.gsdmManth= $("#gsdmManth").val();
params.fgsdmManth= $("#fgsdmManth").val();
var i = layer.load(2);
$get("/calc_mix/calcjsyspy",params,function(result){
var list_calcjsyspy = template('list_calcjsyspy',{list:result});
// 把渲染好的模版html文本追加到表格中
$('#forms tbody').html(list_calcjsyspy);
layer.close(i);
});
});
$("#export").on("click",function(){
var lineName = $('#line option:selected').text();
var startDate = $("#startDate").val();
var endDate = $("#endDate").val();
var params={};
params.empnames=$("#empnames").val();
params.cont = $("#cont").val();
params.line = $("#line").val();
params.startDate = $("#startDate").val();
params.endDate = $("#endDate").val();
params.lpName = $("#lpName").val();
params.gsdmManth= $("#gsdmManth").val();
params.fgsdmManth= $("#fgsdmManth").val();
params.lineName = lineName;
params.type='export';
var i = layer.load(2);
$get('/calc_export/waybilldayExport',params,function(result){
var dateTime = "";
if(startDate == endDate){
dateTime = moment(startDate).format("YYYYMMDD");
} else {
dateTime = moment(startDate).format("YYYYMMDD")
+"-"+moment(endDate).format("YYYYMMDD");
}
window.open("/downloadFile/download?fileName="
+dateTime+"-"+lineName+"-人车班次公里统计");
layer.close(i);
});
});
});
</script>
<script type="text/html" id="list_calcjsyspy">
{{each list as obj i}}
<tr>
<td>{{i+1}}</td>
<td>{{obj.jName}}</td>
<td>{{obj.jhyybc}}</td>
<td>{{obj.sjyybc}}</td>
<td>{{obj.lbbc}}</td>
<td>{{obj.ljbc}}</td>
<td>{{obj.jhzlc}}</td>
<td>{{obj.jhyylc}}</td>
<td>{{obj.jhfyylc}}</td>
<td>{{obj.sjzlc}}</td>
<td>{{obj.sjyylc}}</td>
<td>{{obj.sjfyylc}}</td>
<td>{{obj.lblc}}</td>
<td>{{obj.ljyylc}}</td>
</tr>
{{/each}}
{{if list.length == 0}}
<tr>
<td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
</tr>
{{/if}}
</script>