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/basWrkStatus/basWrkStatus.js | 137 +++++++++++++++++++--------------------------
1 files changed, 57 insertions(+), 80 deletions(-)
diff --git a/src/main/webapp/static/js/basWrkStatus/basWrkStatus.js b/src/main/webapp/static/js/basWrkStatus/basWrkStatus.js
index a64f6da..3ee3796 100644
--- a/src/main/webapp/static/js/basWrkStatus/basWrkStatus.js
+++ b/src/main/webapp/static/js/basWrkStatus/basWrkStatus.js
@@ -6,6 +6,35 @@
var layDate = layui.laydate;
var form = layui.form;
+ // 瀹氫箟鍒楃敓鎴愬嚱鏁�
+ var getCol = function() {
+ return [
+ {type: 'checkbox', fixed: 'left'}
+ ,{field: 'wrkSts', align: 'center', sort: true, title: I18n.t('code')}
+ ,{field: 'wrkDesc', align: 'center', title: I18n.t('status_desc'), templet: function(d) {
+ var key = 'wrk_status_' + d.wrkSts;
+ var text = I18n.t(key);
+ return text === key ? d.wrkDesc : text;
+ }}
+ ,{field: 'modiUser$', align: 'center', title: I18n.t('modifier')}
+ ,{field: 'modiTime$', align: 'center', title: I18n.t('modify_time')}
+ ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width: 150}
+ ];
+ };
+
+ // 瀹氫箟閫氱敤done鍥炶皟
+ var tableDone = function(res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ }
+ pageCurr = curr;
+ limit();
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage();
+ I18n.updateLayuiPagination();
+ }
+ };
+
// 鏁版嵁娓叉煋
tableIns = table.render({
elem: '#basWrkStatus',
@@ -14,22 +43,10 @@
page: true,
limit: 16,
limits: [16, 30, 50, 100, 200, 500],
- // skin: 'line',
even: true,
toolbar: '#toolbar',
cellMinWidth: 50,
- cols: [[
- {type: 'checkbox', fixed: 'left'}
-// ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
- ,{field: 'wrkSts', align: 'center',sort:true,title: '浠e彿'}
- ,{field: 'wrkDesc', align: 'center',title: '鐘舵�佹弿杩�'}
- ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳'}
- ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿'}
- // ,{field: 'appeUser$', align: 'center',title: '鍒涘缓鑰�',event: 'appeUser', style: 'text-decoration: underline;cursor:pointer'}
- // ,{field: 'appeTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
- ]],
+ cols: [getCol()],
request: {
pageName: 'curr',
pageSize: 'limit'
@@ -45,13 +62,7 @@
response: {
statusCode: 200
},
- done: function(res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
- }
+ done: tableDone
});
// 鐩戝惉鎺掑簭浜嬩欢
@@ -67,13 +78,16 @@
page: {
curr: 1
},
- done: function (res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
- }
+ cols: [getCol()],
+ done: tableDone
+ });
+ });
+
+ // 鐩戝惉璇█鍒囨崲
+ $(document).on('i18n:languageChanged i18n:ready', function() {
+ tableIns.reload({
+ cols: [getCol()],
+ done: tableDone
});
});
@@ -84,7 +98,7 @@
case 'addData':
layer.open({
type: 2,
- title: '鏂板',
+ title: I18n.t('add'),
maxmin: true,
area: ['500px', top.detailHeight],
shadeClose: false,
@@ -100,16 +114,17 @@
tableIns.reload({
page: {
curr: pageCurr
- }
+ },
+ done: tableDone
});
limit();
break;
case 'deleteData':
var data = checkStatus.data;
if (data.length === 0){
- layer.msg('璇烽�夋嫨鏁版嵁');
+ layer.msg(I18n.t('please_select_data'));
} else {
- layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){
+ layer.confirm(I18n.t('confirm_delete_prefix')+(data.length===1?I18n.t('this'):data.length)+I18n.t('confirm_delete_suffix'), {title: I18n.t('info')}, function(){
$.ajax({
url: baseUrl+"/basWrkStatus/delete/auth",
headers: {'token': localStorage.getItem('token')},
@@ -131,7 +146,7 @@
}
break;
case 'exportData':
- layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ layer.confirm(I18n.t('confirm_export'), {title: I18n.t('info'), shadeClose: true}, function(){
var titles=[];
var fields=[];
obj.config.cols[0].map(function (col) {
@@ -179,7 +194,7 @@
case 'detail':
layer.open({
type: 2,
- title: '璇︽儏',
+ title: I18n.t('detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -198,7 +213,7 @@
case 'edit':
layer.open({
type: 2,
- title: '淇敼',
+ title: I18n.t('edit'),
maxmin: true,
area: ['500px', top.detailHeight],
shadeClose: false,
@@ -216,11 +231,11 @@
case 'modiUser':
var param = top.reObject(data).modiUser;
if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
+ layer.msg(I18n.t('no_data'));
} else {
layer.open({
type: 2,
- title: '淇敼璇︽儏',
+ title: I18n.t('modifier_detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -252,11 +267,11 @@
case 'appeUser':
var param = top.reObject(data).appeUser;
if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
+ layer.msg(I18n.t('no_data'));
} else {
layer.open({
type: 2,
- title: '鍒涜鎯�',
+ title: I18n.t('creator_detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -394,48 +409,10 @@
pageCurr -= 1;
}
limit(child);
- }
- });
-}
-
-function setFormVal(el, data, showImg) {
- for (var val in data) {
- var find = el.find(":input[id='" + val + "']");
- find.val(data[val]);
- if (showImg){
- var next = find.next();
- if (next.get(0)){
- if (next.get(0).localName === "img") {
- find.hide();
- next.attr("src", data[val]);
- next.show();
- }
+ var i18nObj = child ? parent.I18n : I18n;
+ if (typeof i18nObj !== 'undefined') {
+ i18nObj.updateLayuiPagination();
}
}
- }
-}
-
-function clearFormVal(el) {
- $(':input', el)
- .val('')
- .removeAttr('checked')
- .removeAttr('selected');
-}
-
-function detailScreen(index) {
- var detail = layer.getChildFrame('#data-detail', index);
- var height = detail.height()+60;
- if (height > ($(window).height()*0.9)) {
- height = ($(window).height()*0.9);
- }
- layer.style(index, {
-// top: (($(window).height()-height)/3)+"px",
- height: height+'px'
});
-}
-
-$('body').keydown(function () {
- if (event.keyCode === 13) {
- $("#search").click();
- }
-});
+}
\ No newline at end of file
--
Gitblit v1.9.1