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

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

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