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/report/stayTime.js | 126 ++++++++++++++++++++++++++++++-----------
1 files changed, 91 insertions(+), 35 deletions(-)
diff --git a/src/main/webapp/static/js/report/stayTime.js b/src/main/webapp/static/js/report/stayTime.js
index 7fa12ef..173ca1f 100644
--- a/src/main/webapp/static/js/report/stayTime.js
+++ b/src/main/webapp/static/js/report/stayTime.js
@@ -1,11 +1,15 @@
var pageCurr;
function getCol() {
var cols = [
- {field: 'appeTime$', title: '鍏ュ簱鏃堕棿', align: 'center', width: 200}
- ,{field: 'stay_time', align: 'center',title: '婊炵暀澶╂暟'}
- ,{field: 'loc_no', align: 'center',title: '搴撲綅鍙�'}
+ {field: 'appeTime$', title: typeof I18n !== 'undefined' ? I18n.t('鍏ュ簱鏃堕棿') : '鍏ュ簱鏃堕棿', align: 'center', width: 200}
+ ,{field: 'stay_time', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('婊炵暀澶╂暟') : '婊炵暀澶╂暟'}
+ ,{field: 'loc_no', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('搴撲綅鍙�') : '搴撲綅鍙�'}
];
- cols.push.apply(cols, detlCols);
+ if (typeof getDetlCols === 'function') {
+ cols.push.apply(cols, getDetlCols());
+ } else if (typeof detlCols !== 'undefined') {
+ cols.push.apply(cols, detlCols);
+ }
return cols;
}
@@ -18,38 +22,81 @@
// 鏁版嵁娓叉煋
- tableIns = table.render({
- elem: '#stayTime',
- headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/report/viewStayTimeList.action',
- page: true,
- limit: 16,
- limits: [16, 30, 50, 100, 200, 500],
- toolbar: '#toolbar',
- cellMinWidth: 50,
- cols: [getCol()],
- request: {
- pageName: 'curr',
- pageSize: 'limit'
- },
- parseData: function (res) {
- return {
- 'code': res.code,
- 'msg': res.msg,
- 'count': res.data.total,
- 'data': res.data.records
+ function initTable() {
+ tableIns = table.render({
+ elem: '#stayTime',
+ headers: {token: localStorage.getItem('token')},
+ url: baseUrl+'/report/viewStayTimeList.action',
+ page: true,
+ limit: 16,
+ limits: [16, 30, 50, 100, 200, 500],
+ toolbar: '#toolbar',
+ cellMinWidth: 50,
+ cols: [getCol()],
+ text: {
+ none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '鏆傛棤鐩稿叧鏁版嵁'
+ },
+ 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.updatePage();
+ setTimeout(function(){ I18n.updateLayuiPagination(); }, 300);
+ }
}
- },
- 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 {
+ // Check if I18n is defined but not ready, wait for event
+ if (typeof I18n !== 'undefined') {
+ $(document).on('i18n:ready', initTable);
+ } else {
+ // I18n script not loaded, init anyway
+ initTable();
}
+ }
+
+ $(document).on('i18n:languageChanged', function () {
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage();
+ }
+ tableIns.reload({
+ cols: [getCol()],
+ text: {
+ none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '鏆傛棤鐩稿叧鏁版嵁'
+ },
+ done: function (res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ limit();
+ if (typeof I18n !== 'undefined') {
+ setTimeout(function(){ I18n.updateLayuiPagination(); }, 300);
+ }
+ }
+ });
});
// 鐩戝惉鎺掑簭浜嬩欢
@@ -65,12 +112,18 @@
page: {
curr: 1
},
+ text: {
+ none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '鏆傛棤鐩稿叧鏁版嵁'
+ },
done: function (res, curr, count) {
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
pageCurr=curr;
limit();
+ if (typeof I18n !== 'undefined') {
+ setTimeout(function(){ I18n.updateLayuiPagination(); }, 300);
+ }
}
});
});
@@ -80,7 +133,7 @@
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event) {
case 'exportData':
- layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, 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) {
@@ -152,6 +205,9 @@
pageCurr -= 1;
}
limit(child);
+ if (typeof I18n !== 'undefined') {
+ setTimeout(function(){ I18n.updateLayuiPagination(); }, 300);
+ }
}
});
}
--
Gitblit v1.9.1