Commit 4d04fb397bf82ed53a885cc23d9e4a7ebae730fa

Authored by zhangzzzz
1 parent a98cb273

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

src/mes/productionExec/quickSwitchTabComponent/index.js
... ... @@ -72,28 +72,31 @@ const QuickSwitchTabComponent = baseProps => {
72 72 "",
73 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 96 function translateList(language) {
76 97 // 原始中文列表
77 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 101 if (translations[language]) {
99 102 return list.map(item => translations[language][item] || item);
... ... @@ -132,8 +135,8 @@ const QuickSwitchTabComponent = baseProps => {
132 135 return list;
133 136 }
134 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 140 const no = commonFunc.showLocalMessage(props, 'No', '暂无');
138 141 return (
139 142 <div className={sLanguage === 'sEnglish' ? styles.quickSwitchTabEngComponent : styles.quickSwitchTabComponent} ref={ref}>
... ... @@ -145,6 +148,11 @@ const QuickSwitchTabComponent = baseProps =&gt; {
145 148 const { sModelsId } = currentMesPane;
146 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 156 return (
149 157 <div
150 158 className={currentId === sModelsId ? styles.active : ""}
... ... @@ -153,7 +161,7 @@ const QuickSwitchTabComponent = baseProps =&gt; {
153 161 if (currentId) {
154 162 props.onChangeRouter({
155 163 type: "name",
156   - path: ["生产执行", title === "报工任务" ? "班组报工" : title]
  164 + path: [getPath("生产执行"), title === getPath("报工任务") ? getPath("班组报工") : title]
157 165 });
158 166 } else {
159 167 props.onGetFileUrl(title, url => {
... ...