From 3b8d5759a3e2aaa170b848cc6a85d34274bd4f72 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 08 六月 2020 10:57:00 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/matCode/matCode.js |  126 ++++++++++++++++++++++++++---------------
 1 files changed, 80 insertions(+), 46 deletions(-)

diff --git a/src/main/webapp/static/js/matCode/matCode.js b/src/main/webapp/static/js/matCode/matCode.js
index 2e6971b..711f5a2 100644
--- a/src/main/webapp/static/js/matCode/matCode.js
+++ b/src/main/webapp/static/js/matCode/matCode.js
@@ -135,14 +135,6 @@
                     }
                 });
                 break;
-            case 'refreshData':
-                tableIns.reload({
-                    page: {
-                        curr: pageCurr
-                    }
-                });
-                limit();
-                break;
             case 'deleteData':
                 var data = checkStatus.data;
                 if (data.length === 0){
@@ -171,42 +163,19 @@
                 break;
             // 瀵煎嚭
             case 'exportData':
-                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 = {
-                        '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':
@@ -225,7 +194,30 @@
                     }
                 });
                 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
@@ -272,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);
@@ -376,10 +368,52 @@
                    });
                 }
                 break;
-
+            // 鎵撳嵃
+            case "btnPrint":
+                console.log(data);
+                layer.open({
+                    type: 1,
+                    title: '鎵撳嵃',
+                    // area: ['500px', top.detailHeight],
+                    shadeClose: true,
+                    content: $('#printDataDiv'),
+                    success: function(layero, index){
+                        layer.iframeAuto(index);
+                    },
+                    end: function () {
+                    }
+                });
+                break;
         }
     });
 
+    // 寮�濮嬫墦鍗�
+    form.on('submit(doPrint)', function (data) {
+        let param = [];
+        param.push("1902980-11/12");
+        console.log(param)
+        $.ajax({
+            url: baseUrl+"/macCode/print/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {param: param},
+            method: 'POST',
+            async: false,
+            success: function (res) {
+                if (res.code === 200){
+                    console.log(res.data);
+
+
+                } else if (res.code === 403){
+                    top.location.href = baseUrl;
+                }else {
+                    layer.msg(res.msg)
+                }
+            }
+        })
+        console.log(data.field);
+        // $('#template-preview-1').print();
+    })
+
     // 鏁版嵁淇濆瓨鍔ㄤ綔
     form.on('submit(save)', function () {
         if (banMsg != null){

--
Gitblit v1.9.1