From 8e5eba85f1901354180c6ccfc730ceb51669a6f4 Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Mon, 8 Sep 2025 16:27:48 +0800 Subject: [PATCH] 1.下拉表格增加中英文翻译 --- src/components/Common/CommonComponent/index.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/Common/CommonComponent/index.js b/src/components/Common/CommonComponent/index.js index e87edf7..73fb8e4 100644 --- a/src/components/Common/CommonComponent/index.js +++ b/src/components/Common/CommonComponent/index.js @@ -739,11 +739,24 @@ export default class CommonComponent extends Component { /* 返回值 */ return obj; }; - + getLocalizedString = (jsonStr, language) => { + try { + const data = JSON.parse(jsonStr); + return data[language] || ''; + } catch (e) { + console.error('Error parsing JSON:', e); + return ''; + } + }; getSelectTableOption = () => { const { selectTableData } = this.state; - const { showConfig } = this.props; - const { sTableTitleSql } = showConfig; + const { showConfig, app } = this.props; + const { userinfo } = app; + let { sTableTitleSql } = showConfig; + /* 根据用户配置语言 设置表格标题 */ + if (commonUtils.isJSON(sTableTitleSql) && sTableTitleSql.includes('Chinese')) { + sTableTitleSql = this.getLocalizedString(sTableTitleSql, userinfo.sLanguage); + } const tempColumnArr = sTableTitleSql.split(','); let scrollX = 0; const columns = tempColumnArr.map((item, index) => { -- libgit2 0.22.2