From ab14cf2e9dfa99ff8e063ecdae2b33a66478e8ea Mon Sep 17 00:00:00 2001 From: zhangzhanwei Date: Wed, 16 Jul 2025 11:17:18 +0800 Subject: [PATCH] feat: Paragraph edit permission --- .../paragraph/component/ParagraphCard.vue | 34 +++++++++++++++---- ui/src/views/paragraph/index.vue | 7 +++- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/ui/src/views/paragraph/component/ParagraphCard.vue b/ui/src/views/paragraph/component/ParagraphCard.vue index a50e5b06c..9f0766fdf 100644 --- a/ui/src/views/paragraph/component/ParagraphCard.vue +++ b/ui/src/views/paragraph/component/ParagraphCard.vue @@ -20,18 +20,23 @@ v-model="data.is_active" :before-change="() => changeState(data)" size="small" + v-if="permissionPrecise.doc_edit(id)" /> - + - + @@ -43,15 +48,19 @@ - {{ + {{ $t('common.delete') }} @@ -119,6 +130,7 @@ import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue' import SelectDocumentDialog from '@/views/paragraph/component/SelectDocumentDialog.vue' import { MsgSuccess, MsgConfirm } from '@/utils/message' import { loadSharedApi } from '@/utils/dynamics-api/shared-api' +import permissionMap from '@/permission' import { t } from '@/locales' const props = defineProps<{ data: any @@ -127,6 +139,8 @@ const props = defineProps<{ showMoveDown?: boolean }>() +console.log(props) + const route = useRoute() const { params: { id, documentId }, @@ -137,6 +151,10 @@ const apiType = computed(() => { return type as 'systemShare' | 'workspace' | 'systemManage' }) +const permissionPrecise = computed (() => { + return permissionMap['knowledge'][apiType.value] +}) + const emit = defineEmits(['clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move']) const loading = ref(false) const changeStateloading = ref(false) @@ -202,7 +220,11 @@ function editParagraph(row: any) { } } +const cardClick = permissionPrecise.value.doc_edit(id) + function handleClickCard(row: any) { + if (!cardClick) + {return } if (!props.disabled) { editParagraph(row) }else { diff --git a/ui/src/views/paragraph/index.vue b/ui/src/views/paragraph/index.vue index ea511c53e..43f4f34e5 100644 --- a/ui/src/views/paragraph/index.vue +++ b/ui/src/views/paragraph/index.vue @@ -12,7 +12,7 @@ >) -
+
{{ $t('views.paragraph.setting.batchSelected') }} @@ -172,6 +172,7 @@ import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vu import { VueDraggable } from 'vue-draggable-plus' import { MsgSuccess, MsgConfirm } from '@/utils/message' import { loadSharedApi } from '@/utils/dynamics-api/shared-api' +import permissionMap from '@/permission' import { t } from '@/locales' const route = useRoute() const { @@ -185,6 +186,10 @@ const apiType = computed(() => { const shareDisabled = computed(() => { return isShared === 'true' }) +const permissionPrecise = computed(() => { + return permissionMap['knowledge'][apiType.value] +}) + const SelectDocumentDialogRef = ref() const ParagraphDialogRef = ref()