From 1185b9fa3a42b47116403c581b892ec54503a778 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 06 六月 2020 08:46:58 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/matCode/matCode.js |   58 ++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/src/main/webapp/static/js/matCode/matCode.js b/src/main/webapp/static/js/matCode/matCode.js
index d275886..1aa6c3f 100644
--- a/src/main/webapp/static/js/matCode/matCode.js
+++ b/src/main/webapp/static/js/matCode/matCode.js
@@ -116,19 +116,6 @@
         });
     });
 
-    // 瀵煎叆excel
-
-    upload.render({
-        elem: '#uploadEx'
-        , url: baseUrl + '/matCode/import/auth' //鏀规垚鎮ㄨ嚜宸辩殑涓婁紶鎺ュ彛
-        , headers: {token: localStorage.getItem('token')}
-        , accept: 'file' //鏅�氭枃浠�
-        , exts: 'xls|excel|xlsx' //鍙厑璁哥殑鏂囦欢鍚庣紑
-        , done: function (res) {
-            layer.msg('涓婁紶鎴愬姛');
-        }
-    })
-
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
     table.on('toolbar(matCode)', function (obj) {
         var checkStatus = table.checkStatus(obj.config.id);
@@ -182,8 +169,9 @@
                     });
                 }
                 break;
+            // 瀵煎嚭
             case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', function(){
+                layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true,}, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -220,21 +208,59 @@
                     });
                 });
                 break;
+            // 瀵煎叆
             case 'intoData':
                 layer.open({
                     type: 1,
                     title: '鏁版嵁瀵煎叆',
-                    maxmin: true,
                     shadeClose: true,
                     content: $('#importDataDiv'),
                     success: function(layero, index){
-
+                        uploader.reload();
+                    },
+                    end: function () {
+                        $('#uploadDesc').show();
+                        $('#uploadDemoView').hide();
+                        $('#fileMame').html("");
                     }
                 });
                 break;
         }
     });
 
+    // 瀵煎叆excel
+    var uploader = upload.render({
+        elem: '#uploadEx'
+        , url: baseUrl + '/matCode/import/auth'
+        , headers: {token: localStorage.getItem('token')}
+        , accept: 'file'
+        , exts: 'xls|excel|xlsx'
+        , auto: false
+        , bindAction: '#uploadDo'
+        , before: function(obj){
+            layer.closeAll();
+            layer.load(1, {shade: [0.1,'#fff']});
+        }
+        , choose: function(obj){
+            $('#uploadDesc').hide();
+            $('#uploadDemoView').show();
+            obj.preview(function(index, file, result){
+                $('#fileMame').html(file.name);
+            });
+        }
+        , done: function (res) {
+            limit();
+            $('#uploadDesc').show();
+            $('#uploadDemoView').hide();
+            $('#fileMame').html("");
+            layer.closeAll('loading');
+            layer.msg(res.msg);
+        }
+        , error: function(index, upload){
+            layer.closeAll('loading');
+        }
+    })
+
     // 鐩戝惉琛屽伐鍏蜂簨浠�
     table.on('tool(matCode)', function(obj){
         var data = obj.data;

--
Gitblit v1.9.1