|  |  | 
 |  |  | var pageCurr; | 
 |  |  | function getCol() { | 
 |  |  |     var cols = [ | 
 |  |  |         {field: 'locNo$', align: 'center',title: '库位号'}, | 
 |  |  |         {field: 'matnr', align: 'center',title: '商品编号', sort:true} | 
 |  |  |         ,{field: 'maktx', align: 'center',title: '商品名称', sort:true} | 
 |  |  |         {field: 'locNo', align: 'center',title: '库位号'}, | 
 |  |  |         {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, sort:true} | 
 |  |  |         ,{field: 'orderType', align: 'center',title: '单据类型', hide: false} | 
 |  |  |         ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true} | 
 |  |  |         ,{field: 'anfme', align: 'center',title: '数量', width: 100} | 
 |  |  |         ,{field: 'zpallet', align: 'center',title: '托盘条码'} | 
 |  |  |         ,{field: 'memo', align: 'center',title: '翻包'} | 
 |  |  |         ,{field: 'owner$', align: 'center',title: '拥有者'} | 
 |  |  |         ,{field: 'zpallet', align: 'center',title: '托盘码'} | 
 |  |  |         ,{field: 'templet', align: 'center',title: '机型',templet:function(row){ | 
 |  |  |             return row.mat$.model | 
 |  |  |         }} | 
 |  |  |         ,{field: 'templet', align: 'center',title: '制令',templet:function(row){ | 
 |  |  |                 return row.mat$.decrees | 
 |  |  |         }} | 
 |  |  |         ,{field: 'memo', align: 'center',title: '备注'} | 
 |  |  |         // ,{field: 'owner$', align: 'center',title: '拥有者'} | 
 |  |  |  | 
 |  |  |         ,{field: 'specs', align: 'center',title: '配置'} | 
 |  |  |         ,{field: 'specs', align: 'center',title: '规格'} | 
 |  |  |         ,{field: 'model', align: 'center',title: '代码', hide: true} | 
 |  |  |         ,{field: 'color', align: 'center',title: '颜色', hide: true} | 
 |  |  |         ,{field: 'brand', align: 'center',title: '品牌', hide: true} | 
 |  |  | 
 |  |  |                         exportData[this.name] = this.value; | 
 |  |  |                     }); | 
 |  |  |                     var param = { | 
 |  |  |                         'wrkDetlLog': exportData, | 
 |  |  |                         'locDetl': exportData, | 
 |  |  |                         'fields': fields | 
 |  |  |                     }; | 
 |  |  |  | 
 |  |  |                     layer.load('Loading...', { | 
 |  |  |                         shade: [0.1,'#fff'] | 
 |  |  |                     }); | 
 |  |  |                     var loadIndex = layer.msg('正在导出...', {icon: 16, shade: 0.01, time: false}); | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl + "/locDetl/export/auth", | 
 |  |  |                         url: baseUrl+"/locDetl/export/auth", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: JSON.stringify(param), | 
 |  |  |                         dataType:'json', | 
 |  |  |                         contentType:'application/json;charset=UTF-8', | 
 |  |  |                         method: 'POST', | 
 |  |  |                         xhrFields: { | 
 |  |  |                             responseType: "blob" // 设置响应类型为二进制数据 | 
 |  |  |                         }, | 
 |  |  |                         success: function (res) { | 
 |  |  |                             // 创建一个临时的下载链接 | 
 |  |  |                             const url = window.URL.createObjectURL(res); | 
 |  |  |                             // 创建一个隐藏的 <a> 元素并设置下载链接 | 
 |  |  |                             const a = document.createElement("a"); | 
 |  |  |                             a.style.display = "none"; | 
 |  |  |                             a.href = url; | 
 |  |  |                             a.download = "export.xlsx"; // 指定下载的文件名 | 
 |  |  |                             document.body.appendChild(a); | 
 |  |  |  | 
 |  |  |                             // 触发点击事件以开始下载 | 
 |  |  |                             a.click(); | 
 |  |  |  | 
 |  |  |                             // 清理临时资源 | 
 |  |  |                             setTimeout(function () { | 
 |  |  |                                 window.URL.revokeObjectURL(url); | 
 |  |  |                                 document.body.removeChild(a); | 
 |  |  |                                 layer.closeAll(); | 
 |  |  |                             }, 100); | 
 |  |  |                         }, | 
 |  |  |                         fail: function (){ | 
 |  |  |                             layer.msg('导出失败', {icon: 2}) | 
 |  |  |                             layer.close(loadIndex); | 
 |  |  |                             layer.closeAll(); | 
 |  |  |                             if (res.code === 200) { | 
 |  |  |                                 res.data.forEach((item,index) => { | 
 |  |  |                                     if (item[0] != null) { | 
 |  |  |                                         item[0] = "'" + item[0]; | 
 |  |  |                                     } | 
 |  |  |                                     if (item[1] != null) { | 
 |  |  |                                         item[1] = "'" + item[1]; | 
 |  |  |                                     } | 
 |  |  |                                     if (item[2] != null) { | 
 |  |  |                                         item[2] = "'" + item[2]; | 
 |  |  |                                     } | 
 |  |  |                                 }) | 
 |  |  |                                 table.exportFile(titles,res.data,'xls'); | 
 |  |  |                             } else if (res.code === 403) { | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             } else { | 
 |  |  |                                 layer.msg(res.msg) | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 }); | 
 |  |  |                 // debugger; | 
 |  |  |                 // layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
 |  |  |                 //     var titles=[]; | 
 |  |  |                 //     var fields=[]; | 
 |  |  |                 //     obj.config.cols[0].map(function (col) { | 
 |  |  |                 //         if (col.type === 'normal' && col.hide === false && col.toolbar == null) { | 
 |  |  |                 //             titles.push(col.title); | 
 |  |  |                 //             fields.push(col.field); | 
 |  |  |                 //         } | 
 |  |  |                 //     }); | 
 |  |  |                 //     var exportData = {}; | 
 |  |  |                 //     $.each($('#search-box [name]').serializeArray(), function() { | 
 |  |  |                 //         exportData[this.name] = this.value; | 
 |  |  |                 //     }); | 
 |  |  |                 //     var param = { | 
 |  |  |                 //         'wrkDetlLog': exportData, | 
 |  |  |                 //         'fields': fields | 
 |  |  |                 //     }; | 
 |  |  |                 // | 
 |  |  |                 //     layer.load('Loading...', { | 
 |  |  |                 //         shade: [0.1,'#fff'] | 
 |  |  |                 //     }); | 
 |  |  |                 //     $.ajax({ | 
 |  |  |                 //         url: baseUrl + "/locDetl/export/auth", | 
 |  |  |                 //         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                 //         data: JSON.stringify(param), | 
 |  |  |                 //         contentType:'application/json;charset=UTF-8', | 
 |  |  |                 //         method: 'POST', | 
 |  |  |                 //         xhrFields: { | 
 |  |  |                 //             responseType: "blob" // 设置响应类型为二进制数据 | 
 |  |  |                 //         }, | 
 |  |  |                 //         success: function (res) { | 
 |  |  |                 //             // 创建一个临时的下载链接 | 
 |  |  |                 //             const url = window.URL.createObjectURL(res); | 
 |  |  |                 //             // 创建一个隐藏的 <a> 元素并设置下载链接 | 
 |  |  |                 //             const a = document.createElement("a"); | 
 |  |  |                 //             a.style.display = "none"; | 
 |  |  |                 //             a.href = url; | 
 |  |  |                 //             a.download = "export.xlsx"; // 指定下载的文件名 | 
 |  |  |                 //             document.body.appendChild(a); | 
 |  |  |                 // | 
 |  |  |                 //             // 触发点击事件以开始下载 | 
 |  |  |                 //             a.click(); | 
 |  |  |                 // | 
 |  |  |                 //             // 清理临时资源 | 
 |  |  |                 //             setTimeout(function () { | 
 |  |  |                 //                 window.URL.revokeObjectURL(url); | 
 |  |  |                 //                 document.body.removeChild(a); | 
 |  |  |                 //                 layer.closeAll(); | 
 |  |  |                 //             }, 100); | 
 |  |  |                 //         }, | 
 |  |  |                 //         fail: function (){ | 
 |  |  |                 //             layer.msg('导出失败', {icon: 2}) | 
 |  |  |                 //             layer.closeAll(); | 
 |  |  |                 //         } | 
 |  |  |                 //     }); | 
 |  |  |                 // }); | 
 |  |  |                 break; | 
 |  |  |         } | 
 |  |  |     }); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 pageCurr=curr; | 
 |  |  |  | 
 |  |  |                 limit(child); | 
 |  |  |                 limit(); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     }); |