|  |  |  | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | var tableData; | 
|---|
|  |  |  | var admin; | 
|---|
|  |  |  | function getCol() { | 
|---|
|  |  |  | var cols = [ | 
|---|
|  |  |  | {field: 'locNo', align: 'center',title: '库位号'}, | 
|---|
|  |  |  | {field: 'matnr', align: 'center',title: '存货编码', sort:true} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '存货名称', sort:true} | 
|---|
|  |  |  | {field: 'matnr', align: 'center',title: '商品编码', sort:true} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '商品名称', sort:true} | 
|---|
|  |  |  | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false} | 
|---|
|  |  |  | ,{field: 'batch', align: 'center',title: '序列码', width: 300} | 
|---|
|  |  |  | ,{field: 'anfme', align: 'center',title: '数量'} | 
|---|
|  |  |  | ,{field: 'suppCode', align: 'center',title: '料箱码'} | 
|---|
|  |  |  | ,{field: 'suppCode', align: 'center',title: '货架码'} | 
|---|
|  |  |  | ,{field: 'threeCode', align: 'center',title: '销售订单号'} | 
|---|
|  |  |  | ,{field: 'deadTime', align: 'center',title: '销售订单行号'} | 
|---|
|  |  |  | ,{field: 'specs', align: 'center',title: '规格型号', hide: false} | 
|---|
|  |  |  | ,{field: 'model', align: 'center',title: '通用型号', hide: false} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ,{field: 'brand', align: 'center',title: '存货分类编码', hide: true} | 
|---|
|  |  |  | ,{field: 'color', align: 'center',title: '存货分类名称', hide: true} | 
|---|
|  |  |  | ,{field: 'brand', align: 'center',title: '商品分类编码', hide: true} | 
|---|
|  |  |  | ,{field: 'color', align: 'center',title: '商品分类名称', hide: true} | 
|---|
|  |  |  | ,{field: 'unit', align: 'center',title: '计量单位', hide: true} | 
|---|
|  |  |  | ,{field: 'price', align: 'center',title: '进项税', hide: true} | 
|---|
|  |  |  | ,{field: 'units', align: 'center',title: '销项税', hide: true} | 
|---|
|  |  |  | 
|---|
|  |  |  | return cols; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | layui.use(['table','laydate', 'form'], function(){ | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).use(['table','laydate','admin','form'], function(){ | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | admin = layui.admin; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 数据渲染 | 
|---|
|  |  |  | tableIns = table.render({ | 
|---|
|  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'exportData': | 
|---|
|  |  |  | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
|---|
|  |  |  | layer.load(2, {time: 600*1000}); | 
|---|
|  |  |  | var titles=[]; | 
|---|
|  |  |  | var fields=[]; | 
|---|
|  |  |  | obj.config.cols[0].map(function (col) { | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 导入销售单 | 
|---|
|  |  |  | $("#compareToEss").click(function () { | 
|---|
|  |  |  | $("#importExcel").trigger("click"); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 时间选择器 | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#modiTime\\$', | 
|---|
|  |  |  | 
|---|
|  |  |  | $("#search").click(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | function upload(obj){ | 
|---|
|  |  |  | if(!obj.files) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var file = obj.files[0]; | 
|---|
|  |  |  | admin.confirm('确认导入 [' + file.name +'] 文件吗?', function (index) { | 
|---|
|  |  |  | layer.load(1, {shade: [0.1,'#fff']}); | 
|---|
|  |  |  | var url = baseUrl + "/agv/locDetl/compare/auth"; | 
|---|
|  |  |  | var form = new FormData(); | 
|---|
|  |  |  | form.append("file", file); | 
|---|
|  |  |  | let xhr = new XMLHttpRequest(); | 
|---|
|  |  |  | xhr.open("post", url, true); | 
|---|
|  |  |  | xhr.setRequestHeader('token', localStorage.getItem('token')); | 
|---|
|  |  |  | xhr.onload = uploadComplete; | 
|---|
|  |  |  | xhr.onerror =  uploadFailed; | 
|---|
|  |  |  | xhr.onloadend = function () { | 
|---|
|  |  |  | layer.closeAll('loading'); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | // xhr.upload.onprogress = progressFunction; | 
|---|
|  |  |  | xhr.upload.onloadstart = function(){ | 
|---|
|  |  |  | ot = new Date().getTime(); | 
|---|
|  |  |  | oloaded = 0; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | xhr.send(form); | 
|---|
|  |  |  | }, function(index){ | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function uploadComplete(evt) { | 
|---|
|  |  |  | let res = JSON.parse(evt.target.responseText); | 
|---|
|  |  |  | if(res.code === 200) { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | insTb.reload({page: {curr: 1}}); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | alert(res.msg); | 
|---|
|  |  |  | // layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function uploadFailed(evt) { | 
|---|
|  |  |  | let res = JSON.parse(evt.target.responseText); | 
|---|
|  |  |  | alert(res.msg); | 
|---|
|  |  |  | // layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|