perf: 删除历史记录

This commit is contained in:
rd
2025-09-01 09:33:13 +08:00
parent f9bc0e0187
commit e0aaa74d4f
4 changed files with 15 additions and 10 deletions

View File

@ -21,29 +21,28 @@ import icon1 from '@/assets/img/media-account/icon-warn-1.png';
const emits = defineEmits(['update', 'close', 'batchUpdate']);
const visible = ref(false);
const chatId = ref(null);
const conversationId = ref(null);
const isBatch = computed(() => Array.isArray(taskId.value));
// const isBatch = computed(() => Array.isArray(taskId.value));
function onClose() {
visible.value = false;
chatId.value = null;
conversationId.value = null;
emits('close');
}
const open = (record) => {
console.log({record})
const { id = null } = record;
chatId.value = id;
conversationId.value = id;
visible.value = true;
};
async function onDelete() {
const { code } = await deleteHistoryItem(chatId.value);
const { code } = await deleteHistoryItem(conversationId.value);
if (code === 200) {
AMessage.success('删除成功');
emits('delete', chatId.value);
emits('delete', conversationId.value);
onClose();
}
}

View File

@ -82,6 +82,12 @@ export default {
const { id } = item;
handleUserHome({ conversationId: id });
};
const onDeleteConversation = (id) => {
const index = dataSource.value.findIndex((item) => item.id === id);
if (index === -1) return;
dataSource.value.splice(index, 1);
}
expose({
showDrawer,
@ -107,7 +113,7 @@ export default {
</section>
)}
<DeleteChatModal ref={deleteChatModalRef} />
<DeleteChatModal ref={deleteChatModalRef} onDelete={onDeleteConversation}/>
</Drawer>
);
},

View File

@ -412,7 +412,7 @@ export default {
loading={true}
tip={`${isTextTab.value ? '文本' : '图片'}检测中`}
size={72}
class="h-298px !flex flex-col justify-center items-center"
class="h-298px !flex flex-col justify-center items-center color-#6d4cfe"
/>
</div>
);

View File

@ -411,7 +411,7 @@ export default {
loading={true}
tip={`${isTextTab.value ? '文本' : '图片'}检测中`}
size={72}
class="h-298px !flex flex-col justify-center items-center"
class="h-298px !flex flex-col justify-center items-center color-#6d4cfe"
/>
</div>
);