var initCountVal = 0; var initAnfmeVal = "-"; var matCodeData = []; var currLocNo; var matCodeLayerIdx; function getCol() { var cols = [ {fixed: 'left', field: 'count', title: '实际数量', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'} ,{field: 'anfme', align: 'center',title: '数量'} ,{field: 'batch', align: 'center',title: '批号(编辑)', edit: true, style: 'font-weight:bold'} ]; arrRemove(detlCols, "field", "anfme"); arrRemove(detlCols, "field", "batch"); cols.push.apply(cols, detlCols); cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80}) return cols; } layui.config({ base: baseUrl + "/static/layui/lay/modules/" }).use(['table','laydate', 'form', 'admin'], function() { var table = layui.table; var $ = layui.jquery; var layer = layui.layer; var layDate = layui.laydate; 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(); } }); // 页面修改 table.on('edit(chooseData)', function (obj) { let index = obj.tr.attr("data-index"); let data = matCodeData[index]; let modify = true; if (obj.field === 'count'){ 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) { switch(obj.event) { case 'adjust': if (isEmpty(currLocNo)) { layer.msg("请先检索库位", {icon: 2}) inputTip($("#searchLocNo")); return; } if (matCodeData.length === 0) { layer.msg("请先添加明细", {icon: 2}); return; } for (var i=0;i