|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80}) | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | 
|---|
|  |  |  | url: baseUrl+"/full/store/put/start", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: JSON.stringify({ | 
|---|
|  |  |  | devpNo: $('#putSiteSelect').val(), | 
|---|
|  |  |  | devpNo: Number($('#putSiteSelect').val()), | 
|---|
|  |  |  | list: matCodeData | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | 
|---|
|  |  |  | // 添加表格数据 | 
|---|
|  |  |  | function addTableData(data) { | 
|---|
|  |  |  | for (var i=0;i<data.length;i++){ | 
|---|
|  |  |  | data[i]["count"] = initCountVal; | 
|---|
|  |  |  | let pass = false; | 
|---|
|  |  |  | for (var j=0;j<matCodeData.length;j++){ | 
|---|
|  |  |  | if (data[i].matNo === matCodeData[j].matNo) { | 
|---|
|  |  |  | pass = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pass) { | 
|---|
|  |  |  | data.splice(i--, 1); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | data[i]["count"] = initCountVal; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | matCodeData.push.apply(matCodeData, data); | 
|---|
|  |  |  | tableIns.reload({data: matCodeData}); | 
|---|