159 lines
6.5 KiB
Vue
159 lines
6.5 KiB
Vue
/**
|
|
* features/chat/components/ChatViewOverlays.vue
|
|
* 对话页全局弹窗与浮层:文件预览、反馈、查询预览、履历检索提示、请假 OA、删除确认、发货重试确认、学习之窗。
|
|
*/
|
|
<script setup lang="ts">
|
|
import FilePreviewModal from '@/shared/components/FilePreviewModal.vue';
|
|
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
|
import GeneralFeedbackDialog from '@/shared/components/GeneralFeedbackDialog.vue';
|
|
import ChatQueryPreviewDialog from '@/features/chat/components/ChatQueryPreviewDialog.vue';
|
|
import ChatLeaveAgentDialog from '@/features/chat/components/ChatLeaveAgentDialog.vue';
|
|
import ChatOALoginDialog from '@/features/chat/components/ChatOALoginDialog.vue';
|
|
import ChatGuideModal from '@/features/chat/components/ChatGuideModal.vue';
|
|
import ShippingNoticeDuplicateDialog from '@/features/chat/components/ShippingNoticeDuplicateDialog.vue';
|
|
import { Check, Loader2, X } from 'lucide-vue-next';
|
|
import { nextTick } from 'vue';
|
|
import { useChatPageContext } from '@/features/chat/composables/chat.context';
|
|
import { getAuthHeaders } from '@/shared/utils/auth';
|
|
|
|
const page = useChatPageContext();
|
|
|
|
function onFeedbackSubmitted() {
|
|
const idx = page.activeFeedbackMessageIndex;
|
|
const target = idx !== null ? page.messages[idx] : undefined;
|
|
if (target) target.rated = true;
|
|
page.msg.success(page.t('chat.feedbackSubmitSuccess'));
|
|
page.showGeneralFeedbackDialog = false;
|
|
}
|
|
|
|
async function handleQueryPreviewAssetHistory(assetId: string, assetName: string) {
|
|
page.queryPreview.close();
|
|
await nextTick();
|
|
await page.assetHistory.openHistory(assetId, assetName);
|
|
}
|
|
|
|
async function handleQueryPreviewAssetImage(assetId: string, assetName: string) {
|
|
page.queryPreview.close();
|
|
await nextTick();
|
|
await page.assetImage.openImage(assetId, assetName);
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<FilePreviewModal
|
|
v-model="page.filePreviewVisible"
|
|
:file="page.previewFile"
|
|
:files="page.previewFiles"
|
|
:current-index="page.currentPreviewIndex"
|
|
:agent-id="page.currentAgentId"
|
|
:auth-headers="getAuthHeaders()"
|
|
@update:current-index="page.setPreviewFileIndex"
|
|
/>
|
|
<GeneralFeedbackDialog
|
|
v-model="page.showGeneralFeedbackDialog"
|
|
:auth-headers="getAuthHeaders()"
|
|
source-page="chat"
|
|
:chat-log-id="page.currentGeneralFeedbackChatLogId"
|
|
@submitted="onFeedbackSubmitted"
|
|
/>
|
|
<ChatQueryPreviewDialog
|
|
v-model:open="page.showQueryPreviewDialog"
|
|
:loading="page.queryPreviewLoading"
|
|
:error="page.queryPreviewError"
|
|
:state="page.queryPreviewState"
|
|
@close="page.queryPreview.close"
|
|
@change-page="page.queryPreview.changePage"
|
|
@open-asset-history="({ assetId, assetName }) => handleQueryPreviewAssetHistory(assetId, assetName)"
|
|
@open-asset-image="({ assetId, assetName }) => handleQueryPreviewAssetImage(assetId, assetName)"
|
|
/>
|
|
<div
|
|
v-if="page.assetHistory.loading"
|
|
class="pointer-events-none fixed inset-x-0 top-20 z-[145] flex justify-center px-4"
|
|
>
|
|
<div class="flex items-center gap-2 rounded-full border border-brand-200 bg-white/95 px-4 py-2 text-sm text-brand-700 shadow-lg backdrop-blur">
|
|
<Loader2 class="h-4 w-4 animate-spin text-brand-500" />
|
|
<span>{{ page.t('chat.assetHistory.searchingToast') }}</span>
|
|
</div>
|
|
</div>
|
|
<div
|
|
v-if="page.assetImage.loading"
|
|
class="pointer-events-none fixed inset-x-0 top-20 z-[145] flex justify-center px-4"
|
|
>
|
|
<div class="flex items-center gap-2 rounded-full border border-brand-200 bg-white/95 px-4 py-2 text-sm text-brand-700 shadow-lg backdrop-blur">
|
|
<Loader2 class="h-4 w-4 animate-spin text-brand-500" />
|
|
<span>{{ page.t('chat.assetImage.searchingToast') }}</span>
|
|
</div>
|
|
</div>
|
|
<ChatLeaveAgentDialog
|
|
v-model:open="page.showLeaveAgentDialog"
|
|
v-model:keyword="page.leaveAgentKeyword"
|
|
:select-role="page.leaveUserSelectRole"
|
|
:options="page.leaveAgentOptions"
|
|
:loading="page.leaveAgentLoading"
|
|
:page="page.leaveAgentPage"
|
|
:has-more="page.leaveAgentHasMore"
|
|
@close="page.closeLeaveAgentDialog"
|
|
@search="page.handleAgentSearch"
|
|
@load-more="page.loadMoreAgents"
|
|
@load-all="page.loadAllAgents"
|
|
@select="page.selectLeaveAgent"
|
|
/>
|
|
<ChatOALoginDialog
|
|
v-model:open="page.showOALoginDialog"
|
|
v-model:employee-id="page.oaLoginEmployeeId"
|
|
v-model:password="page.oaLoginPassword"
|
|
@confirm="page.confirmOALogin"
|
|
@cancel="page.cancelOALogin"
|
|
/>
|
|
<DeleteConfirmDialog
|
|
v-model="page.showDeleteConfirmDialog"
|
|
:message="page.deleteConfirmMessage"
|
|
@confirm="page.handleDeleteConfirm"
|
|
@cancel="page.closeDeleteConfirmDialog"
|
|
/>
|
|
<DeleteConfirmDialog
|
|
v-model="page.showRetryFailedConfirmDialog"
|
|
:title="page.t('chat.shippingNoticeUi.retryFailedConfirmTitle')"
|
|
:message="page.t('chat.shippingNoticeUi.retryFailedConfirmMessage')"
|
|
:confirm-text="page.t('chat.shippingNoticeUi.retryFailedConfirmAction')"
|
|
:confirm-loading="page.retryingShippingPendingTasks"
|
|
confirm-tone="primary"
|
|
@confirm="page.handleRetryFailedConfirm"
|
|
@cancel="page.closeRetryFailedConfirm"
|
|
/>
|
|
<div
|
|
v-if="page.shippingToastMessage"
|
|
class="pointer-events-none fixed inset-x-0 top-20 z-[145] flex justify-center px-4"
|
|
>
|
|
<div class="pointer-events-auto flex max-w-[min(92vw,28rem)] items-start gap-2 rounded-full border border-emerald-200 bg-white/95 px-4 py-2 text-sm text-emerald-800 shadow-lg backdrop-blur">
|
|
<Check class="mt-0.5 h-4 w-4 shrink-0 text-emerald-500" />
|
|
<span class="min-w-0 flex-1 leading-5">{{ page.shippingToastMessage }}</span>
|
|
<button
|
|
type="button"
|
|
class="btn-icon-ds -mr-1 shrink-0"
|
|
:aria-label="page.t('common.close')"
|
|
@click="page.clearShippingToast"
|
|
>
|
|
<X class="h-3.5 w-3.5" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<ChatGuideModal
|
|
v-model:open="page.showGuideModal"
|
|
v-model:active-guide-id="page.activeGuideId"
|
|
v-model:show-sidebar="page.showGuideSidebar"
|
|
:agent-name="page.currentAgent?.name || 'AI'"
|
|
:guides="page.agentGuides"
|
|
:active-guide="page.activeGuide"
|
|
/>
|
|
<ShippingNoticeDuplicateDialog
|
|
:open="!!page.showShippingDuplicateDialog"
|
|
:attachment="page.shippingDuplicateAttachment || null"
|
|
:can-force-create="!!page.canForceCreateShippingDuplicate"
|
|
@update:open="(v) => { if (!v) page.closeShippingDuplicateDialog?.(); }"
|
|
@resolve="(payload) => void page.resolveShippingDuplicateDialog?.(payload)"
|
|
@remove="() => void page.removeShippingDuplicateDialogAttachment?.()"
|
|
@cancel="page.closeShippingDuplicateDialog?.()"
|
|
/>
|
|
</template>
|