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

chore: 知识库切片查询优化

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