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/docType/docType.js |  116 +++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 70 insertions(+), 46 deletions(-)

diff --git a/src/main/webapp/static/js/docType/docType.js b/src/main/webapp/static/js/docType/docType.js
index 55a7e40..bd5ce97 100644
--- a/src/main/webapp/static/js/docType/docType.js
+++ b/src/main/webapp/static/js/docType/docType.js
@@ -11,53 +11,77 @@
     var admin = layui.admin;
 
     // 鏁版嵁娓叉煋
-    tableIns = table.render({
-        elem: '#docType',
-        headers: {token: localStorage.getItem('token')},
-        url: baseUrl+'/docType/list/auth',
-        page: true,
-        limit: 15,
-        limits: [15, 30, 50, 100, 200, 500],
-        toolbar: '#toolbar',
-        cellMinWidth: 50,
-        height: 'full-120',
-        cols: [[
+    var getCols = function() {
+        return [[
             {type: 'checkbox'}
-            ,{field: 'docId', align: 'center',title: '绫诲瀷缂栧彿'}
-            ,{field: 'docName', align: 'center',title: '绫诲瀷鍚嶇О'}
-            ,{field: 'pakin', align: 'center',title: '鍏ュ簱', templet: '#pakinTpl', width: 120, unresize: true}
-            ,{field: 'pakout', align: 'center',title: '鍑哄簱', templet: '#pakoutTpl', width: 120, unresize: true}
-            ,{field: 'status$', align: 'center',title: '鐘舵��'}
+            ,{field: 'docId', align: 'center',title: I18n.t('doc_id')}
+            ,{field: 'docName', align: 'center',title: I18n.t('doc_name')}
+            ,{field: 'pakin', align: 'center',title: I18n.t('pakin'), templet: '#pakinTpl', width: 120, unresize: true}
+            ,{field: 'pakout', align: 'center',title: I18n.t('pakout'), templet: '#pakoutTpl', width: 120, unresize: true}
+            ,{field: 'status$', align: 'center',title: I18n.t('status')}
             // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳'}
             // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-            ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
-            ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
-            ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
+            ,{field: 'updateBy$', align: 'center',title: I18n.t('modifier')}
+            ,{field: 'updateTime$', align: 'center',title: I18n.t('update_time')}
+            ,{field: 'memo', align: 'center',title: I18n.t('memo'), hide: true}
 
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
-        ]],
-        request: {
-            pageName: 'curr',
-            pageSize: 'limit'
-        },
-        parseData: function (res) {
-            return {
-                'code': res.code,
-                'msg': res.msg,
-                'count': res.data.total,
-                'data': res.data.records
+            ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:120}
+        ]];
+    };
+
+    var initTable = function() {
+        tableIns = table.render({
+            elem: '#docType',
+            headers: {token: localStorage.getItem('token')},
+            url: baseUrl+'/docType/list/auth',
+            page: true,
+            limit: 15,
+            limits: [15, 30, 50, 100, 200, 500],
+            toolbar: '#toolbar',
+            cellMinWidth: 50,
+            height: 'full-120',
+            cols: getCols(),
+            request: {
+                pageName: 'curr',
+                pageSize: 'limit'
+            },
+            parseData: function (res) {
+                return {
+                    'code': res.code,
+                    'msg': res.msg,
+                    'count': res.data.total,
+                    'data': res.data.records
+                }
+            },
+            response: {
+                statusCode: 200
+            },
+            done: function(res, curr, count) {
+                if (res.code === 403) {
+                    top.location.href = baseUrl+"/";
+                }
+                tableData = table.cache.docType;
+                pageCurr=curr;
+                I18n.updatePage();
+                setTimeout(function() {
+                    I18n.updateLayuiPagination();
+                }, 100);
+                limit();
             }
-        },
-        response: {
-            statusCode: 200
-        },
-        done: function(res, curr, count) {
-            if (res.code === 403) {
-                top.location.href = baseUrl+"/";
-            }
-            tableData = table.cache.docType;
-            pageCurr=curr;
-            limit();
+        });
+    };
+
+    if (typeof I18n !== 'undefined' && I18n.isReady()) {
+        initTable();
+    } else {
+        $(document).on('i18n:ready', initTable);
+    }
+
+    $(document).on('i18n:languageChanged', function() {
+        if (tableIns) {
+            tableIns.reload({
+                cols: getCols()
+            });
         }
     });
 
@@ -102,7 +126,7 @@
                 break;
             case 'deleteData':
                if (checkStatus.length === 0) {
-                   layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+                   layer.msg(I18n.t('please_select_delete_data'), {icon: 2});
                    return;
                }
                del(checkStatus.map(function (d) {
@@ -110,7 +134,7 @@
                }));
                break;
             case 'exportData':
-                admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                admin.confirm(I18n.t('confirm_export_excel'), {shadeClose: true}, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -168,7 +192,7 @@
         admin.open({
             type: 1,
             area: '600px',
-            title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��',
+            title: (mData ? I18n.t('edit') : I18n.t('add')) + ' ' + I18n.t('doc_type_management'),
             content: $('#editDialog').html(),
             success: function (layero, dIndex) {
                 layDateRender(mData);
@@ -203,7 +227,7 @@
 
     /* 鍒犻櫎 */
     function del(ids) {
-        layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
+        layer.confirm(I18n.t('confirm_delete_data'), {
             skin: 'layui-layer-admin',
             shade: .1
         }, function (i) {

--
Gitblit v1.9.1