|
@@ -91,11 +91,13 @@ export function hasPriceAuth(authNode, priceOptions, userAuthCode){
|
|
|
const a = item.code.split('_')
|
|
|
const hasCode = priceOptions.find(k => k.value == a[a.length-1])
|
|
|
const hasRoles = userAuthCode.includes(item.code)
|
|
|
+
|
|
|
if(hasCode && hasRoles){
|
|
|
codes.push(a[a.length-1])
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
priceOptions.map(item => {
|
|
|
ret.push(codes.includes(item.value)?1:0)
|
|
|
})
|
|
@@ -103,11 +105,16 @@ export function hasPriceAuth(authNode, priceOptions, userAuthCode){
|
|
|
}
|
|
|
|
|
|
export function getAuthPriceCode (config, router, store) {
|
|
|
- const permission = router.history.current.meta.permission
|
|
|
+
|
|
|
+ const permission = router.history.current.meta.permission
|
|
|
+
|
|
|
+
|
|
|
const curActionPermission = store.state.app.curActionPermission
|
|
|
+
|
|
|
const priceOptions = store.state.app.priceAuthOptions
|
|
|
+
|
|
|
const authCode = curActionPermission || permission
|
|
|
-
|
|
|
+
|
|
|
const roles = store.state.user.roles
|
|
|
const userAuthCode = roles.permissionList.filter(item => {
|
|
|
const a = item.split('_')
|
|
@@ -115,13 +122,18 @@ export function getAuthPriceCode (config, router, store) {
|
|
|
})
|
|
|
|
|
|
console.log(authCode)
|
|
|
+
|
|
|
if(authCode){
|
|
|
+
|
|
|
const url = config.url
|
|
|
+
|
|
|
const authTree = store.state.app.authMenusList
|
|
|
+
|
|
|
const authNode = treeFind(authTree,(item)=>item.code == authCode)
|
|
|
console.log(authNode)
|
|
|
+
|
|
|
const hasReqUrl = authNode.permission.split(',').find(item => url.replace(/\//g,'_').indexOf(item)>=0)
|
|
|
-
|
|
|
+
|
|
|
if(hasReqUrl&&authNode.children&&authNode.children.length){
|
|
|
return hasPriceAuth(authNode.children,priceOptions,userAuthCode)
|
|
|
}
|