From d7744a5030e5ae69a6366d16df59005ee7573ff9 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期五, 13 九月 2024 10:24:54 +0800
Subject: [PATCH] #

---
 zy-asrs-wms/src/main/webapp/static/js/locDetl/locDetl.js |  133 +++++++++++++++++++++++++++++++------------
 1 files changed, 95 insertions(+), 38 deletions(-)

diff --git a/zy-asrs-wms/src/main/webapp/static/js/locDetl/locDetl.js b/zy-asrs-wms/src/main/webapp/static/js/locDetl/locDetl.js
index c1a777b..c948a57 100644
--- a/zy-asrs-wms/src/main/webapp/static/js/locDetl/locDetl.js
+++ b/zy-asrs-wms/src/main/webapp/static/js/locDetl/locDetl.js
@@ -2,16 +2,23 @@
 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, sort:true}
+        ,{field: 'orderType', align: 'center',title: '鍗曟嵁绫诲瀷', hide: false}
+        ,{field: 'batch', align: 'center',title: '鎵瑰彿', width: 80, 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: '浠g爜', hide: true}
         ,{field: 'color', align: 'center',title: '棰滆壊', hide: true}
         ,{field: 'brand', align: 'center',title: '鍝佺墝', hide: true}
@@ -192,48 +199,98 @@
                         exportData[this.name] = this.value;
                     });
                     var param = {
-                        'wrkDetlLog': exportData,
+                        'locDetl': exportData,
                         'fields': fields
                     };
-
-                    layer.load('Loading...', {
-                        shade: [0.1,'#fff']
-                    });
+                    var loadIndex = layer.msg('姝e湪瀵煎嚭...', {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;
         }
     });
@@ -388,7 +445,7 @@
                 }
                 pageCurr=curr;
 
-                limit(child);
+                limit();
             }
         });
     });

--
Gitblit v1.9.1