list.html
14.7 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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
<div class="page-head">
<div class="page-title">
<h1>进出场存油量</h1>
</div>
</div>
<ul class="page-breadcrumb breadcrumb">
<li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
<li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li>
<li><span class="active">进出场存油量</span></li>
</ul>
<div class="row">
<div class="col-md-12">
<!-- Begin: life time stats -->
<div class="portlet light portlet-fit portlet-datatable bordered">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-fire-extinguisher"></i> <span
class="caption-subject font-dark sbold uppercase">进出场存油量表</span>
</div>
<div class="actions">
<a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
<!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> -->
<button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i> 拆分/保存</button>
<!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
<div class="btn-group">
<a class="btn red btn-outline btn-circle" href="javascript:;"
data-toggle="dropdown"> <i class="fa fa-share"></i> <span
class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
<li><a href="javascript:;" data-action="0"
class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息
</a></li>
<li><a href="javascript:;" data-action="1"
class="tool-action" id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场)
</a></li>
<li><a href="javascript:;" id="checkYl" data-action="3"
class="tool-action"> <i class="fa fa-gg-circle"></i>
核对加注量(有加油无里程)
</a></li>
<li class="divider"></li>
<li><a href="javascript:;" data-action="3"
class="tool-action"> <i class="fa fa-file-excel-o"></i>
导出Excel
</a></li>
</ul>
</div>
</div>
</div>
<div class="portlet-body">
<div class="table-container" style="margin-top: 10px">
<table
class="table table-striped table-bordered table-hover table-checkable"
id="datatable_ylb">
<thead>
<tr role="row" class="filter">
<td colspan="3">
公司:
<select name="ssgsdm">
<option value="">请选择...</option>
<option value="1">可用</option>
<option value="0">禁用</option>
</select>
</td>
<td colspan="3">
<!-- <select name="fgsdm"> -->
<!-- <option value="">请选择...</option> -->
<!-- <option value="1">可用</option> -->
<!-- <option value="0">禁用</option> -->
<!-- </select> -->
日期:
<input type="text" style="width: 80px" name="rq" id="rq"/>
</td>
<td colspan="2">
线路:
</td>
<td colspan="3">
<select class="form-control" name="xlbm" id="xlbm" style="width: 120px;"></select>
</td>
<td colspan="2">
内部编码:
</td>
<td colspan="3">
<select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;" ></select>
</td>
<td colspan="4">
<button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
<i class="fa fa-search"></i> 搜索</button>
<button class="btn btn-sm red btn-outline filter-cancel">
<i class="fa fa-times"></i> 重置</button>
</td>
</tr>
<tr role="row" class="heading">
<th width="2%">#</th>
<th width="8%">日期</th>
<th width="5%">公司</th>
<th width="8%">线路</th>
<th width="5%">自编号</th>
<th width="6%">驾驶员</th>
<th width="4%">加油量</th>
<th width="5%">出场公里</th>
<th width="4%">进场公里</th>
<th width="4%">出场存油</th>
<th width="4%">进场存油</th>
<th width="5%">油耗</th>
<th width="5%">燃油类型</th>
<th width="4%">尿素</th>
<th width="5%">耗损原因</th>
<th width="5%">耗损油量</th>
<th width="5%">当日总里程</th>
<th width="5%">数据类型</th>
<th width="5%">百公里油耗</th>
<th width="5%">操作</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div style="text-align: right;">
<ul id="pagination" class="pagination"></ul>
</div>
</div>
</div>
</div>
</div>
</div>
<script id="ylb_list_temp" type="text/html">
{{each list as obj i}}
<tr>
<td style="vertical-align: middle;">
<input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
</td>
<td>
{{obj.rq}}
</td>
<td>
{{obj.gsname}}
</td>
<td>
{{obj.xlname}}
</td>
<td>
{{obj.nbbm}}
</td>
<td>
{{obj.jsy}}
</td>
<td>
{{obj.jzl}}
</td>
<td>
{{obj.czlc}}
</td>
<td>
{{obj.jzlc}}
</td>
<td>
{{obj.czyl}}
</td>
<td>
<a href="javascript:startOptJzylLink('jzyl{{obj.id}}')" id="jzyl{{obj.id}}" >
{{obj.jzyl}}
</a>
</td>
<td>
{{obj.yh}}
</td>
<td>
{{obj.rylx}}
</td>
<td>
{{obj.ns}}
</td>
<td>
{{obj.shyy}}
</td>
<td>
{{obj.sh}}
</td>
<td>
{{obj.zlc}}
</td>
<td>
{{obj.yhlx}}
</td>
<td>
{{obj.bglyh}}
</td>
<td>
<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>
</td>
</tr>
{{/each}}
{{if list.length == 0}}
<tr>
<td colspan=20><h6 class="muted">没有找到相关数据</h6></td>
</tr>
{{/if}}
</script>
<script>
$(function(){
$("#checkYl").on('click',function(){
console.log("核对加注量");
if($("#rq").val()!=""){
var cells = $('tr.filter')[0].cells
,params = {}
,name;
$.each(cells, function(i, cell){
var items = $('input,select', cell);
for(var j = 0, item; item = items[j++];){
name = $(item).attr('name');
if(name){
params[name] = $(item).val();
}
}
});
$get('/ylb/checkYl', params, function(){
jsDoQuery(null,true);
});
}else{
layer.msg('请选择日期.');
}
})
//进场等于出场
$("#outAndIn").on('click',function(){
console.log("进场油量等于出场油量");
if($("#rq").val()!=""){
var cells = $('tr.filter')[0].cells
,params = {}
,name;
$.each(cells, function(i, cell){
var items = $('input,select', cell);
for(var j = 0, item; item = items[j++];){
name = $(item).attr('name');
if(name){
params[name] = $(item).val();
}
}
});
$get('/ylb/outAndIn', params, function(){
jsDoQuery(null,true);
});
}else{
layer.msg('请选择日期.');
}
})
//拆分
$("#sortButton").on('click',function(){
console.log("拆分油量");
if($("#rq").val()!=""){
var id = $('input.icheck:checked').data('id');
if(typeof(id)=='undefined'){
layer.msg("请选择一行进行拆分");
}else{
//获取输入的进场存油
var jzyl=$("#jzyl"+id).html();
var params = {};
params['jzyl']=jzyl;
params['id']=id;
$get('/ylb/sort', params, function(){
jsDoQuery(null,true);
});
}
}else{
layer.msg('请选择日期.');
}
})
//获取加存信息
$("#obtain").on('click', function(){
console.log("获取加存");
if($("#rq").val()!=""){
var cells = $('tr.filter')[0].cells
,params = {}
,name;
$.each(cells, function(i, cell){
var items = $('input,select', cell);
for(var j = 0, item; item = items[j++];){
name = $(item).attr('name');
if(name){
params[name] = $(item).val();
}
}
});
$get('/ylb/obtain', params, function(){
console.log("----------------------");
jsDoQuery(null,true);
});
}else{
layer.msg('请选择日期.');
}
})
$("#rq").datetimepicker({
format : 'YYYY-MM-DD',
locale : 'zh-cn'
});
if($("#rq").val()!=""){
jsDoQuery(null,true);
}
var page = 0, initPagination;
var icheckOptions = {
radioClass: 'iradio_square-blue icheck',
increaseArea: '20%'
}
//重置
$('tr.filter .filter-cancel').on('click', function(){
$('tr.filter input, select').val('').change();
});
//提交
$('tr.filter .filter-submit').on('click', function(){
if($("#rq").val()!=""){
var cells = $('tr.filter')[0].cells
,params = {}
,name;
$.each(cells, function(i, cell){
var items = $('input,select', cell);
for(var j = 0, item; item = items[j++];){
name = $(item).attr('name');
if(name){
params[name] = $(item).val();
}
}
});
page = 0;
jsDoQuery(params, true);
}else{
layer.msg('请选择日期.');
}
});
/*
* 获取数据 p: 要提交的参数, pagination: 是否重新分页
*/
function jsDoQuery(p, pagination){
var params = {};
if(p)
params = p;
//更新时间排序
console.log(params);
params['order'] = 'nbbm';
params['page'] = page;
params['rq']=$("#rq").val();
var i = layer.load(2);
console.log(params);
$get('/ylb' ,params, function(data){
$.each(data.content, function(i, obj) {
obj.rq = moment(obj.rq).format("YYYY-MM-DD");
});
var bodyHtm = template('ylb_list_temp', {list: data.content});
$('#datatable_ylb tbody').html(bodyHtm)
.find('.icheck').iCheck(icheckOptions)
.on('ifChanged', iCheckChange);
if(pagination && data.content.length > 0){
//重新分页
initPagination = true;
showPagination(data);
}
layer.close(i);
});
}
function iCheckChange(){
var tr = $(this).parents('tr');
if(this.checked)
tr.addClass('row-active');
else
tr.removeClass('row-active');
/* if($('#datatable_resource input.icheck:checked').length == 1)
$('#removeButton').removeAttr('disabled');
else
$('#removeButton').attr('disabled', 'disabled'); */
}
function showPagination(data){
//分页
$('#pagination').jqPaginator({
totalPages: data.totalPages,
visiblePages: 6,
currentPage: page + 1,
first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
onPageChange: function (num, type) {
if(initPagination){
initPagination = false;
return;
}
page = num - 1;
jsDoQuery(null, false);
}
});
}
//删除
$('#removeButton').on('click', function(){
if($(this).attr('disabled'))
return;
var id = $('input.icheck:checked').data('id');
removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
$('tr.filter .filter-submit').click();
});
});
//搜索线路
$('#xlbm').select2({
placeholder: '搜索线路...',
ajax: {
url: '/realSchedule/findLine',
type: 'post',
dataType: 'json',
delay: 150,
data: function(params){
return{line: params.term};
},
processResults: function (data) {
return {
results: data
};
},
cache: true
},
templateResult: function(repo){
if (repo.loading) return repo.text;
var h = '<span>'+repo.text+'</span>';
return h;
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1,
templateSelection: function(repo){
return repo.text;
},
language: {
noResults: function(){
return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>';
},
inputTooShort : function(e) {
return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>';
},
searching : function() {
return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>';
}
}
});
$('#nbbm').select2({
placeholder: '搜索车辆...',
ajax: {
url: '/realSchedule/sreachVehic',
dataType: 'json',
delay: 150,
data: function(params){
return{nbbm: params.term};
},
processResults: function (data) {
return {
results: data
};
},
cache: true
},
templateResult: function(repo){
if (repo.loading) return repo.text;
var h = '<span>'+repo.text+'</span>';
h += (repo.lineName?' <span class="select2-desc">'+repo.lineName+'</span>':'');
return h;
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1,
templateSelection: function(repo){
return repo.text;
},
language: {
noResults: function(){
return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
},
inputTooShort : function(e) {
return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
},
searching : function() {
return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
}
}
})
});
//改变状态
function startOptJzylLink(id){
$('#'+id).editable({
type: 'text',
placement: 'right',
width:100,
display: false,
validate: function(value){
if(!value)
return '值不能为空!';
if(isNaN(value))
return '只能为数字!';
if(value<0)
return '值不能小于0!';
},
inputclass: 'form-control input-medium input-edtable-sm'
})
.on('save', function(e, params) {
$('#'+id).text(params.newValue);
});
}
</script>