RuoYi преди 1 година
родител
ревизия
65d03dc014

+ 11 - 8
ruoyi-ui/src/components/Breadcrumb/index.vue

@@ -41,14 +41,15 @@ export default {
41 41
           if (index !== 0) item = item.slice(1)
42 42
           return item
43 43
         })
44
-        this.getMatched(pathList, this.$store.getters.sidebarRouters, matched)
44
+        this.getMatched(pathList, this.$store.getters.defaultRoutes, matched)
45 45
       } else {
46
-        matched = router.matched.filter((item) => item.meta && item.meta.title)
46
+        matched = router.matched.filter(item => item.meta && item.meta.title)
47 47
       }
48
+      // 判断是否为首页
48 49
       if (!this.isDashboard(matched[0])) {
49 50
         matched = [{ path: "/index", meta: { title: "首页" } }].concat(matched)
50 51
       }
51
-      this.levelList = matched.filter((item) => item.meta && item.meta.title && item.meta.breadcrumb !== false)
52
+      this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
52 53
     },
53 54
     findPathNum(str, char = "/") {
54 55
       let index = str.indexOf(char)
@@ -60,11 +61,13 @@ export default {
60 61
       return num
61 62
     },
62 63
     getMatched(pathList, routeList, matched) {
63
-      let data = routeList.find((item) => item.path == pathList[0])
64
-      matched.push(data)
65
-      if (data.children && pathList.length) {
66
-        pathList.shift()
67
-        this.getMatched(pathList, data.children, matched)
64
+      let data = routeList.find(item => item.path == pathList[0] || (item.name += '').toLowerCase() == pathList[0])
65
+      if (data) {
66
+        matched.push(data)
67
+        if (data.children && pathList.length) {
68
+          pathList.shift()
69
+          this.getMatched(pathList, data.children, matched)
70
+        }
68 71
       }
69 72
     },
70 73
     isDashboard(route) {

+ 3 - 4
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue

@@ -62,11 +62,10 @@ export default {
62 62
       const showingChildren = children.filter(item => {
63 63
         if (item.hidden) {
64 64
           return false
65
-        } else {
66
-          // Temp set(will be used if only has one showing child)
67
-          this.onlyOneChild = item
68
-          return true
69 65
         }
66
+        // Temp set(will be used if only has one showing child)
67
+        this.onlyOneChild = item
68
+        return true
70 69
       })
71 70
 
72 71
       // When there is only one child router, the child router is displayed by default

+ 2 - 0
ruoyi-ui/src/plugins/cache.js

@@ -26,6 +26,7 @@ const sessionCache = {
26 26
     if (value != null) {
27 27
       return JSON.parse(value)
28 28
     }
29
+    return null
29 30
   },
30 31
   remove (key) {
31 32
     sessionStorage.removeItem(key);
@@ -59,6 +60,7 @@ const localCache = {
59 60
     if (value != null) {
60 61
       return JSON.parse(value)
61 62
     }
63
+    return null
62 64
   },
63 65
   remove (key) {
64 66
     localStorage.removeItem(key);

+ 2 - 2
ruoyi-ui/src/views/system/role/index.vue

@@ -522,8 +522,8 @@ export default {
522 522
             })
523 523
           });
524 524
         });
525
-        this.title = "修改角色";
526 525
       });
526
+      this.title = "修改角色";
527 527
     },
528 528
     /** 选择角色权限范围触发 */
529 529
     dataScopeSelectChange(value) {
@@ -543,8 +543,8 @@ export default {
543 543
             this.$refs.dept.setCheckedKeys(res.checkedKeys);
544 544
           });
545 545
         });
546
-        this.title = "分配数据权限";
547 546
       });
547
+      this.title = "分配数据权限";
548 548
     },
549 549
     /** 分配用户操作 */
550 550
     handleAuthUser: function(row) {