/** * 添加或者修改页面 */ 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; $(document).ready(function() { console.log("$('#pageCode').val()--------- "+$('#pageCode').val()); $.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 === "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");//重新渲染 固定写法 }, }); } } }); // 表单提交事件 form.on('submit(btnSubmit)', function (data) { if($('#locationCode').val() === null){ Feng.error("请选择工位") }else { let ajax = new $ax(Feng.ctxPath + "/lineFeedingView/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; } }); });