layui.use(['table','laydate', 'form'], function() { var table = layui.table; var $ = layui.jquery; var layer = layui.layer; var layDate = layui.laydate; var form = layui.form; tableIns = table.render({ elem: '#chooseData', data: [], even: true, limit: 500, cellMinWidth: 50, toolbar: '#toolbar', cols: [[ {type: 'checkbox'}, {field: 'matNo', align: 'center', title: '物料编码', sort: 'true'}, {field: 'barcode', align: 'center', title: '条码'}, {field: 'matName', align: 'center', title: '物料名称'}, {field: 'str1', align: 'center', title: '物料单位'}, {field: 'str2', align: 'center', title: '物料规格'}, {field: 'count', title: '数量', align: 'center', edit:'text', width: 100} ]], done: function (res, curr, count) { } }); // 监听排序事件 table.on('sort(chooseData)', function (obj) { var searchData = {}; $.each($('#search-box [name]').serializeArray(), function() { searchData[this.name] = this.value; }); searchData['orderByField'] = obj.field; searchData['orderByType'] = obj.type; matQueryTable.reload({ where: searchData, page: { curr: 1 }, done: function (res, curr, count) { if (res.code === 403) { top.location.href = baseUrl+"/"; } pageCurr=curr; limit(); } }); }); // 监听头工具栏事件 table.on('toolbar(chooseData)', function (obj) { var checkStatus = table.checkStatus(obj.config.id); var data = checkStatus.data; switch(obj.event) { case 'comb': if (data.length === 0){ layer.msg('请选择数据'); } else { layer.open({ type: 1, title: '组盘', maxmin: true, shadeClose: true, content: $('#combDiv'), success: function (layero, index) { } }) } break; } }); }); // 提取物料 var matCodeLayerIdx; function getMat() { tableIns.reload({data: []}); matCodeLayerIdx = layer.open({ type: 2, title: '提取物料', maxmin: true, area: [top.detailWidth, top.detailHeight], shadeClose: true, content: 'matQuery.html', success: function(layero, index){ } }); }