|
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
|
var $ = layui.jquery;
|
var $ax = layui.ax;
|
var form = layui.form;
|
|
//获取信息
|
var ajax = new $ax(Feng.ctxPath + "/salesOrder/list?id=" + Feng.getUrlParam("id"));
|
var result = ajax.start();
|
let productCode = result.data[0].productCode;
|
|
$.ajax({
|
type: "POST",
|
contentType: "application/json;charset=UTF-8",
|
url: Feng.ctxPath + '/productBomInfo/list?productCode='+productCode,
|
success: function (result) {
|
console.log(result.data)
|
$.each(result.data, function (index, value) {
|
$('#bomCode').append(new Option(value.bomName,value.bomCode));// 下拉菜单里添加元素
|
});
|
layui.form.render("select");//重新渲染 固定写法
|
},
|
});
|
|
$.ajax({
|
type: "POST",
|
contentType: "application/json;charset=UTF-8",
|
url: Feng.ctxPath + '/productRouteInfo/list?productCode='+productCode,
|
success: function (result) {
|
console.log(result.data)
|
$.each(result.data, function (index, value) {
|
$('#routeCode').append(new Option(value.routeName,value.routeCode));// 下拉菜单里添加元素
|
});
|
layui.form.render("select");//重新渲染 固定写法
|
},
|
});
|
|
$('#cancel').click(function(){
|
window.location.href = Feng.ctxPath + '/salesOrder'
|
});
|
|
$('#btnSubmit').click(function(){
|
var ajax = new $ax(Feng.ctxPath + "/salesOrder/DistributeSalesOrder", function (data) {
|
}, function (data) {
|
Feng.error("更新失败!" + data.responseJSON.message)
|
});
|
ajax.set('id',Feng.getUrlParam("id"));
|
ajax.set('routeCode',$('#routeCode').val());
|
ajax.set('recipeCode',$('#recipeCode').val());
|
ajax.set('bomCode',$('#bomCode').val());
|
ajax.start();
|
Feng.success("下发完成")
|
window.location.href = Feng.ctxPath + '/salesOrder'
|
return false;
|
});
|
|
//表单提交事件
|
// form.on('submit(btnSubmit)', function (data) {
|
// var ajax = new $ax(Feng.ctxPath + "/salesOrder/DistributeSalesOrder", function (data) {
|
// Feng.success("下发完成")
|
// window.location.href = Feng.ctxPath + '/salesOrder'
|
// }, function (data) {
|
// Feng.error("添加失败!" + data.responseJSON.message)
|
// });
|
// ajax.set('id',Feng.getUrlParam("id"));
|
// ajax.set('routeCode',$('#routeCode').val());
|
// ajax.set('recipeCode',$('#recipeCode').val());
|
// ajax.set('bomCode',$('#bomCode').val());
|
// ajax.start();
|
// return false;
|
// });
|
|
});
|