From d23f39f6e3f743f7b46097a9315a6e28398218e5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 06 六月 2020 14:57:04 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/matCode/matCode.js |  158 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 90 insertions(+), 68 deletions(-)

diff --git a/src/main/webapp/static/js/matCode/matCode.js b/src/main/webapp/static/js/matCode/matCode.js
index 3208ba7..a199c29 100644
--- a/src/main/webapp/static/js/matCode/matCode.js
+++ b/src/main/webapp/static/js/matCode/matCode.js
@@ -116,27 +116,6 @@
         });
     });
 
-    // 瀵煎叆excel
-    upload.render({
-        elem: '#uploadEx'
-        , url: baseUrl + '/matCode/import/auth'
-        , headers: {token: localStorage.getItem('token')}
-        , accept: 'file'
-        , exts: 'xls|excel|xlsx'
-        , auto: false
-        , bindAction: '#uploadDo'
-        , choose: function(obj){
-            layui.$('#uploadDemoView').removeClass('layui-hide');
-            obj.preview(function(index, file, result){
-                console.log(file.name); //寰楀埌鏂囦欢鍚嶇О
-            });
-        }
-        , done: function (res) {
-            layer.msg('涓婁紶鎴愬姛');
-            limit();
-        }
-    })
-
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
     table.on('toolbar(matCode)', function (obj) {
         var checkStatus = table.checkStatus(obj.config.id);
@@ -155,14 +134,6 @@
                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                     }
                 });
-                break;
-            case 'refreshData':
-                tableIns.reload({
-                    page: {
-                        curr: pageCurr
-                    }
-                });
-                limit();
                 break;
             case 'deleteData':
                 var data = checkStatus.data;
@@ -190,59 +161,97 @@
                     });
                 }
                 break;
+            // 瀵煎嚭
             case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', 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 = {
-                        'matCode': exportData,
-                        'fields': fields
-                    };
-                    $.ajax({
-                        url: baseUrl+"/matCode/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)
-                            }
-                        }
-                    });
-                });
+                layer.open({
+                    type: 1,
+                    title: '鏁版嵁瀵煎嚭',
+                    shadeClose: true,
+                    content: $('#exportDataDiv'),
+                    success: function(layero, index){
+
+                    },
+                    end: function () {
+                        $("#exportFileName").val("");
+                        $("#exportRowCount").val("");
+                    }
+                })
                 break;
+            // 瀵煎叆
             case 'intoData':
                 layer.open({
                     type: 1,
                     title: '鏁版嵁瀵煎叆',
-                    maxmin: true,
-                    area: [top.detailWidth, top.detailHeight],
                     shadeClose: true,
                     content: $('#importDataDiv'),
                     success: function(layero, index){
+                        uploader.reload();
+                    },
+                    end: function () {
+                        $('#uploadDesc').show();
+                        $('#uploadDemoView').hide();
+                        $('#fileMame').html("");
+                    }
+                });
+                break;
+            // 鎵归噺鎵撳嵃
+            case "btnPrintBatch":
+                layer.open({
+                    type: 1,
+                    title: '鎵归噺鎵撳嵃',
+                    shadeClose: true,
+                    content: $('#printDataDiv'),
+                    success: function(layero, index){
 
+                    },
+                    end: function () {
                     }
                 });
                 break;
         }
     });
+
+    // 瀵煎嚭excel
+    form.on('submit(exportDo)', function(data) {
+        layer.closeAll();
+        layer.load(1, {shade: [0.1,'#fff']});
+        location.href = baseUrl + "/matCode/export/auth?fileName="+$("#exportFileName").val()+"&rowCount="+$("#exportRowCount").val();
+        layer.closeAll('loading');
+        return false;
+    });
+
+    // 瀵煎叆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){
@@ -255,7 +264,7 @@
                     title: '璇︽儏',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
-                    shadeClose: false,
+                    shadeClose: true,
                     content: 'matCode_detail.html',
                     success: function(layero, index){
                         setFormVal(layer.getChildFrame('#detail', index), data, true);
@@ -359,7 +368,20 @@
                    });
                 }
                 break;
+            // 鎵撳嵃
+            case "btnPrint":
+                layer.open({
+                    type: 1,
+                    title: '鎵撳嵃',
+                    shadeClose: true,
+                    content: $('#printDataDiv'),
+                    success: function(layero, index){
 
+                    },
+                    end: function () {
+                    }
+                });
+                break;
         }
     });
 

--
Gitblit v1.9.1