Commit 3ab7196ca9a07b293ed2e65b94b39acd17655837
1 parent
01c13ae9
1.完善系统多语言翻译
Showing
9 changed files
with
79 additions
and
49 deletions
src/components/Common/CommonComponent/index.js
| 1 | 1 | import moment from 'moment'; |
| 2 | 2 | import React, { Component, createRef } from 'react'; |
| 3 | 3 | import reactComponentDebounce from '@/components/Common/ReactDebounce'; |
| 4 | +import * as commonFunc from '@/components/Common//commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ | |
| 4 | 5 | // import '@ant-design/compatible/assets/index.css'; |
| 5 | 6 | import { |
| 6 | 7 | InputNumber, |
| ... | ... | @@ -1010,10 +1011,14 @@ export default class CommonComponent extends Component { |
| 1010 | 1011 | }; |
| 1011 | 1012 | |
| 1012 | 1013 | getSearchProps = () => { |
| 1014 | + let chooseTitle = '选择'; | |
| 1015 | + if(commonUtils.isNotEmptyObject(this.props.app) && commonUtils.isNotEmptyObject(this.props.app.commonConst)) { | |
| 1016 | + chooseTitle = commonFunc.showMessage(this.props.app.commonConst, 'choose') ; | |
| 1017 | + } | |
| 1013 | 1018 | const obj = { |
| 1014 | 1019 | onKeyDown: this.onKeyDown, |
| 1015 | 1020 | onChange: e => this.handleSelectOptionEvent(e.target.value), /* 数据改变回带到父组件 */ |
| 1016 | - value: commonUtils.isUndefined(this.state.dataValue) ? '选择' : commonUtils.strUndefinedToEmpty(this.state.dataValue), /* 数据值 */ | |
| 1021 | + value: commonUtils.isUndefined(this.state.dataValue) ? chooseTitle : commonUtils.strUndefinedToEmpty(this.state.dataValue), /* 数据值 */ | |
| 1017 | 1022 | }; |
| 1018 | 1023 | return obj; |
| 1019 | 1024 | } |
| ... | ... | @@ -1113,6 +1118,10 @@ export default class CommonComponent extends Component { |
| 1113 | 1118 | const { |
| 1114 | 1119 | sTableTitleSql, iVisCount, sName, sDateFormat, |
| 1115 | 1120 | } = this.props.showConfig; |
| 1121 | + let chooseTitle = '选择'; | |
| 1122 | + if(commonUtils.isNotEmptyObject(this.props.app) && commonUtils.isNotEmptyObject(this.props.app.commonConst)) { | |
| 1123 | + chooseTitle = commonFunc.showMessage(this.props.app.commonConst, 'choose') ; | |
| 1124 | + } | |
| 1116 | 1125 | if (commonUtils.isNotEmptyStr(sTableTitleSql) && iVisCount > 1) { |
| 1117 | 1126 | return <Select ref={(ref) => { this.selectTableRef = ref; }} {...this.getSelectTableProps()}>{this.getSelectTableOption()}</Select>; |
| 1118 | 1127 | } |
| ... | ... | @@ -1251,7 +1260,7 @@ export default class CommonComponent extends Component { |
| 1251 | 1260 | return <Select {...this.getSelectProps()} >{this.getSelectOption()}</Select>; |
| 1252 | 1261 | } |
| 1253 | 1262 | } else if (this.state.enabled && commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sDropDownType === 'popup') { /* 通用弹窗 */ |
| 1254 | - return (<Search placeholder="选择" defaultValue="选择" {...this.getSearchProps()} onSearch={this.onFieldPopupModal.bind(this, this.props.showConfig, this.props.name)} />); | |
| 1263 | + return (<Search placeholder={chooseTitle} defaultValue={chooseTitle} {...this.getSearchProps()} onSearch={this.onFieldPopupModal.bind(this, this.props.showConfig, this.props.name)} />); | |
| 1255 | 1264 | } else if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd') { /* 数字输入框(整形i和浮点型d) */ |
| 1256 | 1265 | return innerInputProps.readOnly ? <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"><InputNumberA {...innerInputProps} /></span> : |
| 1257 | 1266 | location.pathname.includes('quotationPackTableTree') && this.props.name === 'control' && this.props.showConfig.sName === 'dSinglePQty' ? <span style={{ position: 'relative' }}><InputNumberA {...innerInputProps} /><span onClick={this.handleViewClick} style={{ position: 'absolute', right: '2px' }}><EyeOutlined /></span></span> : <InputNumberA {...innerInputProps} style={{ width: '100%' }} />; | ... | ... |
src/components/Common/CommonListSelectTree/index.js
| ... | ... | @@ -627,7 +627,8 @@ const CommonListComponent = Form.create({ |
| 627 | 627 | enabled: true, |
| 628 | 628 | }; |
| 629 | 629 | } |
| 630 | - | |
| 630 | + const BtnSure =commonFunc.showMessage(app.commonConst, 'BtnSure') || '确认'; | |
| 631 | + const BtnCancel =commonFunc.showMessage(app.commonConst, 'BtnCancel') || '取消'; | |
| 631 | 632 | if (commonUtils.isNotEmptyObject(app.currentPane) && commonUtils.isNotEmptyObject(app.currentPane.name) && app.currentPane.bEdit) { |
| 632 | 633 | tableFilterProps = { |
| 633 | 634 | ...tableFilterProps, |
| ... | ... | @@ -747,8 +748,8 @@ const CommonListComponent = Form.create({ |
| 747 | 748 | width: '50%', textAlign: 'right', marginRight: '9px', marginBottom: '9px', |
| 748 | 749 | }} |
| 749 | 750 | > |
| 750 | - <Button key="back" style={{ marginRight: '8px' }} onClick={props.onCancel}>取消</Button> | |
| 751 | - <Button type="primary" onClick={props.onSelect}>确认</Button> | |
| 751 | + <Button key="back" style={{ marginRight: '8px' }} onClick={props.onCancel}> {BtnCancel}</Button> | |
| 752 | + <Button type="primary" onClick={props.onSelect}> {BtnSure}</Button> | |
| 752 | 753 | </div> |
| 753 | 754 | </div> |
| 754 | 755 | </Layout> | ... | ... |
src/components/Common/CommonListTreeSelect/index.js
| ... | ... | @@ -534,7 +534,10 @@ const CommonListComponent = Form.create({ |
| 534 | 534 | rowSelection: props.rowSelection, |
| 535 | 535 | }; |
| 536 | 536 | } |
| 537 | - | |
| 537 | + | |
| 538 | + const BtnSure =commonFunc.showMessage(app.commonConst, 'BtnSure') || '确认'; | |
| 539 | + const BtnCancel =commonFunc.showMessage(app.commonConst, 'BtnCancel') || '取消'; | |
| 540 | + | |
| 538 | 541 | const realizeHeight = commonUtils.isNotEmptyNumber(props.realizeHeight) ? props.realizeHeight : 0; |
| 539 | 542 | const btnClick = (btn) => { |
| 540 | 543 | const { sControlName } = btn; |
| ... | ... | @@ -566,7 +569,7 @@ const CommonListComponent = Form.create({ |
| 566 | 569 | }; |
| 567 | 570 | |
| 568 | 571 | return ( |
| 569 | - <Form > | |
| 572 | + <Form> | |
| 570 | 573 | <Layout> |
| 571 | 574 | <Layout> |
| 572 | 575 | <div id="modalTreeChooseProcess"> |
| ... | ... | @@ -609,8 +612,8 @@ const CommonListComponent = Form.create({ |
| 609 | 612 | } |
| 610 | 613 | </div> |
| 611 | 614 | <div style={{ textAlign: 'right', marginRight: '9px', marginBottom: '9px' }}> |
| 612 | - <Button key="back" style={{ marginRight: '8px' }} onClick={props.onCancel}>取消</Button> | |
| 613 | - <Button type="primary" onClick={props.onSelect}>确认</Button> | |
| 615 | + <Button key="back" style={{ marginRight: '8px' }} onClick={props.onCancel}>{BtnCancel}</Button> | |
| 616 | + <Button type="primary" onClick={props.onSelect}> {BtnSure}</Button> | |
| 614 | 617 | </div> |
| 615 | 618 | </div> : '' |
| 616 | 619 | } | ... | ... |
src/components/Common/CommonView/index.js
| ... | ... | @@ -9,6 +9,7 @@ import ShowType from '@/components/Common/CommonComponent'; |
| 9 | 9 | import AntdDraggableModal from '@/components/Common/AntdDraggableModal'; |
| 10 | 10 | import CommonListSelectTree from '@/components/Common/CommonListSelectTree'; |
| 11 | 11 | import * as commonUtils from '@/utils/utils';/* 通用方法 */ |
| 12 | +import * as commonFunc from '@/components/Common/commonFunc';/* 单据业务功能 */ | |
| 12 | 13 | |
| 13 | 14 | const FormItem = Form.Item; |
| 14 | 15 | // const EachInputHeight = 32; |
| ... | ... | @@ -291,6 +292,8 @@ export default class CommonView extends Component { |
| 291 | 292 | expanded: true, |
| 292 | 293 | }); |
| 293 | 294 | } |
| 295 | + const afterSave = commonFunc.showMessage(this.props.app.commonConst, 'afterSave') || | |
| 296 | + '保存后自动生成';/* 保存后自动生成 */ | |
| 294 | 297 | |
| 295 | 298 | return ( |
| 296 | 299 | <Tooltip title="master" placement="topLeft" visible={this.props.showTableName}> |
| ... | ... | @@ -475,7 +478,7 @@ export default class CommonView extends Component { |
| 475 | 478 | ].includes(child.sName) |
| 476 | 479 | ) ? |
| 477 | 480 | <Col style={{ display: enabled ? 'block' : 'none' }} className="speacialNote" key={child.sId} span="12"> |
| 478 | - {sModelsType !== 'smg/sendMailMsg' ? '保存后自动生成' : '发送消息无需生成单据号'} | |
| 481 | + {sModelsType !== 'smg/sendMailMsg' ? afterSave : afterSave} | |
| 479 | 482 | </Col> : '' } |
| 480 | 483 | </Col> |
| 481 | 484 | ); | ... | ... |
src/components/Common/PersonCenter/PersonCenter.js
| ... | ... | @@ -862,6 +862,8 @@ const PersonCenterOnlineUser = Form.create({ |
| 862 | 862 | app, |
| 863 | 863 | } = props; |
| 864 | 864 | const { userinfo } = app; |
| 865 | + const BtnSure =commonFunc.showMessage(app.commonConst, 'BtnSure') || '确认'; | |
| 866 | + const BtnCancel =commonFunc.showMessage(app.commonConst, 'BtnCancel') || '取消'; | |
| 865 | 867 | const OnlineUsers = commonFunc.showMessage(props.app.commonConst, 'OnlineUsers');/* 在线用户 */ |
| 866 | 868 | |
| 867 | 869 | const Website = commonFunc.showMessage(props.app.commonConst, 'Website');/* 站点数 */ |
| ... | ... | @@ -937,39 +939,36 @@ const PersonCenterOnlineUser = Form.create({ |
| 937 | 939 | const title = `${OnlineUserName}${commonUtils.isNotEmptyObject(onlineUserDataNew) ? `【 ${Website}:${onlineUserDataNew.consumerCount}\xa0\xa0\xa0\xa0\xa0${ExpirationDate}:${onlineUserDataNew.afterTime}` : ''} 】`; |
| 938 | 940 | return ( |
| 939 | 941 | <div> |
| 940 | - { | |
| 941 | - onlineUserVisible ? | |
| 942 | - <AntdDraggableModal | |
| 943 | - title={title} | |
| 944 | - width="80%" | |
| 945 | - visible={onlineUserVisible} | |
| 946 | - onCancel={handleCancel} | |
| 947 | - afterClose={handleCancel} | |
| 948 | - footer={null} | |
| 942 | + {onlineUserVisible ? ( | |
| 943 | + <AntdDraggableModal title={title} width="80%" visible={onlineUserVisible} onCancel={handleCancel} afterClose={handleCancel} footer={null}> | |
| 944 | + <div | |
| 945 | + style={{ width: "100%", height: tableHeight + "px" }} | |
| 946 | + ref={ref => { | |
| 947 | + if (ref) { | |
| 948 | + ref.querySelector(".ant-table-container").style.height = tableHeight + "px"; | |
| 949 | + ref.querySelector(".ant-table-body").style.height = tableHeight - 30 + "px"; | |
| 950 | + // ref.querySelectorAll('.ant-table-cell-fix-right').forEach(item => { | |
| 951 | + // if (item.previousSibling) { | |
| 952 | + // item.previousSibling.style.display = 'none'; | |
| 953 | + // } | |
| 954 | + // }); | |
| 955 | + } | |
| 956 | + }} | |
| 949 | 957 | > |
| 950 | - <div | |
| 951 | - style={{ width: '100%', height: tableHeight + 'px' }} | |
| 952 | - ref={(ref) => { | |
| 953 | - if (ref) { | |
| 954 | - ref.querySelector('.ant-table-container').style.height = tableHeight + 'px'; | |
| 955 | - ref.querySelector('.ant-table-body').style.height = tableHeight - 30 + 'px'; | |
| 956 | - // ref.querySelectorAll('.ant-table-cell-fix-right').forEach(item => { | |
| 957 | - // if (item.previousSibling) { | |
| 958 | - // item.previousSibling.style.display = 'none'; | |
| 959 | - // } | |
| 960 | - // }); | |
| 961 | - } | |
| 962 | - }} | |
| 963 | - > | |
| 964 | - <StaticEditTable {...onlineUserProps} setOpterationColumn="Y" noVlist /> | |
| 965 | - </div> | |
| 966 | - <div className='ant-modal-footer' style={{ padding: '8px 0 0 0' }}> | |
| 967 | - <Button key="back" onClick={handleCancel}>取消</Button> | |
| 968 | - <Button key="submit" type="primary" onClick={handleCancel}>确认</Button> | |
| 969 | - </div> | |
| 970 | - </AntdDraggableModal> | |
| 971 | - : '' | |
| 972 | - } | |
| 958 | + <StaticEditTable {...onlineUserProps} setOpterationColumn="Y" noVlist /> | |
| 959 | + </div> | |
| 960 | + <div className="ant-modal-footer" style={{ padding: "8px 0 0 0" }}> | |
| 961 | + <Button key="back" onClick={handleCancel}> | |
| 962 | + {BtnCancel} | |
| 963 | + </Button> | |
| 964 | + <Button key="submit" type="primary" onClick={handleCancel}> | |
| 965 | + {BtnSure} | |
| 966 | + </Button> | |
| 967 | + </div> | |
| 968 | + </AntdDraggableModal> | |
| 969 | + ) : ( | |
| 970 | + "" | |
| 971 | + )} | |
| 973 | 972 | </div> |
| 974 | 973 | ); |
| 975 | 974 | }); | ... | ... |
src/components/Common/commonBusiness.js
| ... | ... | @@ -23,6 +23,8 @@ import imgCheckingEnglish from '../../assets/hasChecking_english.png'; /* 审核 |
| 23 | 23 | |
| 24 | 24 | import imgCheckPerson from '../../assets/personChecked1.png'; /* 审核中 */ |
| 25 | 25 | import imgSubmit from '../../assets/haveSubmited.svg'; /* 已提交 */ |
| 26 | +import imgSubmitBig5 from '../../assets/haveSubmit_sBig5.png'; /* 审核中-繁体 */ | |
| 27 | +import imgSubmitEnglish from '../../assets/haveSubmit_english.png'; /* 审核中-英文 */ | |
| 26 | 28 | import { cloneDeep } from 'lodash'; |
| 27 | 29 | |
| 28 | 30 | // ----------------------------------------------------------------------- |
| ... | ... | @@ -174,7 +176,7 @@ export function handleAddIcon(masterData, sModelsType, app = {}) { |
| 174 | 176 | } else if (sStatus === '2') { |
| 175 | 177 | imgSrc = isEnglish ? imgCheckingEnglish : (isTraditionalChinese ? imgCheckingBig5 : imgChecking); |
| 176 | 178 | } else if (bSubmit) { |
| 177 | - imgSrc = imgSubmit; | |
| 179 | + imgSrc = isEnglish ? imgSubmitEnglish : (isTraditionalChinese ? imgSubmitBig5 : imgSubmit); | |
| 178 | 180 | } |
| 179 | 181 | } |
| 180 | 182 | return imgSrc; | ... | ... |
src/components/Manufacture/ProcessCardPackTableTreeNew/index.js
| ... | ... | @@ -3581,7 +3581,7 @@ const ToolBarComponent = props => { |
| 3581 | 3581 | |
| 3582 | 3582 | // 审核状态 |
| 3583 | 3583 | const AvatarComponent = props => { |
| 3584 | - const { masterData, sModelsType, app } = this.props; | |
| 3584 | + const { masterData, sModelsType, app } = props; | |
| 3585 | 3585 | const imgSrc = commonBusiness.handleAddIcon(masterData, sModelsType, app); |
| 3586 | 3586 | if (!imgSrc) return ""; |
| 3587 | 3587 | return ( | ... | ... |
src/components/Manufacture/WorkOrderPackTableTreeNew/index.js
| ... | ... | @@ -4048,7 +4048,7 @@ const ToolBarComponent = props => { |
| 4048 | 4048 | |
| 4049 | 4049 | // 审核状态 |
| 4050 | 4050 | const AvatarComponent = props => { |
| 4051 | - const { masterData, sModelsType, app } = this.props; | |
| 4051 | + const { masterData, sModelsType, app } = props; | |
| 4052 | 4052 | const imgSrc = commonBusiness.handleAddIcon(masterData, sModelsType, app); |
| 4053 | 4053 | if (!imgSrc) return ""; |
| 4054 | 4054 | return ( | ... | ... |
src/utils/common/message.js
| 1 | 1 | /* eslint-disable */ |
| 2 | 2 | import { Modal, message as antdMessage } from 'antd-v4'; |
| 3 | 3 | import { Modal as mobileModal } from 'antd-mobile-v2'; |
| 4 | +import commonConfig from '../config'; | |
| 4 | 5 | |
| 5 | 6 | const { warning } = Modal; |
| 6 | 7 | const antdMobileAlert = mobileModal.alert; |
| ... | ... | @@ -24,15 +25,22 @@ const openConfirm = (config) => { |
| 24 | 25 | }; |
| 25 | 26 | |
| 26 | 27 | const fn = () => { |
| 28 | + const userinfo = JSON.parse(localStorage.getItem(`${commonConfig.prefix}userinfo`)) || {}; | |
| 29 | + const language = userinfo.sLanguage || 'sChinese'; // 默认简体中文 | |
| 30 | + const isEnglish = language === 'sEnglish'; | |
| 31 | + | |
| 32 | + // 使用语言设置 | |
| 33 | + const sTitle = isEnglish ? 'Reminder' : language === 'sBig5' ? '溫馨提示' : '温馨提示'; | |
| 34 | + const okText = language === 'sEnglish' ? 'Confirm' : language === 'sBig5' ? '確認': '确认'; | |
| 27 | 35 | if (location.pathname.toLocaleLowerCase().includes('mobile')) { |
| 28 | - antdMobileAlert('温馨提示', secondContent || '出错了', [ | |
| 36 | + antdMobileAlert(sTitle, secondContent || '出错了', [ | |
| 29 | 37 | { text: '确认', }, |
| 30 | 38 | ]) |
| 31 | 39 | } else { |
| 32 | 40 | warning({ |
| 33 | - title: '温馨提示', | |
| 41 | + title: sTitle, | |
| 34 | 42 | content: <div style={{ maxHeight: '50vh', overflowY: 'auto' }} >{secondContent || '出错了'}</div>, |
| 35 | - okText: '确认', | |
| 43 | + okText: okText, | |
| 36 | 44 | zIndex: 1000, |
| 37 | 45 | width, |
| 38 | 46 | ...rest, |
| ... | ... | @@ -52,6 +60,11 @@ const openConfirm = (config) => { |
| 52 | 60 | export const message = { |
| 53 | 61 | ...antdMessage, |
| 54 | 62 | error: (content, ...rest) => { |
| 55 | - openConfirm({ message: content, ...rest }); | |
| 63 | + const userinfo = JSON.parse(localStorage.getItem(`${commonConfig.prefix}userinfo`)) || {}; | |
| 64 | + const language = userinfo.sLanguage || 'sChinese'; // 默认简体中文 | |
| 65 | + const requiredText = language === 'sEnglish' ? 'is Required' : | |
| 66 | + (language === 'sBig5' ? '為必填項' : '为必填项'); | |
| 67 | + const sContent = content?.replace('为必填项', requiredText); | |
| 68 | + openConfirm({ message: sContent, ...rest }); | |
| 56 | 69 | }, |
| 57 | 70 | }; | ... | ... |