From 35b1b26f1fe16550b4ee2881a26d599456fe59b4 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期四, 22 一月 2026 17:01:11 +0800
Subject: [PATCH] #i18n翻译
---
src/main/webapp/static/js/waitPakinLog/waitPakinLog.js | 129 ++++++++++++++++++++++++++++++++++++------
1 files changed, 110 insertions(+), 19 deletions(-)
diff --git a/src/main/webapp/static/js/waitPakinLog/waitPakinLog.js b/src/main/webapp/static/js/waitPakinLog/waitPakinLog.js
index 54fc129..55bb9b2 100644
--- a/src/main/webapp/static/js/waitPakinLog/waitPakinLog.js
+++ b/src/main/webapp/static/js/waitPakinLog/waitPakinLog.js
@@ -2,23 +2,78 @@
function getCol() {
var cols = [
];
- cols.push.apply(cols, detlCols);
- cols.push({field: 'status', align: 'center',title: '鏁版嵁鐘舵��', templet:function(row){
- var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='姝e父|閿佸畾' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
+ cols.push.apply(cols, typeof getDetlCols === 'function' ? getDetlCols() : detlCols);
+ cols.push({field: 'status', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('data_status') : '鏁版嵁鐘舵��', templet:function(row){
+ var normal = typeof I18n !== 'undefined' ? I18n.t('normal') : '姝e父';
+ var locked = typeof I18n !== 'undefined' ? I18n.t('locked') : '閿佸畾';
+ var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='"+normal+"|"+locked+"' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
if(row.status === 'Y'){html += " checked ";}
html += ">";
return html;
}}
- ,{field: 'ioStatus', align: 'center',title: '鍏ュ嚭鐘舵��', templet:function(row){
- var html = "<input value='ioStatus' type='checkbox' lay-skin='switch' lay-text='杩愯涓瓅寰呭鐞�' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
+ ,{field: 'ioStatus', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('io_status') : '鍏ュ嚭鐘舵��', templet:function(row){
+ var running = typeof I18n !== 'undefined' ? I18n.t('running') : '杩愯涓�';
+ var pending = typeof I18n !== 'undefined' ? I18n.t('pending') : '寰呭鐞�';
+ var html = "<input value='ioStatus' type='checkbox' lay-skin='switch' lay-text='"+running+"|"+pending+"' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
if(row.ioStatus === 'Y'){html += " checked ";}
html += ">";
return html;
}}
- ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳', hide:true}
- ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿', hide:true})
+ ,{field: 'modiUser$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modifier') : '淇敼浜哄憳', hide:true}
+ ,{field: 'modiTime$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modify_time') : '淇敼鏃堕棿', hide:true})
return cols;
}
+
+function updatePagination() {
+ if (typeof I18n === 'undefined') return;
+
+ // Update 'Total X items'
+ $('.layui-laypage-count').each(function() {
+ var text = $(this).text();
+ var count = text.match(/\d+/);
+ if (count) {
+ $(this).text(I18n.t('total_prefix') + count[0] + I18n.t('total_suffix'));
+ }
+ });
+
+ // Update 'Go to [input] page [button]'
+ $('.layui-laypage-skip').each(function() {
+ var $this = $(this);
+ // Replace "鍒扮" (First text node)
+ var contents = $this.contents();
+ for (var i = 0; i < contents.length; i++) {
+ if (contents[i].nodeType === 3 && contents[i].textContent.trim() !== '') {
+ contents[i].textContent = I18n.t('jump_to');
+ break;
+ }
+ }
+
+ // Replace "椤�" (Text node after input)
+ var input = $this.find('.layui-input');
+ if (input.length) {
+ var nextNode = input[0].nextSibling;
+ if (nextNode && nextNode.nodeType === 3) {
+ nextNode.textContent = I18n.t('page');
+ }
+ }
+
+ // Replace Button text
+ var btn = $this.find('.layui-laypage-btn');
+ if (btn.length) {
+ btn.text(I18n.t('confirm'));
+ }
+ });
+
+ // Update 'X items/page'
+ $('.layui-laypage-limits select option').each(function() {
+ var text = $(this).text();
+ var limit = text.match(/\d+/);
+ if (limit) {
+ $(this).text(limit[0] + I18n.t('items_per_page'));
+ }
+ });
+}
+
layui.use(['table','laydate', 'form'], function(){
var table = layui.table;
var $ = layui.jquery;
@@ -57,6 +112,10 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-view'));
+ updatePagination();
+ }
pageCurr=curr;
limit();
form.on('checkbox(tableCheckbox)', function (data) {
@@ -87,6 +146,10 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-view'));
+ updatePagination();
+ }
pageCurr=curr;
limit();
}
@@ -100,7 +163,7 @@
case 'addData':
layer.open({
type: 2,
- title: '鏂板',
+ title: typeof I18n !== 'undefined' ? I18n.t('add') : '鏂板',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
content: 'waitPakinLog_detail.html',
@@ -114,9 +177,16 @@
case 'deleteData':
var data = checkStatus.data;
if (data.length === 0){
- layer.msg('璇烽�夋嫨鏁版嵁');
+ layer.msg(typeof I18n !== 'undefined' ? I18n.t('please_select_data') : '璇烽�夋嫨鏁版嵁');
} else {
- layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){
+ var msg = '纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧';
+ if (typeof I18n !== 'undefined') {
+ msg = I18n.t('confirm_delete_prefix') + " " + data.length + " " + I18n.t('confirm_delete_suffix');
+ }
+ layer.confirm(msg, {
+ title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '鎻愮ず',
+ btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '纭畾', typeof I18n !== 'undefined' ? I18n.t('cancel') : '鍙栨秷']
+ }, function(){
$.ajax({
url: baseUrl+"/waitPakinLog/delete/auth",
headers: {'token': localStorage.getItem('token')},
@@ -138,7 +208,11 @@
}
break;
case 'exportData':
- layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_export_excel') : '纭畾瀵煎嚭Excel鍚�', {
+ shadeClose: true,
+ title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '鎻愮ず',
+ btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '纭畾', typeof I18n !== 'undefined' ? I18n.t('cancel') : '鍙栨秷']
+ }, function(){
var titles=[];
var fields=[];
obj.config.cols[0].map(function (col) {
@@ -186,7 +260,7 @@
case 'detail':
layer.open({
type: 2,
- title: '璇︽儏',
+ title: typeof I18n !== 'undefined' ? I18n.t('detail') : '璇︽儏',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: true,
@@ -205,7 +279,7 @@
case 'edit':
layer.open({
type: 2,
- title: '淇敼',
+ title: typeof I18n !== 'undefined' ? I18n.t('edit') : '淇敼',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
content: 'waitPakinLog_detail.html',
@@ -223,11 +297,11 @@
case 'modiUser':
var param = top.reObject(data).modiUser;
if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
+ layer.msg(typeof I18n !== 'undefined' ? I18n.t('no_data_found') : "鏃犳暟鎹�");
} else {
- layer.open({
+ layer.open({
type: 2,
- title: '淇敼浜哄憳璇︽儏',
+ title: typeof I18n !== 'undefined' ? I18n.t('modifier_detail') : '淇敼浜哄憳璇︽儏',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: true,
@@ -259,11 +333,11 @@
case 'appeUser':
var param = top.reObject(data).appeUser;
if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
+ layer.msg(typeof I18n !== 'undefined' ? I18n.t('no_data_found') : "鏃犳暟鎹�");
} else {
- layer.open({
+ layer.open({
type: 2,
- title: '鍒涘缓鑰呰鎯�',
+ title: typeof I18n !== 'undefined' ? I18n.t('creator_detail') : '鍒涘缓鑰呰鎯�',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: true,
@@ -391,6 +465,19 @@
,range: true
});
+ // Add i18n listener
+ $(document).on('i18n:updated', function() {
+ table.reload('waitPakinLog', {
+ cols: [getCol()],
+ done: function() {
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-view'));
+ updatePagination();
+ }
+ }
+ });
+ });
+
});
// 鍏抽棴鍔ㄤ綔
@@ -412,6 +499,10 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-view'));
+ updatePagination();
+ }
pageCurr=curr;
if (res.data.length === 0 && count !== 0) {
tableIns.reload({
--
Gitblit v1.9.1