diff --git a/src/mes/common/buttonComponent/index.js b/src/mes/common/buttonComponent/index.js index ac94bf0..532eca2 100644 --- a/src/mes/common/buttonComponent/index.js +++ b/src/mes/common/buttonComponent/index.js @@ -16,64 +16,8 @@ const ButtonComponent = props => { const { app, sModelsId, currentContent, menuMap } = props; const { managementData, userinfo = {} } = app; const { iTeamType } = userinfo; - console.log('managementData', managementData); - if ([3, 4, 5, 6].includes(iTeamType)) { - const scheduledTasks = managementData.find( - item => item.sMenuName === "计划任务" - ); - if (scheduledTasks && scheduledTasks.children) { - const iIndex = scheduledTasks.children.findIndex( - child => child.sMenuName === "生产返工" - ); - if (iIndex !== -1) { - scheduledTasks.children.splice(iIndex, 1); - } - } - - const restArr = []; - if (iTeamType === 3) { - restArr.push("研发工艺参数"); - } else if ([4, 5].includes(iTeamType)) { - restArr.push("研发工艺参数(烫金)"); - restArr.push("研发工艺参数(模切)"); - } else if (iTeamType === 6) { - restArr.push("研发工艺参数(丝印)"); - } - const productionExecMain = managementData.find( - item => item.sMenuName === "生产执行" - ); - if (productionExecMain && productionExecMain.children) { - const forLength = productionExecMain.children.length; - for (let i = 0; i < forLength; i++) { - const iIndex = productionExecMain.children.findIndex( - child => - !["生产执行", "质量巡检", ...restArr].includes(child.sMenuName) - ); - if (iIndex !== -1) { - productionExecMain.children.splice(iIndex, 1); - } - } - } - } else { - console.log('managementData', managementData); - const productionExecMain = managementData.find( - item => item.sMenuName === "生产执行" - ); - if (productionExecMain && productionExecMain.children) { - for (let i = 0; i < 4; i++) { - const iIndex = productionExecMain.children.findIndex(child => - child.sMenuName.includes("研发工艺参数") - ); - if (iIndex !== -1) { - productionExecMain.children.splice(iIndex, 1); - } - } - } - } const [expand, setExpand] = useState(true); - const [processReport, setProcessReport] = useState(false); - const [dataList, setDataList] = useState([]); useEffect( @@ -89,8 +33,7 @@ const ButtonComponent = props => { .filter( item => item.sName && - !item.sName.includes("Modal") && - item.sMenuName !== "工单物料信息" + !item.sName.includes("Modal") ) .map(item => { const { sId, sMenuName, sName } = item; @@ -99,7 +42,6 @@ const ButtonComponent = props => { id: sId, sName, badeg: 0, - // badeg: index === 0 ? 1 : index === 4 ? 10 : index === 8 ? 999 : 0, icon: getNavIcon(false), activeIcon: getNavIcon(true), disabled: false @@ -108,93 +50,46 @@ const ButtonComponent = props => { setDataList(newList); } - - // 是否为维修保养模块 - setProcessReport( - props.currentContent === "serviceUpkeep" || - (props.currentContent === "productionExec" && - [3, 4, 5, 6].includes(iTeamType)) - ); }, [JSON.stringify(managementData)] ); - const menuOrderList1 = [ - ["机台任务", 1], - null, - ["标签补打", 2], - null, - ["工单信息", 2], - ["产品质量档案", 3], - ["工艺作业指导书", 4], - ["相关文档", 5], - ["历史任务", 6], - ["生产返工", 2], - null, - null, - // ["产前提醒信息", 7], - null, - ["工单在制品清单", 8], - ["产前提醒信息", 7], - null - ]; - - const menuOrderList2 = [ - ["生产执行", 10], - ["首签样通知", 11], - ["异常/协助提报", 12], - ["完工清场/确认单据", 13], - ["拆合版", 14], - null, - null, - ["质量巡检", 15], - ["班组报工", 16], - ["签样/完成", 17], - ["班组交接", 18], - ["工单变更信息", 19], - ["其它机台日报", 16], - ["印刷出版任务", 2], - null, - ["工艺巡检", 20] - ]; - - const menuOrderList3 = [ - ["设备保养", 21], - ["设备点检", 22], - ["设备维修", 23], - ["设备资料", 24] - ]; - - const menuList = []; - new Array(16).fill("").forEach((_, index) => { - const itemName = [ - menuOrderList1[index]?.[0], - menuOrderList2[index]?.[0], - menuOrderList3[index]?.[0] - ]; - const icon = [ - menuOrderList1[index]?.[1], - menuOrderList2[index]?.[1], - menuOrderList3[index]?.[1] - ]; - const item = dataList.find(item => itemName.includes(item.name)); - let result = ""; - if (item) { - const iIndex = itemName.findIndex(item1 => item1 === item.name); - const iconName = icon[iIndex]; - item.icon = getNavIcon(false, iconName); - item.activeIcon = getNavIcon(true, iconName); - result = item; - } - menuList.push(result); - }); + const iconJson = { + "机台任务": 1, + "标签补打": 2, + "工单信息": 2, + "产品质量档案": 3, + "工艺作业指导书": 4, + "相关文档": 5, + "历史任务": 6, + "生产返工": 2, + "产前提醒信息": 7, + "工单在制品清单": 8, + "生产执行": 10, + "首签样通知": 11, + "异常/协助提报": 12, + "完工清场/确认单据": 13, + "拆合版": 14, + "质量巡检": 15, + "班组报工": 16, + "签样/完成": 17, + "班组交接": 18, + "工单变更信息": 19, + "其它机台日报": 16, + "印刷出版任务": 2, + "工艺巡检": 20, + "设备保养": 21, + "设备点检": 22, + "设备维修": 23, + "设备资料": 24 + } - dataList.forEach(item => { - if (!menuList.some(item1 => item1.name === item.name)) { - const iIndex = menuList.findIndex(item1 => !item1); - menuList[iIndex] = item; - } - }); + const menuList = dataList.map(item => { + const iconName = iconJson[item.name]; + item.icon = getNavIcon(false, iconName); + item.activeIcon = getNavIcon(true, iconName); + return item; + }) // 点击 const itemClick = e => { @@ -311,9 +206,8 @@ const ButtonComponent = props => { return (