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/stoMan/stoQue.js | 274 +++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 196 insertions(+), 78 deletions(-)
diff --git a/src/main/webapp/static/js/stoMan/stoQue.js b/src/main/webapp/static/js/stoMan/stoQue.js
index 0352dd9..8a6551a 100644
--- a/src/main/webapp/static/js/stoMan/stoQue.js
+++ b/src/main/webapp/static/js/stoMan/stoQue.js
@@ -1,11 +1,28 @@
var pageCurr;
var locNo;
+var detailLayerIndex;
+
+// Define i18n mapping for auto-complete fields
+window.i18nEnumMap = {
+ 'basWhsQueryBywhsType': {
+ '1': 'standard_crane_whs',
+ '2': 'flat_whs',
+ '3': 'shuttle_board',
+ '4': 'four_way_vehicle',
+ '5': 'agv'
+ },
+ 'basLocStsQueryBylocSts': function(id) {
+ return 'loc_status_' + id;
+ }
+};
+
layui.use(['table','laydate', 'form'], function(){
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
var layDate = layui.laydate;
var form = layui.form;
+ var tableIns, tableIns1;
layDate.render({
elem: '.layui-laydate-range'
@@ -13,74 +30,151 @@
,range: true
});
- // 鏁版嵁娓叉煋
- tableIns = table.render({
- elem: '#stoQue',
- headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/locMast/list/auth',
- page: true,
- limit: 20,
- limits: [20, 30, 50, 100, 200, 500],
- even: true,
- toolbar: '#toolbar',
- cellMinWidth: 50,
- cols: [[
+ // 鑾峰彇涓昏〃琛ㄥご
+ function getCol() {
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
+ return [[
{type: 'checkbox'}
- ,{field: 'locNo', align: 'center',title: '搴撲綅鍙�', hide:false}
- ,{field: 'locSts$', align: 'center',title: '搴撲綅鐘舵��', width: 180, style: 'color: #8E2323', hide:false}
- ,{field: 'whsType$', align: 'center',title: '搴撲綅绫诲瀷', width: 180, style: 'color: #8E2323', hide:false}
- ,{field: 'crnNo', align: 'center',title: '鍫嗗灈鏈哄彿', sort:true, hide:false}
- ,{field: 'row1', align: 'center',title: '鎺�', sort:true, hide:true}
- ,{field: 'bay1', align: 'center',title: '鍒�', sort:true, hide:true}
- ,{field: 'lev1', align: 'center',title: '灞�', sort:true, hide:true}
- ,{field: 'gro1', align: 'center',title: '缁�', sort:true, hide:true}
- ,{field: 'fullPlt', align: 'center',title: '婊℃澘', templet:function(row){
+ ,{field: 'locNo', align: 'center',title: i18n ? I18n.t('location_no') : '搴撲綅鍙�', hide:false}
+ ,{field: 'locSts$', align: 'center',title: i18n ? I18n.t('location_status') : '搴撲綅鐘舵��', width: 180, style: 'color: #8E2323', hide:false, templet: function(d) {
+ if (typeof I18n !== 'undefined' && I18n.isReady() && d.locSts) {
+ var key = 'loc_status_' + d.locSts.trim();
+ var text = I18n.t(key);
+ if (text !== key) return text;
+ }
+ return d.locSts$ || d.locSts;
+ }}
+ ,{field: 'whsType$', align: 'center',title: i18n ? I18n.t('location_type') : '搴撲綅绫诲瀷', width: 180, style: 'color: #8E2323', hide:false, templet: function(d) {
+ if (typeof I18n !== 'undefined' && I18n.isReady() && d.whsType) {
+ var map = {
+ '1': 'standard_crane_whs',
+ '2': 'flat_whs',
+ '3': 'shuttle_board',
+ '4': 'four_way_vehicle',
+ '5': 'agv'
+ };
+ var key = map[d.whsType];
+ if (key) return I18n.t(key);
+ }
+ return d.whsType$ || d.whsType;
+ }}
+ ,{field: 'crnNo', align: 'center',title: i18n ? I18n.t('crane_no') : '鍫嗗灈鏈哄彿', sort:true, hide:false}
+ ,{field: 'row1', align: 'center',title: i18n ? I18n.t('row') : '鎺�', sort:true, hide:true}
+ ,{field: 'bay1', align: 'center',title: i18n ? I18n.t('bay') : '鍒�', sort:true, hide:true}
+ ,{field: 'lev1', align: 'center',title: i18n ? I18n.t('level') : '灞�', sort:true, hide:true}
+ ,{field: 'gro1', align: 'center',title: i18n ? I18n.t('group') : '缁�', sort:true, hide:true}
+ ,{field: 'fullPlt', align: 'center',title: i18n ? I18n.t('full_pallet') : '婊$洏', templet:function(row){
var html = "<input value='fullPlt' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'";
if(row.fullPlt === 'Y'){html += " checked ";}
html += "disabled='disabled' >";
return html;
},width:80}
- ,{field: 'barcode', align: 'center',title: '鏉$爜鍙�', hide:false}
- ,{field: 'locType1$', align: 'center',title: '楂樹綆绫诲瀷', hide:true}
- ,{field: 'locType2$', align: 'center',title: '瀹界獎绫诲瀷', hide:true}
- ,{field: 'locType3$', align: 'center',title: '杞婚噸绫诲瀷', hide:true}
- ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳', hide:true}
- ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿', width: 180, hide:false}
- ,{ fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate'}
- ]],
- 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();
- 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';
+ ,{field: 'barcode', align: 'center',title: i18n ? I18n.t('barcode') : '鎵樼洏鏉$爜', hide:false}
+ ,{field: 'locType1$', align: 'center',title: i18n ? I18n.t('high_low_type') : '楂樹綆浣�', hide:true}
+ ,{field: 'locType2$', align: 'center',title: i18n ? I18n.t('width_type') : '瀹界獎鏉�', hide:true}
+ ,{field: 'locType3$', align: 'center',title: i18n ? I18n.t('weight_type') : '杞介噸', hide:true}
+ ,{field: 'modiUser$', align: 'center',title: i18n ? I18n.t('modifier') : '鏇存柊鑰�', hide:true}
+ ,{field: 'modiTime$', align: 'center',title: i18n ? I18n.t('modify_time') : '鏇存柊鏃堕棿', width: 180, hide:false}
+ ,{ fixed: 'right', title: i18n ? I18n.t('operation') : '鎿嶄綔', align: 'center', toolbar: '#operate'}
+ ]];
+ }
+
+ // 鏁版嵁娓叉煋
+ window.initTable = function() {
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
+ tableIns = table.render({
+ elem: '#stoQue',
+ headers: {token: localStorage.getItem('token')},
+ url: baseUrl+'/locMast/list/auth',
+ page: true,
+ limit: 20,
+ limits: [20, 30, 50, 100, 200, 500],
+ even: true,
+ toolbar: '#toolbar',
+ cellMinWidth: 50,
+ cols: getCol(),
+ text: {
+ none: i18n ? 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
}
- });
- if (count === 1){
- // locDetl(res.data[0][locNo]);
+ },
+ 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';
+ }
+ });
+ if (count === 1){
+ // locDetl(res.data[0][locNo]);
+ }
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage();
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ // 鍐嶆灏濊瘯锛岀‘淇濆垎椤佃缈昏瘧
+ var retryCount = 0;
+ var interval = setInterval(function() {
+ if ($('.layui-table-page').length > 0) {
+ I18n.updateLayuiPagination();
+ retryCount++;
+ if (retryCount > 5) clearInterval(interval);
+ } else {
+ clearInterval(interval);
+ }
+ }, 100);
+ }
}
+ });
+ }
+
+ initTable();
+ if (typeof I18n === 'undefined' || !I18n.isReady()) {
+ $(document).on('i18n:ready', initTable);
+ }
+
+ $(document).on('i18n:languageChanged', function() {
+ initTable();
+ // Reload detail table if it's visible
+ if ($('#detlTable').css('display') !== 'none' && locNo) {
+ locDetl(locNo);
}
+ // Update layer title if open
+ if (detailLayerIndex && $('#layui-layer' + detailLayerIndex).length > 0) {
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
+ layer.title(i18n ? I18n.t('inventory_detail') : '搴撳瓨鏄庣粏', detailLayerIndex);
+ }
+
+ $('[data-i18n-placeholder]').each(function() {
+ var key = $(this).attr('data-i18n-placeholder');
+ if (typeof I18n !== 'undefined' && I18n.isReady()) {
+ $(this).attr('placeholder', I18n.t(key));
+ }
+ });
+
+ I18n.updatePage();
+ form.render('select');
});
// 鐩戝惉鎺掑簭浜嬩欢
@@ -115,7 +209,8 @@
alert("杩樻病鍋�");
break;
case 'exportData':
- layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
+ layer.confirm(i18n ? I18n.t('confirm_export_excel') : '纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
var titles=[];
var fields=[];
obj.config.cols[0].map(function (col) {
@@ -166,7 +261,8 @@
|| data.locSts.trim() === 'S'
|| data.locSts.trim() === 'D'
|| data.locSts.trim() === 'O') {
- layer.msg("姝ゅ簱浣嶇殑鐘舵�佷笉瀛樺湪鐗╂枡");
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
+ layer.msg(i18n ? I18n.t('location_status_no_material') : "姝ゅ簱浣嶇殑鐘舵�佷笉瀛樺湪鐗╂枡");
return;
}
locDetlToLayer(data.locNo);
@@ -176,10 +272,11 @@
// iframe鐗╂枡璇︽儏
function locDetlToLayer(val) {
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
locNo = val;
- layer.open({
+ detailLayerIndex = layer.open({
type: 2,
- title: '搴撳瓨鏄庣粏',
+ title: i18n ? I18n.t('inventory_detail') : '搴撳瓨鏄庣粏',
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: true,
@@ -190,7 +287,27 @@
}
// div鐗╂枡璇︽儏
var pageCur;
+ function getDetlCols() {
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
+ return [[
+ // {type: 'checkbox'}
+ {field: 'locNo$', align: 'center',title: i18n ? I18n.t('location_no') : '搴撲綅鍙�'}
+ ,{field: 'matnr', align: 'center',title: i18n ? I18n.t('material') : '鐗╂枡'}
+ ,{field: 'lgnum', align: 'center',title: i18n ? I18n.t('warehouse_no') : '浠撳簱鍙�'}
+ ,{field: 'tbnum', align: 'center',title: i18n ? I18n.t('transfer_req_no') : '鎼繍鍑瘉'}
+ // ,{field: 'tbpos', align: 'center',title: '琛岄」鐩�'}
+ ,{field: 'zmatid', align: 'center',title: i18n ? I18n.t('material_label_id') : '鐗╂枡鏍囩ID'}
+ ,{field: 'maktx', align: 'center',title: i18n ? I18n.t('material_desc') : '鐗╂枡鎻忚堪'}
+ ,{field: 'werks', align: 'center',title: i18n ? I18n.t('factory') : '宸ュ巶'}
+ ,{field: 'anfme', align: 'center',title: i18n ? I18n.t('quantity') : '鏁伴噺'}
+ ,{field: 'altme', align: 'center',title: i18n ? I18n.t('unit') : '鍗曚綅'}
+ ,{field: 'zpallet', align: 'center',title: i18n ? I18n.t('pallet_barcode') : '鎵樼洏鏉$爜'}
+ ,{field: 'bname', align: 'center',title: i18n ? I18n.t('user_id') : '鐢ㄦ埛ID'}
+ ]];
+ }
+
function locDetl(locNo){
+ var i18n = (typeof I18n !== 'undefined' && I18n.isReady());
$('#detlTable').css("display", 'block');
// 鏁版嵁娓叉煋
tableIns1 = table.render({
@@ -203,21 +320,10 @@
where: {loc_no: locNo},
even: true,
cellMinWidth: 50,
- cols: [[
- // {type: 'checkbox'}
- {field: 'locNo$', align: 'center',title: '搴撲綅鍙�'}
- ,{field: 'matnr', align: 'center',title: '鐗╂枡'}
- ,{field: 'lgnum', align: 'center',title: '浠撳簱鍙�'}
- ,{field: 'tbnum', align: 'center',title: '杞偍璇锋眰缂栧彿'}
- // ,{field: 'tbpos', align: 'center',title: '琛岄」鐩�'}
- ,{field: 'zmatid', align: 'center',title: '鐗╂枡鏍囩ID'}
- ,{field: 'maktx', align: 'center',title: '鐗╂枡鎻忚堪'}
- ,{field: 'werks', align: 'center',title: '宸ュ巶'}
- ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
- ,{field: 'altme', align: 'center',title: '鍗曚綅'}
- ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜'}
- ,{field: 'bname', align: 'center',title: '鐢ㄦ埛ID'}
- ]],
+ cols: getDetlCols(),
+ text: {
+ none: i18n ? I18n.t('no_data') : '鏃犳暟鎹�'
+ },
request: {
pageName: 'curr',
pageSize: 'limit'
@@ -246,6 +352,12 @@
res.data[_index][data.value] = 'N';
}
});
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('#detlTable'));
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ }
}
});
}
@@ -293,6 +405,12 @@
pageCurr -= 1;
}
limit(child);
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage();
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ }
}
});
}
--
Gitblit v1.9.1