• 页面功能并不是所有用户都能执行 点击判断用户权限路由是否进行跳转


     获取用户动态路由

    1. this.authRoutes = this.$store.state.permission.routes.filter(item => item.path);
    2. const secondroute = this.authRoutes.find(item => item.path === '/todoItem');
    3. if (secondroute && secondroute.children.find(item => item.path === 'materialWarnDetails')) {
    4. this.getTreeselect()
    5. }

    定义公共方法 

    1. funXinxiku(routePath, componentName) {
    2. const secondRoute = this.authRoutes.find(item => item.path === '/base');
    3. if (secondRoute && secondRoute.children.find(item => item.path === routePath)) {
    4. this.$router.push({ name: componentName });
    5. } else {
    6. this.$message.error('暂无权限,需要请联系管理员');
    7. }
    8. },
    9. funMaterial(routePath, componentName) {
    10. const secondRoute = this.authRoutes.find(item => item.path === '/material');
    11. if (secondRoute && secondRoute.children.find(item => item.path === routePath)) {
    12. this.$router.push({ name: componentName });
    13. } else {
    14. this.$message.error('暂无权限,需要请联系管理员');
    15. }
    16. },

    点击传入参数调用方法 

    1. xinxiku() {
    2. this.funXinxiku('information', 'Information');
    3. },
    4. bianmaku() {
    5. this.funXinxiku('material', 'Material');
    6. },
    7. gongyingfang() {
    8. this.funXinxiku('supplier', 'Supplier');
    9. },
    10. fenbaofang() {
    11. this.funXinxiku('supplier2', 'Supplier2');
    12. },
    13. fahuodan() {
    14. this.funMaterial('dispatch', 'Dispatch');
    15. },
    16. daohuodan() {
    17. this.funMaterial('arrival', 'Arrival');
    18. },
    19. yanshoudan() {
    20. this.funMaterial('check', 'Check');
    21. },
    22. lingliaodan() {
    23. this.funMaterial('receiveOrder', 'ReceiveOrder');
    24. },
    25. tuiliaodan() {
    26. this.funMaterial('returnOrder', 'ReturnOrder');
    27. },
    28. zulinshebei() {
    29. this.funMaterial('rentaldevice', 'Rentaldevice');
    30. },

  • 相关阅读:
    关于 JVM 的内存模型
    复现一个循环以及俩个循环问题
    1538_AURIX_TriCore内核架构_地址映射以及存储配置
    实体对齐模型训练知识储备
    gradle尚硅谷笔记
    数据库经典笔试题
    Doris 导出表结构或数据
    Docker
    Java面试题:Redis分片集群结构
    硅树脂油漆申请美国标准UL 790 Class A 合适吗?
  • 原文地址:https://blog.csdn.net/weixin_69811594/article/details/132742736