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/saas/locMove.js | 108 +++++++++++++++++++++++++++++++++++------------------
1 files changed, 71 insertions(+), 37 deletions(-)
diff --git a/src/main/webapp/static/js/saas/locMove.js b/src/main/webapp/static/js/saas/locMove.js
index fb558bf..f0cf0a7 100644
--- a/src/main/webapp/static/js/saas/locMove.js
+++ b/src/main/webapp/static/js/saas/locMove.js
@@ -1,10 +1,17 @@
var pageCurr = 0;
var tableIns;
+
function getCol() {
var cols = [
- {field: 'locNo', align: 'center',title: '搴撲綅鍙�', merge: true, style: 'font-weight: bold'}
+ {field: 'locNo', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('location_no') : '搴撲綅鍙�', merge: true, style: 'font-weight: bold'}
];
- cols.push.apply(cols, detlCols);
+ var dCols = [];
+ if (typeof getDetlCols === 'function') {
+ dCols = getDetlCols();
+ } else {
+ dCols = typeof detlCols !== 'undefined' ? detlCols.slice() : [];
+ }
+ cols.push.apply(cols, dCols);
return cols;
}
@@ -16,42 +23,69 @@
var form = layui.form;
var tableMerge = layui.tableMerge;
- // 鏁版嵁娓叉煋
- tableIns = table.render({
- elem: '#locMatCode',
- headers: {token: localStorage.getItem('token')},
- // url: baseUrl+'/locDetl/list/auth',
- data:[],
- page: true,
- limit: 16,
- limits: [16, 50, 100, 200, 500],
- even: true,
- 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
+ window.initTable = function() {
+ // 鏁版嵁娓叉煋
+ tableIns = table.render({
+ elem: '#locMatCode',
+ headers: {token: localStorage.getItem('token')},
+ // url: baseUrl+'/locDetl/list/auth',
+ data:[],
+ page: true,
+ limit: 16,
+ limits: [16, 50, 100, 200, 500],
+ even: true,
+ cellMinWidth: 50,
+ cols: [getCol()],
+ text: {
+ none: typeof I18n !== 'undefined' ? 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
+ }
+ },
+ response: {
+ statusCode: 200
+ },
+ done: function(res, curr, count) {
+ tableMerge.render(this);
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ limit();
+ clearSelect();
+ if (typeof I18n !== 'undefined') {
+ I18n.updatePage();
+ setTimeout(function() {
+ I18n.updateLayuiPagination();
+ }, 50);
+ }
}
- },
- response: {
- statusCode: 200
- },
- done: function(res, curr, count) {
- tableMerge.render(this);
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
- clearSelect();
- }
+ });
+ };
+
+ if (typeof I18n !== 'undefined' && I18n.isReady()) {
+ initTable();
+ } else {
+ $(document).on('i18n:ready', initTable);
+ }
+
+ $(document).on('i18n:languageChanged', function() {
+ initTable();
+ $('[data-i18n-placeholder]').each(function() {
+ var key = $(this).attr('data-i18n-placeholder');
+ $(this).attr('placeholder', I18n.t(key));
+ });
+ I18n.updatePage();
+ form.render('select');
});
});
--
Gitblit v1.9.1