Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
59201b1c
Commit
59201b1c
authored
Mar 13, 2025
by
nick zheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'beta' into 'master'
chore: [问答知识库]前端展示优化 See merge request
!182
parents
63641405
31572f2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
qa-knowledge-chunk-detail.vue
...owledge-detail/qa-knowledge/qa-knowledge-chunk-detail.vue
+20
-3
personal-knowledge.vue
.../personal-space/personal-knowledge/personal-knowledge.vue
+10
-2
No files found.
src/views/personal-space/personal-knowledge/knowledge-detail/qa-knowledge/qa-knowledge-chunk-detail.vue
View file @
59201b1c
<
script
lang=
"ts"
setup
>
import
{
computed
,
onMounted
,
ref
}
from
'vue'
import
{
computed
,
onMounted
,
ref
,
useTemplateRef
}
from
'vue'
import
{
useI18n
}
from
'vue-i18n'
import
{
DataTableInst
}
from
'naive-ui'
import
{
Left
,
Search
}
from
'@icon-park/vue-next'
import
{
useElementSize
}
from
'@vueuse/core'
import
{
...
...
@@ -45,6 +46,7 @@ const userStore = useUserStore()
const
{
paginationData
}
=
usePagination
()
const
knowledgeChunkListContainer
=
ref
<
HTMLDivElement
|
null
>
(
null
)
const
knowledgeChunkTableRef
=
useTemplateRef
<
DataTableInst
>
(
'knowledgeChunkTableRef'
)
const
{
height
}
=
useElementSize
(
knowledgeChunkListContainer
)
const
totalChunk
=
ref
(
0
)
// 总分片数
...
...
@@ -143,12 +145,14 @@ async function handleQAKnowledgeChunkList() {
async
function
handleSearchKnowledgeChunkList
()
{
paginationData
.
pageNo
=
1
await
handleQAKnowledgeChunkList
()
knowledgeChunkTableRef
.
value
?.
scrollTo
({
top
:
0
,
behavior
:
'smooth'
})
}
// 更新分页数获取分片列表
async
function
handleGetKnowledgeChunkListUpdatePageNo
(
pageNo
:
number
)
{
paginationData
.
pageNo
=
pageNo
await
handleQAKnowledgeChunkList
()
knowledgeChunkTableRef
.
value
?.
scrollTo
({
top
:
0
,
behavior
:
'smooth'
})
}
// 更新分页大小获取分片列表
...
...
@@ -156,6 +160,7 @@ async function handleGetKnowledgeChunkListUpdatePageSize(pageSize: number) {
paginationData
.
pageNo
=
1
paginationData
.
pageSize
=
pageSize
await
handleQAKnowledgeChunkList
()
knowledgeChunkTableRef
.
value
?.
scrollTo
({
top
:
0
,
behavior
:
'smooth'
})
}
// 更新知识库索引
...
...
@@ -349,10 +354,20 @@ function handleBatchDeleteKnowledgeChunk() {
<div
class=
"flex-center mb-4.5 justify-between"
>
<div
class=
"flex-center gap-2.5"
>
<n-button
type=
"primary"
:disabled=
"isDisabledOperateBtn"
@
click=
"handleShowAddQAKnowledgeChunk(0)"
>
<n-button
type=
"primary"
:focusable=
"false"
:disabled=
"isDisabledOperateBtn"
@
click=
"handleShowAddQAKnowledgeChunk(0)"
>
{{
t
(
'personal_space_module.knowledge_module.add_QA'
)
}}
</n-button>
<n-button
type=
"primary"
:disabled=
"isDisabledOperateBtn"
@
click=
"showSettingChunkIndexModal = true"
>
<n-button
type=
"primary"
:focusable=
"false"
:disabled=
"isDisabledOperateBtn"
@
click=
"showSettingChunkIndexModal = true"
>
{{
t
(
'personal_space_module.knowledge_module.setting_index'
)
}}
</n-button>
</div>
...
...
@@ -383,6 +398,7 @@ function handleBatchDeleteKnowledgeChunk() {
<div
ref=
"knowledgeChunkListContainer"
class=
"w-full flex-1 overflow-hidden rounded-[10px] bg-white p-6"
>
<n-data-table
ref=
"knowledgeChunkTableRef"
:loading=
"knowledgeChunkColumnTableLoading"
:columns=
"knowledgeChunkColumn"
:data=
"knowledgeChunkList"
...
...
@@ -390,6 +406,7 @@ function handleBatchDeleteKnowledgeChunk() {
:max-height=
"tableContentY"
:row-key=
"(row: QAKnowledgeChunkContentItem) => row.chunkRelationId"
:checked-row-keys=
"checkedChunkIdList"
:pagination-behavior-on-filter=
"'first'"
@
update:checked-row-keys=
"handleUpdateCheckedChunkId"
>
<
template
#
empty
>
...
...
src/views/personal-space/personal-knowledge/personal-knowledge.vue
View file @
59201b1c
<
script
setup
lang=
"ts"
>
import
{
computed
,
onMounted
,
ref
,
watch
}
from
'vue'
import
{
computed
,
onMounted
,
ref
,
useTemplateRef
,
watch
}
from
'vue'
import
{
useRouter
}
from
'vue-router'
import
{
useI18n
}
from
'vue-i18n'
import
{
DataTableInst
}
from
'naive-ui'
import
{
Search
}
from
'@icon-park/vue-next'
import
{
createKnowledgeColumn
}
from
'./columns.tsx'
import
{
KnowledgeItem
}
from
'./types.d'
...
...
@@ -14,6 +15,8 @@ const { t } = useI18n()
const
router
=
useRouter
()
const
knowledgeListTableRef
=
useTemplateRef
<
DataTableInst
>
(
'knowledgeListTableRef'
)
const
{
pageContentWrapRef
,
tableContentY
}
=
useTableScrollY
(
48
+
32
+
16
+
16
+
28
)
const
{
paginationData
,
handlePageNoChange
,
handlePageSizeChange
}
=
usePagination
()
...
...
@@ -33,7 +36,10 @@ const emptyTableDataText = computed(() => {
return
isSearchEmptyList
.
value
?
t
(
'common_module.search_empty_data'
)
:
t
(
'common_module.empty_data'
)
})
watch
([()
=>
paginationData
.
pageNo
,
()
=>
paginationData
.
pageSize
],
handleGetKnowledgeList
)
watch
([()
=>
paginationData
.
pageNo
,
()
=>
paginationData
.
pageSize
],
()
=>
{
handleGetKnowledgeList
()
knowledgeListTableRef
.
value
?.
scrollTo
({
top
:
0
,
behavior
:
'smooth'
})
})
onMounted
(
async
()
=>
{
await
handleGetKnowledgeList
()
...
...
@@ -100,6 +106,7 @@ async function handleDeleteKnowledge(knowledgeId: number) {
function
handleSearchKnowledge
()
{
paginationData
.
pageNo
=
1
handleGetKnowledgeList
()
knowledgeListTableRef
.
value
?.
scrollTo
({
top
:
0
,
behavior
:
'smooth'
})
}
</
script
>
...
...
@@ -120,6 +127,7 @@ function handleSearchKnowledge() {
<div
class=
"mb-4"
:style=
"{ height: tableContentY + 48 + 'px' }"
>
<NDataTable
ref=
"knowledgeListTableRef"
:loading=
"knowledgeListTableLoading"
:bordered=
"true"
:bottom-bordered=
"true"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment