From 9d2d1b65aa4a19a2a35ea96769dd2abf3a55c3b5 Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Tue, 17 Jun 2025 10:43:10 +0800 Subject: [PATCH] 1.搜索条件 根据系统语言展示对应的语言格式 --- src/components/Common/SearchComponent/index.js | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/src/components/Common/SearchComponent/index.js b/src/components/Common/SearchComponent/index.js index 79dd911..5e4eaf8 100644 --- a/src/components/Common/SearchComponent/index.js +++ b/src/components/Common/SearchComponent/index.js @@ -716,7 +716,7 @@ export default class SearchComponent extends Component { handleFields = (searchColumns) => { /* 默认快捷过滤 */ if (commonUtils.isEmptyArr(searchColumns)) { return; } - const { masterData, searchRowKeys } = this.props; + const { masterData, searchRowKeys, app } = this.props; const children = searchRowKeys.map((key) => { const { [`sFirst-${key}`]: sFirstValue, [`sSecond-${key}`]: sSecondValue, [`${key}disabled`]: disabled } = masterData; const firstDataIndex = commonUtils.isEmpty(sFirstValue) ? 's' : @@ -750,8 +750,11 @@ export default class SearchComponent extends Component { sDropDownType: 'sql', bNotEmpty: true, iVisCount: 1, - dropDownData: sSecondConditionPro && DropDownType === 'sql' ? commonConfig.seaJudge.s_proDropDown : sSecondConditionPro ? commonConfig.seaJudge.s_pro : commonConfig.seaJudge[firstDataIndex], - bCanInput: false, + dropDownData: this.getTranslatedSeaJudge( + sSecondConditionPro && DropDownType === 'sql' ? 's_proDropDown' : + sSecondConditionPro ? 's_pro' : firstDataIndex, + app?.userinfo?.sLanguage + ), bCanInput: false, }; const showThirdConfig = { sId, @@ -797,6 +800,7 @@ export default class SearchComponent extends Component { showThirdConfig.sDateFormat = 'YYYY'; } } + console.log('23showTypeSecondProps3', showTypeSecondProps); return (
@@ -1235,6 +1239,71 @@ export default class SearchComponent extends Component { sGroupByList, }); }; + /* 在类中添加一个方法用于处理多语言转换*/ + getTranslatedSeaJudge = (type, sLanguage) => { + const { seaJudge } = commonConfig; + const judgeMap = seaJudge[type] || []; + + // 定义翻译映射 + const translations = { + sEnglish: { + '包含': 'Contains', + '不包含': 'Not Contains', + '等于': 'Equal', + '大于': 'Greater Than', + '小于': 'Less Than', + '大于等于': 'Greater Than or Equal', + '小于等于': 'Less Than or Equal', + '区间': 'Between', + '区间(默认今天)': 'Between (Default Today)', + '区间(默认昨天)': 'Between (Default Yesterday)', + '区间时间': 'Between Time', + '今日': 'Today', + '今日未清': 'Unfinished Today', + '今天之前': 'Before Today', + '明天之前': 'Before Tomorrow', + '后天之前': 'Before Day After Tomorrow', + '本月': 'This Month', + '上月': 'Last Month', + '本周': 'This Week', + '上周': 'Last Week', + '本期间': 'This Period' + }, + sBig5: { + '包含': '包含', + '不包含': '不包含', + '等于': '等於', + '大于': '大於', + '小于': '小於', + '大于等于': '大於等於', + '小于等于': '小於等於', + '区间': '區間', + '区间(默认今天)': '區間(默認今天)', + '区间(默认昨天)': '區間(默認昨天)', + '区间时间': '區間時間', + '今日': '今日', + '今日未清': '今日未清', + '今天之前': '今天之前', + '明天之前': '明天之前', + '后天之前': '後天之前', + '本月': '本月', + '上月': '上月', + '本周': '本周', + '上周': '上周', + '本期间': '本期間' + } + }; + + if (sLanguage === 'sEnglish' || sLanguage === 'sBig5') { + return judgeMap.map(item => ({ + ...item, + value: translations[sLanguage][item.value] || item.value + })); + } + + return judgeMap; +}; + render() { const { searchSolution, searchColumns, expand, activeTagId, sType, modalVisible, modalSolutionNameVisible, confirmLoading, masterData, columnSettingVisible, app, -- libgit2 0.22.2