feat: resource-authorization
This commit is contained in:
parent
eeb101d150
commit
05f1bbbde6
@ -5,16 +5,15 @@
|
|||||||
<LogoFull />
|
<LogoFull />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-between w-full">
|
<div class="flex-between w-full align-center">
|
||||||
<h4><el-divider class="ml-16 mr-16" direction="vertical" />{{ $t('views.system.title') }}</h4>
|
<h4><el-divider class="ml-16 mr-16" direction="vertical" />{{ $t('views.system.title') }}</h4>
|
||||||
<div>
|
<div class="flex align-center mr-8">
|
||||||
<TopAbout></TopAbout>
|
<TopAbout class="mt-4"></TopAbout>
|
||||||
<span class="mr-8 lighter flex align-center"
|
<el-divider class="ml-8 mr-8" direction="vertical" />
|
||||||
><el-divider class="ml-8 mr-8" direction="vertical" />
|
<el-button link @click="router.push({ path: '/' })">
|
||||||
<el-button link @click="router.push({ path: '/' })">
|
<AppIcon class="mr-8" iconName="app-wordspace" style="font-size: 16px"></AppIcon>
|
||||||
<AppIcon class="mr-8" iconName="app-wordspace" style="font-size: 16px"></AppIcon>
|
{{ '返回工作空间' }}</el-button
|
||||||
{{ '返回工作空间' }}</el-button>
|
>
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Avatar></Avatar>
|
<Avatar></Avatar>
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
>
|
>
|
||||||
<AppIcon
|
<AppIcon
|
||||||
iconName="app-help"
|
iconName="app-help"
|
||||||
class="cursor color-secondary mr-16 ml-8"
|
class="cursor color-secondary mr-8 ml-8"
|
||||||
style="font-size: 20px"
|
style="font-size: 20px"
|
||||||
@click="toUrl(theme.themeInfo?.forumUrl)"
|
@click="toUrl(theme.themeInfo?.forumUrl)"
|
||||||
></AppIcon>
|
></AppIcon>
|
||||||
|
|||||||
@ -99,7 +99,6 @@ import { hasPermission } from '@/utils/permission/index'
|
|||||||
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
||||||
import type { WorkspaceItem } from '@/api/type/workspace'
|
import type { WorkspaceItem } from '@/api/type/workspace'
|
||||||
|
|
||||||
const PermissionSettingRef = ref()
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const rLoading = ref(false)
|
const rLoading = ref(false)
|
||||||
const memberList = ref<any[]>([]) // 全部成员
|
const memberList = ref<any[]>([]) // 全部成员
|
||||||
@ -162,8 +161,8 @@ function submitPermissions() {
|
|||||||
auth_type: item.isRole ? 'ROLE' : 'RESOURCE_PERMISSION_GROUP',
|
auth_type: item.isRole ? 'ROLE' : 'RESOURCE_PERMISSION_GROUP',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.reduce((pre: any, next: any) => [...pre, ...next], [])
|
|
||||||
})
|
}).reduce((pre: any, next: any) => [...pre, ...next], [])
|
||||||
|
|
||||||
AuthorizationApi.putResourceAuthorization(
|
AuthorizationApi.putResourceAuthorization(
|
||||||
currentWorkspaceId.value || 'default',
|
currentWorkspaceId.value || 'default',
|
||||||
@ -295,6 +294,7 @@ const getWholeTree = async (user_id: string) => {
|
|||||||
let folderIdMap = []
|
let folderIdMap = []
|
||||||
const folderTree = cloneDeep((parentRes as unknown as any).data)
|
const folderTree = cloneDeep((parentRes as unknown as any).data)
|
||||||
if (Object.keys(childrenRes.data).indexOf(item.value) !== -1) {
|
if (Object.keys(childrenRes.data).indexOf(item.value) !== -1) {
|
||||||
|
item.isRole = childrenRes.data[item.value].length>0 && childrenRes.data[item.value][0].permission.ROLE
|
||||||
folderIdMap = getFolderIdMap(childrenRes.data[item.value])
|
folderIdMap = getFolderIdMap(childrenRes.data[item.value])
|
||||||
dfsFolder(folderTree, folderIdMap)
|
dfsFolder(folderTree, folderIdMap)
|
||||||
const permissionHalf = {
|
const permissionHalf = {
|
||||||
@ -337,22 +337,6 @@ const getFolderIdMap = (arr: any = []) => {
|
|||||||
return pre
|
return pre
|
||||||
}, {})
|
}, {})
|
||||||
}
|
}
|
||||||
function ResourcePermissions(user_id: string) {
|
|
||||||
AuthorizationApi.getResourceAuthorization(
|
|
||||||
currentWorkspaceId.value || 'default',
|
|
||||||
user_id,
|
|
||||||
rLoading,
|
|
||||||
).then((res) => {
|
|
||||||
if (!res.data || Object.keys(res.data).length > 0) {
|
|
||||||
settingTags.map((item: any) => {
|
|
||||||
if (Object.keys(res.data).indexOf(item.value) !== -1) {
|
|
||||||
item.data = res.data[item.value]
|
|
||||||
getFolderIdMap(item.data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const workspaceList = ref<WorkspaceItem[]>([])
|
const workspaceList = ref<WorkspaceItem[]>([])
|
||||||
const currentWorkspaceId = ref<string | undefined>('')
|
const currentWorkspaceId = ref<string | undefined>('')
|
||||||
@ -360,11 +344,9 @@ const currentWorkspace = computed(() => {
|
|||||||
return workspaceList.value.find((w) => w.id == currentWorkspaceId.value)
|
return workspaceList.value.find((w) => w.id == currentWorkspaceId.value)
|
||||||
})
|
})
|
||||||
async function getWorkspaceList() {
|
async function getWorkspaceList() {
|
||||||
if (user.isEE()) {
|
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
|
||||||
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
|
workspaceList.value = res.data
|
||||||
workspaceList.value = res.data
|
currentWorkspaceId.value = 'default'
|
||||||
currentWorkspaceId.value = 'default'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeWorkspace(item: WorkspaceItem) {
|
function changeWorkspace(item: WorkspaceItem) {
|
||||||
@ -380,7 +362,9 @@ onMounted(() => {
|
|||||||
tableHeight.value = window.innerHeight - 330
|
tableHeight.value = window.innerHeight - 330
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
getWorkspaceList()
|
if (user.isEE()) {
|
||||||
|
getWorkspaceList()
|
||||||
|
}
|
||||||
getMember()
|
getMember()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user