|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | var initCountVal = 1; | 
|---|
|  |  |  | var matCodeData = []; | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | layui.use(['table','laydate', 'form'], function() { | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | // 物料查询数据表 | 
|---|
|  |  |  | matQueryTable = table.render({ | 
|---|
|  |  |  | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl + '/matCode/list/auth', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | limit: 10, | 
|---|
|  |  |  | limits: [10, 30,50,100], | 
|---|
|  |  |  | limit: 7, | 
|---|
|  |  |  | limits: [7, 10, 30,50,100], | 
|---|
|  |  |  | even: true, | 
|---|
|  |  |  | cellMinWidth: 50, | 
|---|
|  |  |  | toolbar: '#toolbar', | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox', fixed: 'left'}, | 
|---|
|  |  |  | {field: 'matNo', align: 'center', title: '物料编码'}, | 
|---|
|  |  |  | {field: 'matNo', align: 'center', title: '物料编码', sort: 'true'}, | 
|---|
|  |  |  | {field: 'barcode', align: 'center', title: '条码'}, | 
|---|
|  |  |  | {field: 'matName', align: 'center', title: '物料名称'}, | 
|---|
|  |  |  | {field: 'str1', align: 'center', title: '物料单位'}, | 
|---|
|  |  |  | 
|---|
|  |  |  | if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl + "/"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | setMatCodeData(res.data); | 
|---|
|  |  |  | $('td[data-field=count] div').html("1"); | 
|---|
|  |  |  | setMatCodeData(res.data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 页面修改 | 
|---|
|  |  |  | table.on('edit(matCode)', function (obj) { | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | searchData['orderByField'] = obj.field; | 
|---|
|  |  |  | searchData['orderByType'] = obj.type; | 
|---|
|  |  |  | tableIns.reload({ | 
|---|
|  |  |  | matQueryTable.reload({ | 
|---|
|  |  |  | where: searchData, | 
|---|
|  |  |  | page: { | 
|---|
|  |  |  | curr: 1 | 
|---|
|  |  |  | 
|---|
|  |  |  | var checkStatus = table.checkStatus(obj.config.id); | 
|---|
|  |  |  | switch(obj.event) { | 
|---|
|  |  |  | case 'confirm': | 
|---|
|  |  |  | parent.layer.close(parent.matCodeLayerIdx); | 
|---|
|  |  |  | console.log(checkStatus); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function setMatCodeData(data, matNo, count) { | 
|---|
|  |  |  | function setMatCodeData(data) { | 
|---|
|  |  |  | matCodeData = data; | 
|---|
|  |  |  | for (var i=0;i<matCodeData.length;i++){ | 
|---|
|  |  |  | matCodeData[i]["count"] = initCountVal; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function updateMatCodeData(matNo, count) { | 
|---|
|  |  |  | for (var i=0;i<matCodeData.length;i++){ | 
|---|
|  |  |  | if (matCodeData[i][matNo] === matNo){ | 
|---|
|  |  |  | matCodeData[i][count] = count; | 
|---|
|  |  |  | if (matCodeData[i]["matNo"] === matNo){ | 
|---|
|  |  |  | matCodeData[i]["count"] = count; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log(matCodeData); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | setMatCodeData(res.data); | 
|---|
|  |  |  | $('td[data-field=count] div').html("1"); | 
|---|
|  |  |  | setMatCodeData(res.data); | 
|---|
|  |  |  | pageCurr=curr; | 
|---|
|  |  |  | if (res.data.length === 0 && count !== 0) { | 
|---|
|  |  |  | tableIns.reload({ | 
|---|