perf: Morefield paragraph tool

This commit is contained in:
zhangzhanwei 2025-07-22 14:17:03 +08:00 committed by zhanweizhang7
parent 42a4ab4e9a
commit f6b271e929
5 changed files with 39 additions and 3 deletions

View File

@ -14,6 +14,7 @@ const systemManage = {
), ),
delete: () => false, delete: () => false,
create: () => false, create: () => false,
import: () => false,
switch: () => false, switch: () => false,
edit: () => false, edit: () => false,
copy: () => false, copy: () => false,

View File

@ -11,6 +11,14 @@ const share = {
], ],
'OR', 'OR',
), ),
import: () =>
hasPermission(
[
RoleConst.ADMIN,
PermissionConst.SHARED_TOOL_IMPORT,
],
'OR',
),
delete: () => delete: () =>
hasPermission( hasPermission(
[ [

View File

@ -20,6 +20,16 @@ const workspace = {
], ],
'OR' 'OR'
), ),
import: () =>
hasPermission(
[
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
RoleConst.USER.getWorkspaceRole,
PermissionConst.TOOL_IMPORT.getWorkspacePermission,
PermissionConst.TOOL_IMPORT.getWorkspacePermissionWorkspaceManageRole
],
'OR'
),
folderCreate: () => folderCreate: () =>
hasPermission( hasPermission(
[ [

View File

@ -14,6 +14,7 @@
shadow="always" shadow="always"
style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px" style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px"
@click.stop @click.stop
v-if="MoreFieldPermission(id)"
> >
<el-switch <el-switch
:loading="changeStateloading" :loading="changeStateloading"
@ -42,7 +43,9 @@
</el-icon> </el-icon>
</el-button> </el-button>
</span> </span>
<el-dropdown trigger="click" :teleported="false"> <el-dropdown trigger="click" :teleported="false"
v-if="MoreFieldPermission(id)"
>
<el-button text> <el-button text>
<el-icon><MoreFilled /></el-icon> <el-icon><MoreFilled /></el-icon>
</el-button> </el-button>
@ -154,6 +157,11 @@ const permissionPrecise = computed (() => {
return permissionMap['knowledge'][apiType.value] return permissionMap['knowledge'][apiType.value]
}) })
const MoreFieldPermission = (id:any) => {
return permissionPrecise.value.doc_generate(id) ||
permissionPrecise.value.doc_edit(id)
}
const emit = defineEmits(['dialogVisibleChange','clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move']) const emit = defineEmits(['dialogVisibleChange','clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move'])
const loading = ref(false) const loading = ref(false)
const changeStateloading = ref(false) const changeStateloading = ref(false)

View File

@ -65,7 +65,9 @@
:on-change="(file: any, fileList: any) => importTool(file)" :on-change="(file: any, fileList: any) => importTool(file)"
class="import-button" class="import-button"
> >
<el-dropdown-item> <el-dropdown-item
v-if="permissionPrecise.import()"
>
<div class="flex align-center w-full"> <div class="flex align-center w-full">
<el-avatar shape="square" class="mt-4" :size="36" style="background: none"> <el-avatar shape="square" class="mt-4" :size="36" style="background: none">
<img src="@/assets/icon_import.svg" alt="" /> <img src="@/assets/icon_import.svg" alt="" />
@ -195,7 +197,8 @@
</div> </div>
</template> </template>
<template #mouseEnter> <template #mouseEnter>
<div @click.stop v-if="!isShared"> <div @click.stop v-if="!isShared &&
MoreFieldPermission(item.id)">
<el-switch <el-switch
v-model="item.is_active" v-model="item.is_active"
:before-change="() => changeState(item)" :before-change="() => changeState(item)"
@ -350,6 +353,12 @@ const permissionPrecise = computed(() => {
return permissionMap['tool'][apiType.value] return permissionMap['tool'][apiType.value]
}) })
const MoreFieldPermission = (id: any) => {
return (permissionPrecise.value.edit(id) ||
permissionPrecise.value.export(id) ||
permissionPrecise.value.delete(id) || isSystemShare.value)
}
const InitParamDrawerRef = ref() const InitParamDrawerRef = ref()
const search_type = ref('name') const search_type = ref('name')
const search_form = ref<any>({ const search_form = ref<any>({