mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-29 16:12:55 +00:00
perf: Morefilled system and model
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
This commit is contained in:
parent
f6b271e929
commit
3ca8c6ef73
|
|
@ -64,7 +64,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<template #mouseEnter>
|
||||
<template #mouseEnter
|
||||
v-if="MoreFilledPermission(model.id)"
|
||||
>
|
||||
<el-dropdown trigger="click" v-if="!isShared">
|
||||
<el-button text @click.stop>
|
||||
<el-icon>
|
||||
|
|
@ -147,10 +149,21 @@ const props = defineProps<{
|
|||
apiType: 'systemShare' | 'workspace' | 'systemManage'
|
||||
}>()
|
||||
|
||||
const apiType = props.apiType
|
||||
|
||||
const isSystemShare = computed(() => {
|
||||
return apiType==='systemShare'
|
||||
})
|
||||
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['model'][props.apiType]
|
||||
})
|
||||
|
||||
const MoreFilledPermission = (id: any) => {
|
||||
return permissionPrecise.value.modify(id) ||
|
||||
permissionPrecise.value.delete(id) || isSystemShare.value
|
||||
}
|
||||
|
||||
const downModel = ref<Model>()
|
||||
|
||||
const currentModel = computed(() => {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@
|
|||
<div class="flex-between">
|
||||
<span class="ellipsis" :title="row.name">{{ row.name }}</span>
|
||||
<div @click.stop v-show="mouseId === row.id">
|
||||
<el-dropdown :teleported="false" trigger="click">
|
||||
<el-dropdown :teleported="false" trigger="click"
|
||||
v-if="editPermission() || dlePermission()"
|
||||
>
|
||||
<el-button text>
|
||||
<el-icon class="color-secondary">
|
||||
<MoreFilled />
|
||||
|
|
@ -74,20 +76,7 @@
|
|||
<el-dropdown-item
|
||||
@click.stop="createOrUpdate(row)"
|
||||
class="p-8"
|
||||
v-if="
|
||||
hasPermission(
|
||||
new ComplexPermission(
|
||||
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||
[
|
||||
PermissionConst.WORKSPACE_USER_GROUP_EDIT,
|
||||
PermissionConst.USER_GROUP_EDIT,
|
||||
],
|
||||
[],
|
||||
'OR',
|
||||
),
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
v-if="editPermission()"
|
||||
>
|
||||
<el-icon>
|
||||
<EditPen />
|
||||
|
|
@ -97,20 +86,7 @@
|
|||
<el-dropdown-item
|
||||
@click.stop="deleteGroup(row)"
|
||||
class="border-t p-8"
|
||||
v-if="
|
||||
hasPermission(
|
||||
new ComplexPermission(
|
||||
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||
[
|
||||
PermissionConst.WORKSPACE_USER_GROUP_DELETE,
|
||||
PermissionConst.USER_GROUP_DELETE,
|
||||
],
|
||||
[],
|
||||
'OR',
|
||||
),
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
v-if="dlePermission()"
|
||||
>
|
||||
<el-icon>
|
||||
<Delete />
|
||||
|
|
@ -307,6 +283,22 @@ async function getUserGroupList() {
|
|||
}
|
||||
}
|
||||
|
||||
const editPermission = () => {
|
||||
return hasPermission(new ComplexPermission(
|
||||
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||
[PermissionConst.WORKSPACE_USER_GROUP_EDIT,
|
||||
PermissionConst.USER_GROUP_EDIT,],[],
|
||||
'OR',),'OR',)
|
||||
}
|
||||
|
||||
const dlePermission = () => {
|
||||
return hasPermission(new ComplexPermission(
|
||||
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||
[PermissionConst.WORKSPACE_USER_GROUP_DELETE,
|
||||
PermissionConst.USER_GROUP_DELETE,],[],
|
||||
'OR',),'OR',)
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getUserGroupList()
|
||||
current.value = list.value[0]
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@
|
|||
>({{ roleTypeMap[row.type as RoleTypeEnum] }})</span
|
||||
>
|
||||
</span>
|
||||
<div @click.stop v-show="mouseId === row.id">
|
||||
<div @click.stop v-show="mouseId === row.id"
|
||||
v-if="editPermission() || delPermission()">
|
||||
<el-dropdown :teleported="false" trigger="click">
|
||||
<el-button text>
|
||||
<el-icon class="color-secondary">
|
||||
|
|
@ -84,17 +85,7 @@
|
|||
<el-dropdown-item
|
||||
@click.stop="createOrUpdateRole(row)"
|
||||
class="p-8"
|
||||
v-if="
|
||||
hasPermission(
|
||||
new ComplexPermission(
|
||||
[RoleConst.ADMIN],
|
||||
[PermissionConst.ROLE_EDIT],
|
||||
[],
|
||||
'OR',
|
||||
),
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
v-if="editPermission()"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>
|
||||
{{ $t('common.rename') }}
|
||||
|
|
@ -102,17 +93,7 @@
|
|||
<el-dropdown-item
|
||||
@click.stop="deleteRole(row)"
|
||||
class="border-t p-8"
|
||||
v-if="
|
||||
hasPermission(
|
||||
new ComplexPermission(
|
||||
[RoleConst.ADMIN],
|
||||
[PermissionConst.ROLE_DELETE],
|
||||
[],
|
||||
'OR',
|
||||
),
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
v-if="delPermission()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
{{ $t('common.delete') }}
|
||||
|
|
@ -205,6 +186,16 @@ async function getRole() {
|
|||
}
|
||||
}
|
||||
|
||||
const editPermission = () => {
|
||||
return hasPermission(new ComplexPermission([RoleConst.ADMIN],
|
||||
[PermissionConst.ROLE_EDIT],[],'OR',),'OR',)
|
||||
}
|
||||
|
||||
const delPermission = () => {
|
||||
return hasPermission(new ComplexPermission([RoleConst.ADMIN],
|
||||
[PermissionConst.ROLE_DELETE],[],'OR',),'OR',)
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getRole()
|
||||
currentRole.value = internalRoleList.value[0]
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@
|
|||
<div class="flex-between">
|
||||
<span class="ellipsis" :title="row.name">{{ row.name }}</span>
|
||||
<div @click.stop v-show="mouseId === row.id">
|
||||
<el-dropdown :teleported="false" trigger="click">
|
||||
<el-dropdown :teleported="false" trigger="click"
|
||||
v-if="editPermission() || dlePermission()"
|
||||
>
|
||||
<el-button text>
|
||||
<el-icon class="color-secondary">
|
||||
<MoreFilled />
|
||||
|
|
@ -54,12 +56,7 @@
|
|||
<el-dropdown-item
|
||||
@click.stop="createOrUpdateWorkspace(row)"
|
||||
class="p-8"
|
||||
v-if="
|
||||
hasPermission(
|
||||
[RoleConst.ADMIN, PermissionConst.WORKSPACE_EDIT],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
v-if="editPermission()"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>
|
||||
{{ $t('common.rename') }}
|
||||
|
|
@ -67,13 +64,7 @@
|
|||
<el-dropdown-item
|
||||
@click.stop="deleteWorkspace(row)"
|
||||
class="border-t p-8"
|
||||
v-if="
|
||||
row.id !== 'default' &&
|
||||
hasPermission(
|
||||
[RoleConst.ADMIN, PermissionConst.WORKSPACE_DELETE],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
v-if="dlePermission()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
{{ $t('common.delete') }}
|
||||
|
|
@ -144,6 +135,16 @@ onMounted(async () => {
|
|||
currentWorkspace.value = list.value[0]
|
||||
})
|
||||
|
||||
const editPermission = () => {
|
||||
return hasPermission([RoleConst.ADMIN,
|
||||
PermissionConst.WORKSPACE_EDIT],'OR',)
|
||||
}
|
||||
|
||||
const dlePermission = () => {
|
||||
return hasPermission([RoleConst.ADMIN,
|
||||
PermissionConst.WORKSPACE_DELETE],'OR',)
|
||||
}
|
||||
|
||||
async function refresh(workspace?: WorkspaceItem) {
|
||||
await getWorkspace()
|
||||
// 创建后选中新建的
|
||||
|
|
|
|||
Loading…
Reference in New Issue