/** * 详情对话框 */ var ProductBomChildInfoInfoDlg = { data: { id: "", opCode: "", opName: "", materialCode: "", materialName: "", costQty: "", unit: "", spareField1: "", spareField2: "", spareField3: "", remark: "", bomCode: "" } }; 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 ajax = new $ax(Feng.ctxPath + "/productBomChildInfo/detail?id=" + Feng.getUrlParam("id")); var result1 = ajax.start(); form.val('productBomChildInfoForm', result1.data); getOpList(); function getOpList(){ $.ajax({ type: "POST", contentType: "application/json;charset=UTF-8", url: Feng.ctxPath + '/opInfo/list?status=ENABLE', success: function (result) { $.each(result.data, function (index, value) { $('#opCode').append(new Option(value.opCode));// 下拉菜单里添加元素 }); console.log(result) $('#opCode').val(result1.data.opCode); layui.form.render("select");//重新渲染 固定写法 }, }); } // $('#materialCode').click(function (){ // layer.open({ // type: 2, // area: ['1000px', '600px'], // // title: '设备列表', // content: Feng.ctxPath + '/materialInfo/materialInfoListOpen', // end: function () { // let msg = JSON.parse(window.localStorage.getItem('message')); // $('#materialCode').val(msg.materialCode); // $('#materialName').val(msg.materialName); // $('#unit').val(msg.unit); // console.log(msg); // } // }); // }); //表单提交事件 form.on('submit(btnSubmit)', function (data) { var ajax = new $ax(Feng.ctxPath + "/productBomChildInfo/editItem", function (data) { Feng.success("更新成功!"); // window.location.href = Feng.ctxPath + '/productBomChildInfo' //传给上个页面,刷新table用 admin.putTempData('formOk', true); //关掉对话框 admin.closeThisDialog(); }, function (data) { Feng.error("更新失败!" + data.responseJSON.message) }); ajax.set(data.field); ajax.start(); return false; }); $('#cancel').click(function(){ // window.location.href = Feng.ctxPath + '/productBomChildInfo' admin.closeThisDialog(); }); });