提交 | 用户 | 时间
|
71e81e
|
1 |
/** |
懒 |
2 |
* 添加或者修改页面 |
|
3 |
*/ |
|
4 |
var KanbanConfInfoDlg = { |
|
5 |
data: { |
|
6 |
id: "", |
|
7 |
pageCode: "", |
|
8 |
ipAddress: "", |
|
9 |
macAddress: "", |
|
10 |
workshopCode: "", |
|
11 |
workshopName: "", |
|
12 |
lineCode: "", |
|
13 |
lineName: "", |
|
14 |
locationCode: "", |
|
15 |
locationName: "", |
|
16 |
warehouseCode: "", |
|
17 |
warehouseName: "" |
|
18 |
} |
|
19 |
}; |
|
20 |
|
|
21 |
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
22 |
var $ = layui.jquery; |
|
23 |
var $ax = layui.ax; |
|
24 |
var form = layui.form; |
|
25 |
var admin = layui.admin; |
|
26 |
|
|
27 |
$(document).ready(function () { |
|
28 |
$.ajax({ |
|
29 |
type: "POST", |
|
30 |
contentType: "application/json;charset=UTF-8", |
|
31 |
url: Feng.ctxPath + '/workshopInfo/list', |
|
32 |
success: function (result) { |
|
33 |
$.each(result.data, function (index, value) { |
|
34 |
$('#workshopCode').append(new Option(value.workshopCode));// 下拉菜单里添加元素 |
|
35 |
}); |
|
36 |
layui.form.render("select");//重新渲染 固定写法 |
|
37 |
}, |
|
38 |
}); |
|
39 |
}); |
|
40 |
|
|
41 |
form.on("select", function (data) { |
|
42 |
switch(data.elem.id){ |
|
43 |
case 'workshopCode': |
|
44 |
$.ajax({ |
|
45 |
type: "POST", |
|
46 |
contentType: "application/json;charset=UTF-8", |
|
47 |
url: Feng.ctxPath + '/lineInfo/list?workshopCode='+data.value, |
|
48 |
success: function (result) { |
|
49 |
$('#lineCode').empty(); |
|
50 |
$('#lineCode').append(new Option("请选择产线", ""));// 下拉菜单里添加元素 |
|
51 |
|
|
52 |
$.each(result.data, function (index, value) { |
|
53 |
$('#lineCode').append(new Option(value.lineCode));// 下拉菜单里添加元素 |
|
54 |
}); |
|
55 |
layui.form.render("select");//重新渲染 固定写法 |
|
56 |
}, |
|
57 |
}); |
|
58 |
break; |
|
59 |
case 'lineCode': |
|
60 |
$.ajax({ |
|
61 |
type: "POST", |
|
62 |
contentType: "application/json;charset=UTF-8", |
|
63 |
url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+data.value, |
|
64 |
success: function (result) { |
|
65 |
$('#locationCode').empty(); |
|
66 |
$('#locationCode').append(new Option("请选择工位", ""));// 下拉菜单里添加元素 |
|
67 |
|
|
68 |
$.each(result.data, function (index, value) { |
|
69 |
$('#locationCode').append(new Option(value.locationCode));// 下拉菜单里添加元素 |
|
70 |
}); |
|
71 |
layui.form.render("select");//重新渲染 固定写法 |
|
72 |
}, |
|
73 |
}); |
|
74 |
break; |
|
75 |
} |
|
76 |
}); |
|
77 |
|
|
78 |
//表单提交事件 |
|
79 |
form.on('submit(btnSubmit)', function (data) { |
|
80 |
var ajax = new $ax(Feng.ctxPath + "/kanbanConf/addItem", function (data) { |
|
81 |
Feng.success("添加成功!"); |
|
82 |
window.location.href = Feng.ctxPath + '/kanbanConf' |
|
83 |
}, function (data) { |
|
84 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
85 |
}); |
|
86 |
ajax.set(data.field); |
|
87 |
ajax.start(); |
|
88 |
|
|
89 |
return false; |
|
90 |
}); |
|
91 |
|
|
92 |
$('#cancel').click(function(){ |
|
93 |
window.location.href = Feng.ctxPath + '/kanbanConf' |
|
94 |
}); |
|
95 |
|
|
96 |
}); |