2025-08-19 18:01:30 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<a-modal v-model:visible="visible" title="删除对话" width="400px" @close="onClose">
|
|
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
|
<img :src="icon1" width="20" height="20" class="mr-12px" />
|
|
|
|
|
|
<span>确认删除对话吗?删除后,聊天记录将不可恢复。</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<a-button size="large" @click="onClose">取消</a-button>
|
|
|
|
|
|
<a-button type="primary" class="ml-16px !bg-#f64b31 !border-none" status="danger" size="large" @click="onDelete"
|
|
|
|
|
|
>确定</a-button
|
|
|
|
|
|
>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-modal>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref } from 'vue';
|
2025-08-22 18:28:09 +08:00
|
|
|
|
import { deleteHistoryItem } from '@/api/all/chat';
|
2025-08-19 18:01:30 +08:00
|
|
|
|
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 isBatch = computed(() => Array.isArray(taskId.value));
|
|
|
|
|
|
|
|
|
|
|
|
function onClose() {
|
|
|
|
|
|
visible.value = false;
|
|
|
|
|
|
chatId.value = null;
|
|
|
|
|
|
emits('close');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const open = (record) => {
|
2025-08-22 18:28:09 +08:00
|
|
|
|
console.log({record})
|
2025-08-19 18:01:30 +08:00
|
|
|
|
const { id = null } = record;
|
|
|
|
|
|
chatId.value = id;
|
|
|
|
|
|
|
|
|
|
|
|
visible.value = true;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
async function onDelete() {
|
2025-08-22 18:28:09 +08:00
|
|
|
|
const { code } = await deleteHistoryItem(chatId.value);
|
2025-08-19 18:01:30 +08:00
|
|
|
|
if (code === 200) {
|
|
|
|
|
|
AMessage.success('删除成功');
|
|
|
|
|
|
emits('delete', chatId.value);
|
|
|
|
|
|
onClose();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ open });
|
|
|
|
|
|
</script>
|