提交 | 用户 | 时间
|
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 |
|
|
103 |
//表单提交事件 |
|
104 |
form.on('submit(btnSubmit)', function (data) { |
|
105 |
var ajax = new $ax(Feng.ctxPath + "/workOrder/addItem", function (data) { |
|
106 |
Feng.success("添加成功!"); |
|
107 |
window.location.href = Feng.ctxPath + '/workOrder' |
|
108 |
}, function (data) { |
|
109 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
110 |
}); |
|
111 |
ajax.set(data.field); |
|
112 |
ajax.start(); |
|
113 |
|
|
114 |
return false; |
|
115 |
}); |
|
116 |
|
|
117 |
$('#cancel').click(function(){ |
|
118 |
window.location.href = Feng.ctxPath + '/workOrder' |
|
119 |
}); |
|
120 |
|
|
121 |
}); |