From b51eadaa66a5c0ee6da0e418a3ba193dfc878fca Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 03 七月 2025 13:21:56 +0800
Subject: [PATCH] 1

---
 src/main/webapp/static/js/order/order.js |  123 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 116 insertions(+), 7 deletions(-)

diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js
index e277615..f85e12f 100644
--- a/src/main/webapp/static/js/order/order.js
+++ b/src/main/webapp/static/js/order/order.js
@@ -10,6 +10,7 @@
     var admin = layui.admin;
     var xmSelect = layui.xmSelect;
     var layDate = layui.laydate;
+    var laytpl = layui.laytpl;
 
     // 娓叉煋鎼滅储妯℃澘
     $.ajax({
@@ -41,13 +42,15 @@
         cellMinWidth: 100,
         cols: [[
             {type: 'numbers'},
-            {field: 'orderNo', title: '鍗曟嵁缂栧彿'},
-            {field: 'docType$', align: 'center', title: '绫诲瀷',  minWidth: 160, width: 160},
-            {align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160},
-            {field: 'createTime$', title: '鍒涘缓鏃堕棿', minWidth: 200, width: 200},
+            {field: 'orderNo', title: '鍗曟嵁缂栧彿', templet: '#orderNoTpl',minWidth: 200},
+            {field: 'docType$', align: 'center', title: '绫诲瀷'},
+            {align: 'center', title: '鏄庣粏', toolbar: '#tbLook'},
+            {field: 'createTime$', title: '鍒涘缓鏃堕棿'},
             {field: 'settle$', align: 'center', title: '鐘舵��', templet: '#settleTpl',  minWidth: 160, width: 160},
+            {field: 'shipName', align: 'center',title: '鍒跺崟浜�'},
+            {field: 'itemName', align: 'center',title: '浠撳簱'},
             {field: 'memo', align: 'center',title: '澶囨敞', hide: true},
-            {align: 'center', title: '鎿嶄綔', toolbar: '#operate', width: 180}
+            {align: 'center', title: '鎿嶄綔', toolbar: '#operate'}
         ]],
         request: {
             pageName: 'curr',
@@ -89,6 +92,8 @@
         var layEvent = obj.event;
         if (layEvent === 'edit') {
             showEditModel(data);
+        } else if (layEvent === 'wrkTrace') {
+            showWrkTrace(data.id);
         } else if (layEvent === 'del') {
             doDel(data.id);
         } else if (layEvent === 'complete') {
@@ -101,7 +106,7 @@
             layer.open({
                 type: 1,
                 title: false,
-                area: '820px',
+                area: '1000px',
                 offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
                 shade: .01,
                 shadeClose: true,
@@ -121,10 +126,15 @@
                             {type: 'numbers'},
                             {field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
                             {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 160},
+                            {field: 'specs', title: '瑙勬牸', width: 160},
                             {field: 'batch', title: '鎵瑰彿'},
+                            // {field: 'supp', align: 'center',title: '渚涘簲鍟�', hide: false}
+                            // ,{field: 'sku', align: 'center',title: '瀹㈡埛鍚嶇О', hide: false}
+                            // ,{field: 'suppCode', align: 'center',title: '鏉ユ簮鍗曞彿', hide: false},
                             {field: 'anfme', title: '鏁伴噺'},
                             {field: 'workQty', title: '浣滀笟鏁伴噺'},
                             {field: 'qty', title: '瀹屾垚鏁伴噺', style: 'font-weight: bold'},
+                            // {align: 'center', title: '鎵撳嵃', toolbar: '#printOperate', width: 80}
                             // {field: 'unit', title: '鍗曚綅'},
                             // {
                             //     field: 'createTime$', title: '鍒涘缓鏃堕棿', sort: true, templet: function (d) {
@@ -133,7 +143,7 @@
                             // },
                             // {field: 'inQty', title: '宸插叆搴撻噺'},
                             // {field: 'color', title: '棰滆壊'},
-                            {field: 'specs', title: '瑙勬牸'}
+
                         ]],
                         request: {
                             pageName: 'curr',
@@ -158,6 +168,42 @@
                 }
             });
         }
+    });
+
+    // 鐩戝惉琛屽伐鍏蜂簨浠�
+    table.on('tool(lookSSXMTable)', function(obj) {
+        $.ajax({
+            url: baseUrl+"/orderDetl/getPrintDetl/" + obj.data.id,
+            headers: {'token': localStorage.getItem('token'),'Content-Type' :'application/json'},
+            method: 'GET',
+            async: false,
+            success: function (res) {
+                if (res.code === 200){
+                    layer.closeAll();
+                    let data = res.data
+                        var templateDom = $("#templatePreview1");
+                        var className = templateDom.attr("class");
+                        var param = "缂栫爜:"+data.matnr+";鍚嶇О:"+data.maktx+";鎵规:"+data.batch+";瑙勬牸:"+data.specs
+                            +";鍗曚綅:"+data.unit+";鏁伴噺:"+data.anfme+";閿�鍞崟鍙�:"+data.suppCode+";瀹㈡埛鍚嶇О:"+data.sku;
+                        var encodeUrl = encodeURIComponent(param);
+                        data["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2&param="+encodeUrl;
+                        console.log(data["barcodeUrl"]);
+                    let list = Array.isArray(res.data) ? res.data : [res.data];
+                    res.data = list;
+                    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)
+                }
+            }
+        })
     });
 
     // 鏄剧ず琛ㄥ崟寮圭獥
@@ -472,6 +518,69 @@
         });
     }
 
+    // 浠诲姟杩芥函
+    function showWrkTrace(orderId) {
+        let loadIndex = layer.msg('璇锋眰涓�...', {icon: 16, shade: 0.01, time: false});
+        $.ajax({
+            url: baseUrl+"/order/wrk/trace/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                orderId: orderId
+            },
+            method: 'POST',
+            success: function (res) {
+                layer.close(loadIndex);
+                if (res.code === 200){
+                    laytpl(wrkTraceDialog.innerHTML).render(res.data, function (html) {
+                        admin.open({
+                            type: 1,
+                            title: '浠诲姟杩芥函',
+                            area: ['800px', '450px'],
+                            shadeClose: true,
+                            content: html,
+                            success: function (layero, dIndex) {
+                                $(layero).children('.layui-layer-content').css('overflow', 'visible');
+                                /** 缁熻鍥捐〃 */
+                                var traceCharts = echarts.init(document.getElementById('wrkTraceCharts'));
+                                var traceOptions = {
+                                    title: {
+                                        text: '鎬婚噺/浣滀笟/瀹屾垚', x: 'center', y: '38%',
+                                        textStyle: {fontSize: 18, color: '#262626', fontWeight: 'normal'},
+                                        subtextStyle: {fontSize: 36, color: '#10B4E8'},
+                                        itemGap: 20
+                                    },
+                                    color: ['#10B4E8', '#E0E0E0', '#FF0000'],
+                                    tooltip: {trigger: 'item'},
+                                    series: [{name: '鏁伴噺', type: 'pie', radius: ['75%', '80%'], label: {normal: {show: false}}}]
+                                };
+                                traceCharts.setOption(traceOptions);
+                                // 璧嬪��
+                                traceCharts.setOption({
+                                    title: {
+                                        subtext: res.data.totalQty+"/"+res.data.wrkQty+"/"+res.data.endQty
+                                    },
+                                    series: [
+                                        {
+                                            data: [
+                                                {name: '宸蹭綔涓�', value: res.data.wrkQty},
+                                                {name: '鏈綔涓�', value: res.data.totalQty-res.data.wrkQty-res.data.lackQty},
+                                                {name: '搴撳瓨涓嶈冻', value: res.data.lackQty},
+                                            ]
+                                        }
+                                    ]
+                                });
+                            }
+                        });
+                    });
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                }else {
+                    layer.msg(res.msg, {icon: 2});
+                }
+            }
+        })
+    }
+
     layDate.render({
         elem: '.layui-laydate-range'
         ,type: 'datetime'

--
Gitblit v1.9.1