jyglEdit.html
6.45 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
<style type="text/css">
#edit_jygl.select2-dropdown{
background-color:white;
border:1px solid #aaa;
border-radius:4px;
box-sizing:border-box;
display:block;
position:absolute;
left:-100000px;
width:100%;
z-index:10510;}
</style>
<div class="modal fade" id="edit_jygl" role="basic"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true"></button>
<h4 class="modal-title">编辑加油信息</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" id="dir_edit_form"
action="/cwjy/savejzl" method="post">
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
您的输入有误,请检查下面的输入项
</div>
<input type="hidden" name="id" >
<input type="hidden" name="jylx" value="1" >
<input type="hidden" name="groupType" >
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">日期</label>
<div class="col-md-9">
<input type="text" class="form-control input-medium" id="yyrq" name="yyrq" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">内部编号</label>
<div class="col-md-9">
<input type="text" class="form-control input-medium" id="nbbm" name="nbbm" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">驾驶员</label>
<div class="col-md-9">
<select class="form-control input-medium" name="jsy" id="jsy"> </select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">加注量</label>
<div class="col-md-9">
<input type="text" class="form-control input-medium" id="jzl" name="jzl" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">加油站</label>
<div class="col-md-9">
<input type="text" class="form-control input-medium" id="stationid" name="stationid" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">加油类型</label>
<div class="col-md-9">
<input type="text" class="form-control input-medium" id="nylx" name="nylx" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">油价</label>
<div class="col-md-9">
<input type="text" class="form-control input-medium" id="yj" name="yj" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">备注</label>
<div class="col-md-9">
<input type="text" class="form-control input-medium" id="bz" name="bz" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">路单工号</label>
<div class="col-md-9">
<input type="text" disabled="disabled" class="form-control input-medium" id="ldgh" name="ldgh" >
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="editDirButton">提交数据</button>
</div>
</div>
</div>
</div>
<script data-exclude=1>
$(function() {
//modal 显示事件
var nbbm=$("#nbbh").val();
var rq=$("#rq").val();
var params={};
params['nbbm']=nbbm;
params['rq']=rq;
// if(nbbm && rq){
$get('/cwjy/bynbbm',params,function(obj){
$("#yyrq").attr('value',rq);
$("#nbbm").attr('value',obj.nbbm);
$("#select2-jsy-container").attr('value',obj.jsy);
$("#select2-jsy-container").html(obj.jsy);
$("#jzl").attr('value',obj.jzl);
$("#stationid").attr('value',obj.stationid);
$("#nylx").attr('value',obj.nylx);
$("#yj").attr('value',obj.yj);
$("#bz").attr('value',obj.bz);
$("#ldgh").attr('value',obj.ldgh);
});
$('#edit_jygl').modal('show');
var form = $('#dir_edit_form');
var error = $('.alert-danger', form);
//提交
$('#editDirButton').on('click', function() {
form.submit();
});
//form validate
form.validate({
errorElement : 'span',
errorClass : 'help-block help-block-error',
focusInvalid : false,
rules : {
jzl : {
number:true,
required : true,
min:0
},
yj : {
number :true,
min:0
}
},
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();
$post('/cwjy/savejzl', params, function(res){
layer.msg('添加成功.');
refreshJsTree();
$('#edit_jygl').modal('hide');
});
}
});
$('#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){
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>';
}
}
});
});
</script>