提交 | 用户 | 时间
|
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 |
var lineCodes = parent.lineCode; |
|
27 |
var locationCodes = parent.locationCode; |
|
28 |
$(document).ready(function() { |
|
29 |
|
|
30 |
// $('#workshopCode').empty(); |
|
31 |
// $.ajax({ |
|
32 |
// type: "POST", |
|
33 |
// contentType: "application/json;charset=UTF-8", |
|
34 |
// url: Feng.ctxPath + '/workshopInfo/list', |
|
35 |
// success: function (result) { |
|
36 |
// $('#workshopCode').append(new Option("请选择车间", "")) |
|
37 |
// $.each(result.data, function (index, value) { |
|
38 |
// $('#workshopCode').append(new Option(value.workshopName, value.workshopCode));// 下拉菜单里添加元素 |
|
39 |
// }); |
|
40 |
// layui.form.render("select");//重新渲染 固定写法 |
|
41 |
// }, |
|
42 |
// }); |
|
43 |
|
|
44 |
$.ajax({ |
|
45 |
type: "POST", |
|
46 |
contentType: "application/json;charset=UTF-8", |
|
47 |
url: Feng.ctxPath + '/lineInfo/list', |
|
48 |
success: function (result) { |
|
49 |
$('#lineCode').empty(); |
|
50 |
$.each(result.data, function (index, value) { |
|
51 |
$('#lineCode').append(new Option(value.lineCode, value.lineCode));// 下拉菜单里添加元素 |
|
52 |
}); |
|
53 |
$('#lineCode').val($("#testlineCode").val()); |
|
54 |
layui.form.render("select");//重新渲染 固定写法 |
|
55 |
}, |
|
56 |
}); |
|
57 |
|
|
58 |
$.ajax({ |
|
59 |
type: "POST", |
|
60 |
contentType: "application/json;charset=UTF-8", |
|
61 |
url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#testlineCode').val(), |
|
62 |
success: function (result) { |
|
63 |
$('#locationCode').empty(); |
|
64 |
$.each(result.data, function (index, value) { |
|
65 |
$('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素 |
|
66 |
}); |
|
67 |
$('#locationCode').val($("#testlocationCode").val()); |
|
68 |
layui.form.render("select");//重新渲染 固定写法 |
|
69 |
}, |
|
70 |
}); |
|
71 |
}); |
|
72 |
|
|
73 |
form.on("select", function (data) { |
|
74 |
if (data.value !== "") { |
|
75 |
// if (data.elem.id == "workshopCode") { |
|
76 |
// $.ajax({ |
|
77 |
// type: "POST", |
|
78 |
// contentType: "application/json;charset=UTF-8", |
|
79 |
// url: Feng.ctxPath + '/lineInfo/list?workshopCode='+ $('#workshopCode').val(), |
|
80 |
// success: function (result) { |
|
81 |
// $('#lineCode').empty(); |
|
82 |
// $.each(result.data, function (index, value) { |
|
83 |
// $('#lineCode').append(new Option(value.lineName, value.lineCode));// 下拉菜单里添加元素 |
|
84 |
// }); |
|
85 |
// $('#lineCode').val(lineCodes); |
|
86 |
// layui.form.render("select");//重新渲染 固定写法 |
|
87 |
// }, |
|
88 |
// }); |
|
89 |
// } |
|
90 |
if (data.elem.id === "lineCode") { |
|
91 |
$.ajax({ |
|
92 |
type: "POST", |
|
93 |
contentType: "application/json;charset=UTF-8", |
|
94 |
url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#lineCode').val(), |
|
95 |
success: function (result) { |
|
96 |
$('#locationCode').empty(); |
|
97 |
$.each(result.data, function (index, value) { |
|
98 |
$('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素 |
|
99 |
}); |
|
100 |
$('#locationCode').val($("#testlocationCode").val()); |
|
101 |
layui.form.render("select");//重新渲染 固定写法 |
|
102 |
}, |
|
103 |
}); |
|
104 |
} |
|
105 |
} |
|
106 |
}); |
|
107 |
|
|
108 |
let lineCode=''; |
|
109 |
let locationCode=''; |
|
110 |
// 表单提交事件 |
|
111 |
form.on('submit(btnSubmit)', function (data) { |
|
112 |
var ajax = new $ax(Feng.ctxPath + "/materialRegistration/addKanBanConfItem", function (data) { |
|
113 |
Feng.success("设置成功!"); |
|
114 |
//关掉对话框 |
|
115 |
admin.closeThisDialog(); |
|
116 |
window.parent.location.reload() |
|
117 |
}, function (data) { |
|
118 |
Feng.error("设置失败!" + data.responseJSON.message) |
|
119 |
}); |
|
120 |
ajax.set(data.field); |
|
121 |
ajax.start(); |
|
122 |
return false; |
|
123 |
}); |
|
124 |
}); |