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) => {