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,11 +254,8 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) { ...@@ -253,11 +254,8 @@ 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"
class="grid w-full flex-1 overflow-hidden"
>
<div class="grid gap-5"> <div class="grid gap-5">
<KnowledgeChuckItem <KnowledgeChuckItem
v-for="chunkItem in knowledgeChunkList" v-for="chunkItem in knowledgeChunkList"
...@@ -272,6 +270,7 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) { ...@@ -272,6 +270,7 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
/> />
</div> </div>
</n-scrollbar> </n-scrollbar>
</div>
<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