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

---
 src/main/webapp/static/js/operateLog/operateLog.js |  182 +++++++++++++++++++++++++++++---------------
 1 files changed, 119 insertions(+), 63 deletions(-)

diff --git a/src/main/webapp/static/js/operateLog/operateLog.js b/src/main/webapp/static/js/operateLog/operateLog.js
index 7bb667e..d7c9804 100644
--- a/src/main/webapp/static/js/operateLog/operateLog.js
+++ b/src/main/webapp/static/js/operateLog/operateLog.js
@@ -1,4 +1,28 @@
 var pageCurr;
+function getCols() {
+    var t = typeof I18n !== 'undefined' ? I18n.t : function(k) { return k; };
+    return [[
+        {type:'checkbox', fixed: 'left'}
+        ,{field: 'id', title: 'ID', sort: true,align: 'center', width: 80}
+        ,{field: 'userId$', align: 'center',title: t('user')}
+        ,{field: 'action', align: 'center',title: t('action'), templet: function(d) {
+            return t(d.action);
+        }}
+        ,{field: 'ip', align: 'center',title: t('client_ip')}
+        ,{field: 'request', align: 'center',title: t('request_data')}
+        ,{field: 'response', align: 'center',title: t('response_data'), templet: function(d) {
+            if (!d.response) return '';
+            try {
+                var res = JSON.parse(d.response);
+                return res && res.msg ? t(res.msg) : d.response;
+            } catch (e) {
+                return d.response;
+            }
+        }}
+        ,{field: 'createTime$', align: 'center',title: t('add_time')}
+        ,{fixed: 'right', title: t('operation'), align: 'center', toolbar: '#operate', width:100}
+    ]];
+}
 layui.use(['table','laydate', 'form'], function(){
     var table = layui.table;
     var $ = layui.jquery;
@@ -7,55 +31,64 @@
     var form = layui.form;
 
     // 鏁版嵁娓叉煋
-    tableIns = table.render({
-        elem: '#operateLog',
-        headers: {token: localStorage.getItem('token')},
-        url: baseUrl+'/operateLog/list/auth',
-        page: true,
-        limit: 16,
-        // even: true,
-        toolbar: '#toolbar',
-        cellMinWidth: 50,
-        cols: [[
-            {type: 'checkbox'}
-            ,{field: 'id', title: 'ID', sort: true,align: 'center', width: 80}
-            ,{field: 'action', align: 'center',title: '璁块棶鍦板潃'}
-            ,{field: 'userId$', align: 'center',title: '鐢ㄦ埛',event: 'userId', style: 'text-decoration: underline;cursor:pointer'}
-            ,{field: 'ip',  edit:'text', align: 'center',title: '瀹㈡埛绔疘P'}
-            ,{field: 'request', align: 'center',title: '璇锋眰鏁版嵁'}
-            ,{field: 'response', align: 'center',title: '鍝嶅簲鏁版嵁'}
-            ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
+    var initTable = function() {
+        tableIns = table.render({
+            elem: '#operateLog',
+            headers: {token: localStorage.getItem('token')},
+            url: baseUrl+'/operateLog/list/auth',
+            page: true,
+            limit: 16,
+            limits: [16, 30, 50, 100, 200, 500],
+            even: true,
+            toolbar: '#toolbar',
+            cellMinWidth: 50,
+            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+"/";
+                }
+                pageCurr=curr;
+                limit();
+                // Update pagination text
+                if (typeof I18n !== 'undefined' && I18n.updateLayuiPagination) {
+                    I18n.updateLayuiPagination();
+                }
+            }
+        });
+    }
 
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
-        ]],
-        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;
-            }
-            pageCurr=curr;
-            limit();
-        }
+    if (typeof I18n !== 'undefined' && I18n.isReady()) {
+        initTable();
+    } else {
+        $(document).one('i18n:ready', initTable);
+    }
+
+    // Listen for language change
+    $(document).on('i18n:languageChanged', function() {
+        tableIns.reload({
+            cols: getCols()
+        });
     });
 
     table.on('edit(operateLog)', function (obj) {
         $('body').keydown(function () {
             if (event.keyCode === 13) {
-                layer.confirm('淇濆瓨淇敼?', function(){
+                layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_save_change') : '淇濆瓨淇敼?', function(){
 
                 });
             }
@@ -77,10 +110,14 @@
             },
             done: function (res, curr, count) {
                 if (res.code === 403) {
-                    top.location.href = baseUrl;
+                    top.location.href = baseUrl+"/";
                 }
                 pageCurr=curr;
                 limit();
+                // Update pagination text
+                if (typeof I18n !== 'undefined' && I18n.updateLayuiPagination) {
+                    I18n.updateLayuiPagination();
+                }
             }
         });
     });
@@ -92,7 +129,7 @@
             case 'addData':
                 layer.open({
                     type: 2,
-                    title: '鏂板',
+                    title: typeof I18n !== 'undefined' ? I18n.t('add') : '鏂板',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     shadeClose: false,
@@ -118,9 +155,12 @@
                     ids.push(track.id);
                 });
                 if (ids.length === 0){
-                    layer.msg('璇烽�夋嫨鏁版嵁');
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('please_select_data') : '璇烽�夋嫨鏁版嵁');
                 } else {
-                    layer.confirm('纭畾鍒犻櫎'+(ids.length===1?'姝�':ids.length)+'鏉℃暟鎹悧', function(){
+                    var confirmMsg = typeof I18n !== 'undefined' ? 
+                        (I18n.t('confirm_delete_prefix') + (ids.length===1 ? I18n.t('this') : ids.length) + I18n.t('confirm_delete_suffix')) 
+                        : ('纭畾鍒犻櫎'+(ids.length===1?'姝�':ids.length)+'鏉℃暟鎹悧');
+                    layer.confirm(confirmMsg, function(){
                         $.ajax({
                             url: baseUrl+"/operateLog/delete/auth",
                             headers: {'token': localStorage.getItem('token')},
@@ -132,9 +172,9 @@
                                     layer.closeAll();
                                     tableReload(false);
                                 } else if (res.code === 403){
-                                    top.location.href = baseUrl;
+                                    top.location.href = baseUrl+"/";
                                 } else {
-                                    layer.msg(res.msg)
+                                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                 }
                             }
                         })
@@ -142,7 +182,7 @@
                 }
                 break;
             case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', function(){
+                layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_export') : '纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -169,11 +209,16 @@
                         success: function (res) {
                             layer.closeAll();
                             if (res.code === 200) {
+                                if (typeof I18n !== 'undefined') {
+                                    $.each(res.data, function(index, item) {
+                                        item.action = I18n.t(item.action);
+                                    });
+                                }
                                 table.exportFile(titles,res.data,'xls');
                             } else if (res.code === 403) {
-                                top.location.href = baseUrl;
+                                top.location.href = baseUrl+"/";
                             } else {
-                                layer.msg(res.msg)
+                                layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                             }
                         }
                     });
@@ -190,13 +235,17 @@
             case 'detail':
                 layer.open({
                     type: 2,
-                    title: '璇︽儏',
+                    title: typeof I18n !== 'undefined' ? I18n.t('detail') : '璇︽儏',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     shadeClose: false,
                     content: 'operateLog_detail.html',
                     success: function(layero, index){
-                        setFormVal(layer.getChildFrame('#detail', index), data, true);
+                        var formData = $.extend({}, data);
+                        if (typeof I18n !== 'undefined') {
+                            formData.action = I18n.t(formData.action);
+                        }
+                        setFormVal(layer.getChildFrame('#detail', index), formData, true);
                         top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
                         layer.getChildFrame('#data-detail-submit,#prompt', index).hide();
                         layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
@@ -208,7 +257,7 @@
             case 'edit':
                 layer.open({
                     type: 2,
-                    title: '淇敼',
+                    title: typeof I18n !== 'undefined' ? I18n.t('edit') : '淇敼',
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     shadeClose: false,
@@ -224,11 +273,11 @@
             case 'userId':
                 var param = top.reObject(data).userId;
                 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('detail') : '璇︽儏',
                        maxmin: true,
                        area: [top.detailHeight, top.detailWidth],
                        shadeClose: false,
@@ -248,7 +297,7 @@
                                    } else if (res.code === 403){
                                        parent.location.href = "/";
                                    }else {
-                                       layer.msg(res.msg)
+                                       layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                    }
                                }
                            })
@@ -288,9 +337,9 @@
                         $(this).val("");
                     });
                 } else if (res.code === 403){
-                    top.location.href = baseUrl;
+                    top.location.href = baseUrl+"/";
                 }else {
-                    layer.msg(res.msg)
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                 }
                 layer.close(index);
             }
@@ -315,7 +364,11 @@
         elem: '#createTime\\$',
         type: 'datetime'
     });
-
+    layDate.render({
+        elem: '.layui-laydate-range'
+        ,type: 'datetime'
+        ,range: true
+    });
 });
 
 // 鍏抽棴鍔ㄤ綔
@@ -335,7 +388,7 @@
         },
         done: function (res, curr, count) {
             if (res.code === 403) {
-                top.location.href = baseUrl;
+                top.location.href = baseUrl+"/";
             }
             pageCurr=curr;
             if (res.data.length === 0 && count !== 0) {
@@ -348,6 +401,10 @@
                 pageCurr -= 1;
             }
             limit(child);
+            // Update pagination text
+            if (typeof I18n !== 'undefined' && I18n.updateLayuiPagination) {
+                I18n.updateLayuiPagination();
+            }
         }
     });
 }
@@ -388,4 +445,3 @@
     });
     $(".layui-layer-shade").remove();
 }
-

--
Gitblit v1.9.1