var matCodeLayerIdx; var initCountVal = 0; var matCodeData = []; function getCol() { var cols = [ {fixed: 'left', field: 'anfme', title: '数量(必填)', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'}, {field: 'batch', title: '箱号(选填)', align: 'center', edit:'text', width: 200, style:'color: block;font-weight: bold'} ]; cols.push.apply(cols, matCols); cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 80}) return cols; } layui.config({ base: baseUrl + "/static/layui/lay/modules/" }).use(['admin', 'table','laydate', 'form'], function() { var table = layui.table; var $ = layui.jquery; var layer = layui.layer; var form = layui.form; var admin = layui.admin; tableIns = table.render({ elem: '#chooseData', data: [], even: true, limit: 500, cellMinWidth: 50, toolbar: '#toolbar', cols: [getCol()], done: function (res, curr, count) { limit(); getInBound(); } }); // 页面修改 table.on('edit(chooseData)', function (obj) { let index = obj.tr.attr("data-index"); let data = matCodeData[index]; let modify = true; if (obj.field === 'anfme'){ let vle = Number(obj.value); if (isNaN(vle)) { layer.msg("请输入数字", {icon: 2}); modify = false; } else { if (vle <= 0) { layer.msg("数量必须大于零", {icon: 2}); modify = false; } } } if (modify) { data[obj.field] = obj.value; } tableIns.reload({data: matCodeData}); }); // 监听头工具栏事件 table.on('toolbar(chooseData)', function (obj) { var checkStatus = table.checkStatus(obj.config.id); var data = checkStatus.data; switch(obj.event) { case 'comb': // 判断是否存在物料 if (matCodeData.length === 0) { layer.msg("请先提取商品", {icon: 2}); return; } // 判断物料数量是否存在异常 for (var i=0;i