From 539a56279625242c497b4b4093f2defbb9d80334 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期四, 29 一月 2026 14:05:44 +0800
Subject: [PATCH] #i18n翻译

---
 src/main/webapp/static/js/handWrkMast/handWrkMast.js |  254 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 178 insertions(+), 76 deletions(-)

diff --git a/src/main/webapp/static/js/handWrkMast/handWrkMast.js b/src/main/webapp/static/js/handWrkMast/handWrkMast.js
index 686640d..3c89aa2 100644
--- a/src/main/webapp/static/js/handWrkMast/handWrkMast.js
+++ b/src/main/webapp/static/js/handWrkMast/handWrkMast.js
@@ -1,11 +1,78 @@
 var pageCurr;
 var wrkNo;
+var tableIns;
+var tableIns1;
+var tableReload;
+
 layui.use(['table','laydate', 'form'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
+
+    function getCols() {
+        var t = function(key, def) {
+            return (typeof I18n !== 'undefined' && typeof I18n.t === 'function') ? I18n.t(key) : def;
+        };
+        return [[
+            {field: 'wrkNo', align: 'center',title: t('work_no', '宸ヤ綔鍙�'),sort: true}
+            ,{field: 'ioTime$', align: 'center',title: t('work_time', '宸ヤ綔鏃堕棿'),sort: true, hide:true}
+            ,{field: 'wrkSts$', align: 'center',title: t('work_status', '宸ヤ綔鐘舵��'), templet: function(d){
+                return (typeof I18n !== 'undefined' && d.wrkSts != null) ? I18n.t('wrk_status_' + d.wrkSts) : d.wrkSts$;
+            }}
+            ,{field: 'ioType$', align: 'center',title: t('transaction_type', '鍏ュ嚭搴撶被鍨�'), templet: function(d){
+                return (typeof I18n !== 'undefined' && d.ioType != null) ? I18n.t('io_type_' + d.ioType) : d.ioType$;
+            }}
+            ,{field: 'crnNo$', align: 'center',title: t('crane', '鍫嗗灈鏈�'), hide:true}
+            ,{field: 'sourceStaNo$', align: 'center',title: t('source_station', '婧愮珯'), hide:true}
+            ,{field: 'staNo$', align: 'center',title: t('target_station', '鐩爣绔�'), hide:true}
+            ,{field: 'sourceLocNo$', align: 'center',title: t('source_location', '婧愬簱浣�'), hide:true}
+            ,{field: 'locNo$', align: 'center',title: t('target_location', '鐩爣搴撲綅'), hide:true}
+            ,{field: 'barcode', align: 'center',title: t('barcode', '鏉$爜'), hide:true}
+
+            ,{field: 'manuType', align: 'center',title: t('handling_mode', '澶勭悊鏂瑰紡'), templet: function(d){
+                if (typeof I18n === 'undefined') return d.manuType;
+                if (d.manuType === '鎵嬪姩鍙栨秷') return I18n.t('handling_mode_manual_cancel');
+                if (d.manuType === '鎵嬪姩瀹屾垚') return I18n.t('handling_mode_manual_complete');
+                return d.manuType;
+            }}
+            ,{field: 'modiUser$', align: 'center',title: t('operator', '鎿嶄綔浜哄憳')}
+
+            ,{field: 'modiUser$', align: 'center',title: t('operator', '鎿嶄綔浜哄憳')}
+            ,{field: 'modiTime$', align: 'center',title: t('operation_time', '鎿嶄綔鏃堕棿')}
+
+            ,{fixed: 'right', title: t('operation', '鎿嶄綔'), align: 'center', templet: function(d) {
+                var detailText = (typeof I18n !== 'undefined' && I18n.t) ? I18n.t('detail') : '鏄庣粏';
+                return '<a class="layui-btn layui-btn-sm btn-detlShow" lay-event="detlShow">' + detailText + '</a>';
+            }, width:100}
+        ]];
+    }
+
+    function getDetlCols() {
+        var t = function(key, def) {
+            return (typeof I18n !== 'undefined' && typeof I18n.t === 'function') ? I18n.t(key) : def;
+        };
+        return [[
+            {type: 'checkbox'}
+            ,{field: 'wrkNo', align: 'center',title: t('work_no', '宸ヤ綔鍙�')}
+            ,{field: 'ioTime$', align: 'center',title: t('work_time', '宸ヤ綔鏃堕棿')}
+            ,{field: 'matnr', align: 'center',title: t('material', '鐗╂枡')}
+            ,{field: 'lgnum', align: 'center',title: t('warehouse_no', '浠撳簱鍙�')}
+            ,{field: 'tbnum', align: 'center',title: t('transfer_req_no', '杞偍璇锋眰缂栧彿')}
+            ,{field: 'tbpos', align: 'center',title: t('line_item', '琛岄」鐩�')}
+            ,{field: 'zmatid', align: 'center',title: t('material_label_id', '鐗╂枡鏍囩ID')}
+            ,{field: 'maktx', align: 'center',title: t('material_desc', '鐗╂枡鎻忚堪')}
+            ,{field: 'werks', align: 'center',title: t('factory', '宸ュ巶')}
+            ,{field: 'anfme', align: 'center',title: t('quantity', '鏁伴噺')}
+            ,{field: 'altme', align: 'center',title: t('unit', '鍗曚綅')}
+            ,{field: 'zpallet', align: 'center',title: t('pallet_barcode', '鎵樼洏鏉$爜')}
+            ,{field: 'bname', align: 'center',title: t('user_id', '鐢ㄦ埛ID')}
+            ,{field: 'memo', align: 'center',title: t('memo', '澶囨敞')}
+
+            ,{fixed: 'right', title: t('operation', '鎿嶄綔'), align: 'center', toolbar: '#operate', width:50}
+        ]];
+    }
 
     // 鏁版嵁娓叉煋
     tableIns = table.render({
@@ -19,26 +86,7 @@
         even: true,
         toolbar: '#toolbar',
         cellMinWidth: 50,
-        cols: [[
-            // {type: 'checkbox'}
-            {field: 'wrkNo', align: 'center',title: '宸ヤ綔鍙�',sort: true}
-            ,{field: 'ioTime$', align: 'center',title: '宸ヤ綔鏃堕棿',sort: true, hide:true}
-            ,{field: 'wrkSts$', align: 'center',title: '宸ヤ綔鐘舵��'}
-            ,{field: 'ioType$', align: 'center',title: '鍏ュ嚭搴撶被鍨�'}
-            ,{field: 'crnNo$', align: 'center',title: '鍫嗗灈鏈�', hide:true}
-            ,{field: 'sourceStaNo$', align: 'center',title: '婧愮珯', hide:true}
-            ,{field: 'staNo$', align: 'center',title: '鐩爣绔�', hide:true}
-            ,{field: 'sourceLocNo$', align: 'center',title: '婧愬簱浣�', hide:true}
-            ,{field: 'locNo$', align: 'center',title: '鐩爣搴撲綅', hide:true}
-            ,{field: 'barcode', align: 'center',title: '鏉$爜', hide:true}
-
-            ,{field: 'manuType', align: 'center',title: '澶勭悊鏂瑰紡'}
-
-            ,{field: 'modiUser$', align: 'center',title: '鎿嶄綔浜哄憳'}
-            ,{field: 'modiTime$', align: 'center',title: '鎿嶄綔鏃堕棿'}
-
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:100}
-        ]],
+        cols: getCols(),
         request: {
             pageName: 'curr',
             pageSize: 'limit'
@@ -60,6 +108,54 @@
             }
             pageCurr=curr;
             limit();
+            if (typeof I18n !== 'undefined' && typeof I18n.updateLayuiPagination === 'function') {
+                I18n.updateLayuiPagination();
+            }
+        }
+    });
+
+    // 鐩戝惉璇█鍒囨崲浜嬩欢
+    $(document).off('i18n:languageChanged').on('i18n:languageChanged', function() {
+        if (typeof I18n !== 'undefined') {
+            I18n.updatePage($('#search-box'));
+        }
+        layDateRender();
+        tableIns.reload({
+            cols: getCols(),
+            done: function(res, curr, count) {
+                if (res.code === 403) {
+                    top.location.href = baseUrl+"/";
+                }
+                pageCurr=curr;
+                limit();
+                if (typeof I18n !== 'undefined' && typeof I18n.updateLayuiPagination === 'function') {
+                    I18n.updateLayuiPagination();
+                }
+            }
+        });
+        
+        // 濡傛灉鏄庣粏琛ㄥ凡鍒濆鍖栦笖鍙锛屼篃鍒锋柊瀹�
+        if (typeof tableIns1 !== 'undefined' && $('#detlTable').is(':visible')) {
+            tableIns1.reload({
+                cols: getDetlCols(),
+                done: function(res, curr, count) {
+                    if (res.code === 403) {
+                        top.location.href = baseUrl+"/";
+                    }
+                    pageCur=curr;
+                    form.on('checkbox(tableCheckbox)', function (data) {
+                        var _index = $(data.elem).attr('table-index')||0;
+                        if(data.elem.checked){
+                            res.data[_index][data.value] = 'Y';
+                        }else{
+                            res.data[_index][data.value] = 'N';
+                        }
+                    });
+                    if (typeof I18n !== 'undefined' && typeof I18n.updateLayuiPagination === 'function') {
+                        I18n.updateLayuiPagination();
+                    }
+                }
+            });
         }
     });
 
@@ -83,6 +179,9 @@
                 }
                 pageCurr=curr;
                 limit();
+                if (typeof I18n !== 'undefined' && typeof I18n.updateLayuiPagination === 'function') {
+                    I18n.updateLayuiPagination();
+                }
             }
         });
     });
@@ -92,7 +191,7 @@
         var checkStatus = table.checkStatus(obj.config.id);
         switch(obj.event) {
             case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                layer.confirm((typeof I18n !== 'undefined' && I18n.t) ? I18n.t('confirm_export_excel') : '纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -144,7 +243,7 @@
                 // 寮瑰眰鏄剧ず
                 layer.open({
                     type: 2,
-                    title: '宸ヤ綔妗f槑缁�',
+                    title: (typeof I18n !== 'undefined' && I18n.t) ? I18n.t('work_order_detail') : '宸ヤ綔妗f槑缁�',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     shadeClose: true,
@@ -328,14 +427,29 @@
         elem: '#logErrTime\\$',
         type: 'datetime'
     });
-    layDate.render({
-        elem: '.layui-laydate-range'
-        ,type: 'datetime'
-        ,range: true
-    });
+    function layDateRender() {
+        var lang = (typeof I18n !== 'undefined' && I18n.getLanguage().indexOf('en') > -1) ? 'en' : 'cn';
+        setTimeout(function () {
+            $('.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
+                });
+            });
+        }, 300);
+    }
+    layDateRender();
 
     var pageCur;
-    function locDetl(param){
+    window.locDetl = function(param){
         $('#detlTable').css("display", 'block');
         // 鏁版嵁娓叉煋
         $('#wrkNo').val(param);
@@ -351,25 +465,7 @@
             even: true,
             toolbar: '#toolbar',
             cellMinWidth: 50,
-            cols: [[
-                {type: 'checkbox'}
-                ,{field: 'wrkNo', align: 'center',title: '宸ヤ綔鍙�'}
-                ,{field: 'ioTime$', align: 'center',title: '宸ヤ綔鏃堕棿'}
-                ,{field: 'matnr', align: 'center',title: '鐗╂枡'}
-                ,{field: 'lgnum', align: 'center',title: '浠撳簱鍙�'}
-                ,{field: 'tbnum', align: 'center',title: '杞偍璇锋眰缂栧彿'}
-                ,{field: 'tbpos', align: 'center',title: '琛岄」鐩�'}
-                ,{field: 'zmatid', align: 'center',title: '鐗╂枡鏍囩ID'}
-                ,{field: 'maktx', align: 'center',title: '鐗╂枡鎻忚堪'}
-                ,{field: 'werks', align: 'center',title: '宸ュ巶'}
-                ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
-                ,{field: 'altme', align: 'center',title: '鍗曚綅'}
-                ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜'}
-                ,{field: 'bname', align: 'center',title: '鐢ㄦ埛ID'}
-                ,{field: 'memo', align: 'center',title: '澶囨敞'}
-
-                ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:50}
-            ]],
+            cols: getDetlCols(),
             request: {
                 pageName: 'curr',
                 pageSize: 'limit'
@@ -398,6 +494,41 @@
                         res.data[_index][data.value] = 'N';
                     }
                 });
+                if (typeof I18n !== 'undefined' && typeof I18n.updateLayuiPagination === 'function') {
+                    I18n.updateLayuiPagination();
+                }
+            }
+        });
+    }
+
+    tableReload = function(child) {
+        var searchData = {};
+        $.each($('#search-box [name]').serializeArray(), function() {
+            searchData[this.name] = this.value;
+        });
+        (child ? parent.tableIns : tableIns).reload({
+            where: searchData,
+            page: {
+                curr: pageCurr
+            },
+            done: function (res, curr, count) {
+                if (res.code === 403) {
+                    top.location.href = baseUrl+"/";
+                }
+                pageCurr=curr;
+                if (res.data.length === 0 && count !== 0) {
+                    tableIns.reload({
+                        where: searchData,
+                        page: {
+                            curr: pageCurr-1
+                        }
+                    });
+                    pageCurr -= 1;
+                }
+                limit(child);
+                if (typeof I18n !== 'undefined' && typeof I18n.updateLayuiPagination === 'function') {
+                    I18n.updateLayuiPagination();
+                }
             }
         });
     }
@@ -408,35 +539,6 @@
 $(document).on('click','#data-detail-close', function () {
     parent.layer.closeAll();
 });
-
-function tableReload(child) {
-    var searchData = {};
-    $.each($('#search-box [name]').serializeArray(), function() {
-        searchData[this.name] = this.value;
-    });
-    (child ? parent.tableIns : tableIns).reload({
-        where: searchData,
-        page: {
-            curr: pageCurr
-        },
-        done: function (res, curr, count) {
-            if (res.code === 403) {
-                top.location.href = baseUrl+"/";
-            }
-            pageCurr=curr;
-            if (res.data.length === 0 && count !== 0) {
-                tableIns.reload({
-                    where: searchData,
-                    page: {
-                        curr: pageCurr-1
-                    }
-                });
-                pageCurr -= 1;
-            }
-            limit(child);
-        }
-    });
-}
 
 function setFormVal(el, data, showImg) {
     for (var val in data) {

--
Gitblit v1.9.1