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/locDetlStatis/locDetlStatis.js | 104 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 94 insertions(+), 10 deletions(-)
diff --git a/src/main/webapp/static/js/locDetlStatis/locDetlStatis.js b/src/main/webapp/static/js/locDetlStatis/locDetlStatis.js
index c89ed36..72d86d3 100644
--- a/src/main/webapp/static/js/locDetlStatis/locDetlStatis.js
+++ b/src/main/webapp/static/js/locDetlStatis/locDetlStatis.js
@@ -1,13 +1,38 @@
var pageCurr;
function getCol() {
+ var title = '搴撳瓨鏁伴噺';
+ if (typeof I18n !== 'undefined') {
+ title = I18n.t('inventory_quantity');
+ }
var cols = [
- {field: 'anfme', align: 'center',title: '搴撳瓨鏁伴噺', style: 'font-weight: bold'}
+ {field: 'anfme', align: 'center',title: title, style: 'font-weight: bold'}
];
- arrRemove(detlCols, "field", "anfme")
- arrRemove(detlCols, "field", "zpallet")
- cols.push.apply(cols, detlCols);
- // cols.push({field: 'anfme', align: 'center',title: '鏁伴噺', style: 'font-weight: bold'}
- // )
+
+ // Use getDetlCols() if available for fresh translations
+ var currentDetlCols = [];
+ if (typeof getDetlCols === 'function') {
+ // Get fresh copy
+ currentDetlCols = getDetlCols();
+ } else if (typeof detlCols !== 'undefined') {
+ // Fallback to global variable (might be stale or already modified)
+ // Clone to avoid affecting the global variable if we are filtering
+ currentDetlCols = JSON.parse(JSON.stringify(detlCols));
+ }
+
+ // Remove unwanted columns from the copy
+ // We use a filter approach to avoid issues with in-place modification of globals
+ // and to ensure we can switch languages correctly.
+ var filteredCols = [];
+ if (currentDetlCols) {
+ for(var i=0; i<currentDetlCols.length; i++){
+ var col = currentDetlCols[i];
+ if(col.field !== 'anfme' && col.field !== 'zpallet'){
+ filteredCols.push(col);
+ }
+ }
+ }
+
+ cols.push.apply(cols, filteredCols);
return cols;
}
@@ -49,6 +74,14 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-tool'));
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ }
+
pageCurr=curr;
limit();
form.on('checkbox(tableCheckbox)', function (data) {
@@ -68,11 +101,43 @@
contentType:'application/json;charset=UTF-8',
method: 'POST',
success: function (res) {
- $("#countNum").text(res.data + '涓�');
+ var unit = (typeof I18n !== 'undefined') ? I18n.t('unit_piece') : '涓�';
+ $("#countNum").text(res.data + unit);
}
});
}
+ });
+
+ // 鐩戝惉璇█鍒囨崲浜嬩欢
+ $(document).on('i18n:languageChanged', function() {
+ tableIns.reload({
+ cols: [getCol()],
+ text: {
+ none: I18n.t('no_data')
+ },
+ done: function(res, curr, count) {
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-tool'));
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ }
+ pageCurr=curr;
+ limit();
+ // 閲嶆柊鑾峰彇鏁伴噺浠ユ洿鏂扮炕璇�
+ $.ajax({
+ url: baseUrl+"/locDetl/count",
+ headers: {'token': localStorage.getItem('token')},
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ var unit = (typeof I18n !== 'undefined') ? I18n.t('unit_piece') : '涓�';
+ $("#countNum").text(res.data + unit);
+ }
+ });
+ }
+ });
});
// 鐩戝惉鎺掑簭浜嬩欢
@@ -92,6 +157,14 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-tool'));
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ }
+
pageCurr=curr;
limit();
}
@@ -105,11 +178,14 @@
case 'exportAll':
layer.closeAll();
layer.load(1, {shade: [0.1,'#fff']});
- location.href = baseUrl + "/locDetl/statis/export";
+ var lang = (typeof I18n !== 'undefined') ? I18n.getLanguage() : 'zh-cn';
+ location.href = baseUrl + "/locDetl/statis/export?lang=" + lang;
layer.closeAll('loading');
break;
case 'exportData':
- layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ var confirmMsg = (typeof I18n !== 'undefined') ? I18n.t('confirm_export_excel') : '纭畾瀵煎嚭Excel鍚�';
+ layer.confirm(confirmMsg, {shadeClose: true, title: (typeof I18n !== 'undefined') ? I18n.t('prompt') : '鎻愮ず', btn: [(typeof I18n !== 'undefined') ? I18n.t('confirm') : '纭畾', (typeof I18n !== 'undefined') ? I18n.t('cancel') : '鍙栨秷']}, function(index){
+ layer.close(index); // Close the confirm dialog
var titles=[];
var fields=[];
obj.config.cols[0].map(function (col) {
@@ -157,7 +233,7 @@
case 'detail':
layer.open({
type: 2,
- title: '璇︽儏',
+ title: (typeof I18n !== 'undefined') ? I18n.t('detail') : '璇︽儏',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -222,6 +298,14 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
+
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-tool'));
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ }
+
pageCurr=curr;
if (res.data.length === 0 && count !== 0) {
tableIns.reload({
--
Gitblit v1.9.1