Commit 22e03906 authored by nick zheng's avatar nick zheng

fix: 文本知识库切片open添加loading

parent 568a1286
...@@ -165,12 +165,15 @@ async function handleDeleteKnowledgeChunk(chunkRelationId: string) { ...@@ -165,12 +165,15 @@ async function handleDeleteKnowledgeChunk(chunkRelationId: string) {
} }
async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) { async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
chunkItem.isOpenLoading = true
const { chunkRelationId, isOpen } = chunkItem const { chunkRelationId, isOpen } = chunkItem
const res = await fetchOpenKnowledgeChunk({ const res = await fetchOpenKnowledgeChunk({
chunkRelationId, chunkRelationId,
isOpen: isOpen === 'Y' ? 'N' : 'Y', isOpen: isOpen === 'Y' ? 'N' : 'Y',
kdId: props.kdId, kdId: props.kdId,
}).finally(() => {
chunkItem.isOpenLoading = false
}) })
if (res.code === 0) { if (res.code === 0) {
......
...@@ -74,7 +74,12 @@ const isShowKnowledgeChunkAction = ref(false) ...@@ -74,7 +74,12 @@ const isShowKnowledgeChunkAction = ref(false)
<span> {{ t('common_module.data_table_module.delete') }}</span> <span> {{ t('common_module.data_table_module.delete') }}</span>
</n-popover> </n-popover>
<n-switch :value="chunkItem.isOpen === 'Y'" size="small" @update:value="emit('updateOpen', chunkItem)" /> <n-switch
:value="chunkItem.isOpen === 'Y'"
size="small"
:loading="chunkItem.isOpenLoading"
@update:value="emit('updateOpen', chunkItem)"
/>
</div> </div>
</div> </div>
......
...@@ -46,6 +46,7 @@ export interface KnowledgeChunkItem { ...@@ -46,6 +46,7 @@ export interface KnowledgeChunkItem {
chunkRelationId: string chunkRelationId: string
chunkSort: number chunkSort: number
isOpen: 'Y' | 'N' isOpen: 'Y' | 'N'
isOpenLoading?: boolean
} }
export interface QAKnowledgeChunkKeyItem { export interface QAKnowledgeChunkKeyItem {
......
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