Commit 69bccc62721a7aecbf2c4147dc50818d17950bb4

Authored by Min
1 parent da40b681

1.MES系统功能 head标题翻译 ,Tab页签悬浮提示,登录提示

src/index.ejs
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <head> 3 <head>
4 <meta charset="UTF-8"> 4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1"> 5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 - <title>MES全局设备操作平台</title> 6 + <title>MES Global Equipment Operation Platform</title>
7 <script> 7 <script>
8 if (!String.prototype.padStart) { 8 if (!String.prototype.padStart) {
9 String.prototype.padStart = function padStart(targetLength, padString) { 9 String.prototype.padStart = function padStart(targetLength, padString) {
src/mes/common/buttonComponent/index.js
@@ -274,7 +274,8 @@ const ButtonComponent = props =&gt; { @@ -274,7 +274,8 @@ const ButtonComponent = props =&gt; {
274 const iconName = icon[iIndex]; 274 const iconName = icon[iIndex];
275 item.icon = getNavIcon(false, iconName); 275 item.icon = getNavIcon(false, iconName);
276 item.activeIcon = getNavIcon(true, iconName); 276 item.activeIcon = getNavIcon(true, iconName);
277 - item.tipName = chineseName !== item.name ? item.name +'-'+chineseName : item.name; 277 + item.tipName = chineseName !== item.name ? item.name + '-' + chineseName : item.name;
  278 +
278 result = item; 279 result = item;
279 } 280 }
280 menuList.push(result); 281 menuList.push(result);
@@ -306,6 +307,35 @@ const ButtonComponent = props =&gt; { @@ -306,6 +307,35 @@ const ButtonComponent = props =&gt; {
306 props.openFirstNotice(e); 307 props.openFirstNotice(e);
307 } 308 }
308 }; 309 };
  310 + function findTargetItem(data, targetName) {
  311 + // 如果不是数组,直接返回null
  312 + if (!Array.isArray(data)) return null;
  313 +
  314 + // 遍历当前层级的每一项
  315 + for (const item of data) {
  316 + // 检查当前项的子项中是否有目标
  317 + const foundChild = item.children?.find(child => child.sMenuName === targetName);
  318 +
  319 + // 如果在当前项的子项中找到目标,返回这个子项(第一层找到返回第二层)
  320 + if (foundChild) {
  321 + return foundChild;
  322 + }
  323 +
  324 + // 如果当前项有子项,递归查找更深层级
  325 + if (item.children && item.children.length > 0) {
  326 + const deepFound = findTargetItem(item.children, targetName);
  327 + // 如果在深层级找到,直接返回(内部层找到返回内部层)
  328 + if (deepFound) {
  329 + return deepFound;
  330 + }
  331 + }
  332 + }
  333 +
  334 + // 没找到返回null
  335 + return null;
  336 + }
  337 +
  338 +// 使用方法
309 339
310 const counterInfo = props.app.counterInfo || {}; 340 const counterInfo = props.app.counterInfo || {};
311 const { table0 = 0, table1 = 0, table2 = 0, table3 = 0 } = counterInfo; 341 const { table0 = 0, table1 = 0, table2 = 0, table3 = 0 } = counterInfo;
@@ -320,6 +350,14 @@ const ButtonComponent = props =&gt; { @@ -320,6 +350,14 @@ const ButtonComponent = props =&gt; {
320 350
321 const iInterface = currentWorkOrderInfo.iInterface || userinfo.iInterface; 351 const iInterface = currentWorkOrderInfo.iInterface || userinfo.iInterface;
322 352
  353 + if (commonUtils.isEmptyObject(e.tipName)) {
  354 + const item = findTargetItem(managementData, e.name);
  355 + if(item?.sChineseName) {
  356 + e.tipName = item.sChineseName !== e.name ? e.name + '-' + item.sChineseName : e.name;
  357 + }
  358 + }
  359 +
  360 +
323 let bHideTab = false; 361 let bHideTab = false;
324 // 【踢废,拼接,倒卷,读码】完工清场记录不可点击 362 // 【踢废,拼接,倒卷,读码】完工清场记录不可点击
325 if ([5, 6, 7, 8].includes(iInterface) && ( 363 if ([5, 6, 7, 8].includes(iInterface) && (
src/mes/common/commonModelComponent/index.js
@@ -276,7 +276,7 @@ const useCommonModelEvent = props =&gt; { @@ -276,7 +276,7 @@ const useCommonModelEvent = props =&gt; {
276 const pageLayoutConfig = gdsconfigformslave.find( 276 const pageLayoutConfig = gdsconfigformslave.find(
277 item => item.sControlName === "pageLayout" 277 item => item.sControlName === "pageLayout"
278 ); 278 );
279 - console.log('pageLayoutConfig', pageLayoutConfig); 279 +
280 if (pageLayoutConfig) { 280 if (pageLayoutConfig) {
281 pageLayout = commonUtils.convertStrToObj( 281 pageLayout = commonUtils.convertStrToObj(
282 pageLayoutConfig.sDefault, 282 pageLayoutConfig.sDefault,
@@ -1259,7 +1259,7 @@ const CommonModelComponent = props =&gt; { @@ -1259,7 +1259,7 @@ const CommonModelComponent = props =&gt; {
1259 bFirstComponent: level === 0 && index === -1 1259 bFirstComponent: level === 0 && index === -1
1260 }; 1260 };
1261 1261
1262 - console.log('222', sName, componentProps) 1262 +
1263 1263
1264 const commonDivHeight = useComputedCommonDivHeight(componentProps); 1264 const commonDivHeight = useComputedCommonDivHeight(componentProps);
1265 return ( 1265 return (
@@ -1386,12 +1386,15 @@ const CommonModelComponent = props =&gt; { @@ -1386,12 +1386,15 @@ const CommonModelComponent = props =&gt; {
1386 ) 1386 )
1387 .map((config, index) => { 1387 .map((config, index) => {
1388 const { sName, sEnglishTabName, sBig5TabName, sTabName } = config; 1388 const { sName, sEnglishTabName, sBig5TabName, sTabName } = config;
1389 - console.log('32323', config, sLanguage); 1389 +
1390 const sTabNewName = sLanguage === 'sEnglish' ? sEnglishTabName : sLanguage ==='sBig5' ? 1390 const sTabNewName = sLanguage === 'sEnglish' ? sEnglishTabName : sLanguage ==='sBig5' ?
1391 sBig5TabName : sTabName; 1391 sBig5TabName : sTabName;
1392 let disabled = false; 1392 let disabled = false;
1393 1393
1394 - console.log('32323', sTabNewName); 1394 + const sTabTip = sEnglishTabName !== sTabName ?
  1395 + sEnglishTabName + '-' + sTabName : sTabNewName; /* 悬浮提示 英文-中文 */
  1396 +
  1397 + console.log('sTabNewName', sTabNewName);
1395 1398
1396 if (sTabName === "拼接列表" && sName === "slaveWypj3") { 1399 if (sTabName === "拼接列表" && sName === "slaveWypj3") {
1397 // 特殊处理:拼接详情可保存时,拼接列表tab不可点击 1400 // 特殊处理:拼接详情可保存时,拼接列表tab不可点击
@@ -1438,7 +1441,7 @@ const CommonModelComponent = props =&gt; { @@ -1438,7 +1441,7 @@ const CommonModelComponent = props =&gt; {
1438 1441
1439 return ( 1442 return (
1440 <TabPane 1443 <TabPane
1441 - tab={sTabNewName} 1444 + tab={<span title ={sTabTip}> {sTabNewName}</span> }
1442 key={`${sName}_${sTabName}`} 1445 key={`${sName}_${sTabName}`}
1443 disabled={disabled} 1446 disabled={disabled}
1444 > 1447 >
@@ -1458,7 +1461,7 @@ const CommonModelComponent = props =&gt; { @@ -1458,7 +1461,7 @@ const CommonModelComponent = props =&gt; {
1458 1461
1459 // 通用标题 1462 // 通用标题
1460 const TabTitleComponent = props => { 1463 const TabTitleComponent = props => {
1461 - const { sTabName, bHideTitle, bFirstComponent } = props; 1464 + const { sTabName, bHideTitle, bFirstComponent, sTipName = '' } = props;
1462 1465
1463 if (!sTabName || bHideTitle) { 1466 if (!sTabName || bHideTitle) {
1464 if (!bFirstComponent) { 1467 if (!bFirstComponent) {
@@ -1467,15 +1470,17 @@ const TabTitleComponent = props =&gt; { @@ -1467,15 +1470,17 @@ const TabTitleComponent = props =&gt; {
1467 return <div style={{ width: "100%", height: 10 }} />; 1470 return <div style={{ width: "100%", height: 10 }} />;
1468 } 1471 }
1469 } 1472 }
1470 - console.log('sTabNsme', sTabName); 1473 +
1471 1474
1472 if (sTabName.split("_")[0] === "空" || sTabName.split("_")[0] === "Empty" ) return ""; 1475 if (sTabName.split("_")[0] === "空" || sTabName.split("_")[0] === "Empty" ) return "";
1473 1476
1474 const costomTitle = 1477 const costomTitle =
1475 props.costomTitle && sTabName === "下料信息" ? props.costomTitle : ""; 1478 props.costomTitle && sTabName === "下料信息" ? props.costomTitle : "";
1476 1479
  1480 + const sTip = sTabName !== sTipName ? sTabName + '-' + sTipName : sTabName;
  1481 +
1477 return ( 1482 return (
1478 - <div className="tabTitle"> 1483 + <div className="tabTitle" title={sTip}>
1479 {sTabName} 1484 {sTabName}
1480 {costomTitle} 1485 {costomTitle}
1481 <RunningStatusConditionComponent {...props} /> 1486 <RunningStatusConditionComponent {...props} />
@@ -1505,7 +1510,7 @@ const CommonViewTableComponent = props =&gt; { @@ -1505,7 +1510,7 @@ const CommonViewTableComponent = props =&gt; {
1505 if (selectedRowKeys.length) { 1510 if (selectedRowKeys.length) {
1506 viewRow = dataArr.find(item => item.sId === selectedRowKeys[0]); 1511 viewRow = dataArr.find(item => item.sId === selectedRowKeys[0]);
1507 } 1512 }
1508 - console.log('111111第', sTabName) 1513 +
1509 if (sTabName?.startsWith("第") && sTabName?.endsWith("转")) { 1514 if (sTabName?.startsWith("第") && sTabName?.endsWith("转")) {
1510 viewRow = data.filter(item => item.sRev === sTabName)[0]; 1515 viewRow = data.filter(item => item.sRev === sTabName)[0];
1511 } 1516 }
@@ -1513,7 +1518,7 @@ const CommonViewTableComponent = props =&gt; { @@ -1513,7 +1518,7 @@ const CommonViewTableComponent = props =&gt; {
1513 if (commonUtils.isEmptyObject(viewRow)) { 1518 if (commonUtils.isEmptyObject(viewRow)) {
1514 viewRow = Array.isArray(data) ? data[0] || {} : data; 1519 viewRow = Array.isArray(data) ? data[0] || {} : data;
1515 } 1520 }
1516 - console.log('viewRow', viewRow) 1521 +
1517 if ( 1522 if (
1518 commonUtils.isNotEmptyObject(viewRow) && 1523 commonUtils.isNotEmptyObject(viewRow) &&
1519 !selectedRowKeys[0] && 1524 !selectedRowKeys[0] &&
@@ -1561,7 +1566,7 @@ const CommonViewTableComponent = props =&gt; { @@ -1561,7 +1566,7 @@ const CommonViewTableComponent = props =&gt; {
1561 } 1566 }
1562 const groupList = sTabName?.split(",") || []; 1567 const groupList = sTabName?.split(",") || [];
1563 1568
1564 - console.log('groupList', groupList) 1569 +
1565 const viewConfigsList = groupList.map((tabName, index) => { 1570 const viewConfigsList = groupList.map((tabName, index) => {
1566 if (tabName === "隐藏") { 1571 if (tabName === "隐藏") {
1567 return []; 1572 return [];
@@ -1583,7 +1588,7 @@ const CommonViewTableComponent = props =&gt; { @@ -1583,7 +1588,7 @@ const CommonViewTableComponent = props =&gt; {
1583 ); 1588 );
1584 } 1589 }
1585 }); 1590 });
1586 - console.log('viewConfigsList', viewConfigsList); 1591 +
1587 1592
1588 const operationBarProps = { 1593 const operationBarProps = {
1589 ...props, 1594 ...props,
@@ -1605,6 +1610,12 @@ const CommonViewTableComponent = props =&gt; { @@ -1605,6 +1610,12 @@ const CommonViewTableComponent = props =&gt; {
1605 const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName; 1610 const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName;
1606 const groupListNew = sTabLocalName?.split(",") || []; 1611 const groupListNew = sTabLocalName?.split(",") || [];
1607 1612
  1613 + const groupListChinese = sTabName?.split(",") || [];
  1614 +
  1615 +
  1616 +
  1617 +
  1618 +
1608 return ( 1619 return (
1609 <> 1620 <>
1610 {sName === "master" ? ( 1621 {sName === "master" ? (
@@ -1636,7 +1647,7 @@ const CommonViewTableComponent = props =&gt; { @@ -1636,7 +1647,7 @@ const CommonViewTableComponent = props =&gt; {
1636 1647
1637 return ( 1648 return (
1638 <> 1649 <>
1639 - <TabTitleComponent {...props} sTabName={groupListNew[index] } /> 1650 + <TabTitleComponent {...props} sTabName={groupListNew[index]} sTipName = {groupListChinese[index] } />
1640 <CommonViewTable {...viewProps} /> 1651 <CommonViewTable {...viewProps} />
1641 <ReportInfo 1652 <ReportInfo
1642 reportInfoVisible={reportInfoVisible} 1653 reportInfoVisible={reportInfoVisible}
@@ -1868,7 +1879,7 @@ const CommonTableComponent = props =&gt; { @@ -1868,7 +1879,7 @@ const CommonTableComponent = props =&gt; {
1868 1879
1869 const stepName = sTabName?.split("_")[1] || ""; 1880 const stepName = sTabName?.split("_")[1] || "";
1870 1881
1871 - console.log('ssss', stepName); 1882 +
1872 if (stepName.startsWith("第") && stepName.endsWith("转")) { 1883 if (stepName.startsWith("第") && stepName.endsWith("转")) {
1873 tableProps.data = tableProps.data.filter(item => item.sRev === stepName); 1884 tableProps.data = tableProps.data.filter(item => item.sRev === stepName);
1874 } 1885 }
@@ -1888,9 +1899,10 @@ const CommonTableComponent = props =&gt; { @@ -1888,9 +1899,10 @@ const CommonTableComponent = props =&gt; {
1888 const sLanguage = props.app.userinfo?.sLanguage; 1899 const sLanguage = props.app.userinfo?.sLanguage;
1889 1900
1890 const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName; 1901 const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName;
  1902 +
1891 return ( 1903 return (
1892 <> 1904 <>
1893 - <TabTitleComponent {...props} sTabName={sTabLocalName } /> 1905 + <TabTitleComponent {...props} sTabName={sTabLocalName } sTipName={sTabName } />
1894 <StaticEditTable {...tableProps} /> 1906 <StaticEditTable {...tableProps} />
1895 <CommonOperationBarComponent {...operationBarProps} /> 1907 <CommonOperationBarComponent {...operationBarProps} />
1896 <SwasterTypeTable 1908 <SwasterTypeTable
src/mes/login/index.js
@@ -202,7 +202,7 @@ const useLoginEvent = props =&gt; { @@ -202,7 +202,7 @@ const useLoginEvent = props =&gt; {
202 } 202 }
203 203
204 if (!username) { 204 if (!username) {
205 - message.error(pleaseSelectUser); 205 + message.error(pleaseSelectUser || 'Please Select User');
206 return; 206 return;
207 } 207 }
208 if (!sEmployeeNo && !password) { 208 if (!sEmployeeNo && !password) {