/**
|
* 添加或者修改页面
|
*/
|
var KanbanConfInfoDlg = {
|
data: {
|
id: "",
|
pageCode: "",
|
ipAddress: "",
|
macAddress: "",
|
workshopCode: "",
|
workshopName: "",
|
lineCode: "",
|
lineName: "",
|
locationCode: "",
|
locationName: "",
|
warehouseCode: "",
|
warehouseName: ""
|
}
|
};
|
|
layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
|
var $ = layui.jquery;
|
var $ax = layui.ax;
|
var form = layui.form;
|
var admin = layui.admin;
|
var lineCodes = parent.lineCode;
|
var locationCodes = parent.locationCode;
|
$(document).ready(function() {
|
|
// $('#workshopCode').empty();
|
// $.ajax({
|
// type: "POST",
|
// contentType: "application/json;charset=UTF-8",
|
// url: Feng.ctxPath + '/workshopInfo/list',
|
// success: function (result) {
|
// $('#workshopCode').append(new Option("请选择车间", ""))
|
// $.each(result.data, function (index, value) {
|
// $('#workshopCode').append(new Option(value.workshopName, value.workshopCode));// 下拉菜单里添加元素
|
// });
|
// layui.form.render("select");//重新渲染 固定写法
|
// },
|
// });
|
|
$.ajax({
|
type: "POST",
|
contentType: "application/json;charset=UTF-8",
|
url: Feng.ctxPath + '/lineInfo/list',
|
success: function (result) {
|
$('#lineCode').empty();
|
$.each(result.data, function (index, value) {
|
$('#lineCode').append(new Option(value.lineCode, value.lineCode));// 下拉菜单里添加元素
|
});
|
$('#lineCode').val($("#testlineCode").val());
|
layui.form.render("select");//重新渲染 固定写法
|
},
|
});
|
|
$.ajax({
|
type: "POST",
|
contentType: "application/json;charset=UTF-8",
|
url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#testlineCode').val(),
|
success: function (result) {
|
$('#locationCode').empty();
|
$.each(result.data, function (index, value) {
|
$('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素
|
});
|
$('#locationCode').val($("#testlocationCode").val());
|
layui.form.render("select");//重新渲染 固定写法
|
},
|
});
|
});
|
|
form.on("select", function (data) {
|
if (data.value !== "") {
|
// if (data.elem.id == "workshopCode") {
|
// $.ajax({
|
// type: "POST",
|
// contentType: "application/json;charset=UTF-8",
|
// url: Feng.ctxPath + '/lineInfo/list?workshopCode='+ $('#workshopCode').val(),
|
// success: function (result) {
|
// $('#lineCode').empty();
|
// $.each(result.data, function (index, value) {
|
// $('#lineCode').append(new Option(value.lineName, value.lineCode));// 下拉菜单里添加元素
|
// });
|
// $('#lineCode').val(lineCodes);
|
// layui.form.render("select");//重新渲染 固定写法
|
// },
|
// });
|
// }
|
if (data.elem.id === "lineCode") {
|
$.ajax({
|
type: "POST",
|
contentType: "application/json;charset=UTF-8",
|
url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+ $('#lineCode').val(),
|
success: function (result) {
|
$('#locationCode').empty();
|
$.each(result.data, function (index, value) {
|
$('#locationCode').append(new Option(value.locationCode, value.locationCode));// 下拉菜单里添加元素
|
});
|
$('#locationCode').val($("#testlocationCode").val());
|
layui.form.render("select");//重新渲染 固定写法
|
},
|
});
|
}
|
}
|
});
|
|
let lineCode='';
|
let locationCode='';
|
// 表单提交事件
|
form.on('submit(btnSubmit)', function (data) {
|
var ajax = new $ax(Feng.ctxPath + "/materialRegistration/addKanBanConfItem", function (data) {
|
Feng.success("设置成功!");
|
//关掉对话框
|
admin.closeThisDialog();
|
window.parent.location.reload()
|
}, function (data) {
|
Feng.error("设置失败!" + data.responseJSON.message)
|
});
|
ajax.set(data.field);
|
ajax.start();
|
return false;
|
});
|
});
|