提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* 添加或者修改页面 |
|
3 |
*/ |
|
4 |
var WorkOrderInfoDlg = { |
|
5 |
data: { |
|
6 |
id: "", |
|
7 |
workOrderCode: "", |
|
8 |
salesOrderCode: "", |
|
9 |
productCode: "", |
|
10 |
productName: "", |
|
11 |
planQty: "", |
|
12 |
produceQty: "", |
|
13 |
onlineQty: "", |
|
14 |
planStartTime: "", |
|
15 |
planEndTime: "", |
|
16 |
produceStartTime: "", |
|
17 |
produceEndTime: "", |
|
18 |
workshopCode: "", |
|
19 |
lineCode: "", |
|
20 |
state: "", |
|
21 |
badQty: "", |
|
22 |
repairQty: "", |
|
23 |
scrapQty: "", |
|
24 |
routeCode: "", |
|
25 |
bomCode: "", |
|
26 |
recipeCode: "", |
|
27 |
spareField1: "", |
|
28 |
spareField2: "", |
|
29 |
spareField3: "", |
|
30 |
createUser: "", |
|
31 |
createTime: "", |
|
32 |
updateUser: "", |
|
33 |
updateTime: "", |
|
34 |
remark: "" |
|
35 |
} |
|
36 |
}; |
|
37 |
|
|
38 |
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
39 |
var $ = layui.jquery; |
|
40 |
var $ax = layui.ax; |
|
41 |
var form = layui.form; |
|
42 |
var admin = layui.admin; |
|
43 |
var laydate = layui.laydate; |
|
44 |
|
|
45 |
//初始化时间选择器 |
|
46 |
laydate.render({ |
|
47 |
elem: '#planStartTime', |
|
48 |
type: 'datetime' |
|
49 |
}); |
|
50 |
//初始化时间选择器 |
|
51 |
laydate.render({ |
|
52 |
elem: '#planEndTime', |
|
53 |
type: 'datetime' |
|
54 |
}); |
|
55 |
//初始化时间选择器 |
|
56 |
laydate.render({ |
|
57 |
elem: '#produceStartTime', |
|
58 |
type: 'datetime' |
|
59 |
}); |
|
60 |
//初始化时间选择器 |
|
61 |
laydate.render({ |
|
62 |
elem: '#produceEndTime', |
|
63 |
type: 'datetime' |
|
64 |
}); |
|
65 |
|
|
66 |
$(document).ready(function () { |
|
67 |
$.ajax({ |
|
68 |
type: "POST", |
|
69 |
contentType: "application/json;charset=UTF-8", |
|
70 |
url: Feng.ctxPath + '/workshopInfo/list', |
|
71 |
success: function (result) { |
|
72 |
$.each(result.data, function (index, value) { |
|
73 |
$('#workshopCode').append(new Option(value.workshopCode));// 下拉菜单里添加元素 |
|
74 |
}); |
|
75 |
layui.form.render("select");//重新渲染 固定写法 |
|
76 |
}, |
|
77 |
}); |
|
78 |
}); |
|
79 |
|
|
80 |
form.on("select", function (data) { |
|
81 |
switch(data.elem.id){ |
|
82 |
case 'workshopCode': |
|
83 |
// layui.$('#lineCode').empty(); // 获取select元素 |
|
84 |
$.ajax({ |
|
85 |
type: "POST", |
|
86 |
contentType: "application/json;charset=UTF-8", |
|
87 |
url: Feng.ctxPath + '/lineInfo/list?workshopCode='+data.value, |
|
88 |
success: function (result) { |
|
89 |
$('#productionLineCode').empty(); |
|
90 |
$.each(result.data, function (index, value) { |
|
91 |
$('#lineCode').append(new Option(value.lineCode));// 下拉菜单里添加元素 |
|
92 |
}); |
|
93 |
if($('#workshopCode').val() === ""||$('#workshopCode').val() === null){ |
|
94 |
layui.$('#lineCode').empty(); // 获取select元素 |
|
95 |
} |
|
96 |
layui.form.render("select");//重新渲染 固定写法 |
|
97 |
}, |
|
98 |
}); |
|
99 |
break; |
|
100 |
} |
|
101 |
}); |
|
102 |
|
92cffc
|
103 |
$('#productCode').click(function () { |
懒 |
104 |
layer.open({ |
|
105 |
type: 2, |
|
106 |
area: ['1000px', '600px'], |
|
107 |
title: '物料信息', |
|
108 |
content: Feng.ctxPath + '/workOrder/productListing', |
|
109 |
success: function (layero, index) { |
|
110 |
window.materialType = '产品'; |
|
111 |
}, |
|
112 |
end: function () { |
|
113 |
let msg = JSON.parse(window.localStorage.getItem('message')); |
|
114 |
$('#productCode').val(msg.materialCode); |
|
115 |
$('#productName').val(msg.materialName); |
|
116 |
} |
|
117 |
}); |
|
118 |
}); |
|
119 |
|
1ac2bc
|
120 |
//表单提交事件 |
懒 |
121 |
form.on('submit(btnSubmit)', function (data) { |
|
122 |
var ajax = new $ax(Feng.ctxPath + "/workOrder/addItem", function (data) { |
|
123 |
Feng.success("添加成功!"); |
|
124 |
window.location.href = Feng.ctxPath + '/workOrder' |
|
125 |
}, function (data) { |
|
126 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
127 |
}); |
|
128 |
ajax.set(data.field); |
|
129 |
ajax.start(); |
|
130 |
|
|
131 |
return false; |
|
132 |
}); |
|
133 |
|
|
134 |
$('#cancel').click(function(){ |
|
135 |
window.location.href = Feng.ctxPath + '/workOrder' |
|
136 |
}); |
|
137 |
|
|
138 |
}); |