| | |
| | | const userStore = useUserStore(); |
| | | const userInfo: any = computed(() => userStore.userInfo); |
| | | |
| | | // 是否为管理员 |
| | | const isAdmin = computed(() => { |
| | | if (!userInfo.value || !userInfo.value.roles || !Array.isArray(userInfo.value.roles)) { |
| | | return false; |
| | | } |
| | | |
| | | return userInfo.value.roles.some( |
| | | (role: any) => role.roleKey === "admin" || role.roleKey === "manager" |
| | | ); |
| | | }); |
| | | |
| | | // 判断是否为巡检员角色 |
| | | const isInspector = computed(() => { |
| | | if (!userInfo.value || !userInfo.value.roles || !Array.isArray(userInfo.value.roles)) { |
| | |
| | | |
| | | if ( |
| | | (data.deviceGroupName && data.deviceGroupName.includes("丝")) || |
| | | (data.deviceGroupName && data.deviceGroupName.includes("绞")) |
| | | (data.deviceGroupName && data.deviceGroupName.includes("绞")) || |
| | | isAdmin.value |
| | | ) { |
| | | // 如果是丝或绞,显示生产管理菜单 |
| | | navList[0].show = true; |
| | | } |
| | | console.log("isInspector.value", isInspector.value); |
| | | if (isInspector.value) { |
| | | if (isInspector.value || isAdmin.value) { |
| | | // 如果是巡检员,显示巡检菜单 |
| | | navList[1].show = true; |
| | | } |
| | | console.log("isStorage.value", isStorage.value); |
| | | if (isStorage.value) { |
| | | if (isStorage.value || isAdmin.value) { |
| | | // 如果是出库角色,显示出库菜单 |
| | | navList[2].show = true; |
| | | } |