Commit cafa9dc47fd195d7434f555b52efc5db769a25c1

Authored by Min
1 parent af7ee863

1.多列头下拉 根据用户的语言,选择对应的json字符串语言配置作为列标题

src/components/Common/CommonComponent/index.js
@@ -635,7 +635,15 @@ export default class CommonComponent extends Component { @@ -635,7 +635,15 @@ export default class CommonComponent extends Component {
635 /* 返回值 */ 635 /* 返回值 */
636 return obj; 636 return obj;
637 }; 637 };
638 - 638 + getLocalizedString = (jsonStr, language) =>{
  639 + try {
  640 + const data = JSON.parse(jsonStr);
  641 + return data[language] || '';
  642 + } catch (e) {
  643 + console.error('Error parsing JSON:', e);
  644 + return '';
  645 + }
  646 + }
639 getSelectTableProps = () => { 647 getSelectTableProps = () => {
640 const { currentPage, tempCurrentPage, searchValue } = this.state; 648 const { currentPage, tempCurrentPage, searchValue } = this.state;
641 const pageNum = searchValue === '' ? currentPage : tempCurrentPage; 649 const pageNum = searchValue === '' ? currentPage : tempCurrentPage;
@@ -828,8 +836,13 @@ export default class CommonComponent extends Component { @@ -828,8 +836,13 @@ export default class CommonComponent extends Component {
828 836
829 getSelectTableOption = () => { 837 getSelectTableOption = () => {
830 const { selectTableData, selectTableIndex = 0 } = this.state; 838 const { selectTableData, selectTableIndex = 0 } = this.state;
831 - const { showConfig } = this.props;  
832 - const { sTableTitleSql } = showConfig; 839 + const { showConfig , app} = this.props;
  840 + const { userinfo } = app;
  841 + let { sTableTitleSql } = showConfig;
  842 + /* 根据用户配置语言 设置表格标题 */
  843 + if(commonUtils.isJSON(sTableTitleSql) && sTableTitleSql.includes('Chinese')) {
  844 + sTableTitleSql = this.getLocalizedString(sTableTitleSql, userinfo.sLanguage);
  845 + }
833 const tempColumnArr = sTableTitleSql.split(','); 846 const tempColumnArr = sTableTitleSql.split(',');
834 let scrollX = 0; 847 let scrollX = 0;
835 const columns = tempColumnArr.map((item, index) => { 848 const columns = tempColumnArr.map((item, index) => {