layui.use(['table','form', 'admin', 'ax','laydate','upload','formSelects'], function () { var $ = layui.jquery; var $ax = layui.ax; var form = layui.form; var admin = layui.admin; var table = layui.table; var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 /** * bom信息管理 */ var MaterialShortage = { tableId: "materialShortageTable2" }; $('#serch').click(function(){ var queryData = {}; queryData['customerCode'] = $("#customerCode").val(); queryData['customerName'] = $("#customerName").val(); queryData['customerType'] = $("#customerType").val(); table.reload(MaterialShortage.tableId, { where: queryData, page: {curr: 1} }); }); /** * 缺料报警初始化表格的列 */ MaterialShortage.initColumn = function () { return [[ {type: 'radio'}, {field: 'id', hide: true, title: 'id'}, {field: 'customerCode', sort: true, title: '客户编号'}, {field: 'customerName', sort: true, title: '客户名称'}, {field: 'customerType', sort: true, title: '客户类型'}, {field: 'contact', sort: true, title: '联系方式'}, {field: 'remarks', sort: true, title: '备注'}, ]]; }; table = $.extend(table, {config: {checkName: 'checked'}}); var tableResult = table.render({ elem: '#' + MaterialShortage.tableId, url: Feng.ctxPath + '/customInfo/list', page: true, cellMinWidth: 80, cols: MaterialShortage.initColumn() }); let Msg=''; table.on('row(materialShortageTable2)',function (data) { Msg = data.data; }) $('#btnSubmit').click(function(){ if (Msg !=='' ){ // 判断是否点击的是确定 var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 window.localStorage.setItem('message',JSON.stringify(Msg)); parent.layer.close(index); } else { Feng.error("请选择一条数据!") } }); });