1131 lines
39 KiB
Vue
1131 lines
39 KiB
Vue
<template>
|
||
<div :class="['page', 'table-page', 'outbound-page', { embedded }]">
|
||
<div class="page-toolbar outbound-toolbar">
|
||
<div class="section-title">{{ t('pages.outbound.batchImportTitle') }}</div>
|
||
<div class="spacer" />
|
||
<n-button :title="t('pages.outbound.downloadZipTemplate')" @click="downloadTemplate">
|
||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||
{{ t('pages.outbound.downloadZipTemplate') }}
|
||
</n-button>
|
||
<n-upload
|
||
:show-file-list="false"
|
||
accept=".zip"
|
||
:custom-request="uploadPreview"
|
||
:disabled="controlsLocked || !auth.canWrite"
|
||
>
|
||
<n-button
|
||
type="primary"
|
||
:loading="previewing"
|
||
:disabled="controlsLocked || !auth.canWrite"
|
||
:title="controlsLocked ? t('pages.outbound.activeTaskPending') : t('pages.outbound.uploadZipPreview')"
|
||
>
|
||
<template #icon><n-icon :component="CloudUploadOutline" /></template>
|
||
{{ t('pages.outbound.uploadZipPreview') }}
|
||
</n-button>
|
||
</n-upload>
|
||
</div>
|
||
|
||
<n-card v-if="session" embedded class="summary-card" :bordered="false">
|
||
<n-space align="center" size="large" wrap>
|
||
<n-statistic :label="t('pages.outbound.totalRows')" :value="summaryTotal" />
|
||
<n-statistic :label="hasImportResult ? t('pages.outbound.successCount') : t('pages.outbound.validRows')">
|
||
<span class="success-text">{{ summarySuccessCount }}</span>
|
||
</n-statistic>
|
||
<n-statistic :label="hasImportResult ? t('pages.outbound.failCount') : t('pages.outbound.invalidRows')">
|
||
<span class="danger-text">{{ summaryFailCount }}</span>
|
||
</n-statistic>
|
||
<n-tag :type="displayStatusType">{{ displayStatusLabel }}</n-tag>
|
||
<n-progress
|
||
v-if="processing"
|
||
type="line"
|
||
:percentage="progressPercent"
|
||
:indicator-placement="'inside'"
|
||
class="progress"
|
||
/>
|
||
<n-button
|
||
v-if="auth.canWrite"
|
||
type="primary"
|
||
:disabled="!canCommit"
|
||
:loading="committing"
|
||
@click="commitImport"
|
||
>
|
||
{{ t('pages.outbound.confirmImport') }}
|
||
</n-button>
|
||
<n-button v-if="canDownloadResult" :loading="downloadingResult" @click="downloadResultFile">
|
||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||
{{ t('pages.outbound.downloadResult') }}
|
||
</n-button>
|
||
</n-space>
|
||
<n-text v-if="waitingInBackground" type="warning" class="session-error">{{ backgroundNotice }}</n-text>
|
||
<n-text v-if="displayError" type="error" class="session-error">{{ displayError }}</n-text>
|
||
</n-card>
|
||
|
||
<n-data-table
|
||
:columns="columns"
|
||
:data="rows"
|
||
:loading="loading"
|
||
:pagination="false"
|
||
class="table-fill"
|
||
flex-height
|
||
remote
|
||
:scroll-x="1480"
|
||
:row-key="(r) => r.id"
|
||
@update:sorter="onSorterChange"
|
||
/>
|
||
<div class="table-pagination">
|
||
<n-pagination v-bind="pagination" :page-sizes="outboundPageSizes" :disabled="loading" />
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { computed, h, onMounted, onUnmounted, ref } from 'vue';
|
||
import { useI18n } from 'vue-i18n';
|
||
import type { UploadCustomRequestOptions } from 'naive-ui';
|
||
import { NButton, NIcon, NImage, NTag, NText, type DataTableColumns } from 'naive-ui';
|
||
import { CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5';
|
||
import { jobApi, outboundApi } from '@/api';
|
||
import { useAuthStore } from '@/stores/auth';
|
||
import { message } from '@/utils/feedback';
|
||
import { downloadFile, saveBlob } from '@/utils/download';
|
||
import { statusType } from '@/utils/format';
|
||
import { useTablePage } from '@/composables/useTablePage';
|
||
import { openMediaViewer } from '@/composables/openMediaViewer';
|
||
import { useRemoteSort } from '@/utils/tableSort';
|
||
import { resolveMediaUrl } from '@/utils/mediaUrl';
|
||
|
||
withDefaults(defineProps<{ embedded?: boolean }>(), { embedded: false });
|
||
|
||
const { t, locale } = useI18n();
|
||
const auth = useAuthStore();
|
||
|
||
type ImportPhase = 'preview' | 'commit';
|
||
|
||
interface StoredImportContext {
|
||
sessionId: string;
|
||
jobId: string;
|
||
phase: ImportPhase;
|
||
requestId?: string;
|
||
requestUncertain?: boolean;
|
||
requestStartedAt?: number;
|
||
}
|
||
|
||
interface PollOutcome {
|
||
job: any;
|
||
timedOut: boolean;
|
||
interrupted: boolean;
|
||
cancelled: boolean;
|
||
}
|
||
|
||
const POLL_TIMEOUT_MS = 15 * 60 * 1000;
|
||
const POLL_INTERVAL_MS = 1000;
|
||
const POLL_MAX_CONSECUTIVE_ERRORS = 5;
|
||
const SESSION_CLOCK_INTERVAL_MS = 30 * 1000;
|
||
const TERMINAL_JOB_STATUSES = new Set(['SUCCESS', 'FAILED', 'PARTIAL']);
|
||
const RUNNING_SESSION_STATUSES = new Set(['PARSING', 'IMPORTING']);
|
||
const STORAGE_KEY_PREFIX = 'artveris_outbound_import';
|
||
const OUTBOUND_PAGE_SIZE_VALUES = [20, 50, 100, 200];
|
||
|
||
const rows = ref<any[]>([]);
|
||
const session = ref<any>(null);
|
||
const result = ref<any>(null);
|
||
const sessionId = ref('');
|
||
const currentRequestId = ref('');
|
||
const currentRequestStartedAt = ref(0);
|
||
const currentJobId = ref('');
|
||
const currentPhase = ref<ImportPhase | null>(null);
|
||
const currentJobStatus = ref('');
|
||
const commitRequestUncertain = ref(false);
|
||
const loading = ref(false);
|
||
const restoring = ref(true);
|
||
const previewing = ref(false);
|
||
const committing = ref(false);
|
||
const waitingInBackground = ref(false);
|
||
const backgroundNoticeKey = ref<'backgroundProcessing' | 'progressUnavailable'>('backgroundProcessing');
|
||
const downloadingResult = ref(false);
|
||
const progressPercent = ref(0);
|
||
const currentTime = ref(Date.now());
|
||
let mounted = true;
|
||
let pollVersion = 0;
|
||
let rowsRequestVersion = 0;
|
||
let uploadRequestVersion = 0;
|
||
let commitRequestVersion = 0;
|
||
let sessionClock: ReturnType<typeof setInterval> | undefined;
|
||
|
||
const processing = computed(() => previewing.value || committing.value);
|
||
const hasUnfinishedTask = computed(
|
||
() =>
|
||
waitingInBackground.value ||
|
||
commitRequestUncertain.value ||
|
||
(RUNNING_SESSION_STATUSES.has(session.value?.status) &&
|
||
!(currentJobId.value && TERMINAL_JOB_STATUSES.has(currentJobStatus.value))) ||
|
||
Boolean(currentJobId.value && !TERMINAL_JOB_STATUSES.has(currentJobStatus.value)),
|
||
);
|
||
const controlsLocked = computed(() => restoring.value || processing.value || hasUnfinishedTask.value);
|
||
const sessionHasExpired = computed(() => {
|
||
const expiresAt = session.value?.expiresAt;
|
||
const expiresAtMs = expiresAt ? Date.parse(expiresAt) : Number.NaN;
|
||
return Number.isFinite(expiresAtMs) && expiresAtMs <= currentTime.value;
|
||
});
|
||
const canCommit = computed(
|
||
() =>
|
||
!controlsLocked.value &&
|
||
!sessionHasExpired.value &&
|
||
session.value?.status === 'READY' &&
|
||
Number(session.value?.invalidCount || 0) === 0 &&
|
||
Number(session.value?.validCount || 0) > 0,
|
||
);
|
||
const hasImportResult = computed(
|
||
() => currentPhase.value === 'commit' && result.value && TERMINAL_JOB_STATUSES.has(result.value.status),
|
||
);
|
||
const canDownloadResult = computed(
|
||
() =>
|
||
hasImportResult.value &&
|
||
Boolean(currentJobId.value) &&
|
||
result.value?.resultFileUrl !== null &&
|
||
result.value?.hasResultFile !== false,
|
||
);
|
||
const summaryTotal = computed(() => Number(hasImportResult.value ? result.value?.total : session.value?.total) || 0);
|
||
const summarySuccessCount = computed(
|
||
() => Number(hasImportResult.value ? result.value?.successCount : session.value?.validCount) || 0,
|
||
);
|
||
const summaryFailCount = computed(
|
||
() => Number(hasImportResult.value ? result.value?.failCount : session.value?.invalidCount) || 0,
|
||
);
|
||
const displayError = computed(() =>
|
||
localizeBackendError(session.value?.error || (hasImportResult.value ? result.value?.error : '') || ''),
|
||
);
|
||
const displayStatusValue = computed(() =>
|
||
hasImportResult.value
|
||
? result.value.status
|
||
: sessionHasExpired.value && session.value?.status === 'READY'
|
||
? 'EXPIRED'
|
||
: session.value?.status,
|
||
);
|
||
const displayStatusType = computed(() => overallStatusType(displayStatusValue.value));
|
||
const displayStatusLabel = computed(() => overallStatusLabel(displayStatusValue.value));
|
||
const backgroundNotice = computed(() => t(`pages.outbound.${backgroundNoticeKey.value}`));
|
||
const outboundPageSizes = computed(() =>
|
||
OUTBOUND_PAGE_SIZE_VALUES.map((value) => ({ label: t('common.pagination.perPage', { n: value }), value })),
|
||
);
|
||
const { pagination, page, pageSize, resetPage, setPageResult } = useTablePage(loadRows, 20);
|
||
const { sortProps, onSorterChange, sortParams } = useRemoteSort(() => {
|
||
resetPage();
|
||
return loadRows();
|
||
});
|
||
|
||
const columns = computed<DataTableColumns<any>>(() => [
|
||
{ title: t('pages.outbound.rowNo'), key: 'rowNo', width: 80, align: 'center' },
|
||
{
|
||
title: t('common.label.status'),
|
||
key: 'status',
|
||
width: 110,
|
||
align: 'center',
|
||
render: (row) => h(NTag, { size: 'small', type: row.status === 'VALID' || row.status === 'IMPORTED' ? 'success' : 'error' }, { default: () => statusLabel(row.status) }),
|
||
},
|
||
{ title: t('pages.traceCode.shortCode'), key: 'shortCode', minWidth: 150, align: 'center', ellipsis: { tooltip: true } },
|
||
{ title: t('pages.traceCode.batchNo'), key: 'batchNo', minWidth: 180, align: 'center', ellipsis: { tooltip: true } },
|
||
{ title: t('pages.outbound.outTime'), key: 'outTime', width: 170, align: 'center', render: (row) => formatBusinessTime(row.outTime || row.preview?.outTime), ...sortProps('outTime') },
|
||
{
|
||
title: t('pages.outbound.outImage'),
|
||
key: 'images',
|
||
width: 240,
|
||
align: 'center',
|
||
render: (row) => renderImages(row),
|
||
},
|
||
{ title: t('common.label.remark'), key: 'remark', minWidth: 220, ellipsis: { tooltip: true } },
|
||
{
|
||
title: t('pages.outbound.errorReason'),
|
||
key: 'reason',
|
||
minWidth: 300,
|
||
ellipsis: { tooltip: true },
|
||
render: (row) => localizeBackendError(row.reason) || h(NText, { depth: 3 }, { default: () => '-' }),
|
||
},
|
||
]);
|
||
|
||
function rowImages(row: any) {
|
||
const list = Array.isArray(row.outImageKeys) && row.outImageKeys.length ? row.outImageKeys : row.preview?.images;
|
||
return Array.isArray(list) ? list.filter((item) => item?.url || item?.key) : [];
|
||
}
|
||
|
||
function renderImages(row: any) {
|
||
const images = rowImages(row);
|
||
if (!images.length) return h(NText, { depth: 3 }, { default: () => '-' });
|
||
const visible = images.slice(0, 3);
|
||
return h('div', { class: 'preview-images' }, [
|
||
...visible.map((item: any, index: number) =>
|
||
h(NImage, {
|
||
width: 38,
|
||
height: 38,
|
||
objectFit: 'cover',
|
||
src: mediaUrl(item),
|
||
previewDisabled: true,
|
||
onClick: () => previewImages(images, index),
|
||
}),
|
||
),
|
||
images.length > visible.length
|
||
? h(
|
||
NButton,
|
||
{ size: 'tiny', quaternary: true, onClick: () => previewImages(images, visible.length) },
|
||
{ default: () => `+${images.length - visible.length}` },
|
||
)
|
||
: null,
|
||
]);
|
||
}
|
||
|
||
function previewImages(images: any[], index: number) {
|
||
void openMediaViewer(
|
||
images.map((item) => ({ url: mediaUrl(item), name: item.name || item.key, type: item.type || 'image' })),
|
||
index,
|
||
);
|
||
}
|
||
|
||
function mediaUrl(item: any) {
|
||
return resolveMediaUrl(item?.url || item?.key);
|
||
}
|
||
|
||
function formatBusinessTime(value?: string | Date | null) {
|
||
if (!value) return '-';
|
||
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(?::\d{2})?$/.test(value)) {
|
||
return value.replace('T', ' ').slice(0, 16);
|
||
}
|
||
const date = value instanceof Date ? value : new Date(value);
|
||
if (Number.isNaN(date.getTime())) return String(value);
|
||
return new Intl.DateTimeFormat('sv-SE', {
|
||
timeZone: 'Asia/Shanghai',
|
||
year: 'numeric',
|
||
month: '2-digit',
|
||
day: '2-digit',
|
||
hour: '2-digit',
|
||
minute: '2-digit',
|
||
hour12: false,
|
||
}).format(date);
|
||
}
|
||
|
||
async function downloadTemplate() {
|
||
await downloadFile('/outbound/import/template', 'outbound-import-template.zip');
|
||
}
|
||
|
||
async function downloadResultFile() {
|
||
const id = sessionId.value;
|
||
if (!id || downloadingResult.value) return;
|
||
downloadingResult.value = true;
|
||
try {
|
||
const response = await outboundApi.result(id);
|
||
saveBlob(response.data, `outbound-import-result-${id}.xlsx`);
|
||
} finally {
|
||
downloadingResult.value = false;
|
||
}
|
||
}
|
||
|
||
async function uploadPreview({ file, onFinish, onError }: UploadCustomRequestOptions) {
|
||
if (controlsLocked.value) {
|
||
message.warning(t('pages.outbound.activeTaskPending'));
|
||
onError();
|
||
return;
|
||
}
|
||
const rawFile = file.file;
|
||
if (!validateUploadFile(rawFile)) {
|
||
onError();
|
||
return;
|
||
}
|
||
|
||
resetImportContext();
|
||
const requestVersion = ++uploadRequestVersion;
|
||
const requestId = createRequestId();
|
||
currentRequestId.value = requestId;
|
||
currentRequestStartedAt.value = Date.now();
|
||
currentPhase.value = 'preview';
|
||
persistImportContext();
|
||
previewing.value = true;
|
||
progressPercent.value = 5;
|
||
let accepted = false;
|
||
try {
|
||
const fd = new FormData();
|
||
fd.append('file', rawFile);
|
||
fd.append('requestId', requestId);
|
||
let res: any;
|
||
try {
|
||
res = await outboundApi.preview(fd);
|
||
} catch (error) {
|
||
if (!mounted || requestVersion !== uploadRequestVersion) return;
|
||
if (!isAmbiguousPreviewError(error)) throw error;
|
||
res = await recoverPreviewRequest(requestId, currentRequestStartedAt.value, requestVersion);
|
||
if (!res) throw error;
|
||
}
|
||
if (!mounted || requestVersion !== uploadRequestVersion) return;
|
||
accepted = true;
|
||
currentRequestStartedAt.value = 0;
|
||
sessionId.value = res.sessionId;
|
||
currentJobId.value = res.jobId;
|
||
persistImportContext();
|
||
|
||
const outcome = await pollJob(res.jobId, 'preview', beginPolling());
|
||
if (outcome.cancelled) return;
|
||
await handlePreviewOutcome(outcome);
|
||
if (mounted) onFinish();
|
||
} catch {
|
||
if (!mounted || requestVersion !== uploadRequestVersion) return;
|
||
if (!accepted) resetImportContext();
|
||
else if (!TERMINAL_JOB_STATUSES.has(currentJobStatus.value)) markTaskInBackground('progressUnavailable');
|
||
if (mounted) {
|
||
if (accepted) onFinish();
|
||
else onError();
|
||
}
|
||
} finally {
|
||
if (requestVersion === uploadRequestVersion) {
|
||
previewing.value = false;
|
||
progressPercent.value = 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
async function recoverPreviewRequest(requestId: string, startedAt: number, requestVersion: number) {
|
||
let attempt = 0;
|
||
const deadline = startedAt + POLL_TIMEOUT_MS;
|
||
while (Date.now() < deadline && mounted && requestVersion === uploadRequestVersion) {
|
||
try {
|
||
const recovered: any = await outboundApi.requestSession(requestId, true);
|
||
if (recovered?.id && recovered?.previewJobId) {
|
||
return { sessionId: recovered.id, jobId: recovered.previewJobId };
|
||
}
|
||
} catch (error: any) {
|
||
const status = Number(error?.response?.status || 0);
|
||
if (status && status !== 404 && !isRetryablePollError(error)) throw error;
|
||
}
|
||
attempt += 1;
|
||
await delay(Math.min(1000 * 2 ** Math.min(attempt - 1, 3), 5000));
|
||
}
|
||
return null;
|
||
}
|
||
|
||
function createRequestId() {
|
||
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') return crypto.randomUUID();
|
||
return `request_${Date.now()}_${Math.random().toString(36).slice(2)}_${Math.random().toString(36).slice(2)}`;
|
||
}
|
||
|
||
async function commitImport() {
|
||
currentTime.value = Date.now();
|
||
if (!sessionId.value || !canCommit.value) return;
|
||
const requestVersion = ++commitRequestVersion;
|
||
stopPolling();
|
||
committing.value = true;
|
||
waitingInBackground.value = false;
|
||
commitRequestUncertain.value = true;
|
||
result.value = null;
|
||
currentPhase.value = 'commit';
|
||
currentJobId.value = '';
|
||
currentJobStatus.value = '';
|
||
persistImportContext();
|
||
progressPercent.value = 5;
|
||
try {
|
||
const res: any = await outboundApi.commit(sessionId.value);
|
||
if (!mounted || requestVersion !== commitRequestVersion) return;
|
||
currentJobId.value = res.jobId;
|
||
commitRequestUncertain.value = false;
|
||
persistImportContext();
|
||
if (!mounted) return;
|
||
|
||
const outcome = await pollJob(res.jobId, 'commit', beginPolling());
|
||
if (outcome.cancelled) return;
|
||
await handleCommitOutcome(outcome);
|
||
} catch (error: any) {
|
||
if (!mounted || requestVersion !== commitRequestVersion) return;
|
||
const ambiguous = !currentJobId.value && isAmbiguousCommitError(error);
|
||
commitRequestUncertain.value = ambiguous;
|
||
persistImportContext();
|
||
if (!currentJobId.value) await recoverCommitRequest(ambiguous, requestVersion);
|
||
else if (!TERMINAL_JOB_STATUSES.has(currentJobStatus.value)) markTaskInBackground('progressUnavailable');
|
||
} finally {
|
||
if (requestVersion === commitRequestVersion) {
|
||
committing.value = false;
|
||
progressPercent.value = 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
async function pollJob(initialJobId: string, phase: ImportPhase, token: number): Promise<PollOutcome> {
|
||
const startedAt = Date.now();
|
||
let job: any = null;
|
||
let jobId = initialJobId;
|
||
let consecutiveErrors = 0;
|
||
while (Date.now() - startedAt < POLL_TIMEOUT_MS) {
|
||
const retryDelay = consecutiveErrors
|
||
? Math.min(POLL_INTERVAL_MS * 2 ** (consecutiveErrors - 1), 5000)
|
||
: POLL_INTERVAL_MS;
|
||
await delay(retryDelay);
|
||
if (!isPollActive(token)) return cancelledPollOutcome(job);
|
||
|
||
try {
|
||
if (jobId) {
|
||
job = await jobApi.get(jobId, true);
|
||
if (!isPollActive(token)) return cancelledPollOutcome(job);
|
||
currentJobStatus.value = String(job?.status || '');
|
||
updateProgress(job, startedAt);
|
||
if (TERMINAL_JOB_STATUSES.has(job.status)) {
|
||
progressPercent.value = 100;
|
||
return completedPollOutcome(job);
|
||
}
|
||
}
|
||
|
||
if (phase === 'preview' || !jobId) {
|
||
const currentSession: any = await refreshSession(false, token, true);
|
||
if (!isPollActive(token)) return cancelledPollOutcome(job);
|
||
syncJobIdFromSession(currentSession, phase);
|
||
jobId = currentJobId.value;
|
||
const terminalJob = terminalJobFromSession(currentSession, phase, job);
|
||
if (terminalJob) {
|
||
currentJobStatus.value = terminalJob.status;
|
||
progressPercent.value = 100;
|
||
return completedPollOutcome(terminalJob);
|
||
}
|
||
}
|
||
consecutiveErrors = 0;
|
||
} catch (error) {
|
||
if (!isPollActive(token)) return cancelledPollOutcome(job);
|
||
if (!isRetryablePollError(error)) throw error;
|
||
consecutiveErrors += 1;
|
||
if (consecutiveErrors >= POLL_MAX_CONSECUTIVE_ERRORS) {
|
||
return { job, timedOut: false, interrupted: true, cancelled: false };
|
||
}
|
||
}
|
||
}
|
||
return { job, timedOut: true, interrupted: false, cancelled: false };
|
||
}
|
||
|
||
function updateProgress(job: any, startedAt: number) {
|
||
const total = Number(job?.total || session.value?.total || 0);
|
||
const done = Number(job?.successCount || 0) + Number(job?.failCount || 0);
|
||
const elapsedSeconds = Math.floor((Date.now() - startedAt) / 1000);
|
||
progressPercent.value = total
|
||
? Math.min(99, Math.round((done / total) * 100))
|
||
: Math.min(95, 10 + elapsedSeconds);
|
||
}
|
||
|
||
function completedPollOutcome(job: any): PollOutcome {
|
||
return { job, timedOut: false, interrupted: false, cancelled: false };
|
||
}
|
||
|
||
function cancelledPollOutcome(job: any): PollOutcome {
|
||
return { job, timedOut: false, interrupted: false, cancelled: true };
|
||
}
|
||
|
||
function delay(ms: number) {
|
||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||
}
|
||
|
||
function isRetryablePollError(error: any) {
|
||
const status = Number(error?.response?.status || 0);
|
||
if (typeof error?.code === 'number' && !error?.isAxiosError) return false;
|
||
return !status || status === 408 || status === 429 || status >= 500;
|
||
}
|
||
|
||
function isAmbiguousCommitError(error: any) {
|
||
const status = Number(error?.response?.status || 0);
|
||
return !status || status === 408 || status === 429 || status >= 500;
|
||
}
|
||
|
||
function isAmbiguousPreviewError(error: any) {
|
||
return isAmbiguousCommitError(error);
|
||
}
|
||
|
||
function syncJobIdFromSession(value: any, phase: ImportPhase) {
|
||
if (phase === 'commit' && value?.status === 'READY') {
|
||
if (currentJobId.value) {
|
||
currentJobId.value = '';
|
||
currentJobStatus.value = '';
|
||
persistImportContext();
|
||
}
|
||
return;
|
||
}
|
||
const recoveredId = phase === 'preview' ? value?.previewJobId : value?.importJobId;
|
||
if (typeof recoveredId !== 'string' || !recoveredId || currentPhase.value !== phase) return;
|
||
if (currentJobId.value !== recoveredId) {
|
||
currentJobId.value = recoveredId;
|
||
persistImportContext();
|
||
}
|
||
}
|
||
|
||
function terminalJobFromSession(value: any, phase: ImportPhase, baseJob: any = null) {
|
||
if (!value) return null;
|
||
let status = '';
|
||
let successCount = Number(value.validCount || baseJob?.successCount || 0);
|
||
let failCount = Number(value.invalidCount || baseJob?.failCount || 0);
|
||
if (phase === 'preview') {
|
||
if (value.status === 'READY') status = 'SUCCESS';
|
||
else if (value.status === 'FAILED' || value.status === 'EXPIRED') status = 'FAILED';
|
||
} else if (value.status === 'IMPORTED') {
|
||
status = 'SUCCESS';
|
||
} else if (value.status === 'PARTIAL') {
|
||
status = 'PARTIAL';
|
||
} else if (value.status === 'FAILED' && value.importJobId) {
|
||
status = Number(value.validCount || 0) > 0 ? 'PARTIAL' : 'FAILED';
|
||
} else if (value.status === 'FAILED' || value.status === 'EXPIRED') {
|
||
status = 'FAILED';
|
||
successCount = 0;
|
||
failCount = value.status === 'EXPIRED' ? Number(value.total || 0) : failCount;
|
||
}
|
||
if (!status) return null;
|
||
return {
|
||
...(baseJob || {}),
|
||
status,
|
||
total: Number(value.total || baseJob?.total || 0),
|
||
successCount,
|
||
failCount,
|
||
error: value.error || baseJob?.error || null,
|
||
};
|
||
}
|
||
|
||
function markTaskInBackground(key: 'backgroundProcessing' | 'progressUnavailable') {
|
||
waitingInBackground.value = true;
|
||
backgroundNoticeKey.value = key;
|
||
if (mounted) message.warning(t(`pages.outbound.${key}`));
|
||
}
|
||
|
||
async function recoverCommitRequest(retryRequest: boolean, requestVersion: number) {
|
||
try {
|
||
if (retryRequest) {
|
||
for (let attempt = 0; attempt < 5; attempt += 1) {
|
||
try {
|
||
const committed: any = await outboundApi.commit(sessionId.value, true);
|
||
if (!mounted || requestVersion !== commitRequestVersion) return;
|
||
currentJobId.value = committed.jobId;
|
||
commitRequestUncertain.value = false;
|
||
persistImportContext();
|
||
const outcome = await pollJob(committed.jobId, 'commit', beginPolling());
|
||
if (!outcome.cancelled) await handleCommitOutcome(outcome);
|
||
return;
|
||
} catch (error) {
|
||
if (!mounted || requestVersion !== commitRequestVersion) return;
|
||
if (!isAmbiguousCommitError(error)) {
|
||
retryRequest = false;
|
||
break;
|
||
}
|
||
if (attempt < 4) await delay(Math.min(1000 * 2 ** attempt, 5000));
|
||
}
|
||
}
|
||
}
|
||
|
||
const currentSession: any = await refreshSession(false, undefined, true);
|
||
if (!mounted || requestVersion !== commitRequestVersion) return;
|
||
syncJobIdFromSession(currentSession, 'commit');
|
||
const terminalJob = terminalJobFromSession(currentSession, 'commit');
|
||
if (terminalJob && (currentSession?.importJobId || currentSession?.status === 'EXPIRED')) {
|
||
commitRequestUncertain.value = false;
|
||
persistImportContext();
|
||
currentJobStatus.value = terminalJob.status;
|
||
await handleCommitOutcome(completedPollOutcome(terminalJob));
|
||
return;
|
||
}
|
||
if (currentSession?.importJobId && currentJobId.value) {
|
||
commitRequestUncertain.value = false;
|
||
persistImportContext();
|
||
const outcome = await pollJob(currentJobId.value, 'commit', beginPolling());
|
||
if (!outcome.cancelled) await handleCommitOutcome(outcome);
|
||
return;
|
||
}
|
||
if (retryRequest) {
|
||
persistImportContext();
|
||
markTaskInBackground('progressUnavailable');
|
||
return;
|
||
}
|
||
commitRequestUncertain.value = false;
|
||
if (currentSession?.status === 'READY') currentPhase.value = 'preview';
|
||
persistImportContext();
|
||
if (currentSession?.status !== 'IMPORTING') {
|
||
waitingInBackground.value = false;
|
||
return;
|
||
}
|
||
} catch {
|
||
if (!TERMINAL_JOB_STATUSES.has(currentJobStatus.value)) markTaskInBackground('progressUnavailable');
|
||
}
|
||
}
|
||
|
||
async function refreshSession(showLoading = true, token?: number, silent = false) {
|
||
const id = sessionId.value;
|
||
if (!id) return null;
|
||
if (showLoading) loading.value = true;
|
||
try {
|
||
const nextSession = await outboundApi.session(id, silent);
|
||
if (mounted && id === sessionId.value && (token === undefined || isPollActive(token))) {
|
||
session.value = nextSession;
|
||
if (typeof nextSession?.requestId === 'string') currentRequestId.value = nextSession.requestId;
|
||
if (currentPhase.value) syncJobIdFromSession(nextSession, currentPhase.value);
|
||
}
|
||
return nextSession;
|
||
} finally {
|
||
if (showLoading && id === sessionId.value) loading.value = false;
|
||
}
|
||
}
|
||
|
||
async function loadRows(silent = false) {
|
||
const id = sessionId.value;
|
||
const requestVersion = ++rowsRequestVersion;
|
||
if (!id) {
|
||
loading.value = false;
|
||
rows.value = [];
|
||
setPageResult({ total: 0, page: page.value, pageSize: pageSize.value });
|
||
return;
|
||
}
|
||
const requestedPage = page.value;
|
||
const requestedPageSize = pageSize.value;
|
||
const requestedSort = sortParams();
|
||
loading.value = true;
|
||
try {
|
||
const res: any = await outboundApi.rows(id, {
|
||
page: requestedPage,
|
||
pageSize: requestedPageSize,
|
||
...requestedSort,
|
||
}, silent);
|
||
if (mounted && requestVersion === rowsRequestVersion && id === sessionId.value) {
|
||
rows.value = res.list;
|
||
setPageResult(res);
|
||
}
|
||
} finally {
|
||
if (requestVersion === rowsRequestVersion && id === sessionId.value) loading.value = false;
|
||
}
|
||
}
|
||
|
||
function validateUploadFile(file: File | null | undefined): file is File {
|
||
if (!file || file.size === 0) {
|
||
message.error(t('pages.outbound.emptyZipFile'));
|
||
return false;
|
||
}
|
||
if (!file.name.toLowerCase().endsWith('.zip')) {
|
||
message.error(t('pages.outbound.zipFileOnly'));
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
async function handlePreviewOutcome(outcome: PollOutcome) {
|
||
let resolved = outcome;
|
||
if (outcome.timedOut || outcome.interrupted) {
|
||
const terminal = await reconcileTerminalOutcome('preview', outcome);
|
||
if (!terminal) {
|
||
markTaskInBackground(outcome.interrupted ? 'progressUnavailable' : 'backgroundProcessing');
|
||
return;
|
||
}
|
||
resolved = terminal;
|
||
}
|
||
|
||
waitingInBackground.value = false;
|
||
currentJobStatus.value = String(resolved.job?.status || '');
|
||
try {
|
||
await refreshSession();
|
||
if (!mounted) return;
|
||
resetPage();
|
||
await loadRows();
|
||
} catch {
|
||
if (mounted) message.warning(t('pages.outbound.progressUnavailable'));
|
||
return;
|
||
}
|
||
if (!mounted) return;
|
||
if (resolved.job?.status === 'SUCCESS' && session.value?.status === 'READY') {
|
||
message.success(t('pages.outbound.previewReady'));
|
||
} else if (Number(session.value?.invalidCount || 0) > 0) {
|
||
message.warning(t('pages.outbound.previewHasErrors', { count: Number(session.value.invalidCount) }));
|
||
} else {
|
||
message.error(t('pages.outbound.previewFailed'));
|
||
}
|
||
}
|
||
|
||
async function handleCommitOutcome(outcome: PollOutcome) {
|
||
let resolved = outcome;
|
||
if (outcome.timedOut || outcome.interrupted) {
|
||
const terminal = await reconcileTerminalOutcome('commit', outcome);
|
||
if (!terminal) {
|
||
markTaskInBackground(outcome.interrupted ? 'progressUnavailable' : 'backgroundProcessing');
|
||
return;
|
||
}
|
||
resolved = terminal;
|
||
}
|
||
|
||
waitingInBackground.value = false;
|
||
currentJobStatus.value = String(resolved.job?.status || '');
|
||
result.value = resolved.job;
|
||
try {
|
||
await refreshSession();
|
||
if (!mounted) return;
|
||
await loadRows();
|
||
} catch {
|
||
if (mounted) message.warning(t('pages.outbound.progressUnavailable'));
|
||
return;
|
||
}
|
||
if (!mounted) return;
|
||
const success = Number(resolved.job?.successCount || 0);
|
||
const fail = Number(resolved.job?.failCount || 0);
|
||
if (resolved.job?.status === 'SUCCESS') {
|
||
message.success(t('pages.outbound.importSuccess', { success }));
|
||
} else if (resolved.job?.status === 'PARTIAL') {
|
||
message.warning(
|
||
fail > 0
|
||
? t('pages.outbound.importPartial', { success, fail })
|
||
: t('pages.outbound.importCompletedWithWarning', { success }),
|
||
);
|
||
} else {
|
||
message.error(t('pages.outbound.importFailed'));
|
||
}
|
||
}
|
||
|
||
async function reconcileTerminalOutcome(phase: ImportPhase, outcome: PollOutcome): Promise<PollOutcome | null> {
|
||
try {
|
||
const currentSession: any = await refreshSession(false, undefined, true);
|
||
if (!mounted) return null;
|
||
const terminalJob = terminalJobFromSession(currentSession, phase, outcome.job);
|
||
if (terminalJob) return completedPollOutcome(terminalJob);
|
||
await loadRows(true);
|
||
} catch {
|
||
// API 层已提示错误;保留持久化上下文,等待下次自动恢复。
|
||
}
|
||
return null;
|
||
}
|
||
|
||
function storageKey() {
|
||
return `${STORAGE_KEY_PREFIX}:${auth.user?.id || 'unknown'}`;
|
||
}
|
||
|
||
function readImportContext(): StoredImportContext | null {
|
||
try {
|
||
const raw = localStorage.getItem(storageKey());
|
||
if (!raw) return null;
|
||
const value = JSON.parse(raw) as Partial<StoredImportContext>;
|
||
if (
|
||
typeof value.sessionId !== 'string' ||
|
||
typeof value.jobId !== 'string' ||
|
||
(!value.sessionId && (typeof value.requestId !== 'string' || !value.requestId)) ||
|
||
(value.phase !== 'preview' && value.phase !== 'commit')
|
||
) {
|
||
localStorage.removeItem(storageKey());
|
||
return null;
|
||
}
|
||
return value as StoredImportContext;
|
||
} catch {
|
||
try {
|
||
localStorage.removeItem(storageKey());
|
||
} catch {
|
||
// 无需阻断主流程。
|
||
}
|
||
return null;
|
||
}
|
||
}
|
||
|
||
function persistImportContext() {
|
||
if ((!sessionId.value && !currentRequestId.value) || !currentPhase.value) return;
|
||
try {
|
||
localStorage.setItem(
|
||
storageKey(),
|
||
JSON.stringify({
|
||
sessionId: sessionId.value,
|
||
jobId: currentJobId.value,
|
||
phase: currentPhase.value,
|
||
requestId: currentRequestId.value,
|
||
requestUncertain: commitRequestUncertain.value,
|
||
requestStartedAt: currentRequestStartedAt.value || undefined,
|
||
}),
|
||
);
|
||
} catch {
|
||
// localStorage 不可用时仅失去刷新恢复能力,不影响当前导入。
|
||
}
|
||
}
|
||
|
||
function resetImportContext() {
|
||
stopPolling();
|
||
uploadRequestVersion += 1;
|
||
commitRequestVersion += 1;
|
||
rowsRequestVersion += 1;
|
||
rows.value = [];
|
||
session.value = null;
|
||
result.value = null;
|
||
sessionId.value = '';
|
||
currentRequestId.value = '';
|
||
currentRequestStartedAt.value = 0;
|
||
currentJobId.value = '';
|
||
currentPhase.value = null;
|
||
currentJobStatus.value = '';
|
||
waitingInBackground.value = false;
|
||
commitRequestUncertain.value = false;
|
||
loading.value = false;
|
||
progressPercent.value = 0;
|
||
resetPage();
|
||
setPageResult({ total: 0, page: page.value, pageSize: pageSize.value });
|
||
try {
|
||
localStorage.removeItem(storageKey());
|
||
} catch {
|
||
// 无需阻断主流程。
|
||
}
|
||
}
|
||
|
||
function beginPolling() {
|
||
pollVersion += 1;
|
||
return pollVersion;
|
||
}
|
||
|
||
function stopPolling() {
|
||
pollVersion += 1;
|
||
}
|
||
|
||
function isPollActive(token: number) {
|
||
return mounted && token === pollVersion;
|
||
}
|
||
|
||
async function restoreImportContext() {
|
||
restoring.value = true;
|
||
loading.value = true;
|
||
try {
|
||
const stored = readImportContext();
|
||
if (!stored) return;
|
||
|
||
sessionId.value = stored.sessionId;
|
||
currentRequestId.value = stored.requestId || '';
|
||
currentRequestStartedAt.value = Number(stored.requestStartedAt || Date.now());
|
||
currentJobId.value = stored.jobId;
|
||
currentPhase.value = stored.phase;
|
||
currentJobStatus.value = '';
|
||
commitRequestUncertain.value =
|
||
stored.requestUncertain === true || (stored.phase === 'commit' && !stored.jobId);
|
||
if (!sessionId.value && stored.phase === 'preview' && currentRequestId.value) {
|
||
previewing.value = true;
|
||
const requestVersion = ++uploadRequestVersion;
|
||
const recovered = await recoverPreviewRequest(
|
||
currentRequestId.value,
|
||
currentRequestStartedAt.value,
|
||
requestVersion,
|
||
);
|
||
if (!mounted || requestVersion !== uploadRequestVersion) return;
|
||
if (!recovered) {
|
||
resetImportContext();
|
||
return;
|
||
}
|
||
currentRequestStartedAt.value = 0;
|
||
sessionId.value = recovered.sessionId;
|
||
currentJobId.value = recovered.jobId;
|
||
persistImportContext();
|
||
}
|
||
if (!sessionId.value) {
|
||
resetImportContext();
|
||
return;
|
||
}
|
||
const restoredSessionId = sessionId.value;
|
||
const restoredSession: any = await refreshSession(false, undefined, true);
|
||
if (!mounted || restoredSessionId !== sessionId.value) return;
|
||
syncJobIdFromSession(restoredSession, stored.phase);
|
||
resetPage();
|
||
await loadRows(true);
|
||
if (!mounted || restoredSessionId !== sessionId.value) return;
|
||
|
||
if (stored.phase === 'commit' && commitRequestUncertain.value) {
|
||
committing.value = true;
|
||
progressPercent.value = 5;
|
||
const requestVersion = ++commitRequestVersion;
|
||
await recoverCommitRequest(true, requestVersion);
|
||
return;
|
||
}
|
||
|
||
if (!currentJobId.value) {
|
||
const terminalJob = terminalJobFromSession(session.value, stored.phase);
|
||
if (terminalJob) {
|
||
currentJobStatus.value = terminalJob.status;
|
||
if (stored.phase === 'commit') result.value = terminalJob;
|
||
return;
|
||
}
|
||
if (!RUNNING_SESSION_STATUSES.has(session.value?.status)) return;
|
||
}
|
||
|
||
if (stored.phase === 'preview') previewing.value = true;
|
||
else committing.value = true;
|
||
progressPercent.value = 5;
|
||
const outcome = await pollJob(currentJobId.value, stored.phase, beginPolling());
|
||
if (outcome.cancelled) return;
|
||
if (stored.phase === 'preview') await handlePreviewOutcome(outcome);
|
||
else await handleCommitOutcome(outcome);
|
||
} catch (error: any) {
|
||
const status = error?.response?.status;
|
||
if (status === 403 || status === 404) resetImportContext();
|
||
else if (sessionId.value && !TERMINAL_JOB_STATUSES.has(currentJobStatus.value)) {
|
||
markTaskInBackground('progressUnavailable');
|
||
}
|
||
} finally {
|
||
restoring.value = false;
|
||
loading.value = false;
|
||
previewing.value = false;
|
||
committing.value = false;
|
||
progressPercent.value = 0;
|
||
}
|
||
}
|
||
|
||
onMounted(() => {
|
||
sessionClock = setInterval(() => {
|
||
currentTime.value = Date.now();
|
||
}, SESSION_CLOCK_INTERVAL_MS);
|
||
void restoreImportContext();
|
||
});
|
||
|
||
onUnmounted(() => {
|
||
mounted = false;
|
||
stopPolling();
|
||
uploadRequestVersion += 1;
|
||
commitRequestVersion += 1;
|
||
if (sessionClock) clearInterval(sessionClock);
|
||
});
|
||
|
||
function statusLabel(value?: string) {
|
||
return value ? t(`pages.outbound.rowStatus.${value}`) : '-';
|
||
}
|
||
|
||
function sessionStatusLabel(value?: string) {
|
||
return value ? t(`pages.outbound.sessionStatus.${value}`) : '-';
|
||
}
|
||
|
||
function overallStatusLabel(value?: string) {
|
||
if (!hasImportResult.value) return sessionStatusLabel(value);
|
||
if (value === 'PARTIAL' && Number(result.value?.failCount || 0) === 0) {
|
||
return t('pages.outbound.jobStatus.SUCCESS_WITH_WARNING');
|
||
}
|
||
return value ? t(`pages.outbound.jobStatus.${value}`) : '-';
|
||
}
|
||
|
||
function overallStatusType(value?: string) {
|
||
if (hasImportResult.value) return statusType(value);
|
||
if (value === 'IMPORTED') return 'success';
|
||
if (value === 'PARSING' || value === 'IMPORTING') return 'info';
|
||
if (value === 'READY' || value === 'EXPIRED') return 'warning';
|
||
return statusType(value);
|
||
}
|
||
|
||
const BACKEND_ERROR_KEY_BY_MESSAGE: Record<string, string> = {
|
||
'追溯码为空': 'traceCodeEmpty',
|
||
'追溯码必须是 12 位数字': 'traceCodeFormat',
|
||
'追溯码不存在': 'traceCodeMissing',
|
||
'该追溯码已登记出库,不可重复出库': 'alreadyOutbound',
|
||
'批次编号不能超过 50 个字符': 'batchNoTooLong',
|
||
'备注不能超过 191 个字符': 'remarkTooLong',
|
||
'出库时间不能为空': 'outTimeEmpty',
|
||
'出库时间为空': 'outTimeEmpty',
|
||
'出库时间格式不正确,请使用 YYYY-MM-DD HH:mm': 'outTimeFormat',
|
||
'导入会话状态无效': 'sessionInvalid',
|
||
'导入会话中没有待处理数据': 'noPendingRows',
|
||
'ZIP 中必须且只能包含一个 xlsx 文件': 'xlsxCount',
|
||
'xlsx 文件必须位于 ZIP 根目录': 'xlsxRoot',
|
||
'xlsx 文件超过 100MB': 'xlsxTooLarge',
|
||
'xlsx 解压后总大小超过限制': 'xlsxExpandedTooLarge',
|
||
'ZIP 文件结构无效': 'zipInvalidStructure',
|
||
'xlsx 文件结构无效': 'xlsxInvalidStructure',
|
||
'ZIP 包含无效文件大小': 'zipInvalidSize',
|
||
'xlsx 包含无效文件大小': 'xlsxInvalidSize',
|
||
'xlsx 中缺少工作表': 'worksheetMissing',
|
||
'xlsx 中没有可导入的数据': 'noRows',
|
||
'导入预览会话已过期或状态已变化': 'previewExpired',
|
||
'导入预览会话不存在': 'previewSessionMissing',
|
||
'导入预览任务与会话不匹配': 'previewJobMismatch',
|
||
'导入会话不存在': 'importSessionMissing',
|
||
'导入任务与会话不匹配': 'importJobMismatch',
|
||
};
|
||
|
||
function localizeBackendError(value?: unknown) {
|
||
const text = typeof value === 'string' ? value : '';
|
||
if (!text || locale.value !== 'en-US' || !/[\u3400-\u9fff]/.test(text)) return text;
|
||
const exactKey = BACKEND_ERROR_KEY_BY_MESSAGE[text];
|
||
if (exactKey) return t(`pages.outbound.backendError.${exactKey}`);
|
||
|
||
const incomplete = text.match(/^导入行状态不完整:成功 (\d+),失败 (\d+),待处理 (\d+),总数 (\d+)$/);
|
||
if (incomplete) {
|
||
return t('pages.outbound.backendError.incompleteRows', {
|
||
success: incomplete[1],
|
||
fail: incomplete[2],
|
||
remaining: incomplete[3],
|
||
total: incomplete[4],
|
||
});
|
||
}
|
||
|
||
const patterns: Array<[RegExp, string, string]> = [
|
||
[/^追溯码在本次导入中重复(首次出现于第 (\d+) 行)$/, 'duplicateTraceCode', 'row'],
|
||
[/^批次编号不匹配,实际为 (.+)$/, 'batchNoMismatch', 'value'],
|
||
[/^ZIP 中存在重复图片路径:(.+)$/, 'duplicateZipImage', 'path'],
|
||
[/^图片超过 100MB:(.+)$/, 'imageTooLarge', 'path'],
|
||
[/^导入数据超过 (\d+) 行限制$/, 'tooManyRows', 'count'],
|
||
[/^ZIP 文件数量超过限制(最多 (\d+) 个)$/, 'zipEntryLimit', 'count'],
|
||
[/^出库导入临时磁盘空间不足:至少需要 (\d+)MB 可用空间$/, 'tempDiskSpace', 'mb'],
|
||
[/^xlsx 文件数量超过限制(最多 (\d+) 个)$/, 'xlsxEntryLimit', 'count'],
|
||
[/^xlsx 列数超过 (\d+) 列限制$/, 'tooManyColumns', 'count'],
|
||
[/^xlsx 表头重复:(.+)$/, 'duplicateHeader', 'value'],
|
||
[/^xlsx 包含未知表头:(.+)$/, 'unknownHeaders', 'value'],
|
||
[/^xlsx 缺少必填表头:(.+)$/, 'missingHeaders', 'value'],
|
||
[/^图片路径不安全:(.+)$/, 'unsafeImagePath', 'path'],
|
||
[/^图片必须位于 images 目录:(.+)$/, 'imageOutsideDirectory', 'path'],
|
||
[/^图片必须位于 images\/<12位追溯码>\/ 目录:(.+)$/, 'imageCodeDirectory', 'path'],
|
||
[/^图片目录对应的追溯码未出现在 xlsx 中:(.+)$/, 'orphanImageDirectory', 'code'],
|
||
[/^不支持的图片格式:(.+)$/, 'unsupportedImage', 'path'],
|
||
[/^图片实际格式与扩展名不一致:(.+)$/, 'imageFormat', 'path'],
|
||
[/^图片像素尺寸超过限制:(.+)$/, 'imagePixels', 'path'],
|
||
[/^不支持多帧图片:(.+)$/, 'animatedImage', 'path'],
|
||
[/^结果文件生成失败:(.+)$/, 'resultFileFailed', 'detail'],
|
||
[/^导入任务异常中止:(.+)$/, 'taskAborted', 'detail'],
|
||
];
|
||
for (const [pattern, key, param] of patterns) {
|
||
const match = text.match(pattern);
|
||
if (match) {
|
||
const value = param === 'detail' ? localizeBackendError(match[1]) : match[1];
|
||
return t(`pages.outbound.backendError.${key}`, { [param]: value });
|
||
}
|
||
}
|
||
return text;
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.outbound-page {
|
||
min-width: 0;
|
||
}
|
||
.outbound-page.embedded {
|
||
height: 100%;
|
||
min-height: 0;
|
||
max-height: none;
|
||
padding: 0;
|
||
}
|
||
.outbound-page.embedded .page-toolbar {
|
||
position: static;
|
||
margin: 0 0 12px;
|
||
padding: 0 0 12px;
|
||
box-shadow: none;
|
||
}
|
||
.outbound-toolbar {
|
||
margin-bottom: 12px;
|
||
}
|
||
.outbound-toolbar :deep(.n-upload) {
|
||
width: auto;
|
||
}
|
||
.section-title {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
white-space: nowrap;
|
||
}
|
||
.summary-card {
|
||
margin-bottom: 12px;
|
||
flex: 0 0 auto;
|
||
}
|
||
.success-text {
|
||
color: #138a72;
|
||
}
|
||
.danger-text {
|
||
color: #c0392b;
|
||
}
|
||
.progress {
|
||
width: 180px;
|
||
}
|
||
.session-error {
|
||
display: block;
|
||
margin-top: 8px;
|
||
}
|
||
.preview-images {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 6px;
|
||
}
|
||
.preview-images :deep(img) {
|
||
border-radius: 4px;
|
||
cursor: zoom-in;
|
||
}
|
||
</style>
|