From 8e943b7104561c3b14cf223016698709c5ade4b5 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期二, 03 二月 2026 15:37:26 +0800
Subject: [PATCH] #pda料箱组托和换码

---
 src/main/webapp/static/js/waitPakin/waitPakin.js |  164 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 135 insertions(+), 29 deletions(-)

diff --git a/src/main/webapp/static/js/waitPakin/waitPakin.js b/src/main/webapp/static/js/waitPakin/waitPakin.js
index 4027f58..d520cf3 100644
--- a/src/main/webapp/static/js/waitPakin/waitPakin.js
+++ b/src/main/webapp/static/js/waitPakin/waitPakin.js
@@ -1,23 +1,74 @@
 var pageCurr;
 function getCol() {
     var cols = [ {type: 'checkbox'} ];
-    cols.push.apply(cols, detlCols);
-    cols.push({field: 'locNo', align: 'center',title: '搴撲綅鍙�'}
-        ,{field: 'status', align: 'center',title: '鏁版嵁鐘舵��', templet:function(row){
-                var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='姝e父|閿佸畾'' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
+    cols.push.apply(cols, typeof getDetlCols === 'function' ? getDetlCols() : detlCols);
+    cols.push({field: 'locNo', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('location_no') : '搴撲綅鍙�',hide:true}
+        ,{field: 'status', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('data_status') : '鏁版嵁鐘舵��', templet:function(row){
+                var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='"+(typeof I18n !== 'undefined' ? I18n.t('normal') : '姝e父')+"|"+(typeof I18n !== 'undefined' ? I18n.t('locked') : '閿佸畾')+"' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
                 if(row.status === 'Y'){html += " checked ";}
                 html += ">";
                 return html;
             }, hide: true}
-        ,{field: 'ioStatus', align: 'center',title: '鍏ュ嚭鐘舵��', templet:function(row){
-                var html = "<input value='ioStatus' type='checkbox' lay-skin='switch' lay-text='鍏ュ簱涓瓅寰呭叆搴�' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
+        ,{field: 'ioStatus', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('io_status') : '鍏ュ嚭鐘舵��', templet:function(row){
+                var html = "<input value='ioStatus' type='checkbox' lay-skin='switch' lay-text='"+(typeof I18n !== 'undefined' ? I18n.t('inbound') : '鍏ュ簱涓�')+"|"+(typeof I18n !== 'undefined' ? I18n.t('pending_inbound') : '寰呭叆搴�')+"' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
                 if(row.ioStatus === 'Y'){html += " checked ";}
                 html += ">";
                 return html;
             }}
-        ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳', hide:true}
-        ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿', hide:true})
+        ,{field: 'modiUser$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modifier') : '淇敼浜哄憳', hide:true}
+        ,{field: 'modiTime$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modify_time') : '淇敼鏃堕棿', hide:true})
     return cols;
+}
+
+function updatePagination() {
+    if (typeof I18n === 'undefined') return;
+
+    // Update 'Total X items'
+    $('.layui-laypage-count').each(function() {
+        var text = $(this).text();
+        var count = text.match(/\d+/);
+        if (count) {
+            $(this).text(I18n.t('total_prefix') + count[0] + I18n.t('total_suffix'));
+        }
+    });
+
+    // Update 'Go to [input] page [button]'
+    $('.layui-laypage-skip').each(function() {
+        var $this = $(this);
+        // Replace "鍒扮" (First text node)
+        var contents = $this.contents();
+        for (var i = 0; i < contents.length; i++) {
+            if (contents[i].nodeType === 3 && contents[i].textContent.trim() !== '') {
+                // Assuming the first non-empty text node is "鍒扮"
+                contents[i].textContent = I18n.t('jump_to');
+                break;
+            }
+        }
+
+        // Replace "椤�" (Text node after input)
+        var input = $this.find('.layui-input');
+        if (input.length) {
+            var nextNode = input[0].nextSibling;
+            if (nextNode && nextNode.nodeType === 3) {
+                nextNode.textContent = I18n.t('page');
+            }
+        }
+
+        // Replace Button text
+        var btn = $this.find('.layui-laypage-btn');
+        if (btn.length) {
+            btn.text(I18n.t('confirm'));
+        }
+    });
+
+    // Update 'X items/page'
+    $('.layui-laypage-limits select option').each(function() {
+        var text = $(this).text();
+        var limit = text.match(/\d+/);
+        if (limit) {
+            $(this).text(limit[0] + I18n.t('items_per_page'));
+        }
+    });
 }
 
 layui.config({
@@ -42,6 +93,9 @@
         toolbar: '#toolbar',
         cellMinWidth: 50,
         cols: [getCol()],
+        text: {
+            none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '鏆傛棤鐩稿叧鏁版嵁'
+        },
         request: {
             pageName: 'curr',
             pageSize: 'limit'
@@ -49,7 +103,7 @@
         parseData: function (res) {
             return {
                 'code': res.code,
-                'msg': res.msg,
+                'msg': typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg,
                 'count': res.data.total,
                 'data': res.data.records
             }
@@ -61,6 +115,10 @@
             // tableMerge.render(this);
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
+            }
+            if (typeof I18n !== 'undefined') {
+                I18n.updatePage($('.layui-table-view'));
+                updatePagination();
             }
             pageCurr=curr;
             limit();
@@ -76,7 +134,7 @@
     });
 
     // 鐩戝惉鎺掑簭浜嬩欢
-    table.on('sort(locMast)', function (obj) {
+    table.on('sort(waitPakin)', function (obj) {
         var searchData = {};
         $.each($('#search-box [name]').serializeArray(), function() {
             searchData[this.name] = this.value;
@@ -92,6 +150,9 @@
                 if (res.code === 403) {
                     top.location.href = baseUrl+"/";
                 }
+                if (typeof I18n !== 'undefined') {
+                    updatePagination();
+                }
                 pageCurr=curr;
                 limit();
             }
@@ -104,9 +165,12 @@
         switch(obj.event) {
             case 'addWrk':
                 if (checkStatus.data.length === 0){
-                    layer.msg('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�', {icon: 2});
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('select_one_data') : '璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�', {icon: 2});
                 } else {
-                    layer.confirm('纭畾鐢熸垚宸ヤ綔妗d换鍔″悧', function(){
+                    layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_generate_task') : '纭畾鐢熸垚宸ヤ綔妗d换鍔″悧', {
+                        title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '鎻愮ず',
+                        btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '纭畾', typeof I18n !== 'undefined' ? I18n.t('cancel') : '鍙栨秷']
+                    }, function(){
                         $.ajax({
                             url: baseUrl+"/create/waitPain/wrkMast/start",
                             headers: {'token': localStorage.getItem('token')},
@@ -118,11 +182,11 @@
                                 if (res.code === 200){
                                     layer.closeAll();
                                     tableReload(false);
-                                    layer.msg(res.msg, {icon: 1})
+                                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg, res.data) : res.msg, {icon: 1})
                                 } else if (res.code === 403){
                                     top.location.href = baseUrl+"/";
                                 } else {
-                                    layer.msg(res.msg, {icon: 2})
+                                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                 }
                             }
                         })
@@ -132,7 +196,7 @@
             case 'addData':
                 layer.open({
                     type: 2,
-                    title: '鏂板',
+                    title: typeof I18n !== 'undefined' ? I18n.t('add') : '鏂板',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     content: 'waitPakin_detail.html',
@@ -146,9 +210,16 @@
             case 'deleteData':
                 var data = checkStatus.data;
                 if (data.length === 0){
-                    layer.msg('璇烽�夋嫨鏁版嵁');
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('please_select_data') : '璇烽�夋嫨鏁版嵁');
                 } else {
-                    layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){
+                    var msg = '纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧';
+                    if (typeof I18n !== 'undefined') {
+                        msg = I18n.t('confirm_delete_prefix') + " " + data.length + " " + I18n.t('confirm_delete_suffix');
+                    }
+                    layer.confirm(msg, {
+                        title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '鎻愮ず',
+                        btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '纭畾', typeof I18n !== 'undefined' ? I18n.t('cancel') : '鍙栨秷']
+                    }, function(){
                         $.ajax({
                             url: baseUrl+"/waitPakin/delete/auth",
                             headers: {'token': localStorage.getItem('token')},
@@ -162,7 +233,7 @@
                                 } else if (res.code === 403){
                                     top.location.href = baseUrl+"/";
                                 } else {
-                                    layer.msg(res.msg)
+                                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg)
                                 }
                             }
                         })
@@ -170,7 +241,11 @@
                 }
                 break;
             case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_export_excel') : '纭畾瀵煎嚭Excel鍚�', {
+                    shadeClose: true,
+                    title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '鎻愮ず',
+                    btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '纭畾', typeof I18n !== 'undefined' ? I18n.t('cancel') : '鍙栨秷']
+                }, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -201,7 +276,7 @@
                             } else if (res.code === 403) {
                                 top.location.href = baseUrl+"/";
                             } else {
-                                layer.msg(res.msg)
+                                layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg)
                             }
                         }
                     });
@@ -218,7 +293,7 @@
             case 'detail':
                 layer.open({
                     type: 2,
-                    title: '璇︽儏',
+                    title: typeof I18n !== 'undefined' ? I18n.t('detail') : '璇︽儏',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     shadeClose: true,
@@ -237,7 +312,7 @@
             case 'edit':
                 layer.open({
                     type: 2,
-                    title: '淇敼',
+                    title: typeof I18n !== 'undefined' ? I18n.t('edit') : '淇敼',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     content: 'waitPakin_detail.html',
@@ -255,11 +330,11 @@
             case 'modiUser':
                 var param = top.reObject(data).modiUser;
                 if (param === undefined) {
-                    layer.msg("鏃犳暟鎹�");
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('no_data_found') : "鏃犳暟鎹�");
                 } else {
                    layer.open({
                        type: 2,
-                       title: '淇敼浜哄憳璇︽儏',
+                       title: typeof I18n !== 'undefined' ? I18n.t('modifier_detail') : '淇敼浜哄憳璇︽儏',
                        maxmin: true,
                        area: [top.detailWidth, top.detailHeight],
                        shadeClose: true,
@@ -280,7 +355,7 @@
                                    } else if (res.code === 403){
                                        top.location.href = baseUrl+"/";
                                    }else {
-                                       layer.msg(res.msg)
+                                       layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg)
                                    }
                                }
                            })
@@ -291,11 +366,11 @@
             case 'appeUser':
                 var param = top.reObject(data).appeUser;
                 if (param === undefined) {
-                    layer.msg("鏃犳暟鎹�");
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('no_data_found') : "鏃犳暟鎹�");
                 } else {
                    layer.open({
                        type: 2,
-                       title: '鍒涘缓鑰呰鎯�',
+                       title: typeof I18n !== 'undefined' ? I18n.t('creator_detail') : '鍒涘缓鑰呰鎯�',
                        maxmin: true,
                        area: [top.detailWidth, top.detailHeight],
                        shadeClose: true,
@@ -316,7 +391,7 @@
                                    } else if (res.code === 403){
                                        top.location.href = baseUrl+"/";
                                    }else {
-                                       layer.msg(res.msg)
+                                       layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg)
                                    }
                                }
                            })
@@ -377,7 +452,7 @@
                 } else if (res.code === 403){
                     top.location.href = baseUrl+"/";
                 }else {
-                    layer.msg(res.msg)
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg)
                 }
                 layer.close(index);
             }
@@ -416,10 +491,38 @@
         elem: '#appeTime\\$',
         type: 'datetime'
     });
+    // Initial render
+    var lang = (typeof I18n !== 'undefined' && I18n.getLanguage().indexOf('en') > -1) ? 'en' : 'cn';
     layDate.render({
         elem: '.layui-laydate-range'
         ,type: 'datetime'
         ,range: true
+        ,lang: lang
+    });
+
+    $(document).on('i18n:languageChanged', function() {
+        I18n.updatePage($('#search-box'));
+
+        var lang = (typeof I18n !== 'undefined' && I18n.getLanguage().indexOf('en') > -1) ? 'en' : 'cn';
+        // Re-render date picker with new language
+        $('.layui-laydate-range').each(function() {
+            var $this = $(this);
+            var val = $this.val();
+            var $newElem = $this.clone();
+            $newElem.removeAttr('lay-key');
+            $newElem.val(val);
+            $this.replaceWith($newElem);
+            layDate.render({
+                elem: $newElem[0]
+                ,type: 'datetime'
+                ,range: true
+                ,lang: lang
+            });
+        });
+
+        table.reload('waitPakin', {
+            cols: [getCol()]
+        });
     });
 
 });
@@ -443,6 +546,9 @@
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
+            if (typeof I18n !== 'undefined') {
+                updatePagination();
+            }
             pageCurr=curr;
             if (res.data.length === 0 && count !== 0) {
                 tableIns.reload({

--
Gitblit v1.9.1