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/wrkMastLog/wrkMastLog.js | 181 +++++++++++++++++++++++++++++---------------
1 files changed, 118 insertions(+), 63 deletions(-)
diff --git a/src/main/webapp/static/js/wrkMastLog/wrkMastLog.js b/src/main/webapp/static/js/wrkMastLog/wrkMastLog.js
index e637bfa..85e08de 100644
--- a/src/main/webapp/static/js/wrkMastLog/wrkMastLog.js
+++ b/src/main/webapp/static/js/wrkMastLog/wrkMastLog.js
@@ -9,30 +9,95 @@
var form = layui.form;
// 鏁版嵁娓叉煋
- tableIns = table.render({
- elem: '#wrkMastLog',
- headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/wrkMastLog/list/auth',
- page: true,
- limit: 16,
- limits: [16, 30, 50, 100, 200, 500],
- even: true,
- toolbar: '#toolbar',
- cellMinWidth: 50,
- cols: [[
+ function initTable() {
+ tableIns = table.render({
+ elem: '#wrkMastLog',
+ headers: {token: localStorage.getItem('token')},
+ url: baseUrl+'/wrkMastLog/list/auth',
+ page: true,
+ limit: 16,
+ limits: [16, 30, 50, 100, 200, 500],
+ even: true,
+ toolbar: '#toolbar',
+ cellMinWidth: 50,
+ cols: getCol(),
+ 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: doneCallback
+ });
+ }
+
+ if (I18n.isReady()) {
+ initTable();
+ } else {
+ $(document).on('i18n:ready', initTable);
+ }
+
+ var doneCallback = 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';
+ }
+ });
+ setTimeout(function() {
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-view'));
+ I18n.updateLayuiPagination();
+ }
+ }, 50);
+ };
+
+ $(document).on('i18n:languageChanged', function() {
+ tableIns.reload({
+ cols: getCol(),
+ done: doneCallback
+ });
+ });
+
+ function getCol() {
+ return [[
// {type: 'checkbox'}
// ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
// ,{field: 'id', align: 'center',title: '缂栧彿'}
- {field: 'wrkNo', align: 'center',title: '宸ヤ綔鍙�',event: 'wrkNo', sort: true}
- ,{field: 'ioTime$', align: 'center',title: '宸ヤ綔鏃堕棿', width:160, sort: true}
- ,{field: 'wrkSts$', align: 'center',title: '宸ヤ綔鐘舵��', width:160}
- ,{field: 'ioType$', align: 'center',title: '鍏ュ嚭搴撶被鍨�', width:160}
- ,{field: 'ioPri', align: 'center',title: '浼樺厛绾�'}
- ,{field: 'crnNo$', align: 'center',title: '鍫嗗灈鏈哄彿'}
- ,{field: 'sourceStaNo$', align: 'center',title: '婧愮珯'}
- ,{field: 'staNo$', align: 'center',title: '鐩爣绔�'}
- ,{field: 'sourceLocNo$', align: 'center',title: '婧愬簱浣�'}
- ,{field: 'locNo$', align: 'center',title: '鐩爣搴撲綅'}
+ {field: 'wrkNo', align: 'center',title: I18n.t('work_no'),event: 'wrkNo', sort: true}
+ ,{field: 'ioTime$', align: 'center',title: I18n.t('work_time'), width:160, sort: true}
+ ,{field: 'wrkSts', align: 'center',title: I18n.t('work_status'), width:160, templet: function(d) {
+ var key = 'wrk_status_' + d.wrkSts;
+ var text = I18n.t(key);
+ return text === key ? d.wrkSts$ : text;
+ }}
+ ,{field: 'ioType', align: 'center',title: I18n.t('transaction_type'), width:160, templet: function(d) {
+ var key = 'io_type_' + d.ioType;
+ var text = I18n.t(key);
+ return text === key ? d.ioType$ : text;
+ }}
+ ,{field: 'ioPri', align: 'center',title: I18n.t('priority')}
+ ,{field: 'crnNo$', align: 'center',title: I18n.t('crane_no')}
+ ,{field: 'sourceStaNo$', align: 'center',title: I18n.t('source_station')}
+ ,{field: 'staNo$', align: 'center',title: I18n.t('target_station')}
+ ,{field: 'sourceLocNo$', align: 'center',title: I18n.t('source_location')}
+ ,{field: 'locNo$', align: 'center',title: I18n.t('target_location')}
// ,{field: 'picking', align: 'center',title: '鎷f枡', templet:function(row){
// var html = "<input value='picking' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'";
// if(row.picking === 'Y'){html += " checked ";}
@@ -55,11 +120,11 @@
// ,{field: 'crnStrTime$', align: 'center',title: '鍫嗗灈鏈哄惎鍔ㄦ椂闂�'}
// ,{field: 'crnEndTime$', align: 'center',title: '鍫嗗灈鏈哄仠姝㈡椂闂�'}
// ,{field: 'plcStrTime$', align: 'center',title: '鎷f枡鏃堕棿'}
- ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳', hide:true}
- ,{field: 'modiTime$', 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: '鍒涘缓鑰�',event: 'appeUser', style: 'cursor:pointer'}
// ,{field: 'appeTime$', align: 'center',title: '娣诲姞鏃堕棿'}
- ,{field: 'barcode', align: 'center',title: '鏉$爜'}
+ ,{field: 'barcode', align: 'center',title: I18n.t('barcode')}
// ,{field: 'fullPlt', align: 'center',title: '婊℃澘', 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 ";}
@@ -67,39 +132,11 @@
// return html;
// }}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width: 80}
- ]],
- 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';
- }
- });
- }
- });
+ ,{fixed: 'right', title: I18n.t('operation'), align: 'center', width: 80, templet: function(d) {
+ return '<a class="layui-btn layui-btn-xs btn-detlShow" lay-event="detlShow" data-i18n="detail">' + I18n.t('detail') + '</a>';
+ }}
+ ]];
+ }
// 鐩戝惉鎺掑簭浜嬩欢
table.on('sort(wrkMastLog)', function (obj) {
@@ -120,6 +157,10 @@
}
pageCurr=curr;
limit();
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage($('.layui-table-view'));
+ I18n.updateLayuiPagination();
+ }
}
});
});
@@ -131,7 +172,7 @@
case 'addData':
layer.open({
type: 2,
- title: '鏂板',
+ title: I18n.t('add'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -154,9 +195,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+"/wrkMastLog/delete/auth",
headers: {'token': localStorage.getItem('token')},
@@ -178,7 +219,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) {
@@ -231,7 +272,7 @@
// 寮瑰眰鏄剧ず
layer.open({
type: 2,
- title: '宸ヤ綔鏄庣粏鍘嗗彶妗�',
+ title: I18n.t('work_order_detail_history'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: true,
@@ -244,7 +285,7 @@
case 'detail':
layer.open({
type: 2,
- title: '璇︽儏',
+ title: I18n.t('detail'),
maxmin: true,
area: [top.detailWidth, top.detailHeight],
shadeClose: false,
@@ -474,6 +515,20 @@
pageCurr -= 1;
}
limit(child);
+ setTimeout(function() {
+ if (typeof I18n !== 'undefined') {
+ if (child) {
+ // If reloading parent table from iframe
+ if (typeof parent.I18n !== 'undefined') {
+ parent.I18n.updatePage(parent.layui.jquery('.layui-table-view'));
+ parent.I18n.updateLayuiPagination();
+ }
+ } else {
+ I18n.updatePage($('.layui-table-view'));
+ I18n.updateLayuiPagination();
+ }
+ }
+ }, 50);
}
});
}
--
Gitblit v1.9.1