Browse Source

fix: 添加路由跳转定位菜单功能

johnsen 7 months ago
parent
commit
e8392772e4

+ 32 - 0
src/layout/header-aside/components/header-search-feature/index.vue

@@ -51,6 +51,38 @@ export default {
       })
     }
   },
+  watch: {
+    $route: {
+      async handler(val, oldVal) {
+        const { activeHeader } = this.$store.getters
+        console.log(val)
+        const str = val.path && val.path.split('/')[1]
+        if (!str) return
+        const {
+          variables: { data = [] }
+        } = await this.$common.request('query', {
+          key: 'getPathByResAlias',
+          params: [str]
+        })
+        if (!data || !data[0]) {
+          await this.$store.dispatch('ibps/menu/activeHeaderSet', {
+            activeHeader: '',
+            vm: this
+          })
+          return
+        }
+        if (data[0] && data[0].id && data[0].id === activeHeader) {
+        } else {
+          const id = data[0]?.PATH_?.split('.')[0]
+          await this.$store.dispatch('ibps/menu/activeHeaderSet', {
+            activeHeader: id,
+            vm: this
+          })
+          this.handleMenuSelect(val.path)
+        }
+      }
+    }
+  },
   methods: {
     /**
      * @description 接收用户在下拉菜单中选中事件

+ 1 - 0
src/store/getters.js

@@ -68,6 +68,7 @@ export default {
   routers: (state) => state.ibps.menu.routers, // 新增的路由表
   // =========== 子系统
   system: (state) => state.ibps.system.system, // 子系统
+  activeHeader: (state) => state.ibps.menu.activeHeader,
   systemid: (state) =>
     state.ibps.system.system ? state.ibps.system.system.id : '', // 子系统id
   permissions: (state) => state.ibps.menu.permissions, //  拥有的权限

+ 7 - 6
src/views/platform/message/inner/detail/index.vue

@@ -230,7 +230,11 @@ export default {
     },
     // 路由
     handleRouterSkip(way) {
-      this.$router.push(`${way}`)
+      // console.log('way===>', )
+      // return
+      this.$router.push({
+        path: way
+      })
     },
     // 无流程表单
     // handleFlowlessForm(way){
@@ -353,11 +357,8 @@ export default {
 
 .text-border {
   color: #000000;
-  box-shadow:
-    0 0 0 0 rgba(0, 0, 0, 0.1),
-    0 0 0 0 rgba(0, 0, 0, 0.1),
-    0 0 0 0 rgba(0, 0, 0, 0.1),
-    0 1px 0px 0 rgba(0, 0, 0, 0.1);
+  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.1), 0 0 0 0 rgba(0, 0, 0, 0.1),
+    0 0 0 0 rgba(0, 0, 0, 0.1), 0 1px 0px 0 rgba(0, 0, 0, 0.1);
   padding-left: 5px;
   min-height: 38px;
   font-size: 16px;