提交 | 用户 | 时间
|
1ac2bc
|
1 |
|
懒 |
2 |
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
3 |
var $ = layui.jquery; |
|
4 |
var $ax = layui.ax; |
|
5 |
var form = layui.form; |
|
6 |
|
|
7 |
//获取信息 |
|
8 |
var ajax = new $ax(Feng.ctxPath + "/salesOrder/list?id=" + Feng.getUrlParam("id")); |
|
9 |
var result = ajax.start(); |
|
10 |
let productCode = result.data[0].productCode; |
|
11 |
|
|
12 |
$.ajax({ |
|
13 |
type: "POST", |
|
14 |
contentType: "application/json;charset=UTF-8", |
|
15 |
url: Feng.ctxPath + '/productBomInfo/list?productCode='+productCode, |
|
16 |
success: function (result) { |
|
17 |
console.log(result.data) |
|
18 |
$.each(result.data, function (index, value) { |
|
19 |
$('#bomCode').append(new Option(value.bomName,value.bomCode));// 下拉菜单里添加元素 |
|
20 |
}); |
|
21 |
layui.form.render("select");//重新渲染 固定写法 |
|
22 |
}, |
|
23 |
}); |
|
24 |
|
|
25 |
$.ajax({ |
|
26 |
type: "POST", |
|
27 |
contentType: "application/json;charset=UTF-8", |
|
28 |
url: Feng.ctxPath + '/productRouteInfo/list?productCode='+productCode, |
|
29 |
success: function (result) { |
|
30 |
console.log(result.data) |
|
31 |
$.each(result.data, function (index, value) { |
|
32 |
$('#routeCode').append(new Option(value.routeName,value.routeCode));// 下拉菜单里添加元素 |
|
33 |
}); |
|
34 |
layui.form.render("select");//重新渲染 固定写法 |
|
35 |
}, |
|
36 |
}); |
|
37 |
|
|
38 |
$('#cancel').click(function(){ |
|
39 |
window.location.href = Feng.ctxPath + '/salesOrder' |
|
40 |
}); |
|
41 |
|
|
42 |
$('#btnSubmit').click(function(){ |
|
43 |
var ajax = new $ax(Feng.ctxPath + "/salesOrder/DistributeSalesOrder", function (data) { |
|
44 |
}, function (data) { |
|
45 |
Feng.error("更新失败!" + data.responseJSON.message) |
|
46 |
}); |
|
47 |
ajax.set('id',Feng.getUrlParam("id")); |
|
48 |
ajax.set('routeCode',$('#routeCode').val()); |
|
49 |
ajax.set('recipeCode',$('#recipeCode').val()); |
|
50 |
ajax.set('bomCode',$('#bomCode').val()); |
|
51 |
ajax.start(); |
|
52 |
Feng.success("下发完成") |
|
53 |
window.location.href = Feng.ctxPath + '/salesOrder' |
|
54 |
return false; |
|
55 |
}); |
|
56 |
|
|
57 |
//表单提交事件 |
|
58 |
// form.on('submit(btnSubmit)', function (data) { |
|
59 |
// var ajax = new $ax(Feng.ctxPath + "/salesOrder/DistributeSalesOrder", function (data) { |
|
60 |
// Feng.success("下发完成") |
|
61 |
// window.location.href = Feng.ctxPath + '/salesOrder' |
|
62 |
// }, function (data) { |
|
63 |
// Feng.error("添加失败!" + data.responseJSON.message) |
|
64 |
// }); |
|
65 |
// ajax.set('id',Feng.getUrlParam("id")); |
|
66 |
// ajax.set('routeCode',$('#routeCode').val()); |
|
67 |
// ajax.set('recipeCode',$('#recipeCode').val()); |
|
68 |
// ajax.set('bomCode',$('#bomCode').val()); |
|
69 |
// ajax.start(); |
|
70 |
// return false; |
|
71 |
// }); |
|
72 |
|
|
73 |
}); |