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