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/apiLog/apiLog.js | 147 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 102 insertions(+), 45 deletions(-)
diff --git a/src/main/webapp/static/js/apiLog/apiLog.js b/src/main/webapp/static/js/apiLog/apiLog.js
index 1d24b5e..a270353 100644
--- a/src/main/webapp/static/js/apiLog/apiLog.js
+++ b/src/main/webapp/static/js/apiLog/apiLog.js
@@ -9,59 +9,93 @@
var form = layui.form;
var admin = layui.admin;
- // 鏁版嵁娓叉煋
- tableIns = table.render({
- elem: '#apiLog',
- headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/apiLog/list/auth',
- page: true,
- limit: 15,
- limits: [15, 30, 50, 100, 200, 500],
- toolbar: '#toolbar',
- cellMinWidth: 50,
- height: 'full-120',
- cols: [[
+ function getCols() {
+ return [[
{type: 'checkbox'}
// ,{field: 'id', align: 'center',title: 'ID'}
// ,{field: 'uuid', align: 'center',title: '鏃ュ織缂栧彿'}
- ,{field: 'namespace', align: 'center',title: '鍚嶇О绌洪棿'}
- ,{field: 'url', align: 'center',title: '琛ㄥ崟ID'}
- ,{field: 'appkey', align: 'center',title: '骞冲彴瀵嗛挜',hide: true}
+ ,{field: 'namespace', align: 'center',title: I18n.t('namespace')}
+ ,{field: 'url', align: 'center',title: I18n.t('form_id')}
+ ,{field: 'appkey', align: 'center',title: I18n.t('app_key'),hide: true}
// ,{field: 'timestamp', align: 'center',title: '鏃堕棿鎴�'}
- ,{field: 'clientIp', align: 'center',title: 'URL',hide: true}
- ,{field: 'request', align: 'center',title: '璇锋眰鍐呭'}
- ,{field: 'response', align: 'center',title: '鎿嶄綔鍐呭'}
+ ,{field: 'clientIp', align: 'center',title: I18n.t('client_ip'),hide: true}
+ ,{field: 'request', align: 'center',title: I18n.t('request_content')}
+ ,{field: 'response', align: 'center',title: I18n.t('operation_content')}
// ,{field: 'err', align: 'center',title: '寮傚父鍐呭'}
- ,{field: 'result$', align: 'center',title: '缁撴灉', templet: '#resTpl', width: 80}
+ ,{field: 'result$', align: 'center',title: I18n.t('result'), templet: '#resTpl', width: 80}
// ,{field: 'status$', align: 'center',title: '鐘舵��'}
- ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
+ ,{field: 'createTime$', align: 'center',title: I18n.t('add_time')}
// ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
- ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
+ ,{field: 'memo', align: 'center',title: I18n.t('memo'), hide: true}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width: 80}
- ]],
- 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: 80}
+ ]];
+ }
+
+ // 鏁版嵁娓叉煋
+ var initTable = function() {
+ tableIns = table.render({
+ elem: '#apiLog',
+ headers: {token: localStorage.getItem('token')},
+ url: baseUrl+'/apiLog/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+"/";
+ }
+ pageCurr=curr;
+ limit();
+ I18n.updatePage();
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 100);
}
- },
- response: {
- statusCode: 200
- },
- done: function(res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
+ });
+ }
+
+ if (typeof I18n !== 'undefined' && I18n.isReady()) {
+ initTable();
+ } else {
+ $(document).on('i18n:ready', initTable);
+ }
+
+ $(document).on('i18n:languageChanged', function() {
+ tableIns.reload({
+ cols: getCols(),
+ done: function(res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ limit();
+ I18n.updatePage();
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 100);
}
- pageCurr=curr;
- limit();
- }
+ });
+ I18n.updatePage();
});
// 鐩戝惉鎺掑簭浜嬩欢
@@ -74,7 +108,18 @@
searchData['orderByType'] = obj.type;
tableIns.reload({
where: searchData,
- page: {curr: 1}
+ page: {curr: 1},
+ done: function(res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ limit();
+ I18n.updatePage();
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 100);
+ }
});
});
@@ -156,6 +201,7 @@
title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��',
content: $('#editDialog').html(),
success: function (layero, dIndex) {
+ I18n.updatePage(layero);
layDateRender(mData);
form.val('detail', mData);
form.on('submit(editSubmit)', function (data) {
@@ -259,6 +305,17 @@
});
tableIns.reload({
where: searchData,
- page: {curr: pageCurr}
+ page: {curr: pageCurr},
+ done: function(res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ limit();
+ I18n.updatePage();
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 100);
+ }
});
}
--
Gitblit v1.9.1