Browse Source

冲突解决

hbchen 1 year ago
parent
commit
a368355bd4

+ 15 - 0
src/views/Home.vue

@@ -773,6 +773,21 @@ export default {
             return item.name === "数据报表";
           });
           this.$store.commit("SET_DATA_AUTH", bool_data);
+
+          // 需要确认是否有权限的路由 
+          /**
+           * Sysdatauth-手工数据权限
+           */
+          let shouldVerificationRoute=["Sysdatauth"]
+          shouldVerificationRoute.map(sMenu =>{
+            this.navlists.forEach(item =>{
+              if(item.children.some(menu => menu.path === sMenu || '/'+menu.path === sMenu)){
+                // 添加有权限的路由
+                this.$store.commit("ADD_PERMISSION_ROUTE", sMenu);
+                return
+              }
+            })
+          })
         }
       });
     },

+ 3 - 0
src/views/dataEntry_manage/components/addTarget.vue

@@ -416,6 +416,9 @@ import {dataInterence} from 'api/api.js';
 			},
 			// 手工数据权限页面跳转
 			dataAuthorityJump(){
+				if(!this.$store.state.permissionRoute.includes('Sysdatauth')){
+					return this.$message.warning("暂无权限,请联系管理员开通“手工数据权限”菜单!")
+				}
 				this.$router.push('Sysdatauth')
 			}
 		},

+ 1 - 1
src/vuex/index.js

@@ -7,7 +7,6 @@ import edb from "./modules/edb";
 import permissionButton from "./modules/permissionButton";
 import sheet from "./modules/sheet";
 
-
 // 应用初始状态
 const state = {
   theme: "#409EFF",
@@ -33,6 +32,7 @@ const state = {
   hasDoPageListening:false,
   // 是否有 试用用户行为权限
   hasTrialUserPermisson:false,
+  permissionRoute:[], //用于需要验证是否有某个菜单的权限
 };
 
 export default {

+ 4 - 0
src/vuex/mutations.js

@@ -73,6 +73,10 @@ const mutations = {
     state.publicConfigs = filterObj; 
     setting.publicConfigs = state.publicConfigs;
   },
+  // 添加需要校验且有权限的路由
+  ADD_PERMISSION_ROUTE(state,route){
+    state.permissionRoute.push(route)
+  }
 };
 
 export default mutations;