feat: add API endpoint and methods for retrieving workspace knowledge tags
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
CaptainB 2025-10-20 11:32:44 +08:00
parent 9d1149b5ca
commit ba5f86d6df
3 changed files with 27 additions and 14 deletions

View File

@ -180,6 +180,14 @@ const getAllMemberList: (arg: string, loading?: Ref<boolean>) => Promise<Result<
return get('/user/list', undefined, loading)
}
const getTags: (knowledge_id: string, params: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
knowledge_id,
params,
loading,
) => {
return get(`${prefix}/${prefix_workspace.value}/knowledge/${knowledge_id}/tags`, params, loading)
}
export default {
getKnowledgeList,
getKnowledgeListPage,
@ -193,5 +201,6 @@ export default {
getToolListPage,
getUserGroupList,
getUserGroupUserList,
getAllMemberList
getAllMemberList,
getTags
}

View File

@ -1233,7 +1233,7 @@ function addTags(tags: any) {
const knowledgeTags = ref<any[]>([])
function getTags() {
loadSharedApi({type: 'knowledge', systemType: apiType.value})
loadSharedApi({type: 'knowledge', systemType: apiType.value, isShared: isShared.value})
.getTags(id, {}, loading)
.then((res: any) => {
knowledgeTags.value = res.data

View File

@ -6,7 +6,7 @@
<div class="flex-between mb-16">
<div>
<el-button type="primary" @click="openCreateTagDialog()"
>{{ $t('views.document.tag.create') }}
>{{ $t('views.document.tag.create') }}
</el-button>
<el-button :disabled="multipleSelection.length === 0" @click="batchDelete">
{{ $t('common.delete') }}
@ -27,7 +27,7 @@
v-loading="loading"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column type="selection" width="55"/>
<el-table-column :label="$t('views.document.tag.key')">
<template #default="{ row }">
<div class="flex-between">
@ -41,10 +41,10 @@
/>
</el-button>
<el-button link>
<AppIcon iconName="app-edit" class="mr-4" @click="editTagKey(row)" />
<AppIcon iconName="app-edit" class="mr-4" @click="editTagKey(row)"/>
</el-button>
<el-button link>
<AppIcon iconName="app-delete" class="mr-4" @click="delTag(row)" />
<AppIcon iconName="app-delete" class="mr-4" @click="delTag(row)"/>
</el-button>
</div>
</div>
@ -56,10 +56,10 @@
{{ row.value }}
<div>
<el-button link>
<AppIcon iconName="app-edit" class="mr-4" @click="editTagValue(row)" />
<AppIcon iconName="app-edit" class="mr-4" @click="editTagValue(row)"/>
</el-button>
<el-button link>
<AppIcon iconName="app-delete" class="mr-4" @click="delTagValue(row)" />
<AppIcon iconName="app-delete" class="mr-4" @click="delTagValue(row)"/>
</el-button>
</div>
</div>
@ -67,8 +67,8 @@
</el-table-column>
</el-table>
</el-drawer>
<CreateTagDialog ref="createTagDialogRef" @refresh="getList" />
<EditTagDialog ref="editTagDialogRef" @refresh="getList" />
<CreateTagDialog ref="createTagDialogRef" @refresh="getList"/>
<EditTagDialog ref="editTagDialogRef" @refresh="getList"/>
</template>
<script setup lang="ts">
@ -84,9 +84,13 @@ const emit = defineEmits(['refresh'])
const route = useRoute()
const {
params: { id }, // idknowledgeID
params: {id, folderId}, // idknowledgeID
} = route as any
const isShared = computed(() => {
return folderId === 'share'
})
const apiType = computed(() => {
if (route.path.includes('shared')) {
return 'systemShare'
@ -121,7 +125,7 @@ const tableData = computed(() => {
})
//
const spanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
const spanMethod = ({row, column, rowIndex, columnIndex}: any) => {
if (columnIndex === 0 || columnIndex === 1) {
// key (1)
if (row.keyIndex === 0) {
@ -213,9 +217,9 @@ function delTagValue(row: any) {
function getList() {
const params = {
...(filterText.value && { name: filterText.value }),
...(filterText.value && {name: filterText.value}),
}
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
loadSharedApi({type: 'knowledge', systemType: apiType.value, isShared: isShared.value})
.getTags(id, params, loading)
.then((res: any) => {
tags.value = res.data