Commit 4d04fb397bf82ed53a885cc23d9e4a7ebae730fa

Authored by zhangzzzz
1 parent a98cb273

处理英文版本快捷方式跳转问题;

src/mes/productionExec/quickSwitchTabComponent/index.js
@@ -72,28 +72,31 @@ const QuickSwitchTabComponent = baseProps => { @@ -72,28 +72,31 @@ const QuickSwitchTabComponent = baseProps => {
72 "", 72 "",
73 "12710101117087404588200" 73 "12710101117087404588200"
74 ]; 74 ];
  75 +
  76 + // 定义多语言映射
  77 + const translations = {
  78 + sEnglish: {
  79 + "生产执行": "Production Execution",
  80 + "质量巡检": "Quality Inspection",
  81 + "拼版图": "Assembly Drawing",
  82 + "产品图": "Product Drawing",
  83 + "报工任务": "Work Reporting ïTask",
  84 + "班组报工": "Team Production Reporting"
  85 + },
  86 + sBig5: {
  87 + "生产执行": "生產執行",
  88 + "质量巡检": "質量巡檢",
  89 + "拼版图": "拼版圖",
  90 + "产品图": "產品圖",
  91 + "报工任务": "報工任務",
  92 + "班组报工": "班組報工",
  93 + }
  94 + };
  95 +
75 function translateList(language) { 96 function translateList(language) {
76 // 原始中文列表 97 // 原始中文列表
77 const list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"]; 98 const list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"];
78 99
79 - // 定义多语言映射  
80 - const translations = {  
81 - sEnglish: {  
82 - "生产执行": "Production Execution",  
83 - "质量巡检": "Quality Inspection",  
84 - "拼版图": "Assembly Drawing",  
85 - "产品图": "Product Drawing",  
86 - "报工任务": "Work Reporting Task"  
87 - },  
88 - sBig5: {  
89 - "生产执行": "生產執行",  
90 - "质量巡检": "質量巡檢",  
91 - "拼版图": "拼版圖",  
92 - "产品图": "產品圖",  
93 - "报工任务": "報工任務"  
94 - }  
95 - };  
96 -  
97 // 根据语言设置进行转换 100 // 根据语言设置进行转换
98 if (translations[language]) { 101 if (translations[language]) {
99 return list.map(item => translations[language][item] || item); 102 return list.map(item => translations[language][item] || item);
@@ -132,8 +135,8 @@ const QuickSwitchTabComponent = baseProps => { @@ -132,8 +135,8 @@ const QuickSwitchTabComponent = baseProps => {
132 return list; 135 return list;
133 } 136 }
134 const sLanguage = props.app.userinfo.sLanguage || 'sChinese'; 137 const sLanguage = props.app.userinfo.sLanguage || 'sChinese';
135 - list = translateList(sLanguage);  
136 - const tipList = translateTipList(sLanguage); 138 + list = translateList(sLanguage);
  139 + const tipList = translateTipList(sLanguage);
137 const no = commonFunc.showLocalMessage(props, 'No', '暂无'); 140 const no = commonFunc.showLocalMessage(props, 'No', '暂无');
138 return ( 141 return (
139 <div className={sLanguage === 'sEnglish' ? styles.quickSwitchTabEngComponent : styles.quickSwitchTabComponent} ref={ref}> 142 <div className={sLanguage === 'sEnglish' ? styles.quickSwitchTabEngComponent : styles.quickSwitchTabComponent} ref={ref}>
@@ -145,6 +148,11 @@ const QuickSwitchTabComponent = baseProps =&gt; { @@ -145,6 +148,11 @@ const QuickSwitchTabComponent = baseProps =&gt; {
145 const { sModelsId } = currentMesPane; 148 const { sModelsId } = currentMesPane;
146 const tip = tipList[index]; 149 const tip = tipList[index];
147 150
  151 + const getPath = (path) => {
  152 + if (sLanguage === "sChinese") return path;
  153 + return translations[sLanguage][path];
  154 + }
  155 +
148 return ( 156 return (
149 <div 157 <div
150 className={currentId === sModelsId ? styles.active : ""} 158 className={currentId === sModelsId ? styles.active : ""}
@@ -153,7 +161,7 @@ const QuickSwitchTabComponent = baseProps =&gt; { @@ -153,7 +161,7 @@ const QuickSwitchTabComponent = baseProps =&gt; {
153 if (currentId) { 161 if (currentId) {
154 props.onChangeRouter({ 162 props.onChangeRouter({
155 type: "name", 163 type: "name",
156 - path: ["生产执行", title === "报工任务" ? "班组报工" : title] 164 + path: [getPath("生产执行"), title === getPath("报工任务") ? getPath("班组报工") : title]
157 }); 165 });
158 } else { 166 } else {
159 props.onGetFileUrl(title, url => { 167 props.onGetFileUrl(title, url => {