| | |
| | | |
| | | var initCountVal = 0; |
| | | var matCodeData = []; |
| | | function getCol() { |
| | | var cols = [ |
| | | {fixed: 'left', field: 'count', title: '数量(必填)', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'} |
| | | ]; |
| | | cols.push.apply(cols, matCols); |
| | | cols.push( |
| | | {field: 'memo', title:'备注', align: 'center'}, |
| | | {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | ) |
| | | return cols; |
| | | } |
| | | |
| | | layui.use(['table','laydate', 'form'], function() { |
| | | var table = layui.table; |
| | |
| | | limit: 500, |
| | | cellMinWidth: 50, |
| | | toolbar: '#toolbar', |
| | | cols: [[ |
| | | {fixed: 'left', field: 'count', title: '数量(必填)', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'}, |
| | | {field: 'matNo', align: 'center', title: '物料编码'}, |
| | | {field: 'barcode', align: 'center', title: '条码'}, |
| | | {field: 'matName', align: 'center', title: '物料名称'}, |
| | | {field: 'str1', align: 'center', title: '物料单位'}, |
| | | {field: 'str2', align: 'center', title: '物料规格'}, |
| | | {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80} |
| | | ]], |
| | | cols: [getCol()], |
| | | done: function (res, curr, count) { |
| | | $('td[data-field=count] div').html(initCountVal); |
| | | setMatCodeData(res.data); |
| | |
| | | var data = checkStatus.data; |
| | | switch(obj.event) { |
| | | case 'comb': |
| | | // 判断是否存在物料 |
| | | // 判断是否存在产品 |
| | | if (matCodeData.length === 0) { |
| | | layer.msg("请先添加物料"); |
| | | layer.msg("请先添加产品"); |
| | | return; |
| | | } |
| | | // 判断物料数量是否存在异常 |
| | | // 判断产品数量是否存在异常 |
| | | for (var i=0;i<matCodeData.length;i++){ |
| | | if (isNaN(matCodeData[i].count)) { |
| | | layer.msg("请输入数字"); |
| | |
| | | // 监听行工具事件 |
| | | table.on('tool(chooseData)', function(obj){ |
| | | var data = obj.data; |
| | | |
| | | switch (obj.event) { |
| | | case 'remove': |
| | | for (var i = matCodeData.length - 1; i >= 0; i--) { |
| | |
| | | getInBound(); |
| | | // 覆盖render方法的done |
| | | }}); |
| | | break; |
| | | case 'memo': |
| | | var memoLayer = layer.open({ |
| | | type: 2, |
| | | title: '备注', |
| | | maxmin: true, |
| | | area: ['400px', '215px'], |
| | | shadeClose: false, |
| | | content: 'matMemo.html', |
| | | btn: ['保存', '取消'], |
| | | style: 'text-algin: center', |
| | | yes: function(index, layero){ |
| | | var memo = layer.getChildFrame('body', index).find("#memo")[0].value; |
| | | matCodeData.map(function (item) { |
| | | if (item.matNo === data.matNo) { |
| | | item.memo = memo; |
| | | } |
| | | }); |
| | | // 重置表格数据 |
| | | tableIns.reload({data: matCodeData,done:function (res) { |
| | | limit(); |
| | | getInBound(); |
| | | layer.close(memoLayer); |
| | | }}); |
| | | }, |
| | | success: function(layero, index){ |
| | | var iframeWin = window[layero.find('iframe')[0]['name']];//得到iframe页的窗口对象 |
| | | iframeWin.setMatMemo(data.memo); |
| | | } |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | |
| | | |
| | | }); |
| | | |
| | | // 提取物料 |
| | | // 提取产品 |
| | | var matCodeLayerIdx; |
| | | function getMat() { |
| | | matCodeLayerIdx = layer.open({ |
| | | type: 2, |
| | | title: '提取物料', |
| | | title: '提取产品', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |