|
|
|
@ -24,19 +24,29 @@ import { useMultipleTabStore } from '/@/store/modules/multipleTab'
|
|
|
|
|
export function permissionsInfo() {
|
|
|
|
|
let permissionId: string = ''
|
|
|
|
|
let permissionName: string = ''
|
|
|
|
|
const fullPath = ref(router.currentRoute.value.fullPath)
|
|
|
|
|
usePermissionStore().getWrouteList.forEach((item: Record<any, any>) => {
|
|
|
|
|
item.children[0].children?.forEach((row: Record<any, any>) => {
|
|
|
|
|
if (fullPath.value.indexOf(row.path) != -1) {
|
|
|
|
|
permissionId = row.id
|
|
|
|
|
permissionName = row.name
|
|
|
|
|
console.log(permissionId)
|
|
|
|
|
const fullPath = ref(router.currentRoute.value.path)
|
|
|
|
|
const routerList = treeOptionData(usePermissionStore().getWrouteList)
|
|
|
|
|
routerList.forEach(item => {
|
|
|
|
|
if (item.path === fullPath.value) {
|
|
|
|
|
console.log(fullPath.value)
|
|
|
|
|
permissionId = item.id
|
|
|
|
|
permissionName = item.name
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
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
|
|
|
|
|
export function usePermission() {
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|