Skip to content

Commit ba5f86d

Browse files
committed
feat: add API endpoint and methods for retrieving workspace knowledge tags
1 parent 9d1149b commit ba5f86d

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

ui/src/api/shared-workspace.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ const getAllMemberList: (arg: string, loading?: Ref<boolean>) => Promise<Result<
180180
return get('/user/list', undefined, loading)
181181
}
182182

183+
const getTags: (knowledge_id: string, params: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
184+
knowledge_id,
185+
params,
186+
loading,
187+
) => {
188+
return get(`${prefix}/${prefix_workspace.value}/knowledge/${knowledge_id}/tags`, params, loading)
189+
}
190+
183191
export default {
184192
getKnowledgeList,
185193
getKnowledgeListPage,
@@ -193,5 +201,6 @@ export default {
193201
getToolListPage,
194202
getUserGroupList,
195203
getUserGroupUserList,
196-
getAllMemberList
204+
getAllMemberList,
205+
getTags
197206
}

ui/src/views/document/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ function addTags(tags: any) {
12331233
12341234
const knowledgeTags = ref<any[]>([])
12351235
function getTags() {
1236-
loadSharedApi({type: 'knowledge', systemType: apiType.value})
1236+
loadSharedApi({type: 'knowledge', systemType: apiType.value, isShared: isShared.value})
12371237
.getTags(id, {}, loading)
12381238
.then((res: any) => {
12391239
knowledgeTags.value = res.data

ui/src/views/document/tag/TagDrawer.vue

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="flex-between mb-16">
77
<div>
88
<el-button type="primary" @click="openCreateTagDialog()"
9-
>{{ $t('views.document.tag.create') }}
9+
>{{ $t('views.document.tag.create') }}
1010
</el-button>
1111
<el-button :disabled="multipleSelection.length === 0" @click="batchDelete">
1212
{{ $t('common.delete') }}
@@ -27,7 +27,7 @@
2727
v-loading="loading"
2828
@selection-change="handleSelectionChange"
2929
>
30-
<el-table-column type="selection" width="55" />
30+
<el-table-column type="selection" width="55"/>
3131
<el-table-column :label="$t('views.document.tag.key')">
3232
<template #default="{ row }">
3333
<div class="flex-between">
@@ -41,10 +41,10 @@
4141
/>
4242
</el-button>
4343
<el-button link>
44-
<AppIcon iconName="app-edit" class="mr-4" @click="editTagKey(row)" />
44+
<AppIcon iconName="app-edit" class="mr-4" @click="editTagKey(row)"/>
4545
</el-button>
4646
<el-button link>
47-
<AppIcon iconName="app-delete" class="mr-4" @click="delTag(row)" />
47+
<AppIcon iconName="app-delete" class="mr-4" @click="delTag(row)"/>
4848
</el-button>
4949
</div>
5050
</div>
@@ -56,19 +56,19 @@
5656
{{ row.value }}
5757
<div>
5858
<el-button link>
59-
<AppIcon iconName="app-edit" class="mr-4" @click="editTagValue(row)" />
59+
<AppIcon iconName="app-edit" class="mr-4" @click="editTagValue(row)"/>
6060
</el-button>
6161
<el-button link>
62-
<AppIcon iconName="app-delete" class="mr-4" @click="delTagValue(row)" />
62+
<AppIcon iconName="app-delete" class="mr-4" @click="delTagValue(row)"/>
6363
</el-button>
6464
</div>
6565
</div>
6666
</template>
6767
</el-table-column>
6868
</el-table>
6969
</el-drawer>
70-
<CreateTagDialog ref="createTagDialogRef" @refresh="getList" />
71-
<EditTagDialog ref="editTagDialogRef" @refresh="getList" />
70+
<CreateTagDialog ref="createTagDialogRef" @refresh="getList"/>
71+
<EditTagDialog ref="editTagDialogRef" @refresh="getList"/>
7272
</template>
7373

7474
<script setup lang="ts">
@@ -84,9 +84,13 @@ const emit = defineEmits(['refresh'])
8484
8585
const route = useRoute()
8686
const {
87-
params: { id }, // id为knowledgeID
87+
params: {id, folderId}, // id为knowledgeID
8888
} = route as any
8989
90+
const isShared = computed(() => {
91+
return folderId === 'share'
92+
})
93+
9094
const apiType = computed(() => {
9195
if (route.path.includes('shared')) {
9296
return 'systemShare'
@@ -121,7 +125,7 @@ const tableData = computed(() => {
121125
})
122126
123127
// 合并单元格方法
124-
const spanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
128+
const spanMethod = ({row, column, rowIndex, columnIndex}: any) => {
125129
if (columnIndex === 0 || columnIndex === 1) {
126130
// key列 (由于添加了选择列,索引变为1)
127131
if (row.keyIndex === 0) {
@@ -213,9 +217,9 @@ function delTagValue(row: any) {
213217
214218
function getList() {
215219
const params = {
216-
...(filterText.value && { name: filterText.value }),
220+
...(filterText.value && {name: filterText.value}),
217221
}
218-
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
222+
loadSharedApi({type: 'knowledge', systemType: apiType.value, isShared: isShared.value})
219223
.getTags(id, params, loading)
220224
.then((res: any) => {
221225
tags.value = res.data

0 commit comments

Comments
 (0)