Commit 65c1c1f2 authored by nick zheng's avatar nick zheng

chore: 知识库切片查询优化

parent 1bd7f85b
......@@ -108,8 +108,6 @@ async function handleGetKnowledgeChunkList() {
pagingInfo.value = res.pagingInfo as PaginationInfo
knowledgeChunkListLoading.value = false
isSearchEmptyList.value = !!searchKnowledgeChunkValue.value && pagingInfo.value.totalRows === 0
scrollBarRef.value?.scrollTo({ top: 0 })
}
}
......@@ -120,17 +118,20 @@ function handleBackKnowledgeDocumentList() {
async function handleGetKnowledgeChunkListUpdatePageNo(pageNo: number) {
pagingInfo.value.pageNo = pageNo
await handleGetKnowledgeChunkList()
scrollBarRef.value?.scrollTo({ top: 0 })
}
async function handleGetKnowledgeChunkListUpdatePageSize(pageSize: number) {
pagingInfo.value.pageNo = 1
pagingInfo.value.pageSize = pageSize
await handleGetKnowledgeChunkList()
scrollBarRef.value?.scrollTo({ top: 0 })
}
async function handleSearchKnowledgeChunkList() {
pagingInfo.value.pageNo = 1
await handleGetKnowledgeChunkList()
scrollBarRef.value?.scrollTo({ top: 0 })
}
function handleEditKnowledgeChunkModal(chunkItem: KnowledgeChunkItem) {
......@@ -204,7 +205,7 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
})
if (res.code === 0) {
await handleGetKnowledgeChunkList()
chunkItem.isOpen = isOpen === 'Y' ? 'N' : 'Y'
}
}
</script>
......@@ -253,25 +254,23 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
</div>
<n-spin :show="knowledgeChunkListLoading" class="w-full flex-1 overflow-hidden" content-class="flex w-full h-full">
<n-scrollbar
v-if="!knowledgeChunkListLoading && knowledgeChunkList.length"
ref="scrollBarRef"
class="grid w-full flex-1 overflow-hidden"
>
<div class="grid gap-5">
<KnowledgeChuckItem
v-for="chunkItem in knowledgeChunkList"
:key="chunkItem.chunkRelationId"
:chunk-item="chunkItem"
:total-chunk="totalChunk"
@edit="handleEditKnowledgeChunkModal"
@up-add-chunk="handleShowUpAddChunkModal"
@down-add-chunk="handleShowDownAddChunkModal"
@delete="handleDeleteKnowledgeChunk"
@update-open="handleUpdateOpenKnowledgeChunk"
/>
</div>
</n-scrollbar>
<div v-if="knowledgeChunkList.length" class="flex flex-1">
<n-scrollbar v-show="!knowledgeChunkListLoading" ref="scrollBarRef" class="grid w-full flex-1 overflow-hidden">
<div class="grid gap-5">
<KnowledgeChuckItem
v-for="chunkItem in knowledgeChunkList"
:key="chunkItem.chunkRelationId"
:chunk-item="chunkItem"
:total-chunk="totalChunk"
@edit="handleEditKnowledgeChunkModal"
@up-add-chunk="handleShowUpAddChunkModal"
@down-add-chunk="handleShowDownAddChunkModal"
@delete="handleDeleteKnowledgeChunk"
@update-open="handleUpdateOpenKnowledgeChunk"
/>
</div>
</n-scrollbar>
</div>
<div
v-show="!knowledgeChunkListLoading && knowledgeChunkList.length === 0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment