Commit 9d2d1b65aa4a19a2a35ea96769dd2abf3a55c3b5
1 parent
0e4bf461
1.搜索条件 根据系统语言展示对应的语言格式
Showing
1 changed file
with
72 additions
and
3 deletions
src/components/Common/SearchComponent/index.js
| @@ -716,7 +716,7 @@ export default class SearchComponent extends Component { | @@ -716,7 +716,7 @@ export default class SearchComponent extends Component { | ||
| 716 | handleFields = (searchColumns) => { | 716 | handleFields = (searchColumns) => { |
| 717 | /* 默认快捷过滤 */ | 717 | /* 默认快捷过滤 */ |
| 718 | if (commonUtils.isEmptyArr(searchColumns)) { return; } | 718 | if (commonUtils.isEmptyArr(searchColumns)) { return; } |
| 719 | - const { masterData, searchRowKeys } = this.props; | 719 | + const { masterData, searchRowKeys, app } = this.props; |
| 720 | const children = searchRowKeys.map((key) => { | 720 | const children = searchRowKeys.map((key) => { |
| 721 | const { [`sFirst-${key}`]: sFirstValue, [`sSecond-${key}`]: sSecondValue, [`${key}disabled`]: disabled } = masterData; | 721 | const { [`sFirst-${key}`]: sFirstValue, [`sSecond-${key}`]: sSecondValue, [`${key}disabled`]: disabled } = masterData; |
| 722 | const firstDataIndex = commonUtils.isEmpty(sFirstValue) ? 's' : | 722 | const firstDataIndex = commonUtils.isEmpty(sFirstValue) ? 's' : |
| @@ -750,8 +750,11 @@ export default class SearchComponent extends Component { | @@ -750,8 +750,11 @@ export default class SearchComponent extends Component { | ||
| 750 | sDropDownType: 'sql', | 750 | sDropDownType: 'sql', |
| 751 | bNotEmpty: true, | 751 | bNotEmpty: true, |
| 752 | iVisCount: 1, | 752 | iVisCount: 1, |
| 753 | - dropDownData: sSecondConditionPro && DropDownType === 'sql' ? commonConfig.seaJudge.s_proDropDown : sSecondConditionPro ? commonConfig.seaJudge.s_pro : commonConfig.seaJudge[firstDataIndex], | ||
| 754 | - bCanInput: false, | 753 | + dropDownData: this.getTranslatedSeaJudge( |
| 754 | + sSecondConditionPro && DropDownType === 'sql' ? 's_proDropDown' : | ||
| 755 | + sSecondConditionPro ? 's_pro' : firstDataIndex, | ||
| 756 | + app?.userinfo?.sLanguage | ||
| 757 | + ), bCanInput: false, | ||
| 755 | }; | 758 | }; |
| 756 | const showThirdConfig = { | 759 | const showThirdConfig = { |
| 757 | sId, | 760 | sId, |
| @@ -797,6 +800,7 @@ export default class SearchComponent extends Component { | @@ -797,6 +800,7 @@ export default class SearchComponent extends Component { | ||
| 797 | showThirdConfig.sDateFormat = 'YYYY'; | 800 | showThirdConfig.sDateFormat = 'YYYY'; |
| 798 | } | 801 | } |
| 799 | } | 802 | } |
| 803 | + console.log('23showTypeSecondProps3', showTypeSecondProps); | ||
| 800 | 804 | ||
| 801 | return ( | 805 | return ( |
| 802 | <div key={key} className={styles.addFilterBox}> | 806 | <div key={key} className={styles.addFilterBox}> |
| @@ -1235,6 +1239,71 @@ export default class SearchComponent extends Component { | @@ -1235,6 +1239,71 @@ export default class SearchComponent extends Component { | ||
| 1235 | sGroupByList, | 1239 | sGroupByList, |
| 1236 | }); | 1240 | }); |
| 1237 | }; | 1241 | }; |
| 1242 | + /* 在类中添加一个方法用于处理多语言转换*/ | ||
| 1243 | + getTranslatedSeaJudge = (type, sLanguage) => { | ||
| 1244 | + const { seaJudge } = commonConfig; | ||
| 1245 | + const judgeMap = seaJudge[type] || []; | ||
| 1246 | + | ||
| 1247 | + // 定义翻译映射 | ||
| 1248 | + const translations = { | ||
| 1249 | + sEnglish: { | ||
| 1250 | + '包含': 'Contains', | ||
| 1251 | + '不包含': 'Not Contains', | ||
| 1252 | + '等于': 'Equal', | ||
| 1253 | + '大于': 'Greater Than', | ||
| 1254 | + '小于': 'Less Than', | ||
| 1255 | + '大于等于': 'Greater Than or Equal', | ||
| 1256 | + '小于等于': 'Less Than or Equal', | ||
| 1257 | + '区间': 'Between', | ||
| 1258 | + '区间(默认今天)': 'Between (Default Today)', | ||
| 1259 | + '区间(默认昨天)': 'Between (Default Yesterday)', | ||
| 1260 | + '区间时间': 'Between Time', | ||
| 1261 | + '今日': 'Today', | ||
| 1262 | + '今日未清': 'Unfinished Today', | ||
| 1263 | + '今天之前': 'Before Today', | ||
| 1264 | + '明天之前': 'Before Tomorrow', | ||
| 1265 | + '后天之前': 'Before Day After Tomorrow', | ||
| 1266 | + '本月': 'This Month', | ||
| 1267 | + '上月': 'Last Month', | ||
| 1268 | + '本周': 'This Week', | ||
| 1269 | + '上周': 'Last Week', | ||
| 1270 | + '本期间': 'This Period' | ||
| 1271 | + }, | ||
| 1272 | + sBig5: { | ||
| 1273 | + '包含': '包含', | ||
| 1274 | + '不包含': '不包含', | ||
| 1275 | + '等于': '等於', | ||
| 1276 | + '大于': '大於', | ||
| 1277 | + '小于': '小於', | ||
| 1278 | + '大于等于': '大於等於', | ||
| 1279 | + '小于等于': '小於等於', | ||
| 1280 | + '区间': '區間', | ||
| 1281 | + '区间(默认今天)': '區間(默認今天)', | ||
| 1282 | + '区间(默认昨天)': '區間(默認昨天)', | ||
| 1283 | + '区间时间': '區間時間', | ||
| 1284 | + '今日': '今日', | ||
| 1285 | + '今日未清': '今日未清', | ||
| 1286 | + '今天之前': '今天之前', | ||
| 1287 | + '明天之前': '明天之前', | ||
| 1288 | + '后天之前': '後天之前', | ||
| 1289 | + '本月': '本月', | ||
| 1290 | + '上月': '上月', | ||
| 1291 | + '本周': '本周', | ||
| 1292 | + '上周': '上周', | ||
| 1293 | + '本期间': '本期間' | ||
| 1294 | + } | ||
| 1295 | + }; | ||
| 1296 | + | ||
| 1297 | + if (sLanguage === 'sEnglish' || sLanguage === 'sBig5') { | ||
| 1298 | + return judgeMap.map(item => ({ | ||
| 1299 | + ...item, | ||
| 1300 | + value: translations[sLanguage][item.value] || item.value | ||
| 1301 | + })); | ||
| 1302 | + } | ||
| 1303 | + | ||
| 1304 | + return judgeMap; | ||
| 1305 | +}; | ||
| 1306 | + | ||
| 1238 | render() { | 1307 | render() { |
| 1239 | const { | 1308 | const { |
| 1240 | searchSolution, searchColumns, expand, activeTagId, sType, modalVisible, modalSolutionNameVisible, confirmLoading, masterData, columnSettingVisible, app, | 1309 | searchSolution, searchColumns, expand, activeTagId, sType, modalVisible, modalSolutionNameVisible, confirmLoading, masterData, columnSettingVisible, app, |