|
|
@ -24,19 +24,29 @@ import { useMultipleTabStore } from '/@/store/modules/multipleTab'
|
|
|
|
export function permissionsInfo() {
|
|
|
|
export function permissionsInfo() {
|
|
|
|
let permissionId: string = ''
|
|
|
|
let permissionId: string = ''
|
|
|
|
let permissionName: string = ''
|
|
|
|
let permissionName: string = ''
|
|
|
|
const fullPath = ref(router.currentRoute.value.fullPath)
|
|
|
|
const fullPath = ref(router.currentRoute.value.path)
|
|
|
|
usePermissionStore().getWrouteList.forEach((item: Record<any, any>) => {
|
|
|
|
const routerList = treeOptionData(usePermissionStore().getWrouteList)
|
|
|
|
item.children[0].children?.forEach((row: Record<any, any>) => {
|
|
|
|
routerList.forEach(item => {
|
|
|
|
if (fullPath.value.indexOf(row.path) != -1) {
|
|
|
|
if (item.path === fullPath.value) {
|
|
|
|
permissionId = row.id
|
|
|
|
console.log(fullPath.value)
|
|
|
|
permissionName = row.name
|
|
|
|
permissionId = item.id
|
|
|
|
console.log(permissionId)
|
|
|
|
permissionName = item.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return { permissionId, permissionName }
|
|
|
|
return { permissionId, permissionName }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 递归查找路由中path与当前path完全相同的路由
|
|
|
|
|
|
|
|
function treeOptionData(array, result = []) {
|
|
|
|
|
|
|
|
array.forEach(item => {
|
|
|
|
|
|
|
|
result.push({ name: item.name, id: item.id, path: item.path })
|
|
|
|
|
|
|
|
if (item.children && item.children.length) {
|
|
|
|
|
|
|
|
treeOptionData(item.children, result)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return JSON.parse(JSON.stringify(result))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// User permissions related operations
|
|
|
|
// User permissions related operations
|
|
|
|
export function usePermission() {
|
|
|
|
export function usePermission() {
|
|
|
|
const userStore = useUserStore()
|
|
|
|
const userStore = useUserStore()
|
|
|
|