Commit 69bccc62721a7aecbf2c4147dc50818d17950bb4
1 parent
da40b681
1.MES系统功能 head标题翻译 ,Tab页签悬浮提示,登录提示
Showing
4 changed files
with
68 additions
and
18 deletions
src/index.ejs
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | <head> |
| 4 | 4 | <meta charset="UTF-8"> |
| 5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | - <title>MES全局设备操作平台</title> | |
| 6 | + <title>MES Global Equipment Operation Platform</title> | |
| 7 | 7 | <script> |
| 8 | 8 | if (!String.prototype.padStart) { |
| 9 | 9 | String.prototype.padStart = function padStart(targetLength, padString) { | ... | ... |
src/mes/common/buttonComponent/index.js
| ... | ... | @@ -274,7 +274,8 @@ const ButtonComponent = props => { |
| 274 | 274 | const iconName = icon[iIndex]; |
| 275 | 275 | item.icon = getNavIcon(false, iconName); |
| 276 | 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 | 279 | result = item; |
| 279 | 280 | } |
| 280 | 281 | menuList.push(result); |
| ... | ... | @@ -306,6 +307,35 @@ const ButtonComponent = props => { |
| 306 | 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 | 340 | const counterInfo = props.app.counterInfo || {}; |
| 311 | 341 | const { table0 = 0, table1 = 0, table2 = 0, table3 = 0 } = counterInfo; |
| ... | ... | @@ -320,6 +350,14 @@ const ButtonComponent = props => { |
| 320 | 350 | |
| 321 | 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 | 361 | let bHideTab = false; |
| 324 | 362 | // 【踢废,拼接,倒卷,读码】完工清场记录不可点击 |
| 325 | 363 | if ([5, 6, 7, 8].includes(iInterface) && ( | ... | ... |
src/mes/common/commonModelComponent/index.js
| ... | ... | @@ -276,7 +276,7 @@ const useCommonModelEvent = props => { |
| 276 | 276 | const pageLayoutConfig = gdsconfigformslave.find( |
| 277 | 277 | item => item.sControlName === "pageLayout" |
| 278 | 278 | ); |
| 279 | - console.log('pageLayoutConfig', pageLayoutConfig); | |
| 279 | + | |
| 280 | 280 | if (pageLayoutConfig) { |
| 281 | 281 | pageLayout = commonUtils.convertStrToObj( |
| 282 | 282 | pageLayoutConfig.sDefault, |
| ... | ... | @@ -1259,7 +1259,7 @@ const CommonModelComponent = props => { |
| 1259 | 1259 | bFirstComponent: level === 0 && index === -1 |
| 1260 | 1260 | }; |
| 1261 | 1261 | |
| 1262 | - console.log('222', sName, componentProps) | |
| 1262 | + | |
| 1263 | 1263 | |
| 1264 | 1264 | const commonDivHeight = useComputedCommonDivHeight(componentProps); |
| 1265 | 1265 | return ( |
| ... | ... | @@ -1386,12 +1386,15 @@ const CommonModelComponent = props => { |
| 1386 | 1386 | ) |
| 1387 | 1387 | .map((config, index) => { |
| 1388 | 1388 | const { sName, sEnglishTabName, sBig5TabName, sTabName } = config; |
| 1389 | - console.log('32323', config, sLanguage); | |
| 1389 | + | |
| 1390 | 1390 | const sTabNewName = sLanguage === 'sEnglish' ? sEnglishTabName : sLanguage ==='sBig5' ? |
| 1391 | 1391 | sBig5TabName : sTabName; |
| 1392 | 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 | 1399 | if (sTabName === "拼接列表" && sName === "slaveWypj3") { |
| 1397 | 1400 | // 特殊处理:拼接详情可保存时,拼接列表tab不可点击 |
| ... | ... | @@ -1438,7 +1441,7 @@ const CommonModelComponent = props => { |
| 1438 | 1441 | |
| 1439 | 1442 | return ( |
| 1440 | 1443 | <TabPane |
| 1441 | - tab={sTabNewName} | |
| 1444 | + tab={<span title ={sTabTip}> {sTabNewName}</span> } | |
| 1442 | 1445 | key={`${sName}_${sTabName}`} |
| 1443 | 1446 | disabled={disabled} |
| 1444 | 1447 | > |
| ... | ... | @@ -1458,7 +1461,7 @@ const CommonModelComponent = props => { |
| 1458 | 1461 | |
| 1459 | 1462 | // 通用标题 |
| 1460 | 1463 | const TabTitleComponent = props => { |
| 1461 | - const { sTabName, bHideTitle, bFirstComponent } = props; | |
| 1464 | + const { sTabName, bHideTitle, bFirstComponent, sTipName = '' } = props; | |
| 1462 | 1465 | |
| 1463 | 1466 | if (!sTabName || bHideTitle) { |
| 1464 | 1467 | if (!bFirstComponent) { |
| ... | ... | @@ -1467,15 +1470,17 @@ const TabTitleComponent = props => { |
| 1467 | 1470 | return <div style={{ width: "100%", height: 10 }} />; |
| 1468 | 1471 | } |
| 1469 | 1472 | } |
| 1470 | - console.log('sTabNsme', sTabName); | |
| 1473 | + | |
| 1471 | 1474 | |
| 1472 | 1475 | if (sTabName.split("_")[0] === "空" || sTabName.split("_")[0] === "Empty" ) return ""; |
| 1473 | 1476 | |
| 1474 | 1477 | const costomTitle = |
| 1475 | 1478 | props.costomTitle && sTabName === "下料信息" ? props.costomTitle : ""; |
| 1476 | 1479 | |
| 1480 | + const sTip = sTabName !== sTipName ? sTabName + '-' + sTipName : sTabName; | |
| 1481 | + | |
| 1477 | 1482 | return ( |
| 1478 | - <div className="tabTitle"> | |
| 1483 | + <div className="tabTitle" title={sTip}> | |
| 1479 | 1484 | {sTabName} |
| 1480 | 1485 | {costomTitle} |
| 1481 | 1486 | <RunningStatusConditionComponent {...props} /> |
| ... | ... | @@ -1505,7 +1510,7 @@ const CommonViewTableComponent = props => { |
| 1505 | 1510 | if (selectedRowKeys.length) { |
| 1506 | 1511 | viewRow = dataArr.find(item => item.sId === selectedRowKeys[0]); |
| 1507 | 1512 | } |
| 1508 | - console.log('111111第', sTabName) | |
| 1513 | + | |
| 1509 | 1514 | if (sTabName?.startsWith("第") && sTabName?.endsWith("转")) { |
| 1510 | 1515 | viewRow = data.filter(item => item.sRev === sTabName)[0]; |
| 1511 | 1516 | } |
| ... | ... | @@ -1513,7 +1518,7 @@ const CommonViewTableComponent = props => { |
| 1513 | 1518 | if (commonUtils.isEmptyObject(viewRow)) { |
| 1514 | 1519 | viewRow = Array.isArray(data) ? data[0] || {} : data; |
| 1515 | 1520 | } |
| 1516 | - console.log('viewRow', viewRow) | |
| 1521 | + | |
| 1517 | 1522 | if ( |
| 1518 | 1523 | commonUtils.isNotEmptyObject(viewRow) && |
| 1519 | 1524 | !selectedRowKeys[0] && |
| ... | ... | @@ -1561,7 +1566,7 @@ const CommonViewTableComponent = props => { |
| 1561 | 1566 | } |
| 1562 | 1567 | const groupList = sTabName?.split(",") || []; |
| 1563 | 1568 | |
| 1564 | - console.log('groupList', groupList) | |
| 1569 | + | |
| 1565 | 1570 | const viewConfigsList = groupList.map((tabName, index) => { |
| 1566 | 1571 | if (tabName === "隐藏") { |
| 1567 | 1572 | return []; |
| ... | ... | @@ -1583,7 +1588,7 @@ const CommonViewTableComponent = props => { |
| 1583 | 1588 | ); |
| 1584 | 1589 | } |
| 1585 | 1590 | }); |
| 1586 | - console.log('viewConfigsList', viewConfigsList); | |
| 1591 | + | |
| 1587 | 1592 | |
| 1588 | 1593 | const operationBarProps = { |
| 1589 | 1594 | ...props, |
| ... | ... | @@ -1605,6 +1610,12 @@ const CommonViewTableComponent = props => { |
| 1605 | 1610 | const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName; |
| 1606 | 1611 | const groupListNew = sTabLocalName?.split(",") || []; |
| 1607 | 1612 | |
| 1613 | + const groupListChinese = sTabName?.split(",") || []; | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1608 | 1619 | return ( |
| 1609 | 1620 | <> |
| 1610 | 1621 | {sName === "master" ? ( |
| ... | ... | @@ -1636,7 +1647,7 @@ const CommonViewTableComponent = props => { |
| 1636 | 1647 | |
| 1637 | 1648 | return ( |
| 1638 | 1649 | <> |
| 1639 | - <TabTitleComponent {...props} sTabName={groupListNew[index] } /> | |
| 1650 | + <TabTitleComponent {...props} sTabName={groupListNew[index]} sTipName = {groupListChinese[index] } /> | |
| 1640 | 1651 | <CommonViewTable {...viewProps} /> |
| 1641 | 1652 | <ReportInfo |
| 1642 | 1653 | reportInfoVisible={reportInfoVisible} |
| ... | ... | @@ -1868,7 +1879,7 @@ const CommonTableComponent = props => { |
| 1868 | 1879 | |
| 1869 | 1880 | const stepName = sTabName?.split("_")[1] || ""; |
| 1870 | 1881 | |
| 1871 | - console.log('ssss', stepName); | |
| 1882 | + | |
| 1872 | 1883 | if (stepName.startsWith("第") && stepName.endsWith("转")) { |
| 1873 | 1884 | tableProps.data = tableProps.data.filter(item => item.sRev === stepName); |
| 1874 | 1885 | } |
| ... | ... | @@ -1888,9 +1899,10 @@ const CommonTableComponent = props => { |
| 1888 | 1899 | const sLanguage = props.app.userinfo?.sLanguage; |
| 1889 | 1900 | |
| 1890 | 1901 | const sTabLocalName = sLanguage === 'sEnglish' ? sEnglishTabName : sTabName; |
| 1902 | + | |
| 1891 | 1903 | return ( |
| 1892 | 1904 | <> |
| 1893 | - <TabTitleComponent {...props} sTabName={sTabLocalName } /> | |
| 1905 | + <TabTitleComponent {...props} sTabName={sTabLocalName } sTipName={sTabName } /> | |
| 1894 | 1906 | <StaticEditTable {...tableProps} /> |
| 1895 | 1907 | <CommonOperationBarComponent {...operationBarProps} /> |
| 1896 | 1908 | <SwasterTypeTable | ... | ... |
src/mes/login/index.js