From 3ca19bf8f8356440d4bede84cde8450327e189cb Mon Sep 17 00:00:00 2001
From: mrzhssss <pro6@qq.com>
Date: 星期五, 06 五月 2022 17:03:25 +0800
Subject: [PATCH] 新增库存同步excel导出功能

---
 src/main/webapp/static/js/locSync/locSync.js |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/main/webapp/static/js/locSync/locSync.js b/src/main/webapp/static/js/locSync/locSync.js
index 00e4f42..e6bf0ab 100644
--- a/src/main/webapp/static/js/locSync/locSync.js
+++ b/src/main/webapp/static/js/locSync/locSync.js
@@ -54,6 +54,44 @@
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
     table.on('toolbar(locSum)', function (obj) {
         switch (obj.event) {
+            case 'otherExportData':
+                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 = {
+                        'pakin': exportData,
+                        'fields': fields
+                    };
+                    $.ajax({
+                        url: baseUrl+"/locsync/export/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: JSON.stringify(param),
+                        dataType:'json',
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        success: function (res) {
+                            layer.closeAll();
+                            if (res.code === 200) {
+                                table.exportFile(titles,res.data,'xls');
+                            } else if (res.code === 403) {
+                                top.location.href = baseUrl+"/";
+                            } else {
+                                layer.msg(res.msg, {icon: 2})
+                            }
+                        }
+                    });
+                });
+                break;
             case 'btnSync':
                 $.ajax({
                     url: baseUrl + "/locSync/syncLocWrkCount",
@@ -133,6 +171,7 @@
                     }
                 });
                 break;
+
             default:
                 break;
         }

--
Gitblit v1.9.1