Skip to content

Commit 05f1bbb

Browse files
feat: resource-authorization
1 parent eeb101d commit 05f1bbb

File tree

3 files changed

+18
-35
lines changed

3 files changed

+18
-35
lines changed

ui/src/layout/layout-header/SystemHeader.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
<LogoFull />
66
</div>
77

8-
<div class="flex-between w-full">
8+
<div class="flex-between w-full align-center">
99
<h4><el-divider class="ml-16 mr-16" direction="vertical" />{{ $t('views.system.title') }}</h4>
10-
<div>
11-
<TopAbout></TopAbout>
12-
<span class="mr-8 lighter flex align-center"
13-
><el-divider class="ml-8 mr-8" direction="vertical" />
14-
<el-button link @click="router.push({ path: '/' })">
15-
<AppIcon class="mr-8" iconName="app-wordspace" style="font-size: 16px"></AppIcon>
16-
{{ '返回工作空间' }}</el-button>
17-
</span>
10+
<div class="flex align-center mr-8">
11+
<TopAbout class="mt-4"></TopAbout>
12+
<el-divider class="ml-8 mr-8" direction="vertical" />
13+
<el-button link @click="router.push({ path: '/' })">
14+
<AppIcon class="mr-8" iconName="app-wordspace" style="font-size: 16px"></AppIcon>
15+
{{ '返回工作空间' }}</el-button
16+
>
1817
</div>
1918
</div>
2019
<Avatar></Avatar>

ui/src/layout/layout-header/top-about/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
>
3535
<AppIcon
3636
iconName="app-help"
37-
class="cursor color-secondary mr-16 ml-8"
37+
class="cursor color-secondary mr-8 ml-8"
3838
style="font-size: 20px"
3939
@click="toUrl(theme.themeInfo?.forumUrl)"
4040
></AppIcon>

ui/src/views/system/resource-authorization/index.vue

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ import { hasPermission } from '@/utils/permission/index'
9999
import WorkspaceApi from '@/api/workspace/workspace.ts'
100100
import type { WorkspaceItem } from '@/api/type/workspace'
101101
102-
const PermissionSettingRef = ref()
103102
const loading = ref(false)
104103
const rLoading = ref(false)
105104
const memberList = ref<any[]>([]) // 全部成员
@@ -162,8 +161,8 @@ function submitPermissions() {
162161
auth_type: item.isRole ? 'ROLE' : 'RESOURCE_PERMISSION_GROUP',
163162
}
164163
})
165-
.reduce((pre: any, next: any) => [...pre, ...next], [])
166-
})
164+
165+
}).reduce((pre: any, next: any) => [...pre, ...next], [])
167166
168167
AuthorizationApi.putResourceAuthorization(
169168
currentWorkspaceId.value || 'default',
@@ -295,6 +294,7 @@ const getWholeTree = async (user_id: string) => {
295294
let folderIdMap = []
296295
const folderTree = cloneDeep((parentRes as unknown as any).data)
297296
if (Object.keys(childrenRes.data).indexOf(item.value) !== -1) {
297+
item.isRole = childrenRes.data[item.value].length>0 && childrenRes.data[item.value][0].permission.ROLE
298298
folderIdMap = getFolderIdMap(childrenRes.data[item.value])
299299
dfsFolder(folderTree, folderIdMap)
300300
const permissionHalf = {
@@ -337,34 +337,16 @@ const getFolderIdMap = (arr: any = []) => {
337337
return pre
338338
}, {})
339339
}
340-
function ResourcePermissions(user_id: string) {
341-
AuthorizationApi.getResourceAuthorization(
342-
currentWorkspaceId.value || 'default',
343-
user_id,
344-
rLoading,
345-
).then((res) => {
346-
if (!res.data || Object.keys(res.data).length > 0) {
347-
settingTags.map((item: any) => {
348-
if (Object.keys(res.data).indexOf(item.value) !== -1) {
349-
item.data = res.data[item.value]
350-
getFolderIdMap(item.data)
351-
}
352-
})
353-
}
354-
})
355-
}
356340
357341
const workspaceList = ref<WorkspaceItem[]>([])
358342
const currentWorkspaceId = ref<string | undefined>('')
359343
const currentWorkspace = computed(() => {
360344
return workspaceList.value.find((w) => w.id == currentWorkspaceId.value)
361345
})
362346
async function getWorkspaceList() {
363-
if (user.isEE()) {
364-
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
365-
workspaceList.value = res.data
366-
currentWorkspaceId.value = 'default'
367-
}
347+
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
348+
workspaceList.value = res.data
349+
currentWorkspaceId.value = 'default'
368350
}
369351
370352
function changeWorkspace(item: WorkspaceItem) {
@@ -380,7 +362,9 @@ onMounted(() => {
380362
tableHeight.value = window.innerHeight - 330
381363
})()
382364
}
383-
getWorkspaceList()
365+
if (user.isEE()) {
366+
getWorkspaceList()
367+
}
384368
getMember()
385369
})
386370
</script>

0 commit comments

Comments
 (0)