From 35b1b26f1fe16550b4ee2881a26d599456fe59b4 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期四, 22 一月 2026 17:01:11 +0800
Subject: [PATCH] #i18n翻译

---
 src/main/webapp/static/js/mat/mat.js |   95 ++++++++++++++++++++++++++---------------------
 1 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/src/main/webapp/static/js/mat/mat.js b/src/main/webapp/static/js/mat/mat.js
index addc55e..0908539 100644
--- a/src/main/webapp/static/js/mat/mat.js
+++ b/src/main/webapp/static/js/mat/mat.js
@@ -4,16 +4,16 @@
 function getCol() {
     var cols = [
         {type: 'checkbox'}
-        ,{field: 'tagId$', align: 'center',title: '褰掔被', templet: '#tagTpl'}
-        ,{field: 'store_max', align: 'center',title: '搴撳瓨涓婇檺'}
-        ,{field: 'store_min', align: 'center',title: '搴撳瓨涓嬮檺'}
-        ,{field: 'store_max_date', align: 'center',title: '搴撻緞涓婇檺(澶�)'}
-        ,{field: 'areaId$', align: 'center',title: '鍖哄煙', templet: '#areaTpl'}
+        ,{field: 'tagId$', align: 'center',title: I18n.t('classification'), templet: '#tagTpl'}
+        ,{field: 'store_max', align: 'center',title: I18n.t('stock_upper_limit')}
+        ,{field: 'store_min', align: 'center',title: I18n.t('stock_lower_limit')}
+        ,{field: 'store_max_date', align: 'center',title: I18n.t('stock_age_upper_limit_days')}
+        ,{field: 'areaId$', align: 'center',title: I18n.t('area'), templet: '#areaTpl'}
 
     ];
-    cols.push.apply(cols, matCols);
+    cols.push.apply(cols, getMatCols());
     cols.push(
-        {fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
+        {fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:150}
     )
     return cols;
 }
@@ -76,6 +76,26 @@
     });
 
     // 鏁版嵁娓叉煋
+    var tableDone = function(res, curr, count) {
+        if (res.code === 403) {
+            top.location.href = baseUrl+"/";
+        }
+        pageCurr=curr;
+        limit();
+        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') {
+            I18n.updatePage();
+            I18n.updateLayuiPagination();
+        }
+    };
+
     tableIns = table.render({
         elem: '#mat',
         headers: {token: localStorage.getItem('token')},
@@ -102,21 +122,7 @@
         response: {
             statusCode: 200
         },
-        done: function(res, curr, count) {
-            if (res.code === 403) {
-                top.location.href = baseUrl+"/";
-            }
-            pageCurr=curr;
-            limit();
-            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';
-                }
-            });
-        }
+        done: tableDone
     });
 
     // 鐩戝惉鎺掑簭浜嬩欢
@@ -132,13 +138,15 @@
             page: {
                 curr: 1
             },
-            done: function (res, curr, count) {
-                if (res.code === 403) {
-                    top.location.href = baseUrl+"/";
-                }
-                pageCurr=curr;
-                limit();
-            }
+            done: tableDone
+        });
+    });
+
+    // 鐩戝惉璇█鍒囨崲
+    $(document).on('i18n:languageChanged i18n:ready', function() {
+        tableIns.reload({
+            cols: [getCol()],
+            done: tableDone
         });
     });
 
@@ -152,9 +160,9 @@
             case 'deleteData':
                 var data = checkStatus.data;
                 if (data.length === 0){
-                    layer.msg('璇烽�夋嫨鏁版嵁');
+                    layer.msg(I18n.t('please_select_data'));
                 } else {
-                    layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){
+                    layer.confirm(I18n.t('confirm_delete_prefix') + (data.length===1?I18n.t('this'):data.length) + I18n.t('confirm_delete_suffix'), function(){
                         $.ajax({
                             url: baseUrl+"/mat/delete/auth",
                             headers: {'token': localStorage.getItem('token')},
@@ -176,7 +184,7 @@
                 }
                 break;
             case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                layer.confirm(I18n.t('confirm_export_excel'), {shadeClose: true}, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -218,11 +226,11 @@
                 printMatCodeNos = [];
                 var data = checkStatus.data;
                 if (data.length === 0){
-                    layer.msg('璇烽�夋嫨鎵撳嵃鏁版嵁');
+                    layer.msg(I18n.t('please_select_print_data'));
                 } else {
                     layer.open({
                         type: 1,
-                        title: '鎵归噺鎵撳嵃 [鏁伴噺'+ data.length +']',
+                        title: I18n.t('batch_print_count', {count: data.length}),
                         area: ['500px'],
                         shadeClose: true,
                         content: $('#printDataDiv'),
@@ -248,7 +256,7 @@
                 printMatCodeNos = [];
                 layer.open({
                     type: 1,
-                    title: data.matnr + ' [鏁伴噺锛�1]',
+                    title: data.matnr + ' [' + I18n.t('count') + '锛�1]',
                     area: ['500px'],
                     shadeClose: true,
                     content: $('#printDataDiv'),
@@ -272,7 +280,7 @@
         admin.open({
             type: 1,
             area: '600px',
-            title: (mData ? '淇敼' : '娣诲姞') + '鍟嗗搧',
+            title: (mData ? I18n.t('edit') : I18n.t('add')) + I18n.t('material'),
             content: $('#editDialog').html(),
             success: function (layero, dIndex) {
                 // 鍥炴樉琛ㄥ崟鏁版嵁
@@ -289,7 +297,7 @@
                     data.field.tagId = insXmSel.getValue('valueStr');
                     data.field.areaId = areaXmSel.getValue('valueStr');
                     if (isEmpty(data.field.tagId)) {
-                        layer.msg('鍒嗙被涓嶈兘涓虹┖', {icon: 2});
+                        layer.msg(I18n.t('category_cannot_be_empty'), {icon: 2});
                         return false;
                     }
                     var loadIndex = layer.load(2);
@@ -334,8 +342,6 @@
                     }
                 });
                 // 娓叉煋鍖哄煙涓嬫媺閫夋嫨
-                console.log('鍑嗗娓叉煋鍖哄煙閫夋嫨鍣紝鏁版嵁:', areaData);
-                console.log('褰撳墠鍟嗗搧鏁版嵁:', mData);
                 var areaXmSel = xmSelect.render({
                     el: $(layero).find('#areaSel')[0],
                     height: '250px',
@@ -349,10 +355,8 @@
                     radio: true,
                     clickClose: true,
                     on: function(data) {
-                        console.log('鍖哄煙閫夋嫨鍣ㄤ簨浠�:', data);
                     }
                 });
-                console.log('鍖哄煙閫夋嫨鍣ㄦ覆鏌撳畬鎴�');
                 // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
                 $(layero).children('.layui-layer-content').css('overflow', 'visible');
                 layui.form.render('select');
@@ -392,6 +396,9 @@
                     var html = template(res);
                     var box = $("#box");
                     box.html(html);box.show();
+                    if (typeof I18n !== 'undefined' && I18n.updatePage) {
+                        I18n.updatePage(box[0]);
+                    }
                     box.print({mediaPrint:true});
                     box.hide();
                 } else if (res.code === 403){
@@ -445,7 +452,7 @@
         return;
     }
     var file = obj.files[0];
-    admin.confirm('纭鍚屾 [' + file.name +'] 鏂囦欢鍚楋紵', function (index) {
+    admin.confirm(I18n.t('confirm_sync_file', {filename: file.name}), function (index) {
         layer.load(1, {shade: [0.1,'#fff']});
         var url = baseUrl + "/mat/excel/import/auth";
         var form = new FormData();
@@ -514,6 +521,10 @@
                 pageCurr -= 1;
             }
             limit(child);
+            if (typeof I18n !== 'undefined') {
+                I18n.updatePage();
+                I18n.updateLayuiPagination();
+            }
         }
     });
 }

--
Gitblit v1.9.1