From 8145b109ec0e9bb73d3930acf73e8dc18844adc2 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期四, 05 九月 2024 13:10:07 +0800
Subject: [PATCH] #

---
 zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js |  167 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 117 insertions(+), 50 deletions(-)

diff --git a/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js b/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js
index cbda7a6..7461fd9 100644
--- a/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js
+++ b/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js
@@ -24,20 +24,20 @@
         height: 'full-120',
         cols: [[
             {type: 'checkbox'}
-            ,{field: 'id', align: 'center',title: ''}
-            ,{field: 'uuid', align: 'center',title: ''}
-            ,{field: 'status', align: 'center',title: ''}
-            ,{field: 'createTime$', align: 'center',title: ''}
-            ,{field: 'createBy', align: 'center',title: ''}
-            ,{field: 'updateTime$', align: 'center',title: ''}
-            ,{field: 'updateBy', align: 'center',title: ''}
-            ,{field: 'memo', align: 'center',title: ''}
-            ,{field: 'matnr', align: 'center',title: ''}
-            ,{field: 'batch', align: 'center',title: ''}
-            ,{field: 'anfme', align: 'center',title: ''}
-            ,{field: 'locNo', align: 'center',title: ''}
-            ,{field: 'maktx', align: 'center',title: ''}
-            ,{field: 'ownerId', align: 'center',title: ''}
+            ,{field: 'id', align: 'center',title: 'ID',hide : true}
+            ,{field: 'uuid', align: 'center',title: '缂栧彿',hide: true}
+            ,{field: 'status$', align: 'center',title: '鎵撳嵃鎯呭喌', width:100,hide: false}
+            ,{field: 'matnr', align: 'center',title: '鍝佸彿', width:180,hide: false}
+            // ,{field: 'batch', align: 'center',title: '鎵规', width:100,hide: false}
+            // ,{field: 'anfme', align: 'center',title: '閲嶉噺(kg)', width:100,hide: false}
+            // ,{field: 'locNo', align: 'center',title: '搴撲綅鍙�', width:120,hide: false}
+            ,{field: 'maktx', align: 'center',title: '鍝佸悕',hide: false}
+            // ,{field: 'owner$', align: 'center',title: '璐т富',hide: false}
+            // ,{field: 'createTime$', align: 'center',title: '鍏ュ簱鏃堕棿', width:120,hide: false}
+            // ,{field: 'createBy$', align: 'center',title: '鍏ュ簱浜哄憳', width:100,hide: false}
+            ,{field: 'updateTime$', align: 'center',title: '鎵撳嵃鏃堕棿', width:180,hide: false}
+            ,{field: 'updateBy$', align: 'center',title: '鎵撳嵃浜哄憳',hide: false}
+            ,{field: 'memo', align: 'center',title: '澶囨敞',hide: false}
 
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
         ]],
@@ -60,7 +60,7 @@
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
-            pageCurr=curr;pageCount=count;
+            pageCurr=curr;
             limit();
         }
     });
@@ -87,14 +87,14 @@
                 showEditModel();
                 break;
             case 'deleteData':
-               if (checkStatus.length === 0) {
-                   layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
-                   return;
-               }
-               del(checkStatus.map(function (d) {
-                   return d.id;
-               }));
-               break;
+                if (checkStatus.length === 0) {
+                    layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+                    return;
+                }
+                del(checkStatus.map(function (d) {
+                    return d.id;
+                }));
+                break;
             case 'exportData':
                 admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
                     var titles=[];
@@ -133,6 +133,29 @@
                     });
                 });
                 break;
+            // 鎵归噺鎵撳嵃
+            case "btnPrintBatch":
+                printMatCodeNos = [];
+                var data = checkStatus;
+                if (data.length === 0){
+                    layer.msg('璇烽�夋嫨鎵撳嵃鏁版嵁');
+                } else {
+                    layer.open({
+                        type: 1,
+                        title: '鎵归噺鎵撳嵃 [鏁伴噺'+ data.length +']',
+                        area: ['500px'],
+                        shadeClose: true,
+                        content: $('#printDataDiv'),
+                        success: function(layero, index){
+                            for (var i = 0; i<data.length;i++) {
+                                printMatCodeNos.push(data[i].id);
+                            }
+                        },
+                        end: function () {
+                        }
+                    });
+                }
+                break;
         }
     });
 
@@ -140,6 +163,10 @@
     table.on('tool(locInPrintMat)', function(obj){
         var data = obj.data;
         switch (obj.event) {
+            case 'btnPrint':
+                layer.msg("搴熷純")
+                break;
+            // btnPrint(data.id, data.orderNo, 4);
             case 'edit':
                 showEditModel(data);
                 break;
@@ -154,11 +181,11 @@
         admin.open({
             type: 1,
             area: '600px',
-            title: (mData ? '淇敼' : '娣诲姞') + '',
+            title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��',
             content: $('#editDialog').html(),
             success: function (layero, dIndex) {
-                form.val('detail', mData);
                 layDateRender(mData);
+                form.val('detail', mData);
                 form.on('submit(editSubmit)', function (data) {
                     var loadIndex = layer.load(2);
                     $.ajax({
@@ -218,40 +245,84 @@
     // 鎼滅储
     form.on('submit(search)', function (data) {
         pageCurr = 1;
-        tableReload(true);
+        tableReload(false);
     });
 
     // 閲嶇疆
     form.on('submit(reset)', function (data) {
         pageCurr = 1;
         clearFormVal($('#search-box'));
-        tableReload(true);
+        tableReload(false);
+    });
+
+    // 妯℃澘閫夋嫨
+    form.on('radio(selectTemplateRadio)', function (data) {
+        $('.template-preview').hide();
+        $('#template-preview-'+data.value).show();
+    });
+
+    // 寮�濮嬫墦鍗�
+    form.on('submit(doPrint)', function (data) {
+        var templateNo = data.field.selectTemplate;
+        $.ajax({
+            url: baseUrl+"/loc/in/mat/print/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {param: printMatCodeNos},
+            method: 'POST',
+            async: false,
+            success: function (res) {
+                if (res.code === 200){
+                    layer.closeAll();
+                    for (let i=0;i<res.data.length;i++){
+                        var templateDom = $("#templatePreview"+templateNo);
+                        var className = templateDom.attr("class");
+                        if (className === 'template-barcode') {
+                            res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1&param="
+                                +res.data[i].matnr+";" +res.data[i].batch+";"
+                                +res.data[i].anfme+";" +res.data[i].locNo+";"
+                                +res.data[i].ownerId+";"+res.data[i].maktx+";"
+                                +res.data[i].id;
+                        } else {
+                            res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2&param="
+                                +res.data[i].matnr+";" +res.data[i].batch+";"
+                                +res.data[i].anfme+";" +res.data[i].locNo+";"
+                                +res.data[i].ownerId+";"+res.data[i].maktx+";"
+                                +res.data[i].id;
+                        }
+                    }
+                    var tpl = templateDom.html();
+                    var template = Handlebars.compile(tpl);
+                    var html = template(res);
+                    var box = $("#box");
+                    box.html(html);box.show();
+                    box.print({mediaPrint:true});
+                    box.hide();
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                }else {
+                    layer.msg(res.msg)
+                }
+            }
+        })
     });
 
     // 鏃堕棿閫夋嫨鍣�
     function layDateRender(data) {
         setTimeout(function () {
             layDate.render({
-                elem: '.layui-laydate-range'
-                ,type: 'datetime'
-                ,range: true
-            });
-            layDate.render({
                 elem: '#createTime\\$',
                 type: 'datetime',
-                value: data!==undefined?data['createTime$']:null
+                value: data!==undefined?data['createTime\\$']:null
             });
             layDate.render({
                 elem: '#updateTime\\$',
                 type: 'datetime',
-                value: data!==undefined?data['updateTime$']:null
+                value: data!==undefined?data['updateTime\\$']:null
             });
 
-        }, 100);
+        }, 300);
     }
     layDateRender();
-
-
 
 });
 
@@ -260,17 +331,13 @@
     parent.layer.closeAll();
 });
 
-function tableReload(search) {
-    if (pageCount === 0 || search) {
-        let searchData = {};
-        $.each($('#search-box [name]').serializeArray(), function() {
-            searchData[this.name] = this.value;
-        });
-        tableIns.reload({
-            where: searchData,
-            page: {curr: pageCurr}
-        });
-    } else {
-        $(".layui-laypage-btn")[0].click();
-    }
+function tableReload(child) {
+    var searchData = {};
+    $.each($('#search-box [name]').serializeArray(), function() {
+        searchData[this.name] = this.value;
+    });
+    tableIns.reload({
+        where: searchData,
+        page: {curr: pageCurr}
+    });
 }

--
Gitblit v1.9.1