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/locMast/locMast.js | 217 +++++++++++++++++++++++++++++++++--------------------
1 files changed, 135 insertions(+), 82 deletions(-)
diff --git a/src/main/webapp/static/js/locMast/locMast.js b/src/main/webapp/static/js/locMast/locMast.js
index 20e5195..6f1baac 100644
--- a/src/main/webapp/static/js/locMast/locMast.js
+++ b/src/main/webapp/static/js/locMast/locMast.js
@@ -6,6 +6,87 @@
var layDate = layui.laydate;
var form = layui.form;
+ var doneCallback = function(res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ limit();
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-view'));
+ I18n.updateLayuiPagination();
+ }
+ };
+
+ // 鑾峰彇琛ㄥご閰嶇疆
+ function getCols() {
+ return [[
+ {type: 'checkbox', fixed: 'left'}
+ // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
+ ,{field: 'locNo', align: 'center',title: I18n.t('location_no'),sort:true, hide:false}
+ ,{field: 'locSts', align: 'center',title: I18n.t('location_status'),width:200, hide:false, templet: function(d) {
+ var key = 'loc_status_' + d.locSts;
+ var text = I18n.t(key);
+ return text === key ? d.locSts$ : text;
+ }}
+ ,{field: 'whsType', align: 'center',title: I18n.t('location_type'),width:200, hide:false, templet: function(d) {
+ var map = {
+ '1': 'standard_crane_whs',
+ '2': 'flat_whs',
+ '3': 'shuttle_board',
+ '4': 'four_way_vehicle',
+ '5': 'agv'
+ };
+ var key = map[d.whsType];
+ return key ? I18n.t(key) : d.whsType$;
+ }}
+ // ,{field: 'pltType', align: 'center',title: ''}
+ // ,{field: 'ctnType', align: 'center',title: ''}
+ // ,{field: 'locSts', align: 'center',title: ''}
+ // ,{field: 'sheetNo', align: 'center',title: ''}
+ ,{field: 'crnNo', align: 'center',title: I18n.t('crane_no'), hide:false}
+ ,{field: 'row1', align: 'center',title: I18n.t('row'), sort:true, hide:false}
+ ,{field: 'bay1', align: 'center',title: I18n.t('bay'), sort:true, hide:false}
+ ,{field: 'lev1', align: 'center',title: I18n.t('level'), sort:true, hide:false}
+ ,{field: 'gro1', align: 'center',title: I18n.t('group'), sort:true, hide:false}
+ ,{field: 'fullPlt', align: 'center',title: I18n.t('full_pallet'), templet:function(row){
+ var html = "<input value='fullPlt' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' disabled table-index='"+row.LAY_TABLE_INDEX+"'";
+ if(row.fullPlt === 'Y'){html += " checked ";}
+ html += ">";
+ return html;
+ },width:80, hide:false}
+ // ,{field: 'outEnable', align: 'center',title: ''}
+ ,{field: 'ioTime$', align: 'center',title: 'ioTime', hide:true}
+ // ,{field: 'firstTime$', align: 'center',title: '', hide:true}
+ ,{field: 'modiUser$', align: 'center',title: I18n.t('modifier'), hide:true}
+ ,{field: 'modiTime$', align: 'center',title: I18n.t('modify_time'), hide:true}
+ ,{field: 'appeUser$', align: 'center',title: I18n.t('creator'),event: 'appeUser', style: 'text-decoration: underline;cursor:pointer', hide:true}
+ ,{field: 'appeTime$', align: 'center',title: I18n.t('add_time'), hide:true}
+ // ,{field: 'errorTime$', align: 'center',title: ''}
+ // ,{field: 'errorMemo', align: 'center',title: ''}
+ // ,{field: 'ctnKind', align: 'center',title: ''}
+ // ,{field: 'scWeight', align: 'center',title: ''}
+ // ,{field: 'invWh', align: 'center',title: ''}
+ // ,{field: 'mk', align: 'center',title: ''}
+ // ,{field: 'barcode', align: 'center',title: ''}
+ // ,{field: 'PdcType', align: 'center',title: ''}
+ // ,{field: 'ctnNo', align: 'center',title: ''}
+ ,{field: 'locType1$', align: 'center',title: I18n.t('high_low_type'), hide:true}
+ ,{field: 'locType2$', align: 'center',title: I18n.t('width_type'), hide:true}
+ ,{field: 'locType3$', align: 'center',title: I18n.t('weight_type'), hide:true}
+
+ ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:100}
+ ]];
+ }
+
+ // 鐩戝惉璇█鍒囨崲浜嬩欢
+ $(document).on('i18n:languageChanged', function() {
+ tableIns.reload({
+ cols: getCols(),
+ done: doneCallback
+ });
+ });
+
// 鏁版嵁娓叉煋
tableIns = table.render({
elem: '#locMast',
@@ -18,49 +99,7 @@
// size: 'sm',
toolbar: '#toolbar',
cellMinWidth: 50,
- cols: [[
- {type: 'checkbox', fixed: 'left'}
-// ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
- ,{field: 'locNo', align: 'center',title: '搴撲綅鍙�',sort:true, hide:false}
- ,{field: 'locSts$', align: 'center',title: '搴撲綅鐘舵��',width:200, hide:false}
- ,{field: 'whsType$', align: 'center',title: '搴撲綅绫诲瀷',width:200, hide:false}
- // ,{field: 'pltType', align: 'center',title: ''}
- // ,{field: 'ctnType', align: 'center',title: ''}
- // ,{field: 'locSts', align: 'center',title: ''}
- // ,{field: 'sheetNo', align: 'center',title: ''}
- ,{field: 'crnNo', align: 'center',title: '鍫嗗灈鏈哄彿', hide:false}
- ,{field: 'row1', align: 'center',title: '鎺�', sort:true, hide:false}
- ,{field: 'bay1', align: 'center',title: '鍒�', sort:true, hide:false}
- ,{field: 'lev1', align: 'center',title: '灞�', sort:true, hide:false}
- ,{field: 'gro1', align: 'center',title: '缁�', sort:true, hide:false}
- ,{field: 'fullPlt', align: 'center',title: '婊℃澘', templet:function(row){
- var html = "<input value='fullPlt' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' disabled table-index='"+row.LAY_TABLE_INDEX+"'";
- if(row.fullPlt === 'Y'){html += " checked ";}
- html += ">";
- return html;
- },width:80, hide:false}
- // ,{field: 'outEnable', align: 'center',title: ''}
- ,{field: 'ioTime$', align: 'center',title: 'ioTime', hide:true}
- // ,{field: 'firstTime$', align: 'center',title: '', hide:true}
- ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳', hide:true}
- ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿', hide:true}
- ,{field: 'appeUser$', align: 'center',title: '鍒涘缓鑰�',event: 'appeUser', style: 'text-decoration: underline;cursor:pointer', hide:true}
- ,{field: 'appeTime$', align: 'center',title: '娣诲姞鏃堕棿', hide:true}
- // ,{field: 'errorTime$', align: 'center',title: ''}
- // ,{field: 'errorMemo', align: 'center',title: ''}
- // ,{field: 'ctnKind', align: 'center',title: ''}
- // ,{field: 'scWeight', align: 'center',title: ''}
- // ,{field: 'invWh', align: 'center',title: ''}
- // ,{field: 'mk', align: 'center',title: ''}
- // ,{field: 'barcode', align: 'center',title: ''}
- // ,{field: 'PdcType', align: 'center',title: ''}
- // ,{field: 'ctnNo', align: 'center',title: ''}
- ,{field: 'locType1$', align: 'center',title: '楂樹綆绫诲瀷', hide:true}
- ,{field: 'locType2$', align: 'center',title: '瀹界獎绫诲瀷', hide:true}
- ,{field: 'locType3$', align: 'center',title: '杞婚噸绫诲瀷', hide:true}
-
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:100}
- ]],
+ cols: getCols(),
request: {
pageName: 'curr',
pageSize: 'limit'
@@ -76,21 +115,7 @@
response: {
statusCode: 200
},
- done: function(res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
- form.on('checkbox(tableCheckbox)', function (data) {
- var _index = $(data.elem).attr('table-index')||0;
- if(data.elem.checked){
- res.data[_index][data.value] = 'Y';
- }else{
- res.data[_index][data.value] = 'N';
- }
- });
- }
+ done: doneCallback
});
// 鐩戝惉鎺掑簭浜嬩欢
@@ -106,13 +131,7 @@
page: {
curr: 1
},
- done: function (res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
- }
+ done: doneCallback
});
});
@@ -123,9 +142,9 @@
case 'addData':
layer.open({
type: 2,
- title: '鏂板',
+ title: I18n.t('add'),
maxmin: true,
- area: ['500px', top.detailHeight],
+ area: ['2000px', top.detailHeight],
shadeClose: false,
content: 'locMast_detail.html',
success: function(layero, index){
@@ -147,9 +166,9 @@
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'), function(){
$.ajax({
url: baseUrl+"/locMast/delete/auth",
headers: {'token': localStorage.getItem('token')},
@@ -171,7 +190,7 @@
}
break;
case 'exportData':
- layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ layer.confirm(I18n.t('confirm_export_excel'), {shadeClose: true}, function(){
var titles=[];
var fields=[];
obj.config.cols[0].map(function (col) {
@@ -209,12 +228,12 @@
});
break;
case "init":
- layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞堕噸缃簱浣�', formType: 1, shadeClose: true}, function(pass, idx){
+ layer.prompt({title: I18n.t('please_enter_password_reset_location'), formType: 1, shadeClose: true}, function(pass, idx){
http.get(baseUrl+"/locMast/init/pwd", {pwd: pass}, function (res) {
if (res.data) {
layer.open({
type: 1,
- title: '鍒濆鍖栧簱浣�',
+ title: I18n.t('init_location'),
area: ["400px"],
maxmin: true,
shadeClose: true,
@@ -224,7 +243,7 @@
}
})
} else {
- layer.msg("鍙d护閿欒");
+ layer.msg(I18n.t('password_error'));
}
layer.close(idx);
})
@@ -232,6 +251,36 @@
break;
}
});
+
+ // 缈昏瘧璇︽儏鏁版嵁
+ function translateDetailData(data) {
+ var newData = $.extend({}, data);
+
+ // 缈昏瘧 locSts
+ if (newData.locSts) {
+ var key = 'loc_status_' + newData.locSts;
+ var text = I18n.t(key);
+ if (text !== key) {
+ newData.locSts$ = text;
+ }
+ }
+
+ // 缈昏瘧 whsType
+ if (newData.whsType) {
+ var map = {
+ '1': 'standard_crane_whs',
+ '2': 'flat_whs',
+ '3': 'shuttle_board',
+ '4': 'four_way_vehicle',
+ '5': 'agv'
+ };
+ var key = map[newData.whsType];
+ if (key) {
+ newData.whsType$ = I18n.t(key);
+ }
+ }
+ return newData;
+ }
// 鐩戝惉琛屽伐鍏蜂簨浠�
table.on('tool(locMast)', function(obj){
@@ -241,7 +290,7 @@
case 'detail':
layer.open({
type: 2,
- title: '璇︽儏',
+ title: I18n.t('detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -261,9 +310,9 @@
case 'edit':
layer.open({
type: 2,
- title: '淇敼',
+ title: I18n.t('modify'),
maxmin: true,
- area: ['500px', top.detailHeight],
+ area: ['700px', '600px'],
shadeClose: false,
content: 'locMast_detail.html',
success: function(layero, index){
@@ -280,11 +329,11 @@
case 'whsType':
var param = top.reObject(data).whsType;
if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
+ layer.msg(I18n.t('no_data_found'));
} else {
layer.open({
type: 2,
- title: '搴撲綅璇︽儏',
+ title: I18n.t('location_detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -316,11 +365,11 @@
case 'modiUser':
var param = top.reObject(data).modiUser;
if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
+ layer.msg(I18n.t('no_data_found'));
} else {
layer.open({
type: 2,
- title: '淇敼璇︽儏',
+ title: I18n.t('modify_detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -353,11 +402,11 @@
case 'appeUser':
var param = top.reObject(data).appeUser;
if (param === undefined) {
- layer.msg("鏃犳暟鎹�");
+ layer.msg(I18n.t('no_data_found'));
} else {
layer.open({
type: 2,
- title: '鍒涜鎯�',
+ title: I18n.t('create_detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -563,6 +612,10 @@
pageCurr -= 1;
}
limit(child);
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage();
+ I18n.updateLayuiPagination();
+ }
}
});
}
--
Gitblit v1.9.1