add.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
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
<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><a href="list.html" data-pjax>进场场油量</a> <i class="fa fa-circle"></i></li>
<li><span class="active">进场站油量信息编辑</span></li>
</ul>
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">
<i class="icon-equalizer font-red-sunglo"></i> <span
class="caption-subject font-red-sunglo bold uppercase">表单</span>
</div>
</div>
<div class="portlet-body form">
<form action="/addYlb" class="form-horizontal" id="ylb_add_form" >
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
您的输入有误,请检查下面的输入项
</div>
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">线路</label>
<div class="col-md-4">
<select class="form-control" name="xlbm" id="xlbm" ></select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">内部编码</label>
<div class="col-md-4">
<select class="form-control" name="nbbm" id="nbbm" ></select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">日期</label>
<div class="col-md-4">
<input type="text" class="form-control" name="rq" id="date">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">开始营运日期</label>
<div class="col-md-4">
<input type="text" class="form-control" name="jhsj" >
<span class="help-block"> 如:12:12</span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">驾驶员</label>
<div class="col-md-4">
<select class="form-control" name="jsy" id="jsy"> </select>
<input type="hidden" name="ssgsdm" id="ssgsdm" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">出场里程</label>
<div class="col-md-4">
<input type="text" class="form-control" name="czlc" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">出场油量</label>
<div class="col-md-4">
<input type="text" class="form-control" name="czyl" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">加油量</label>
<div class="col-md-4">
<input type="text" class="form-control" name="jzl" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">进场油量</label>
<div class="col-md-4">
<input type="text" class="form-control" name="jzyl" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">油耗</label>
<div class="col-md-4">
<input type="text" class="form-control" name="yh" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">燃油类型</label>
<div class="col-md-4">
<input type="text" class="form-control" name="rylx" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">尿素</label>
<div class="col-md-4">
<input type="text" class="form-control" name="ns" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">进场里程</label>
<div class="col-md-4">
<input type="text" class="form-control" name="jzlc" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">损耗原因</label>
<div class="col-md-4">
<input type="text" class="form-control" name="shyy" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">损耗油量</label>
<div class="col-md-4">
<input type="text" class="form-control" name="sh" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">行驶总里程</label>
<div class="col-md-4">
<input type="text" class="form-control" name="zlc" >
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-4">
<button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
<a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
</div>
</div>
</div>
</form>
<!-- END FORM-->
</div>
</div>
<script>
(function(){
$("#date").datetimepicker({
format : 'YYYY-MM-DD',
locale : 'zh-cn'
});
//搜索线路
$('#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>';
}
}
})
$('#jsy').select2({
placeholder: '搜索驾驶员...',
ajax: {
url: '/personnel/sreachPersonnel',
dataType: 'json',
delay: 150,
data: function(params){
return{jobCode: 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){
$("#ssgsdm").val(repo.gs);
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(){
/* $get('/role/all',null,function(result){
$.each(result,function(i,obj){
$("#role").append("<option value='"+obj.id+"'>"+obj.roleName+"</option>");
});
}); */
var form = $('#ylb_add_form');
var error = $('.alert-danger', form);
//表单 validate
form.validate({
errorElement : 'span',
errorClass : 'help-block help-block-error',
focusInvalid : false,
rules : {
'xlbm' : {
required : true,
maxlength: 25
},
'nbbm' : {
required : true,
maxlength: 25
},
'rq' : {
required : true,
maxlength: 25
},
'jsy' : {
required : true,
maxlength: 20
}
},
invalidHandler : function(event, validator) {
error.show();
App.scrollTo(error, -200);
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight : function(element) {
$(element).closest('.form-group').removeClass('has-error');
},
success : function(label) {
label.closest('.form-group').removeClass('has-error');
},
submitHandler : function(f) {
var params = form.serializeJSON();
error.hide();
console.log(params);
//检查一下用户是否存在
$post('/ylb/saveYlb', params, function(){
layer.msg('添加信息成功.');
loadPage('list.html');
});
// $get('/user/all', {userName_eq: params.userName}, function(list){
// if(!list || list.length == 0){
/* console.log(params);
$.ajax({
url: '/ylb/saveYlb',
type: 'POST',
traditional: true,
data: params,
success: function(res){
layer.msg('添加信息成功.');
loadPage('list.html');
}
}); */
/* $post('/user', params, function(res){
layer.msg('添加用户成功.');
loadPage('list.html');
}); */
// }
// else
// layer.alert('用户【' + params.userName + '】已存在', {icon: 2, title: '提交被拒绝'});
// });
}
});
});
})();
</script>