提交 | 用户 | 时间
|
58d006
|
1 |
/** |
A |
2 |
* date: |
|
3 |
* author: neeler |
|
4 |
*/ |
|
5 |
|
|
6 |
//test data start |
|
7 |
// var data_getList = Mock.mock('/task/getList.htm', {code: 0, 'list|6-30': [{bussinessNo: 'bussinessNo', vehicleId: 'vehicleId', fdnum: 'fdnum', fdweight: 'fdweight', driver: 'driver', phone: 'phone', dcompany: 'dcompany', rcompany: 'rcompany', invitecode: 'invitecode', hasCard: false}], pages: 12}) |
|
8 |
// var data_getVehicleList = Mock.mock('/business/getVehicleList.htm', {code: 0, 'list|5-30': [{vehicleId: 'vehicleId', feature: 'feature', note: 'note', fdnum: 'fdnum', fdweight: '4.551', vehicleweight: 'vehicleweight', loadweight: '51.111', driver: 'driver', phone: 'phone'}]}) |
|
9 |
// var data_validVehicle = Mock.mock('/business/validVehicle.htm', {code: 0, errmsg: '车牌号不能使用!'}) |
|
10 |
// var data_changeVehicle = Mock.mock('/task/changeVehicle.htm', {code: 0, }) |
|
11 |
// var data_doDel = Mock.mock('/task/delItem.htm', {code: 0, errmsg: '不能删除!'}) |
|
12 |
// var data_send = Mock.mock('/task/send.htm', {code: 0, }) |
|
13 |
// var data_resend = Mock.mock('/task/resend.htm', {code: 0, item: '23333'}) |
|
14 |
//test data end |
|
15 |
|
|
16 |
var TYPE = ['千克' ,'吨' ] |
|
17 |
|
|
18 |
window.I = { |
|
19 |
PZ: 30, |
|
20 |
keyword: $('#keyword'), |
|
21 |
searchBtn: $('#searchBtn'), |
|
22 |
_page: !!$('#p').val() ? $('#p').val() - 1 : 0, |
|
23 |
keywordValue: $('#k').val(), |
|
24 |
newObj: $('#newObj'), |
|
25 |
modal: $('#modal'), |
|
26 |
save: $('#save'), |
|
27 |
vehicleModal: $('#vehicleModal'), |
|
28 |
tempVehicleModal: $('#tempVehicleModal'), |
|
29 |
vehicleKeyword: $('#vehicleKeyword'), |
|
30 |
refreshVehicleBtn: $('#refreshVehicleBtn'), |
|
31 |
searchVehicleBtn: $('#searchVehicleBtn'), |
|
32 |
addTempVehicle: $('#addTempVehicle'), |
|
33 |
vehicleBindBtn: $('#vehicleBindBtn'), |
|
34 |
tempVehicleSaveBtn: $('#tempVehicleSaveBtn'), |
|
35 |
sendBtn: $('#sendBtn') |
|
36 |
} |
|
37 |
|
|
38 |
var Obj = { |
|
39 |
vehicleId: '豫A', |
|
40 |
driver: '', |
|
41 |
phone: '', |
|
42 |
IDNum: '', |
|
43 |
vehicleweight: '', |
|
44 |
loadweight: '', |
|
45 |
note: '', |
|
46 |
feature: '' |
|
47 |
} |
|
48 |
|
|
49 |
var ViewModel = function() { |
|
50 |
var self = this; |
|
51 |
self.isAdmin = ko.observable(typeof(parent.G) != 'undefined' ? parent.G.isAdmin : false); |
|
52 |
self.tList = ko.observableArray(); |
|
53 |
self.mtid = ko.observable(); |
|
54 |
self.o = ko.observable(ko.mapping.fromJS(Obj)); |
|
55 |
|
|
56 |
self.keyword = ko.observable(I.keywordValue); |
|
57 |
self.list = ko.observableArray(); |
|
58 |
|
|
59 |
self.edit = function(item) { |
|
60 |
doEdit(item); |
|
61 |
} |
|
62 |
self.del = function(item) { |
|
63 |
delConfirm(item); |
|
64 |
} |
|
65 |
|
|
66 |
self.change = function() { |
|
67 |
doOpen(); |
|
68 |
} |
|
69 |
self.mtvalid=function(item){ |
|
70 |
doValid(item); |
|
71 |
} |
|
72 |
|
|
73 |
self.tyList = ko.observableArray(TYPE); |
|
74 |
self.resend = function(item) { |
|
75 |
doResend(item); |
|
76 |
} |
|
77 |
|
|
78 |
self.details = function(item) { |
|
79 |
newTab(item); |
|
80 |
} |
|
81 |
self.vehicleTasks = function(item) { |
|
82 |
gotoVehicleDetails(item); |
|
83 |
} |
|
84 |
self.changeVehicle = function () { |
|
85 |
I.vehicleModal.modal('show'); |
|
86 |
} |
|
87 |
self.vList = ko.observableArray(); |
|
88 |
|
8d48c5
|
89 |
self.getSdepartName = function (sdepartNo) { |
H |
90 |
if(sdepartNo == '08') return "义瑞新材"; |
|
91 |
if(sdepartNo == '04') return "明泰科技"; |
|
92 |
if(sdepartNo == '06') return "郑州明泰"; |
|
93 |
} |
58d006
|
94 |
//厂区 |
A |
95 |
self.cqVal=ko.observable(0); |
|
96 |
self.cqList=ko.observableArray(); |
|
97 |
self.cqchange=function(){ |
|
98 |
doOpen(); |
|
99 |
} |
|
100 |
|
|
101 |
} |
|
102 |
|
|
103 |
$(function () { |
|
104 |
window.vm = new ViewModel(); |
|
105 |
ko.applyBindings(vm); |
|
106 |
// doSearch(); |
|
107 |
// getVehicleList(); |
|
108 |
getcqList(); |
|
109 |
autoHeight(); |
|
110 |
if (vm.isAdmin()) { |
|
111 |
getCompanyList(); |
|
112 |
} |
|
113 |
pageInit(); |
|
114 |
}); |
|
115 |
|
8d48c5
|
116 |
|
58d006
|
117 |
function pageInit() { |
A |
118 |
I.sendBtn.click(function (e) { |
|
119 |
e.preventDefault(); |
|
120 |
doSend(); |
|
121 |
}); |
|
122 |
I.tempVehicleSaveBtn.click(function (e) { |
|
123 |
e.preventDefault(); |
|
124 |
if (valid()) { |
|
125 |
validVehicle(); |
|
126 |
} |
|
127 |
}); |
|
128 |
I.vehicleBindBtn.click(function (e) { |
|
129 |
e.preventDefault(); |
|
130 |
if ($('.vitem.info').length) { |
|
131 |
doVehicleBind(); |
|
132 |
} else { |
|
133 |
parent.showErrmsg('请选择一个车辆!'); |
|
134 |
} |
|
135 |
}); |
|
136 |
I.addTempVehicle.click(function (e) { |
|
137 |
e.preventDefault(); |
|
138 |
vm.o(ko.mapping.fromJS(Obj)); |
|
139 |
I.vehicleModal.modal('hide'); |
|
140 |
I.tempVehicleModal.modal('show'); |
|
141 |
}); |
|
142 |
I.tempVehicleModal.on('hidden.bs.modal', function (e) { |
|
143 |
clearError(); |
|
144 |
}); |
|
145 |
I.vehicleKeyword.keyup(function (e) { |
|
146 |
// updateVList(); |
|
147 |
}); |
|
148 |
I.searchVehicleBtn.click(function (e) { |
|
149 |
e.preventDefault(); |
|
150 |
// updateVList(); |
|
151 |
}); |
|
152 |
I.refreshVehicleBtn.click(function (e) { |
|
153 |
e.preventDefault(); |
|
154 |
// getVehicleList(); |
|
155 |
}); |
|
156 |
$('.main-table').scroll(function() { |
|
157 |
$('.th').css('top', $(this).scrollTop()); |
|
158 |
}) |
|
159 |
I.newObj.click(function(event) { |
|
160 |
vm.o(ko.mapping.fromJS(Obj)); |
|
161 |
// getNewNo(); |
|
162 |
I.modal.modal('show'); |
|
163 |
}); |
|
164 |
I.searchBtn.click(function(event) { |
|
165 |
doOpen(); |
|
166 |
}); |
|
167 |
I.modal.on('hidden.bs.modal', function (e) { |
|
168 |
clearError(); |
|
169 |
}); |
|
170 |
I.keyword.on(ISIE ? 'keydown' : 'keyup', function (event) { |
|
171 |
if (event.keyCode == 13) { |
|
172 |
doOpen(); |
|
173 |
} |
|
174 |
}); |
|
175 |
} |
|
176 |
|
|
177 |
function doOpen() { |
|
178 |
doSearch(); |
|
179 |
} |
|
180 |
|
|
181 |
function doSearch() { |
|
182 |
getList(vm.keyword(), vm.mtid(), I._page, I.PZ, 1); |
|
183 |
} |
|
184 |
|
|
185 |
function doSend() { |
|
186 |
if (!!I.Ajaxsend) { |
|
187 |
return; |
|
188 |
} |
|
189 |
showErrmsg('该方法已取消,不能使用!'); |
|
190 |
return ; |
|
191 |
I.Ajaxsend = true; |
|
192 |
I.sendBtn.prop('disabled', true); |
|
193 |
$.post("/task/send.htm", null, |
|
194 |
function (data, textStatus, jqXHR) { |
|
195 |
I.Ajaxsend = false; |
|
196 |
I.sendBtn.prop('disabled', false); |
|
197 |
if (data.code >= 1) { |
|
198 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
199 |
return; |
|
200 |
} |
|
201 |
if (data.code == 0) { |
|
202 |
showErrmsg('发送成功!'); |
|
203 |
return; |
|
204 |
} |
|
205 |
}, |
|
206 |
"json" |
|
207 |
); |
|
208 |
} |
|
209 |
|
|
210 |
function doVehicleBind() { |
|
211 |
I.vehicleBindBtn.prop('disabled', true); |
|
212 |
var bussinessNo = $('.titem.info').attr('data-no'); |
|
213 |
var vehicle = null; |
|
214 |
var indx = $('.vitem.info').attr('data-indx'); |
|
215 |
$.each(vm.vList(), function (index, value) { |
|
216 |
if (value.indx === indx) { |
|
217 |
vehicle = value; |
|
218 |
} |
|
219 |
}); |
|
220 |
changeVehicle(bussinessNo, vehicle); |
|
221 |
} |
|
222 |
|
|
223 |
function changeVehicle(bussinessNo, vehicle) { |
|
224 |
if (!!I.AjaxchangeVehicle) { |
|
225 |
return; |
|
226 |
} |
|
227 |
I.AjaxchangeVehicle = true; |
|
228 |
$.post("/task/changeVehicle.htm", {bussinessNo: bussinessNo, vehicle: $.toJSON(vehicle)}, |
|
229 |
function (data, textStatus, jqXHR) { |
|
230 |
I.AjaxchangeVehicle = false; |
|
231 |
I.vehicleBindBtn.prop('disabled', false); |
|
232 |
I.tempVehicleSaveBtn.prop('disabled', false); |
|
233 |
if (data.code >= 1) { |
|
234 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
235 |
return; |
|
236 |
} |
|
237 |
if (data.code == 0) { |
|
238 |
showErrmsg('换车成功!'); |
|
239 |
doSearch(); |
|
240 |
I.vehicleModal.modal('hide'); |
|
241 |
I.tempVehicleModal.modal('hide'); |
|
242 |
return; |
|
243 |
} |
|
244 |
}, |
|
245 |
"json" |
|
246 |
); |
|
247 |
} |
|
248 |
|
|
249 |
function getList(keyword, companyNo, page, pagesize, pages) { |
|
250 |
I._page = page; |
|
251 |
$.post('/task/getList.htm', { |
|
252 |
searchword: keyword, |
|
253 |
companyNo: vm.isAdmin() ? companyNo : (typeof(parent.G) != 'undefined' ? parent.G.loginCompanyNo : 'ABCDEFG'), |
|
254 |
page: page, |
|
255 |
pagesize: pagesize, |
|
256 |
pages: pages, |
|
257 |
cqV:vm.cqVal() |
|
258 |
}, function(data, textStatus, xhr) { |
|
259 |
vm.list.removeAll(); |
|
260 |
if (data.code >= 1) { |
|
261 |
//parent.showErrmsg(data.errmsg); |
|
262 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
263 |
return; |
|
264 |
} |
|
265 |
if (data.code == 0) { |
|
266 |
if (isList(data.list)) { |
|
267 |
$.each(data.list, function(index, val) { |
|
268 |
val.invitecode=ko.observable(val.invitecode); |
|
269 |
val.hasCard = val.hasCard == 'true'; |
|
270 |
vm.list.push(val); |
|
271 |
}); |
|
272 |
$('.titem').click(function (e) { |
|
273 |
$('.titem').removeClass('info'); |
|
274 |
$(this).addClass('info'); |
|
275 |
}); |
|
276 |
} |
|
277 |
if (!!pages) { |
|
278 |
pages = data.pages; |
|
279 |
$('#pagdiv').unbind('page').empty(); |
|
280 |
if (pages > 1) { |
|
281 |
$('#pagdiv').bootpag({total: pages, maxVisible: 10, page: page + 1}).on('page',function(event,num){ |
|
282 |
getList(keyword, companyNo, num - 1, pagesize, 0); |
|
283 |
}); |
|
284 |
} |
|
285 |
} |
|
286 |
return; |
|
287 |
} |
|
288 |
}, 'json'); |
|
289 |
} |
|
290 |
|
|
291 |
function getVehicleList() { |
|
292 |
$.post("/business/getVehicleList.htm", { |
|
293 |
companyNo: vm.isAdmin() ? '' : (typeof(parent.G) != 'undefined' ? parent.G.loginCompanyNo : 'ABCDEFG'), |
|
294 |
vehicleId:'111111' |
|
295 |
}, |
|
296 |
function (data, textStatus, jqXHR) { |
|
297 |
I.VDB = []; |
|
298 |
if (data.code >= 1) { |
|
299 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
300 |
return; |
|
301 |
} |
|
302 |
if (data.code == 0) { |
|
303 |
if (isList(data.list)) { |
|
304 |
$.each(data.list, function (index, value) { |
|
305 |
value.indx = index + ''; |
|
306 |
value.lastweight = ''; |
|
307 |
if ($.isNumeric(value.loadweight) && $.isNumeric(value.fdweight)) { |
|
308 |
value.lastweight = (parseFloat(value.loadweight) - parseFloat(value.fdweight)).toFixed(3); |
|
309 |
} |
|
310 |
I.VDB.push(value); |
|
311 |
}); |
|
312 |
} |
|
313 |
updateVList(); |
|
314 |
return; |
|
315 |
} |
|
316 |
}, |
|
317 |
"json" |
|
318 |
); |
|
319 |
} |
|
320 |
|
|
321 |
function updateVList() { |
|
322 |
var str = I.vehicleKeyword.val(); |
|
323 |
vm.vList.removeAll(); |
|
324 |
if (!!str) { |
|
325 |
var reg = new RegExp(str); |
|
326 |
$.each(I.VDB, function (index, value) { |
|
327 |
if (reg.test(value.vehicleId)) { |
|
328 |
vm.vList.push(value); |
|
329 |
} |
|
330 |
}); |
|
331 |
} else { |
|
332 |
$.each(I.VDB, function (index, value) { |
|
333 |
vm.vList.push(value); |
|
334 |
}); |
|
335 |
} |
|
336 |
$('.vitem').click(function (e) { |
|
337 |
$('.vitem').removeClass('info'); |
|
338 |
$(this).addClass('info'); |
|
339 |
}); |
|
340 |
} |
|
341 |
|
|
342 |
function doTempVehicleBind() { |
|
343 |
I.tempVehicleSaveBtn.prop('disabled', false); |
|
344 |
var bussinessNo = $('.titem.info').attr('data-no'); |
|
345 |
var vehicle = ko.mapping.toJS(vm.o()); |
|
346 |
changeVehicle(bussinessNo, vehicle); |
|
347 |
} |
|
348 |
|
|
349 |
function validVehicle() { |
|
350 |
$.post("/business/validVehicle.htm", {vehicleId: ko.mapping.toJS(vm.o()).vehicleId.toUpperCase()}, |
|
351 |
function (data, textStatus, jqXHR) { |
|
352 |
if (data.code >= 1) { |
|
353 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
354 |
return; |
|
355 |
} |
|
356 |
if (data.code == 0) { |
|
357 |
doTempVehicleBind(); |
|
358 |
return; |
|
359 |
} |
|
360 |
}, |
|
361 |
"json" |
|
362 |
); |
|
363 |
} |
|
364 |
|
|
365 |
function valid(){ |
|
366 |
var isValid = false; |
|
367 |
var iF = $('#form'); |
|
368 |
iF.validate({ |
|
369 |
rules: { |
|
370 |
'vehicleId': { |
|
371 |
required: true, |
|
372 |
isPlateNumber: true |
|
373 |
}, |
|
374 |
'driver': { |
|
375 |
required: true, |
|
376 |
}, |
|
377 |
'phone': { |
|
378 |
required: true, |
|
379 |
isPhone: true |
|
380 |
}, |
|
381 |
'IDNum':{ |
|
382 |
required:true, |
|
383 |
} |
|
384 |
}, |
|
385 |
messages: { |
|
386 |
'vehicleId': { |
|
387 |
required: '不能为空!', |
|
388 |
isPlateNumber: '车牌号不正确!' |
|
389 |
}, |
|
390 |
'driver': { |
|
391 |
required: '不能为空!', |
|
392 |
}, |
|
393 |
'phone': { |
|
394 |
required: '不能为空!', |
|
395 |
isPhone: '手机号不正确!' |
|
396 |
}, |
|
397 |
'IDNum':{ |
|
398 |
required:'不能为空!' |
|
399 |
} |
|
400 |
}, |
|
401 |
errorPlacement: function (err, element) { |
|
402 |
var p = element.parents('.form-group').eq(0); |
|
403 |
var d = p.find('.text-error').eq(0); |
|
404 |
d.css('color', '#D9534F'); |
|
405 |
err.appendTo(d); |
|
406 |
} |
|
407 |
}) |
|
408 |
isValid = iF.valid(); |
|
409 |
return isValid; |
|
410 |
} |
|
411 |
|
|
412 |
function doEdit(item) { |
|
413 |
if(isFunction(item.valid)){ |
|
414 |
item.valid=item.valid(); |
|
415 |
} |
|
416 |
vm.o(ko.mapping.fromJS(item)); |
|
417 |
I.modal.modal('show'); |
|
418 |
} |
|
419 |
|
|
420 |
function delConfirm(item) { |
|
421 |
$("#modalContent").html('确定要取消【' + item.vehicleId + '】的派车任务吗?'); |
|
422 |
$("#dialog-confirm").removeClass('hide').dialog({ |
|
423 |
resizable: false, |
|
424 |
width: '320', |
|
425 |
modal: true, |
|
426 |
title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-exclamation-triangle red'></i>确认信息</h4></div>", |
|
427 |
title_html: true, |
|
428 |
position: { my: "center", at: "center", of: window }, |
|
429 |
buttons: [ |
|
430 |
{ |
|
431 |
html: "<i class='ace-icon fa fa-trash-o bigger-110'></i> 确定", |
|
432 |
"class" : "btn btn-danger btn-minier", |
|
433 |
click: function() { |
|
434 |
$( this ).dialog( "close" ); |
|
435 |
doDel(item); |
|
436 |
} |
|
437 |
} |
|
438 |
, |
|
439 |
{ |
|
440 |
html: "<i class='ace-icon fa fa-times bigger-110'></i> 取消", |
|
441 |
"class" : "btn btn-minier", |
|
442 |
click: function() { |
|
443 |
$( this ).dialog( "close" ); |
|
444 |
} |
|
445 |
} |
|
446 |
] |
|
447 |
}); |
|
448 |
} |
|
449 |
|
|
450 |
function doDel(item) { |
|
451 |
if (!!I.AjaxDelItem) return; |
|
452 |
I.AjaxDelItem = true; |
|
453 |
$.post('/task/delItem.htm', {bussinessNo: item.bussinessNo}, function(data, textStatus, xhr) { |
|
454 |
I.AjaxDelItem = false; |
|
455 |
if (data.code >= 1) { |
|
456 |
//parent.showErrmsg(data.errmsg); |
|
457 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
458 |
return; |
|
459 |
} |
|
460 |
if (data.code == 0) { |
|
461 |
vm.list.remove(item); |
|
462 |
parent.showErrmsg('删除成功!'); |
|
463 |
return; |
|
464 |
} |
|
465 |
}, 'json'); |
|
466 |
} |
|
467 |
|
|
468 |
function doSave() { |
|
469 |
if (!I.AjaxSaveItem &&valid()) { |
|
470 |
I.AjaxSaveItem = true; |
|
471 |
I.save.prop('disabled', true); |
|
472 |
var o = ko.mapping.toJS(vm.o()); |
|
473 |
o.vehicleId = o.vehicleId.toUpperCase(); |
|
474 |
o.state = $('#state').prop('checked'); |
|
475 |
o.companyNo = vm.isAdmin() ? o.companyNo : (typeof(parent.G) != 'undefined' ? parent.G.loginCompanyNo : 'ABCDEFG') |
|
476 |
$.post('/vehicle/saveItem.htm', o, function(data, textStatus, xhr) { |
|
477 |
I.AjaxSaveItem = false; |
|
478 |
I.save.prop('disabled', false); |
|
479 |
if (data.code >= 1) { |
|
480 |
//parent.showErrmsg(data.errmsg); |
|
481 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
482 |
return; |
|
483 |
} |
|
484 |
if (data.code == 0) { |
|
485 |
parent.showErrmsg('保存成功!'); |
|
486 |
I.modal.modal('hide'); |
|
487 |
getList(vm.keyword(), vm.mtid(), I._page, I.PZ, 1); |
|
488 |
return; |
|
489 |
} |
|
490 |
}, 'json'); |
|
491 |
} |
|
492 |
} |
|
493 |
|
|
494 |
function clearError() { |
|
495 |
$('#form input').removeClass('error'); |
|
496 |
$('#form .text-error').html(''); |
|
497 |
} |
|
498 |
|
|
499 |
function getCompanyList() { |
|
500 |
$.post('/company/getList.htm', null, function(data, textStatus, xhr) { |
|
501 |
vm.tList.removeAll(); |
|
502 |
if (data.code >= 1) { |
|
503 |
//parent.showErrmsg(data.errmsg); |
|
504 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
505 |
return; |
|
506 |
} |
|
507 |
if (data.code == 0) { |
|
508 |
if (isList(data.list)) { |
|
509 |
$.each(data.list, function(index, val) { |
|
510 |
vm.tList.push(val); |
|
511 |
}); |
|
512 |
} |
|
513 |
} |
|
514 |
}, 'json'); |
|
515 |
} |
|
516 |
|
|
517 |
function doValid(item){ |
|
518 |
var state=true; |
|
519 |
if(isFunction(item.state)){ |
|
520 |
state=item.state(); |
|
521 |
}else{ |
|
522 |
state=item.state; |
|
523 |
} |
|
524 |
jQuery.post('/vehicle/changeState.htm', {vehicleId: item.vehicleId, state: !state}, function(data, textStatus, xhr) { |
|
525 |
//optional stuff to do after success |
|
526 |
if(data.code==0){ |
|
527 |
item.state(data.item); |
|
528 |
}else{ |
|
529 |
//parent.showErrmsg(data.errmsg); |
|
530 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
531 |
} |
|
532 |
},'json'); |
|
533 |
} |
|
534 |
|
|
535 |
function getNewNo() { |
|
536 |
$.post("/basicconfig/prefix/getNewNo.htm", {type: 'materiel'}, |
|
537 |
function (data, textStatus, jqXHR) { |
|
538 |
if (data.code >= 1) { |
|
539 |
//parent.showErrmsg(data.errmsg); |
|
540 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
541 |
return; |
|
542 |
} |
|
543 |
if (data.code == 0) { |
|
544 |
// vm.o().visitNo(data.number); |
|
545 |
$('#materielNo').val(data.number); |
|
546 |
return; |
|
547 |
} |
|
548 |
}, |
|
549 |
"json" |
|
550 |
); |
|
551 |
} |
|
552 |
|
|
553 |
function autoHeight() { |
|
554 |
$('.page-content').css('min-height', $(parent.window).height() - 117); |
|
555 |
$('.table-responsive').css('height', $(parent.window).height() - 217); |
|
556 |
} |
|
557 |
|
|
558 |
function doResend(item) { |
|
559 |
$.post("/task/resend.htm", {item: item.bussinessNo}, |
|
560 |
function (data, textStatus, jqXHR) { |
|
561 |
if (data.code >= 1) { |
|
562 |
//parent.showErrmsg(data.errmsg); |
|
563 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
564 |
return; |
|
565 |
} |
|
566 |
if (data.code == 0) { |
|
567 |
item.invitecode(data.item); |
|
568 |
parent.showErrmsg('重发成功!'); |
|
569 |
return; |
|
570 |
} |
|
571 |
}, |
|
572 |
"json" |
|
573 |
); |
|
574 |
} |
|
575 |
|
|
576 |
function newTab(item) { |
|
577 |
parent.closableTab.addTab({ |
|
578 |
'id': new Date().getTime(), |
|
579 |
'name': '业务详情', |
|
580 |
'url': '/basic/bizDetalis.jsf?id=' + item.id + '&businessNo=' + item.bussinessNo, |
|
581 |
'closable': true |
|
582 |
}); |
|
583 |
} |
|
584 |
|
|
585 |
function gotoVehicleDetails(item) { |
|
586 |
parent.closableTab.addTab({ |
|
587 |
'id': new Date().getTime(), |
|
588 |
'name': item.vehicleId + '的配车物资', |
|
589 |
'url': '/basic/vehicleBindMaterials.jsf?numberplates=' + encodeURI(encodeURI(item.vehicleId)) + '&id=' + item.id+'&bsNo=' + item.bussinessNo, |
|
590 |
'closable': true |
|
591 |
}); |
|
592 |
} |
|
593 |
|
|
594 |
//获取物流公司可操作的厂区 |
|
595 |
function getcqList() { |
|
596 |
$.post('/company/getcqList.htm', null, function(data, textStatus, xhr) { |
|
597 |
vm.cqList.removeAll(); |
|
598 |
if (data.code >= 1) { |
|
599 |
//parent.showErrmsg(data.errmsg); |
|
600 |
swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'}); |
|
601 |
return; |
|
602 |
} |
|
603 |
if (data.code == 0) { |
|
604 |
if (isList(data.list)) { |
|
605 |
$.each(data.list, function(index, val) { |
|
606 |
vm.cqList.push(val); |
|
607 |
}); |
|
608 |
} |
|
609 |
} |
|
610 |
}, 'json'); |
|
611 |
} |