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; /** * bom信息管理 */ var MaterialShortage = { tableId: "materialShortageTable2" }; var materialType = parent.materialType; console.log(materialType); var test; console.log(queryData); $('#serch').click(function(){ var queryData = {}; queryData['materialType'] = materialType; queryData['materialName'] = $("#materialName").val(); queryData['materialCode'] = $("#materialCode").val(); table.reload(MaterialShortage.tableId, { where: queryData, page: {curr: 1} }); }); /** * 缺料报警初始化表格的列 */ MaterialShortage.initColumn = function () { return [[ {type: 'radio'}, {field: 'id', hide: true, title: '主键id'}, {field: 'materialCode', sort: true, title: '产品编号', width: 125}, {field: 'materialName', sort: true, title: '产品名称', width: 270}, {field: 'drawingNo', sort: true, title: '图号', width: 165}, {field: 'materialSpecs', sort: true, title: '规格', width: 215}, {field: 'unit', sort: true, title: '单位'}, {field: 'materialScience', sort: true, title: '材料'}, {field: 'materialType', sort: true, title: '物料类型'}, {field: 'materialAttribute', sort: true, title: '属性'}, ]]; }; table = $.extend(table, {config: {checkName: 'checked'}}); var queryData = {}; queryData['materialType'] = materialType; var tableResult = table.render({ elem: '#' + MaterialShortage.tableId, url: Feng.ctxPath + '/materialInfo/list', page: true, where:queryData, cellMinWidth: 80, cols: MaterialShortage.initColumn() }); let Msg=''; table.on('row(materialShortageTable2)',function (data) { Msg = data.data; }) $('#btnSubmit').click(function(){ clearType(); if (Msg !=='' ){ // 判断是否点击的是确定 var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 window.localStorage.setItem('message',JSON.stringify(Msg)); parent.layer.close(index); } else { Feng.error("请选择一条数据!") } }); $('#reset').click(function(){ clearType(); }); function clearType(){ parent.materialType=""; } window.onunload = function () { console.log("11111111111") } });