|
|
@ -36,6 +36,7 @@ |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { mapState, mapActions } from 'vuex' |
|
|
|
import { mapState, mapActions } from 'vuex' |
|
|
|
import Setting from '@/setting' |
|
|
|
import Setting from '@/setting' |
|
|
|
|
|
|
|
import addRoutes from '@/libs/route/addRoutes' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data () { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -70,7 +71,9 @@ export default { |
|
|
|
} else if (path.includes('allocationReview/')) { |
|
|
|
} else if (path.includes('allocationReview/')) { |
|
|
|
this.active = '/allocationReview' |
|
|
|
this.active = '/allocationReview' |
|
|
|
} |
|
|
|
} |
|
|
|
this.initMenu() |
|
|
|
}, |
|
|
|
|
|
|
|
mounted () { |
|
|
|
|
|
|
|
localStorage.getItem('review_token') && this.getPer() |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
...mapActions('user', [ |
|
|
|
...mapActions('user', [ |
|
|
@ -85,26 +88,24 @@ export default { |
|
|
|
initMenu () { |
|
|
|
initMenu () { |
|
|
|
// 如果开启了动态路由,则取store里的路由匹配 |
|
|
|
// 如果开启了动态路由,则取store里的路由匹配 |
|
|
|
if (Setting.dynamicRoute) { |
|
|
|
if (Setting.dynamicRoute) { |
|
|
|
const { btns } = this |
|
|
|
const { btns, defaultMenus: all } = this |
|
|
|
const menus = [] |
|
|
|
console.log("🚀 ~ initMenu ~ btns:", btns) |
|
|
|
this.defaultMenus.map(e => { |
|
|
|
const menus = [all[0]] |
|
|
|
if (btns.find(n => n.includes(e.index) || n === e.title)) { |
|
|
|
btns.find(e => e === '分配评阅任务') && menus.push(all[1]) |
|
|
|
// 匹配子菜单 |
|
|
|
btns.find(e => e === '专家管理') && menus.push(all[2]) |
|
|
|
if (e.subs && e.subs.length) { |
|
|
|
|
|
|
|
const children = [] |
|
|
|
|
|
|
|
e.subs.map((j, i) => { |
|
|
|
|
|
|
|
btns.find(n => n.includes(j.index)) && children.push(j) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
e.subs = children |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
menus.push(e) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.menus = menus |
|
|
|
this.menus = menus |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.menus = this.defaultMenus |
|
|
|
this.menus = this.defaultMenus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async getPer () { |
|
|
|
|
|
|
|
const res = await this.$get(this.api.getUserRolesPermissionMenu, { |
|
|
|
|
|
|
|
platformId: 3 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const routes = res.permissionMenu[0].children.find(e => e.path === '/review') // 只获取评阅平台的权限 |
|
|
|
|
|
|
|
routes && addRoutes(routes.children) |
|
|
|
|
|
|
|
this.initMenu() |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|