提交 | 用户 | 时间
|
71e81e
|
1 |
/** |
懒 |
2 |
* 添加或者修改页面 |
|
3 |
*/ |
|
4 |
var RecipeManageInfoDlg = { |
|
5 |
data: { |
|
6 |
id: "", |
|
7 |
productionLine: "", |
|
8 |
locationCode: "", |
|
9 |
productCode: "", |
|
10 |
operationSteps: "", |
|
11 |
techRequirement: "", |
|
12 |
operationType: "", |
|
13 |
stepSort: "", |
|
14 |
paramCode: "", |
|
15 |
materialCode: "", |
|
16 |
picture: "", |
|
17 |
remarks: "", |
|
18 |
spareField1: "", |
|
19 |
spareField2: "", |
|
20 |
spareField3: "", |
|
21 |
spareField4: "" |
|
22 |
} |
|
23 |
}; |
|
24 |
|
|
25 |
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
26 |
var $ = layui.jquery; |
|
27 |
var $ax = layui.ax; |
|
28 |
var form = layui.form; |
|
29 |
var admin = layui.admin; |
|
30 |
|
|
31 |
$(document).ready(function () { |
|
32 |
$.ajax({ |
|
33 |
type: "POST", |
|
34 |
contentType: "application/json;charset=UTF-8", |
|
35 |
url: Feng.ctxPath + '/lineInfo/list', |
|
36 |
success: function (result) { |
|
37 |
$.each(result.data, function (index, value) { |
|
38 |
$('#productionLine').append(new Option(value.lineCode));// 下拉菜单里添加元素 |
|
39 |
}); |
|
40 |
layui.form.render("select");//重新渲染 固定写法 |
|
41 |
}, |
|
42 |
}); |
|
43 |
}); |
|
44 |
|
|
45 |
$('#productCode').click(function () { |
|
46 |
layer.open({ |
|
47 |
type: 2, |
|
48 |
area: ['1000px', '600px'], |
|
49 |
title: '物料信息', |
|
50 |
content: Feng.ctxPath + '/productionOrdeInfo/materialList', |
|
51 |
success: function (layero, index) { |
|
52 |
window.materialType = '成品'; |
|
53 |
}, |
|
54 |
end: function () { |
|
55 |
let msg = JSON.parse(window.localStorage.getItem('message')); |
|
56 |
console.log(msg) |
|
57 |
$('#productCode').val(msg.materialCode); |
|
58 |
} |
|
59 |
}); |
|
60 |
}); |
|
61 |
|
|
62 |
form.on("select", function (data) { |
|
63 |
switch(data.elem.id){ |
|
64 |
case 'productionLine': |
|
65 |
$.ajax({ |
|
66 |
type: "POST", |
|
67 |
contentType: "application/json;charset=UTF-8", |
|
68 |
url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+data.value, |
|
69 |
success: function (result) { |
|
70 |
$('#locationCode').empty(); |
|
71 |
$('#locationCode').append(new Option("请选择工位", ""));// 下拉菜单里添加元素 |
|
72 |
|
|
73 |
$.each(result.data, function (index, value) { |
|
74 |
$('#locationCode').append(new Option(value.locationCode));// 下拉菜单里添加元素 |
|
75 |
}); |
|
76 |
layui.form.render("select");//重新渲染 固定写法 |
|
77 |
}, |
|
78 |
}); |
|
79 |
break; |
|
80 |
} |
|
81 |
}); |
|
82 |
|
|
83 |
//表单提交事件 |
|
84 |
form.on('submit(btnSubmit)', function (data) { |
|
85 |
var ajax = new $ax(Feng.ctxPath + "/recipeManage/addItem", function (data) { |
|
86 |
Feng.success("添加成功!"); |
|
87 |
window.location.href = Feng.ctxPath + '/recipeManage' |
|
88 |
}, function (data) { |
|
89 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
90 |
}); |
|
91 |
ajax.set(data.field); |
|
92 |
ajax.start(); |
|
93 |
|
|
94 |
return false; |
|
95 |
}); |
|
96 |
|
|
97 |
$('#cancel').click(function(){ |
|
98 |
window.location.href = Feng.ctxPath + '/recipeManage' |
|
99 |
}); |
|
100 |
|
|
101 |
}); |