|  |  |  | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | function getCol() { | 
|---|
|  |  |  | var cols = [ | 
|---|
|  |  |  | {type: 'checkbox'}, | 
|---|
|  |  |  | {field: 'locNo$', align: 'center',title: '库位号'} | 
|---|
|  |  |  | ,{field: 'storeDate', align: 'center',title: '库龄(天)', hide: true, sort:true} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '商品编号', hide: false, sort:true} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '商品名称', hide: false, sort:true} | 
|---|
|  |  |  | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} | 
|---|
|  |  |  | ,{field: 'batch', align: 'center',title: '批号', hide: false, width: 300, sort:true} | 
|---|
|  |  |  | ,{field: 'anfme', align: 'center',title: '数量', hide: false} | 
|---|
|  |  |  | ,{field: 'zpallet', align: 'center',title: '托盘条码', hide: false} | 
|---|
|  |  |  | ,{field: 'specs', align: 'center',title: '规格', hide: false} | 
|---|
|  |  |  | ,{field: 'model', align: 'center',title: '代码', hide: true} | 
|---|
|  |  |  | ,{field: 'color', align: 'center',title: '颜色', hide: true} | 
|---|
|  |  |  | ,{field: 'brand', align: 'center',title: '品牌', hide: true} | 
|---|
|  |  |  | ,{field: 'unit', align: 'center',title: '单位', hide: true} | 
|---|
|  |  |  | ,{field: 'price', align: 'center',title: '单价', hide: true} | 
|---|
|  |  |  | ,{field: 'sku', align: 'center',title: '工序', hide: false} | 
|---|
|  |  |  | ,{field: 'units', align: 'center',title: '单位量', hide: true} | 
|---|
|  |  |  | ,{field: 'barcode', align: 'center',title: '条码', hide: true} | 
|---|
|  |  |  | ,{field: 'origin', align: 'center',title: '在库标记', hide: false} | 
|---|
|  |  |  | ,{field: 'manu', align: 'center',title: '厂家', hide: true} | 
|---|
|  |  |  | ,{field: 'manuDate', align: 'center',title: '生产日期', hide: true} | 
|---|
|  |  |  | ,{field: 'itemNum', align: 'center',title: '品项数', hide: true} | 
|---|
|  |  |  | ,{field: 'safeQty', align: 'center',title: '安全库存量', hide: true} | 
|---|
|  |  |  | ,{field: 'weight', align: 'center',title: '单箱净重', hide: true} | 
|---|
|  |  |  | ,{field: 'length', align: 'center',title: '单箱毛重', hide: true} | 
|---|
|  |  |  | ,{field: 'volume', align: 'center',title: '单箱体积', hide: true} | 
|---|
|  |  |  | ,{field: 'threeCode', align: 'center',title: '箱子尺寸', hide: true} | 
|---|
|  |  |  | ,{field: 'supp', align: 'center',title: '供应商', hide: true} | 
|---|
|  |  |  | ,{field: 'suppCode', align: 'center',title: '供应商编码', hide: true} | 
|---|
|  |  |  | ,{field: 'beBatch$', align: 'center',title: '是否批次', hide: true} | 
|---|
|  |  |  | ,{field: 'deadTime', align: 'center',title: '保质期', hide: true} | 
|---|
|  |  |  | ,{field: 'deadWarn', align: 'center',title: '预警天数', hide: true} | 
|---|
|  |  |  | ,{field: 'source$', align: 'center',title: '制购', hide: true} | 
|---|
|  |  |  | ,{field: 'check$', align: 'center',title: '要求检验', hide: true} | 
|---|
|  |  |  | ,{field: 'danger$', align: 'center',title: '危险品', hide: true} | 
|---|
|  |  |  | ,{field: 'frozen$', align: 'center',title: '冻结否', hide: true, | 
|---|
|  |  |  | templet: function(d) { | 
|---|
|  |  |  | // 根据条件判断字体颜色 | 
|---|
|  |  |  | if (d.frozen$ === '已冻结') { | 
|---|
|  |  |  | return '<span style="color: #34a8de;">' +d.frozen$ + '</span>'; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return '<span">' +d.frozen$ + '</span>'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // cols.push.apply(cols, detlCols); | 
|---|
|  |  |  | cols.push({field: 'modiUser$', align: 'center',title: '修改人员',hide: true} | 
|---|
|  |  |  | ,{field: 'modiTime$', align: 'center',title: '修改时间'} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: '备注', hide: false} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return cols; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | layui.use(['table','laydate', 'form'], function(){ | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/locDetl/list/auth', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | limit: 10, | 
|---|
|  |  |  | skin: 'line', | 
|---|
|  |  |  | limit: 16, | 
|---|
|  |  |  | limits: [16, 30, 50, 100, 200, 500], | 
|---|
|  |  |  | even: true, | 
|---|
|  |  |  | toolbar: '#toolbar', | 
|---|
|  |  |  | cellMinWidth: 50, | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | //            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} | 
|---|
|  |  |  | ,{field: 'locNo$', align: 'center',title: '库位号'} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '物料'} | 
|---|
|  |  |  | ,{field: 'lgnum', align: 'center',title: '仓库号', width:80} | 
|---|
|  |  |  | ,{field: 'tbnum', align: 'center',title: '转储请求编号'} | 
|---|
|  |  |  | // ,{field: 'tbpos', align: 'center',title: '行项目'} | 
|---|
|  |  |  | ,{field: 'zmatid', align: 'center',title: '物料标签ID', width:200} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '物料描述', width:150} | 
|---|
|  |  |  | ,{field: 'werks', align: 'center',title: '工厂'} | 
|---|
|  |  |  | ,{field: 'anfme', align: 'center',title: '数量', width:80} | 
|---|
|  |  |  | ,{field: 'altme', align: 'center',title: '单位', width:80} | 
|---|
|  |  |  | ,{field: 'zpallet', align: 'center',title: '托盘条码'} | 
|---|
|  |  |  | ,{field: 'bname', align: 'center',title: '用户ID'} | 
|---|
|  |  |  | // ,{field: 'memo', align: 'center',title: '备注'} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | cols: [getCol()], | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | pageSize: 'limit' | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'exportData': | 
|---|
|  |  |  | layer.confirm('确定导出Excel吗', function(){ | 
|---|
|  |  |  | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
|---|
|  |  |  | var titles=[]; | 
|---|
|  |  |  | var fields=[]; | 
|---|
|  |  |  | obj.config.cols[0].map(function (col) { | 
|---|
|  |  |  | 
|---|
|  |  |  | 'locDetl': exportData, | 
|---|
|  |  |  | 'fields': fields | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | var loadIndex = layer.msg('正在导出...', {icon: 16, shade: 0.01, time: false}); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/locDetl/export/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | table.exportFile(titles,res.data,'xls'); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | // 冻结 | 
|---|
|  |  |  | case 'frozen': | 
|---|
|  |  |  | let frozenData = checkStatus.data; | 
|---|
|  |  |  | console.log(frozenData) | 
|---|
|  |  |  | if (frozenData.length === 0){ | 
|---|
|  |  |  | layer.msg('请选择数据'); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.confirm('确定冻结库存吗?', function(){ | 
|---|
|  |  |  | let requestData = frozenData.map(obj => ({ | 
|---|
|  |  |  | locNo: obj.locNo, | 
|---|
|  |  |  | matnr: obj.matnr, | 
|---|
|  |  |  | batch: obj.batch | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/locDetl/frozenInventory", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: JSON.stringify(requestData), | 
|---|
|  |  |  | dataType:'json', | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | traditional:true, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | tableReload(false); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | // 解冻 | 
|---|
|  |  |  | case 'unfreeze': | 
|---|
|  |  |  | let unfreezeData = checkStatus.data; | 
|---|
|  |  |  | console.log(unfreezeData) | 
|---|
|  |  |  | if (unfreezeData.length === 0){ | 
|---|
|  |  |  | layer.msg('请选择数据'); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.confirm('确定解冻库存吗?', function(){ | 
|---|
|  |  |  | let requestData = unfreezeData.map(obj => ({ | 
|---|
|  |  |  | locNo: obj.locNo, | 
|---|
|  |  |  | matnr: obj.matnr, | 
|---|
|  |  |  | batch: obj.batch | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/locDetl/unfreezeInventory", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: JSON.stringify(requestData), | 
|---|
|  |  |  | dataType:'json', | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | traditional:true, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | tableReload(false); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | tableReload(false); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 搜索栏重置事件 | 
|---|
|  |  |  | form.on('submit(reset)', function (data) { | 
|---|
|  |  |  | pageCurr = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function tableReload(child) { | 
|---|
|  |  |  | var searchData = {}; | 
|---|
|  |  |  | var searchData = { | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | $.each($('#search-box [name]').serializeArray(), function() { | 
|---|
|  |  |  | searchData[this.name] = this.value; | 
|---|
|  |  |  | }); | 
|---|