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/area/area.js |   97 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 73 insertions(+), 24 deletions(-)

diff --git a/src/main/webapp/static/js/area/area.js b/src/main/webapp/static/js/area/area.js
index d513630..dc47bbd 100644
--- a/src/main/webapp/static/js/area/area.js
+++ b/src/main/webapp/static/js/area/area.js
@@ -8,8 +8,13 @@
     var layDate = layui.laydate;
     var form = layui.form;
     var admin = layui.admin;
-
-    // 鏁版嵁娓叉煋
+    var t = typeof I18n !== 'undefined' ? I18n.t : function(k) { return k; };
+    var dateIns = layDate.render({
+        elem: '#modi_time'
+        ,type: 'datetime'
+        ,range: true
+        ,lang: typeof I18n !== 'undefined' && I18n.getLanguage().toLowerCase() === 'zh-cn' ? 'cn' : 'en'
+    });
     tableIns = table.render({
         elem: '#area',
         headers: {token: localStorage.getItem('token')},
@@ -22,16 +27,10 @@
         height: 'full-120',
         cols: [[
             {type: 'checkbox'}
-            // ,{field: 'id', align: 'center',title: 'ID'}
-            // ,{field: 'tagId', align: 'center',title: ''}
-            ,{field: 'areaId', align: 'center',title: '搴撳尯缂栧彿'}
-            ,{field: 'areaName', align: 'center',title: '搴撳尯鍚嶇О'}
-            ,{field: 'memo', align: 'center',title: '搴撳尯澶囨敞'}
-            // ,{field: 'backup1', align: 'center',title: '澶囩敤瀛楁'}
-            // ,{field: 'backup2', align: 'center',title: '澶囩敤瀛楁2'}
-            // ,{field: 'backup3', align: 'center',title: '澶囩敤瀛楁3'}
-
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
+            ,{field: 'areaId', align: 'center',title: t('area_id')}
+            ,{field: 'areaName', align: 'center',title: t('area_name')}
+            ,{field: 'memo', align: 'center',title: t('area_memo')}
+            ,{fixed: 'right', title: t('operation'), align: 'center', toolbar: '#operate', width:180}
         ]],
         request: {
             pageName: 'curr',
@@ -54,6 +53,33 @@
             }
             pageCurr=curr;
             limit();
+            if (typeof I18n !== 'undefined') {
+                I18n.updatePage();
+                if (I18n.updateLayuiPagination) {
+                    I18n.updateLayuiPagination();
+                }
+            }
+        }
+    });
+
+    $(document).on('i18n:languageChanged', function() {
+        if (typeof I18n !== 'undefined' && tableIns) {
+            tableIns.reload({
+                cols: [[
+                    {type: 'checkbox'},
+                    {field: 'areaId', align: 'center', title: I18n.t('area_id')},
+                    {field: 'areaName', align: 'center', title: I18n.t('area_name')},
+                    {field: 'memo', align: 'center', title: I18n.t('area_memo')},
+                    {fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:180}
+                ]]
+            });
+            
+            layDateRender();
+
+            I18n.updatePage();
+            if (I18n.updateLayuiPagination) {
+                I18n.updateLayuiPagination();
+            }
         }
     });
 
@@ -80,7 +106,7 @@
                 break;
             case 'deleteData':
                if (checkStatus.length === 0) {
-                   layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+                   layer.msg(t('please_select_data'), {icon: 2});
                    return;
                }
                del(checkStatus.map(function (d) {
@@ -88,7 +114,7 @@
                }));
                break;
             case 'exportData':
-                admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                admin.confirm(t('confirm_export_excel'), {shadeClose: true}, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -143,14 +169,24 @@
 
     /* 寮圭獥 - 鏂板銆佷慨鏀� */
     function showEditModel(mData) {
+        var isCn = typeof I18n !== 'undefined' && I18n.getLanguage().toLowerCase() === 'zh-cn';
         admin.open({
             type: 1,
             area: '600px',
-            title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��',
+            title: (mData ? t('edit') : t('add')) + (isCn ? '' : ' ') + t('zone_management'),
             content: $('#editDialog').html(),
             success: function (layero, dIndex) {
-                layDateRender(mData);
                 form.val('detail', mData);
+                
+                if (typeof I18n !== 'undefined') {
+                    I18n.updatePage(layero);
+                    // Double check with a slight delay to ensure DOM is ready and accessible
+                    setTimeout(function() {
+                        I18n.updatePage(layero);
+                    }, 50);
+                }
+                
+                layDateRender(mData);
                 form.on('submit(editSubmit)', function (data) {
                     var loadIndex = layer.load(2);
                     $.ajax({
@@ -162,7 +198,7 @@
                             layer.close(loadIndex);
                             if (res.code === 200){
                                 layer.close(dIndex);
-                                layer.msg(res.msg, {icon: 1});
+                                layer.msg(t('response.operation_success'), {icon: 1});
                                 tableReload();
                             } else if (res.code === 403){
                                 top.location.href = baseUrl+"/";
@@ -181,7 +217,7 @@
 
     /* 鍒犻櫎 */
     function del(ids) {
-        layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
+        layer.confirm(t('confirm_delete_selected'), {
             skin: 'layui-layer-admin',
             shade: .1
         }, function (i) {
@@ -195,7 +231,7 @@
                 success: function (res) {
                     layer.close(loadIndex);
                     if (res.code === 200){
-                        layer.msg(res.msg, {icon: 1});
+                        layer.msg(t('response.operation_success'), {icon: 1});
                         tableReload();
                     } else if (res.code === 403){
                         top.location.href = baseUrl+"/";
@@ -222,13 +258,26 @@
 
     // 鏃堕棿閫夋嫨鍣�
     function layDateRender(data) {
+        var lang = (typeof I18n !== 'undefined' && I18n.getLanguage().indexOf('en') > -1) ? 'en' : 'cn';
         setTimeout(function () {
-            layDate.render({
-                elem: '.layui-laydate-range'
-                ,type: 'datetime'
-                ,range: true
+            $('.layui-laydate-range').each(function() {
+                var $this = $(this);
+                var val = $this.val();
+                
+                // Clone the element to remove old event listeners and lay-key
+                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();

--
Gitblit v1.9.1