style(chat): 统一会话/批次中心/订单工作台颜色为语义令牌

This commit is contained in:
hugo committed 2026-09-04 02:21:55 +08:00
1 parent 1269e04116
commit 420f1a4abb
57 files changed
+1857 -1166

No files matched your search

@@ -38,7 +38,7 @@ const emit = defineEmits<{
>
<div
class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors"
:class="isResizing ? 'bg-brand-500' : 'bg-slate-200'"
:class="isResizing ? 'bg-brand-500' : 'bg-surface-strong'"
/>
</div>
@@ -94,7 +94,7 @@ const emit = defineEmits<{
</button>
</div>
<div class="min-h-0 flex-1 bg-slate-100">
<div class="min-h-0 flex-1 bg-surface-strong">
<div
v-if="!currentUrl"
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-muted"
@@ -93,7 +93,7 @@ defineProps<{
v-else-if="activeGuide.file_type === 'pdf'"
:key="'pdf-' + activeGuide.id"
:src="activeGuide.file_url || activeGuide.file_path"
class="h-full w-full border-none bg-white"
class="h-full w-full border-none bg-surface"
/>
<img
v-else
@@ -417,7 +417,7 @@ watch(
role="tab"
class="rounded-full px-3 py-1.5 text-xs font-bold transition-all"
:class="procurementReviewMode === 'compare'
? 'bg-white text-[#2f80d1] shadow-[0_1px_4px_rgba(23,32,51,0.08)]'
? 'bg-surface text-[#2f80d1] shadow-[0_1px_4px_rgba(23,32,51,0.08)]'
: 'bg-transparent text-[#667792] hover:text-[#172033]'"
:aria-selected="procurementReviewMode === 'compare'"
@click="procurementReviewMode = 'compare'"
@@ -429,7 +429,7 @@ watch(
role="tab"
class="rounded-full px-3 py-1.5 text-xs font-bold transition-all"
:class="procurementReviewMode === 'solo'
? 'bg-white text-[#2f80d1] shadow-[0_1px_4px_rgba(23,32,51,0.08)]'
? 'bg-surface text-[#2f80d1] shadow-[0_1px_4px_rgba(23,32,51,0.08)]'
: 'bg-transparent text-[#667792] hover:text-[#172033]'"
:aria-selected="procurementReviewMode === 'solo'"
@click="procurementReviewMode = 'solo'"
@@ -542,7 +542,7 @@ watch(
</p>
<div class="mt-1 flex min-w-0 items-center gap-1.5 text-[11px] leading-none">
<span v-if="getAttachmentSize(a)" class="shrink-0 text-muted">{{ getAttachmentSize(a) }}</span>
<span v-if="getAttachmentSize(a)" class="text-slate-300">·</span>
<span v-if="getAttachmentSize(a)" class="text-muted">·</span>
<span
class="flex min-w-0 items-center gap-1 truncate"
:class="{
@@ -656,7 +656,7 @@ watch(
v-for="action in procurementQuickActions"
:key="action.label"
type="button"
class="rounded-full border border-[#d8e0ec] bg-white px-3 py-1.5 text-xs font-semibold text-[#31445f] transition-colors hover:border-[#2f80d1] hover:bg-[#eef6ff] hover:text-[#1f5f99] disabled:cursor-not-allowed disabled:opacity-50"
class="rounded-full border border-[#d8e0ec] bg-surface px-3 py-1.5 text-xs font-semibold text-[#31445f] transition-colors hover:border-[#2f80d1] hover:bg-[#eef6ff] hover:text-[#1f5f99] disabled:cursor-not-allowed disabled:opacity-50"
:disabled="isThinking || isUploadingAttachments"
@click="runProcurementQuickAction(action.prompt)"
>
@@ -858,7 +858,7 @@ watch(
:disabled="!canSendMessage"
class="flex h-10 w-10 shrink-0 items-center justify-center rounded-full border shadow-sm transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50"
:class="!canSendMessage
? 'border-default bg-slate-100 text-muted'
? 'border-default bg-surface-strong text-muted'
: 'border-brand-500 bg-brand-500 text-white shadow-[0_0_0_4px_rgba(59,130,246,0.18)] hover:scale-105 hover:bg-brand-600 hover:shadow-[0_0_0_6px_rgba(59,130,246,0.24)] active:scale-95'"
@click="emit('send')"
>
@@ -207,7 +207,7 @@ const isLatestAssistantMessage = (items: ChatMessage[], index: number) => {
<button
v-if="showScrollToBottom"
type="button"
class="sticky bottom-4 left-1/2 z-30 flex h-10 w-10 -translate-x-1/2 items-center justify-center rounded-full border border-slate-100 bg-white text-[28px] font-light leading-none text-slate-500 shadow-[0_10px_28px_rgba(15,23,42,0.16)] transition hover:-translate-y-0.5 hover:border-slate-200 hover:text-slate-700 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300 dark:shadow-black/30 md:bottom-6"
class="sticky bottom-4 left-1/2 z-30 flex h-10 w-10 -translate-x-1/2 items-center justify-center rounded-full border border-subtle bg-surface text-[28px] font-light leading-none text-muted shadow-[0_10px_28px_rgba(15,23,42,0.16)] transition hover:-translate-y-0.5 hover:border-slate-200 hover:text-slate-700 dark:shadow-black/30 md:bottom-6"
:title="$t('chat.scrollToLatest')"
@click="emit('scroll-to-bottom')"
>
@@ -1,4 +1,4 @@
/**
/**
* features/chat/components/ChatSidebar.vue
* 用途:桌面端聊天侧栏,承载 Agent 信息、会话历史、Agent 切换面板与底部用户菜单。
* 依赖:lucide-vue-next、LocaleToggleButton、ExternalSystemLinks、AgentCategoryList、chat.types。
@@ -205,11 +205,11 @@ const orderExtractionAttentionClass = (item: DisplayHistoryItem) => {
</div>
<div class="flex items-center justify-between px-4 py-2">
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.history') }}</span>
<span class="text-xs font-semibold text-muted">{{ $t('chat.history') }}</span>
<button
v-if="displayHistory.length > 0"
type="button"
class="text-xs text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200"
class="text-xs text-muted transition-colors hover:text-slate-600 dark:hover:text-slate-200"
@click="emit('clear-all-history')"
>
{{ $t('chat.clearAll') }}
@@ -217,7 +217,7 @@ const orderExtractionAttentionClass = (item: DisplayHistoryItem) => {
</div>
<div class="scrollbar-thin flex-1 overflow-y-auto px-2">
<div v-if="displayHistory.length === 0" class="py-8 text-center text-sm italic text-slate-400">
<div v-if="displayHistory.length === 0" class="py-8 text-center text-sm italic text-muted">
{{ $t('chat.noHistory') }}
</div>
<div v-else class="space-y-0.5">
@@ -225,14 +225,14 @@ const orderExtractionAttentionClass = (item: DisplayHistoryItem) => {
v-for="item in displayHistory"
:key="item.conversation_id"
class="group relative flex w-full items-center justify-between rounded-lg transition-colors"
:class="activeHistoryKey === item.conversation_id ? 'bg-brand-50 dark:bg-brand-900/20' : 'hover:bg-slate-50 dark:hover:bg-slate-800/50'"
:class="activeHistoryKey === item.conversation_id ? 'bg-brand-50 dark:bg-brand-900/20' : 'hover-surface-soft dark:hover:bg-slate-800/50'"
>
<button
type="button"
class="flex-1 truncate px-3 py-2.5 pr-8 text-left text-sm"
:class="activeHistoryKey === item.conversation_id
? 'font-medium text-brand-700 dark:text-brand-300'
: 'text-slate-600 dark:text-slate-300'"
: 'text-secondary '"
@click="emit('history-select', item)"
>
{{ item.title || $t('chat.newChat') }}
@@ -47,7 +47,7 @@ const items = computed(() =>
</div>
<blockquote
v-if="item.quote"
class="rounded border border-slate-200 bg-slate-50 px-2 py-1.5 font-mono text-[11px] leading-5 text-slate-700"
class="rounded border border-default bg-surface-soft px-2 py-1.5 font-mono text-[11px] leading-5 text-secondary"
>
{{ item.quote }}
</blockquote>
@@ -79,7 +79,7 @@ async function resolveConflict(
<span v-if="conflict.position != null">#{{ Number(conflict.position) + 1 }} · </span>
<span class="font-mono">{{ conflict.field_name }}</span>
</div>
<div class="mt-1 grid gap-1 text-slate-700 sm:grid-cols-2">
<div class="mt-1 grid gap-1 text-secondary sm:grid-cols-2">
<div>
<span class="text-muted">{{ t('chat.shippingFieldConflict.existing') }}:</span>
<span class="ml-1 font-mono">{{ conflict.existing_value || '—' }}</span>
@@ -92,7 +92,7 @@ async function resolveConflict(
<div class="mt-2 flex flex-wrap gap-2">
<button
type="button"
class="rounded border border-slate-300 bg-white px-2 py-1 text-[11px] font-medium hover:bg-slate-50 disabled:opacity-50"
class="rounded border border-default bg-surface px-2 py-1 text-[11px] font-medium hover-surface-soft disabled:opacity-50"
:disabled="resolvingId != null"
@click="resolveConflict(conflict, 'keep_existing')"
>
@@ -116,7 +116,7 @@ function issueReasonLabel(reason?: string | null): string {
class="rounded-xl border p-3 text-xs"
:class="hasBlocking
? 'border-amber-200 bg-amber-50/70'
: 'border-slate-200 bg-surface-soft/80'"
: 'border-default bg-surface-soft/80'"
>
<button
type="button"
@@ -139,7 +139,7 @@ function issueReasonLabel(reason?: string | null): string {
</button>
<div v-if="expanded" class="mt-3 space-y-3">
<div class="rounded-lg border border-slate-200/80 bg-white/80 px-2.5 py-2 text-[11px] leading-5 text-slate-700">
<div class="rounded-lg border border-slate-200/80 bg-white/80 px-2.5 py-2 text-[11px] leading-5 text-secondary">
{{ t('chat.shippingParsedResult.impactHint') }}
</div>
@@ -152,11 +152,11 @@ function issueReasonLabel(reason?: string | null): string {
/>
<div v-if="orderedHeaderFields.length" class="rounded-xl border border-default bg-white/90 p-2.5">
<div class="mb-2 font-semibold text-slate-700">{{ t('chat.shippingParsedResult.orderInformation') }}</div>
<div class="mb-2 font-semibold text-secondary">{{ t('chat.shippingParsedResult.orderInformation') }}</div>
<dl class="grid gap-2 sm:grid-cols-2">
<div v-for="field in orderedHeaderFields" :key="field.field_code" class="rounded-lg bg-slate-50 px-2.5 py-2">
<div v-for="field in orderedHeaderFields" :key="field.field_code" class="rounded-lg bg-surface-soft px-2.5 py-2">
<dt class="text-[10px] text-muted">{{ field.display_name }}</dt>
<dd class="mt-0.5 break-words text-xs text-slate-800">{{ displayValue(orderHeader?.[field.field_code]) }}</dd>
<dd class="mt-0.5 break-words text-xs text-primary">{{ displayValue(orderHeader?.[field.field_code]) }}</dd>
</div>
</dl>
</div>
@@ -64,9 +64,9 @@ const kbSyncMeta = (status?: string | null) => {
return { label: '知识库同步中', tone: 'border-sky-200 bg-sky-50 text-sky-700', icon: 'syncing' };
}
if (value === 'skipped') {
return { label: '知识库未同步', tone: 'border-slate-200 bg-slate-50 text-slate-600', icon: 'skipped' };
return { label: '知识库未同步', tone: 'border-default bg-surface-soft text-secondary', icon: 'skipped' };
}
return { label: `知识库:${status || '未知'}`, tone: 'border-slate-200 bg-slate-50 text-slate-600', icon: 'skipped' };
return { label: `知识库:${status || '未知'}`, tone: 'border-default bg-surface-soft text-secondary', icon: 'skipped' };
};
const parseDownloadFilename = (disposition: string | null, fallback: string) => {
@@ -128,14 +128,14 @@ const downloadExcel = async () => {
>
<div class="flex items-start justify-between gap-3 border-b border-sky-100/80 px-4 py-3">
<div>
<div class="flex items-center gap-2 text-sm font-semibold text-slate-800">
<div class="flex items-center gap-2 text-sm font-semibold text-primary">
<Loader2 v-if="run?.status === 'running'" class="h-4 w-4 animate-spin text-sky-600" />
<CheckCircle2 v-else-if="run?.status === 'success'" class="h-4 w-4 text-emerald-600" />
<AlertCircle v-else-if="run?.status === 'failed' || run?.status === 'partial_failed'" class="h-4 w-4 text-amber-600" />
<Clock3 v-else class="h-4 w-4 text-sky-600" />
{{ run?.title || fallbackTitle || '任务进度' }}
</div>
<p class="mt-1 text-xs text-slate-500">
<p class="mt-1 text-xs text-muted">
<template v-if="run">
批次:{{ run.run_no }} · 状态:{{ statusLabel(run.status) }}
<span v-if="run.error_message" class="ml-2 text-rose-700">错误信息:{{ run.error_message }}</span>
@@ -181,48 +181,48 @@ const downloadExcel = async () => {
{{ downloadError }}
</div>
<div class="h-2.5 overflow-hidden rounded-full bg-slate-200">
<div class="h-2.5 overflow-hidden rounded-full bg-surface-strong">
<div
class="h-full rounded-full bg-gradient-to-r from-sky-500 to-emerald-500 transition-all duration-500"
:style="{ width: `${percent()}%` }"
></div>
</div>
<div class="flex flex-wrap items-center justify-between gap-2 text-xs text-slate-500">
<div class="flex flex-wrap items-center justify-between gap-2 text-xs text-muted">
<span>进度 {{ percent() }}%</span>
<span>开始:{{ formatTime(run.started_at) }} · 完成:{{ formatTime(run.finished_at) }}</span>
</div>
<div class="grid grid-cols-2 gap-1.5 sm:grid-cols-4 lg:grid-cols-8">
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">总数</div>
<div class="text-base font-bold text-slate-800">{{ run.total_count }}</div>
<div class="whitespace-nowrap text-xs text-muted">总数</div>
<div class="text-base font-bold text-primary">{{ run.total_count }}</div>
</div>
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">已处理</div>
<div class="whitespace-nowrap text-xs text-muted">已处理</div>
<div class="text-base font-bold text-sky-700">{{ run.processed_count }}</div>
</div>
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">成功</div>
<div class="whitespace-nowrap text-xs text-muted">成功</div>
<div class="text-base font-bold text-emerald-700">{{ run.success_count }}</div>
</div>
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">失败</div>
<div class="whitespace-nowrap text-xs text-muted">失败</div>
<div class="text-base font-bold text-rose-700">{{ run.failed_count }}</div>
</div>
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">跳过</div>
<div class="whitespace-nowrap text-xs text-muted">跳过</div>
<div class="text-base font-bold text-amber-700">{{ run.skipped_count }}</div>
</div>
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">合格笔数</div>
<div class="whitespace-nowrap text-xs text-muted">合格笔数</div>
<div class="text-base font-bold text-emerald-700">{{ run.judgement?.qualified_count ?? 0 }}</div>
</div>
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">不合格笔数</div>
<div class="whitespace-nowrap text-xs text-muted">不合格笔数</div>
<div class="text-base font-bold text-rose-700">{{ run.judgement?.unqualified_count ?? 0 }}</div>
</div>
<div class="rounded-lg bg-white/80 px-2 py-1.5">
<div class="whitespace-nowrap text-xs text-slate-500">人工判定笔数</div>
<div class="whitespace-nowrap text-xs text-muted">人工判定笔数</div>
<div class="text-base font-bold text-amber-700">{{ run.judgement?.manual_count ?? 0 }}</div>
</div>
</div>
@@ -233,10 +233,10 @@ const downloadExcel = async () => {
</div>
<div v-else-if="waiting || loading" class="space-y-3 px-4 py-4">
<div class="h-2.5 overflow-hidden rounded-full bg-slate-200">
<div class="h-2.5 overflow-hidden rounded-full bg-surface-strong">
<div class="h-full w-1/3 animate-pulse rounded-full bg-gradient-to-r from-sky-400 to-emerald-400" />
</div>
<p class="text-xs text-slate-500">检核启动后,这里会显示实时进度。</p>
<p class="text-xs text-muted">检核启动后,这里会显示实时进度。</p>
</div>
</section>
</template>
@@ -1,4 +1,4 @@
<!--
<!--
features/chat/components/messages/TransferBacklogSummaryCard.vue
用途:待处理异常卡(可恢复/已关闭/结果未知三组)+ 人工重试/人工关闭入口。
依赖:props.items、i18n chat.transfer.*。
@@ -30,12 +30,12 @@ function agingLabel(level: string): string {
</script>
<template>
<div class="my-2 rounded-2xl border border-brand-100 bg-white p-4 shadow-sm" data-testid="transfer-backlog-card">
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-backlog-card">
<div class="mb-2 flex items-center justify-between">
<h3 class="text-sm font-bold text-slate-800">{{ $t('chat.transfer.backlogTitle') }}</h3>
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.backlogTitle') }}</h3>
<button
type="button"
class="rounded-lg border border-slate-200 px-2 py-1 text-xs text-slate-600 hover:bg-slate-50"
class="rounded-lg border border-default px-2 py-1 text-xs text-secondary hover-surface-soft"
data-testid="transfer-backlog-refresh"
@click="emit('refresh')"
>
@@ -46,15 +46,15 @@ function agingLabel(level: string): string {
<li
v-for="item in items"
:key="item.item_id"
class="flex items-center justify-between gap-2 rounded-lg border border-slate-100 px-3 py-2 text-xs"
class="flex items-center justify-between gap-2 rounded-lg border border-subtle px-3 py-2 text-xs"
:data-testid="`transfer-backlog-${item.invoice_no}`"
>
<div class="min-w-0">
<div class="font-semibold text-slate-700">
<div class="font-semibold text-secondary">
{{ item.invoice_no }}
<span class="ml-1 text-slate-400">{{ item.source_code }}</span>
<span class="ml-1 text-muted">{{ item.source_code }}</span>
</div>
<div class="text-[11px] text-slate-500">
<div class="text-[11px] text-muted">
{{ item.reason }} · {{ $t(agingLabel(item.aging_level)) }}
</div>
</div>
@@ -77,13 +77,13 @@ function agingLabel(level: string): string {
{{ $t('chat.transfer.manualClose') }}
</button>
</template>
<span v-else-if="item.status === 'result_unknown'" class="text-[11px] text-slate-400">
<span v-else-if="item.status === 'result_unknown'" class="text-[11px] text-muted">
{{ $t('chat.transfer.resultUnknownReadonly') }}
</span>
</div>
</li>
</ul>
<div v-else class="rounded-lg bg-slate-50 p-3 text-xs text-slate-500">
<div v-else class="rounded-lg bg-surface-soft p-3 text-xs text-muted">
{{ $t('chat.transfer.noBacklog') }}
</div>
</div>
@@ -1,4 +1,4 @@
<!--
<!--
features/chat/components/messages/TransferFileProgressCard.vue
用途:来源实例级收料文件准备进度(决策 18:来源隔离展示,不伪造总百分比)。
依赖:props.sources、i18n chat.transfer.*。
@@ -14,20 +14,20 @@ defineProps<{
<template>
<div
class="my-2 rounded-2xl border border-brand-100 bg-white p-4 shadow-sm"
class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm"
data-testid="transfer-file-progress-card"
>
<h3 class="mb-3 text-sm font-bold text-slate-800">{{ $t('chat.transfer.fileProgressTitle') }}</h3>
<h3 class="mb-3 text-sm font-bold text-primary">{{ $t('chat.transfer.fileProgressTitle') }}</h3>
<ul class="flex flex-col gap-2">
<li
v-for="source in sources"
:key="source.source_code"
class="flex items-center justify-between rounded-lg border border-slate-100 px-3 py-2"
class="flex items-center justify-between rounded-lg border border-subtle px-3 py-2"
:data-testid="`transfer-source-${source.source_code}`"
>
<div class="min-w-0">
<div class="text-sm font-semibold text-slate-700">{{ source.source_code }}</div>
<div v-if="source.file_no" class="truncate text-xs text-slate-400">
<div class="text-sm font-semibold text-secondary">{{ source.source_code }}</div>
<div v-if="source.file_no" class="truncate text-xs text-muted">
{{ source.file_no }}<template v-if="source.file_version"> · v{{ source.file_version }}</template>
</div>
<div v-else-if="source.error_message" class="truncate text-xs text-red-500">{{ source.error_message }}</div>
@@ -96,10 +96,10 @@ function goBack() {
<button
type="button"
data-testid="transfer-home-closed"
class="rounded-2xl border border-slate-200 bg-surface p-4 text-left transition-colors hover:border-brand-200 hover:bg-brand-50"
class="rounded-2xl border border-default bg-surface p-4 text-left transition-colors hover:border-brand-200 hover:bg-brand-50"
@click="view = 'backlog'"
>
<b class="block text-2xl leading-none text-slate-600">{{ transfer.backlogSummary.value?.closed ?? 0 }}</b>
<b class="block text-2xl leading-none text-secondary">{{ transfer.backlogSummary.value?.closed ?? 0 }}</b>
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeClosed') }}</b>
<span class="mt-1 block text-xs text-secondary">{{ $t('chat.transfer.homeClosedHint') }}</span>
</button>
@@ -33,20 +33,20 @@ watch(
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4"
data-testid="transfer-manual-close-dialog"
>
<div class="w-full max-w-md rounded-2xl bg-white p-5 shadow-xl">
<h3 class="text-base font-bold text-slate-800">{{ $t('chat.transfer.manualCloseTitle') }}</h3>
<p class="mt-1 text-xs text-slate-500">{{ invoiceNo }} · {{ $t('chat.transfer.manualCloseHint') }}</p>
<div class="w-full max-w-md rounded-2xl bg-surface p-5 shadow-xl">
<h3 class="text-base font-bold text-primary">{{ $t('chat.transfer.manualCloseTitle') }}</h3>
<p class="mt-1 text-xs text-muted">{{ invoiceNo }} · {{ $t('chat.transfer.manualCloseHint') }}</p>
<textarea
v-model="reason"
rows="3"
class="mt-3 w-full rounded-lg border border-slate-200 p-2 text-sm"
class="mt-3 w-full rounded-lg border border-default p-2 text-sm"
:placeholder="$t('chat.transfer.closeReasonPlaceholder')"
data-testid="transfer-close-reason"
/>
<div class="mt-4 flex justify-end gap-2">
<button
type="button"
class="rounded-lg border border-slate-200 px-4 py-1.5 text-sm text-slate-600 hover:bg-slate-50"
class="rounded-lg border border-default px-4 py-1.5 text-sm text-secondary hover-surface-soft"
data-testid="transfer-close-cancel"
@click="emit('cancel')"
>
@@ -1,4 +1,4 @@
<!--
<!--
features/chat/components/messages/TransferPrecheckCard.vue
用途:预检卡——计数 + 调拨明细表(决策 6 十列)+ 勾选 + “直接生成调拨单”按钮。
依赖:props(summary/items/selected/busy)、i18n chat.transfer.*。
@@ -49,39 +49,39 @@ function resultLabel(result: string): string {
</script>
<template>
<div class="my-2 rounded-2xl border border-brand-100 bg-white p-4 shadow-sm" data-testid="transfer-precheck-card">
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-precheck-card">
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-bold text-slate-800">{{ $t('chat.transfer.precheckTitle') }}</h3>
<span class="text-xs text-slate-400">{{ $t('chat.transfer.businessDate') }}:{{ summary.business_date }}</span>
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.precheckTitle') }}</h3>
<span class="text-xs text-muted">{{ $t('chat.transfer.businessDate') }}:{{ summary.business_date }}</span>
</div>
<div class="mb-3 grid grid-cols-2 gap-2 sm:grid-cols-5" data-testid="transfer-precheck-counts">
<div class="rounded-lg bg-slate-50 p-2 text-center">
<div class="rounded-lg bg-surface-soft p-2 text-center">
<div class="text-lg font-black text-brand-600">{{ summary.counts.executable_count }}</div>
<div class="text-[11px] text-slate-500">{{ $t('chat.transfer.executableCount') }}</div>
<div class="text-[11px] text-muted">{{ $t('chat.transfer.executableCount') }}</div>
</div>
<div class="rounded-lg bg-slate-50 p-2 text-center">
<div class="text-lg font-black text-slate-600">{{ summary.counts.not_matured_count }}</div>
<div class="text-[11px] text-slate-500">{{ $t('chat.transfer.notMaturedCount') }}</div>
<div class="rounded-lg bg-surface-soft p-2 text-center">
<div class="text-lg font-black text-secondary">{{ summary.counts.not_matured_count }}</div>
<div class="text-[11px] text-muted">{{ $t('chat.transfer.notMaturedCount') }}</div>
</div>
<div class="rounded-lg bg-slate-50 p-2 text-center">
<div class="text-lg font-black text-slate-600">{{ summary.counts.blocked_count }}</div>
<div class="text-[11px] text-slate-500">{{ $t('chat.transfer.blockedCount') }}</div>
<div class="rounded-lg bg-surface-soft p-2 text-center">
<div class="text-lg font-black text-secondary">{{ summary.counts.blocked_count }}</div>
<div class="text-[11px] text-muted">{{ $t('chat.transfer.blockedCount') }}</div>
</div>
<div class="rounded-lg bg-slate-50 p-2 text-center">
<div class="rounded-lg bg-surface-soft p-2 text-center">
<div class="text-lg font-black text-brand-600">{{ summary.estimated_transfer_quantity }}</div>
<div class="text-[11px] text-slate-500">{{ $t('chat.transfer.estimatedQuantity') }}</div>
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedQuantity') }}</div>
</div>
<div class="rounded-lg bg-slate-50 p-2 text-center">
<div class="rounded-lg bg-surface-soft p-2 text-center">
<div class="text-lg font-black text-brand-600">{{ summary.estimated_erp_write_count }}</div>
<div class="text-[11px] text-slate-500">{{ $t('chat.transfer.estimatedErpWrites') }}</div>
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedErpWrites') }}</div>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full min-w-[1100px] text-xs" data-testid="transfer-precheck-table">
<thead>
<tr class="border-b border-slate-200 bg-slate-50 text-left text-[11px] text-slate-500">
<tr class="border-b border-default bg-surface-soft text-left text-[11px] text-muted">
<th class="p-2"></th>
<th class="p-2">{{ $t('chat.transfer.colSource') }}</th>
<th class="p-2">{{ $t('chat.transfer.colMaterial') }}</th>
@@ -99,8 +99,8 @@ function resultLabel(result: string): string {
<tr
v-for="item in items"
:key="item.invoice_no"
class="border-b border-slate-100"
:class="{ 'bg-slate-50 text-slate-400': !isSelectable(item) }"
class="border-b border-subtle"
:class="{ 'bg-surface-soft text-muted': !isSelectable(item) }"
:data-testid="`transfer-item-${item.invoice_no}`"
>
<td class="p-2">
@@ -138,8 +138,8 @@ function resultLabel(result: string): string {
</table>
</div>
<div class="mt-3 flex items-center justify-end gap-3 border-t border-slate-100 pt-3">
<span class="text-xs text-slate-500">
<div class="mt-3 flex items-center justify-end gap-3 border-t border-subtle pt-3">
<span class="text-xs text-muted">
{{ $t('chat.transfer.selectedCount', { count: selectedCount }) }} ·
{{ $t('chat.transfer.estimatedErpWrites') }}:{{ summary.estimated_erp_write_count }}
</span>
@@ -1,4 +1,4 @@
<!--
<!--
features/chat/components/messages/TransferProgressCard.vue
用途:Run 执行进度卡(页面关闭/刷新后经 run_no 恢复)。
依赖:props(runNo/status/busy)、i18n chat.transfer.*。
@@ -28,11 +28,11 @@ function statusLabel(status: string): string {
</script>
<template>
<div class="my-2 rounded-2xl border border-brand-100 bg-white p-4 shadow-sm" data-testid="transfer-progress-card">
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-progress-card">
<div class="flex items-center justify-between">
<div>
<div class="text-sm font-bold text-slate-800">{{ $t('chat.transfer.runProgress') }}</div>
<div class="mt-1 text-xs text-slate-500">{{ runNo }}</div>
<div class="text-sm font-bold text-primary">{{ $t('chat.transfer.runProgress') }}</div>
<div class="mt-1 text-xs text-muted">{{ runNo }}</div>
</div>
<span
class="rounded-full px-2 py-0.5 text-xs font-bold"
@@ -48,7 +48,7 @@ function statusLabel(status: string): string {
</span>
<button
type="button"
class="rounded-lg border border-slate-200 px-3 py-1 text-xs font-bold text-slate-600 hover:bg-slate-50"
class="rounded-lg border border-default px-3 py-1 text-xs font-bold text-secondary hover-surface-soft"
:disabled="busy"
data-testid="transfer-run-refresh"
@click="emit('refresh')"
@@ -1,4 +1,4 @@
<!--
<!--
features/chat/components/messages/TransferResultCard.vue
用途:结果卡——按 ERP 单号聚合(决策 20)、可展开物料明细、未生成单据异常区、
下载收料来源文件 / ERP 库存表(决策 21)。不展示执行审计入口(决策 19)。
@@ -32,10 +32,10 @@ function reasonLabel(reason: string): string {
</script>
<template>
<div class="my-2 rounded-2xl border border-brand-100 bg-white p-4 shadow-sm" data-testid="transfer-result-card">
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-result-card">
<div class="mb-3 flex items-center justify-between">
<h3 class="text-sm font-bold text-slate-800">{{ $t('chat.transfer.resultTitle') }}</h3>
<span class="text-xs text-slate-400">{{ run.run_no }}</span>
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.resultTitle') }}</h3>
<span class="text-xs text-muted">{{ run.run_no }}</span>
</div>
<!-- 已生成 ERP 单据:按单号聚合 + 可展开物料明细 -->
@@ -43,22 +43,22 @@ function reasonLabel(reason: string): string {
<details
v-for="doc in run.result.erp_documents"
:key="doc.document_no"
class="rounded-lg border border-slate-200"
class="rounded-lg border border-default"
data-testid="transfer-erp-document"
>
<summary class="flex cursor-pointer flex-wrap items-center justify-between gap-2 px-3 py-2 text-xs">
<span class="font-bold text-brand-700">{{ doc.document_no }}</span>
<span class="text-slate-600">{{ doc.from_warehouse }} → {{ doc.to_warehouse }}</span>
<span class="text-slate-500">{{ $t('chat.transfer.materialCount', { count: doc.material_count }) }}</span>
<span class="font-bold text-slate-700">{{ doc.total_quantity }}</span>
<span class="text-secondary">{{ doc.from_warehouse }} → {{ doc.to_warehouse }}</span>
<span class="text-muted">{{ $t('chat.transfer.materialCount', { count: doc.material_count }) }}</span>
<span class="font-bold text-secondary">{{ doc.total_quantity }}</span>
<span class="rounded-full bg-emerald-50 px-2 py-0.5 font-bold text-emerald-700">
{{ $t('chat.transfer.posted') }}
</span>
</summary>
<div class="border-t border-slate-100 px-3 py-2">
<div class="border-t border-subtle px-3 py-2">
<table class="w-full text-xs" data-testid="transfer-erp-document-lines">
<thead>
<tr class="text-left text-[11px] text-slate-500">
<tr class="text-left text-[11px] text-muted">
<th class="p-1">{{ $t('chat.transfer.colMaterial') }}</th>
<th class="p-1">{{ $t('chat.transfer.colName') }}</th>
<th class="p-1">{{ $t('chat.transfer.colSpec') }}</th>
@@ -67,7 +67,7 @@ function reasonLabel(reason: string): string {
</tr>
</thead>
<tbody>
<tr v-for="line in doc.lines" :key="line.invoice_no" class="border-t border-slate-100">
<tr v-for="line in doc.lines" :key="line.invoice_no" class="border-t border-subtle">
<td class="p-1">{{ line.material_no }}</td>
<td class="p-1">{{ line.material_name }}</td>
<td class="p-1">{{ line.specification }}</td>
@@ -79,13 +79,13 @@ function reasonLabel(reason: string): string {
</div>
</details>
</div>
<div v-else class="mb-3 rounded-lg bg-slate-50 p-3 text-xs text-slate-500">
<div v-else class="mb-3 rounded-lg bg-surface-soft p-3 text-xs text-muted">
{{ $t('chat.transfer.noDocuments') }}
</div>
<!-- 未生成 ERP 单据的异常区(决策 20 单独展示) -->
<div v-if="run.result.exceptions.length" class="mt-3" data-testid="transfer-exceptions-area">
<h4 class="mb-1 text-xs font-bold text-slate-600">{{ $t('chat.transfer.exceptionsTitle') }}</h4>
<h4 class="mb-1 text-xs font-bold text-secondary">{{ $t('chat.transfer.exceptionsTitle') }}</h4>
<ul class="flex flex-col gap-1">
<li
v-for="exc in run.result.exceptions"
@@ -101,7 +101,7 @@ function reasonLabel(reason: string): string {
</div>
<!-- 下载:收料来源文件 + ERP 库存表(决策 21);无审计入口(决策 19) -->
<div class="mt-3 flex flex-wrap gap-2 border-t border-slate-100 pt-3" data-testid="transfer-result-downloads">
<div class="mt-3 flex flex-wrap gap-2 border-t border-subtle pt-3" data-testid="transfer-result-downloads">
<button
type="button"
class="rounded-lg border border-brand-200 px-3 py-1.5 text-xs font-bold text-brand-700 hover:bg-brand-50"
@@ -120,7 +120,7 @@ function reasonLabel(reason: string): string {
</button>
<button
type="button"
class="rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-bold text-slate-600 hover:bg-slate-50"
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft"
data-testid="transfer-download-exceptions"
@click="emit('downloadExceptions')"
>
@@ -110,9 +110,9 @@ function confirm() {
</script>
<template>
<div class="my-2 rounded-2xl border border-brand-100 bg-white p-4 shadow-sm" data-testid="transfer-source-select-card">
<h3 class="mb-1 text-sm font-bold text-slate-800">{{ $t('chat.transfer.sourceSelectTitle') }}</h3>
<p class="mb-3 text-xs text-slate-500">{{ $t('chat.transfer.sourceSelectHint') }}</p>
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-source-select-card">
<h3 class="mb-1 text-sm font-bold text-primary">{{ $t('chat.transfer.sourceSelectTitle') }}</h3>
<p class="mb-3 text-xs text-muted">{{ $t('chat.transfer.sourceSelectHint') }}</p>
<div class="mb-3 flex flex-wrap items-center gap-2">
<button
@@ -144,23 +144,23 @@ function confirm() {
</button>
<button
type="button"
class="rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-bold text-slate-600 hover:bg-slate-50 disabled:opacity-50"
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-50"
:disabled="busy"
data-testid="transfer-source-clear"
@click="clearSelected"
>
{{ $t('chat.transfer.clearSources') }}
</button>
<span class="ml-auto text-xs text-slate-500">
<span class="ml-auto text-xs text-muted">
{{ $t('chat.transfer.selectedSourceCount', { count: selectedCount }) }}
<span v-if="selectedRetryableCount > 0" class="text-amber-600"> · {{ $t('chat.transfer.selectedRetryableCount', { count: selectedRetryableCount }) }}</span>
</span>
</div>
<div v-for="platform in platforms" :key="platform" class="mb-3 rounded-lg border border-slate-100">
<div class="flex items-center justify-between rounded-t-lg bg-slate-50 px-3 py-1.5">
<b class="text-xs text-slate-700">{{ platform.toUpperCase() }}</b>
<label class="text-[11px] text-slate-500">
<div v-for="platform in platforms" :key="platform" class="mb-3 rounded-lg border border-subtle">
<div class="flex items-center justify-between rounded-t-lg bg-surface-soft px-3 py-1.5">
<b class="text-xs text-secondary">{{ platform.toUpperCase() }}</b>
<label class="text-[11px] text-muted">
<input
type="checkbox"
:checked="props.sources.filter((source) => source.platform === platform).every((source) => selected.has(source.source_code))"
@@ -173,7 +173,7 @@ function confirm() {
<div
v-for="source in props.sources.filter((item) => item.platform === platform)"
:key="source.source_code"
class="flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-slate-50"
class="flex items-center gap-2 rounded-lg px-2 py-1.5 hover-surface-soft"
:data-testid="`transfer-source-option-${source.source_code}`"
>
<input
@@ -183,8 +183,8 @@ function confirm() {
@change="toggle(source.source_code, ($event.target as HTMLInputElement).checked)"
/>
<span class="min-w-0 flex-1">
<span class="block truncate text-xs font-semibold text-slate-700">{{ source.source_code }}</span>
<span class="block truncate text-[11px] text-slate-400">{{ source.display_name }}</span>
<span class="block truncate text-xs font-semibold text-secondary">{{ source.source_code }}</span>
<span class="block truncate text-[11px] text-muted">{{ source.display_name }}</span>
</span>
<span class="shrink-0">
<span
@@ -210,14 +210,14 @@ function confirm() {
</span>
<span
v-else
class="inline-flex items-center gap-1 rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-bold text-slate-500"
class="inline-flex items-center gap-1 rounded-full bg-surface-strong px-2 py-0.5 text-[10px] font-bold text-muted"
:data-testid="`transfer-source-status-${source.source_code}`"
>
{{ t('chat.transfer.fileNone') }}
</span>
<button
type="button"
class="ml-1 inline-flex h-6 w-6 items-center justify-center rounded-md border border-slate-200 text-sm text-slate-500 hover:border-brand-200 hover:text-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
class="ml-1 inline-flex h-6 w-6 items-center justify-center rounded-md border border-default text-sm text-muted hover:border-brand-200 hover:text-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
:disabled="busy || !isRetryable(source) || retrying?.has(source.source_code)"
:title="t('chat.transfer.retryReceipt')"
:data-testid="`transfer-source-retry-${source.source_code}`"
@@ -230,8 +230,8 @@ function confirm() {
</div>
</div>
<div class="flex items-center justify-end gap-3 border-t border-slate-100 pt-3">
<span class="text-xs text-slate-500">{{ $t('chat.transfer.selectedCount', { count: selectedCount }) }}</span>
<div class="flex items-center justify-end gap-3 border-t border-subtle pt-3">
<span class="text-xs text-muted">{{ $t('chat.transfer.selectedCount', { count: selectedCount }) }}</span>
<button
type="button"
class="rounded-lg bg-brand-600 px-4 py-1.5 text-sm font-bold text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
@@ -183,15 +183,15 @@ function loadMore() {
data-testid="review-audit-trail-drawer"
@click.self="emit('close')"
>
<aside class="flex h-full w-full max-w-xl flex-col bg-white shadow-xl dark:bg-slate-900">
<header class="flex items-center justify-between gap-2 border-b border-slate-200 px-4 py-3 dark:border-slate-800">
<aside class="flex h-full w-full max-w-xl flex-col bg-surface shadow-xl">
<header class="flex items-center justify-between gap-2 border-b border-default px-4 py-3">
<div>
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.auditTrail.title') }}</h2>
<p class="text-[11px] text-muted">{{ t('chat.shippingOrderReview.auditTrail.subtitle') }}</p>
</div>
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-audit-trail-close"
@click="emit('close')"
>
@@ -209,7 +209,7 @@ function loadMore() {
<li
v-for="item in items"
:key="item.id"
class="rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-xs dark:border-slate-800 dark:bg-slate-950/40"
class="rounded-lg border border-default bg-surface-soft px-3 py-2 text-xs dark:bg-slate-950/40"
:data-testid="`review-audit-item-${item.id}`"
>
<button
@@ -239,7 +239,7 @@ function loadMore() {
</div>
<div
v-if="expandedId === item.id"
class="mt-2 space-y-2 border-t border-slate-200 pt-2 dark:border-slate-800"
class="mt-2 space-y-2 border-t border-default pt-2"
data-testid="review-audit-item-details"
>
<p v-if="item.sensitive_redacted" class="text-amber-800 dark:text-amber-200">
@@ -254,7 +254,7 @@ function loadMore() {
<li
v-for="(row, idx) in normalizeDiffRows(item.diff)"
:key="idx"
class="rounded bg-white px-2 py-1.5 text-[11px] dark:bg-slate-900"
class="rounded bg-surface px-2 py-1.5 text-[11px]"
>
<p class="font-medium text-primary">{{ diffFieldLabel(row) }}</p>
<p class="mt-0.5 text-muted">
@@ -271,39 +271,39 @@ function loadMore() {
<p v-if="item.reason" class="text-[11px] text-secondary">
{{ t('chat.shippingOrderReview.auditTrail.reason') }}:{{ item.reason }}
</p>
<details class="rounded border border-slate-200 dark:border-slate-800">
<details class="rounded border border-default">
<summary class="cursor-pointer px-2 py-1 text-[11px] text-muted">
{{ t('chat.shippingOrderReview.auditTrail.technicalDetails') }}
</summary>
<div class="space-y-2 border-t border-slate-200 p-2 dark:border-slate-800">
<div class="space-y-2 border-t border-default p-2">
<div class="flex items-center justify-between gap-2">
<p class="font-medium text-secondary">
{{ t('chat.shippingOrderReview.auditTrail.before') }}
</p>
<button
type="button"
class="rounded border border-slate-300 px-1.5 py-0.5 text-[11px] hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-1.5 py-0.5 text-[11px] hover-surface-soft"
data-testid="review-audit-copy-before"
@click="copyJson(item.before_snapshot)"
>
{{ t('chat.shippingOrderReview.auditTrail.copyJson') }}
</button>
</div>
<pre class="max-h-32 overflow-auto rounded bg-white p-2 text-xs leading-relaxed dark:bg-slate-900">{{ formatJson(item.before_snapshot) }}</pre>
<pre class="max-h-32 overflow-auto rounded bg-surface p-2 text-xs leading-relaxed">{{ formatJson(item.before_snapshot) }}</pre>
<div class="flex items-center justify-between gap-2">
<p class="font-medium text-secondary">
{{ t('chat.shippingOrderReview.auditTrail.after') }}
</p>
<button
type="button"
class="rounded border border-slate-300 px-1.5 py-0.5 text-[11px] hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-1.5 py-0.5 text-[11px] hover-surface-soft"
data-testid="review-audit-copy-after"
@click="copyJson(item.after_snapshot)"
>
{{ t('chat.shippingOrderReview.auditTrail.copyJson') }}
</button>
</div>
<pre class="max-h-32 overflow-auto rounded bg-white p-2 text-xs leading-relaxed dark:bg-slate-900">{{ formatJson(item.after_snapshot) }}</pre>
<pre class="max-h-32 overflow-auto rounded bg-surface p-2 text-xs leading-relaxed">{{ formatJson(item.after_snapshot) }}</pre>
</div>
</details>
</template>
@@ -313,7 +313,7 @@ function loadMore() {
<button
v-if="items.length < total"
type="button"
class="mt-3 w-full rounded border border-slate-300 px-2 py-1.5 text-xs hover:bg-slate-50 disabled:opacity-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="mt-3 w-full rounded border border-default px-2 py-1.5 text-xs hover-surface-soft disabled:opacity-50"
data-testid="review-audit-trail-load-more"
:disabled="loading"
@click="loadMore"
@@ -66,7 +66,7 @@ function statusClass(status: string): string {
<template>
<section
v-if="visible"
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
data-testid="review-automation-status-panel"
>
<header class="mb-2">
@@ -152,12 +152,12 @@ const hasDiagnosticDetails = computed(() => Boolean(
data-testid="review-eligibility-details-drawer"
@click.self="emit('close')"
>
<aside class="flex h-full w-full max-w-md flex-col bg-white shadow-xl dark:bg-slate-900">
<header class="flex items-center justify-between gap-2 border-b border-slate-200 px-4 py-3 dark:border-slate-800">
<aside class="flex h-full w-full max-w-md flex-col bg-surface shadow-xl">
<header class="flex items-center justify-between gap-2 border-b border-default px-4 py-3">
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.workbench.fullChecksTitle') }}</h2>
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-eligibility-details-close"
@click="emit('close')"
>
@@ -168,7 +168,7 @@ const hasDiagnosticDetails = computed(() => Boolean(
<section
class="rounded-lg border px-3 py-2 text-xs"
:class="eligibility.can_build === null
? 'border-slate-200 bg-slate-50 text-slate-800 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100'
? 'border-default bg-surface-soft text-primary '
: eligibility.can_build
? 'border-emerald-200 bg-emerald-50 text-emerald-900 dark:border-emerald-900 dark:bg-emerald-950/30 dark:text-emerald-100'
: 'border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-900 dark:bg-amber-950/30 dark:text-amber-100'"
@@ -176,8 +176,8 @@ const hasDiagnosticDetails = computed(() => Boolean(
>
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="font-semibold">{{ t('chat.shippingOrderReview.buildEligibility.overallResult') }}</span>
<span class="text-slate-600 dark:text-slate-300">{{ t('chat.shippingOrderReview.buildEligibility.manualBuildLabel') }}</span>
<span class="rounded-full px-2 py-0.5 font-medium" :class="eligibility.can_build === null ? 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-100' : eligibility.can_build ? 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/60 dark:text-emerald-100' : 'bg-amber-100 text-amber-900 dark:bg-amber-900/60 dark:text-amber-100'">
<span class="text-secondary">{{ t('chat.shippingOrderReview.buildEligibility.manualBuildLabel') }}</span>
<span class="rounded-full px-2 py-0.5 font-medium" :class="eligibility.can_build === null ? 'bg-surface-strong text-secondary ' : eligibility.can_build ? 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/60 dark:text-emerald-100' : 'bg-amber-100 text-amber-900 dark:bg-amber-900/60 dark:text-amber-100'">
<span data-testid="review-eligibility-manual-status">{{ eligibility.can_build === null
? t('chat.shippingOrderReview.buildEligibility.notValidated')
: eligibility.can_build
@@ -186,7 +186,7 @@ const hasDiagnosticDetails = computed(() => Boolean(
</span>
</div>
<div class="mt-2 flex flex-wrap items-center justify-between gap-2">
<span class="text-slate-600 dark:text-slate-300">{{ t('chat.shippingOrderReview.buildEligibility.autoBuildLabel') }}</span>
<span class="text-secondary">{{ t('chat.shippingOrderReview.buildEligibility.autoBuildLabel') }}</span>
<span
class="rounded-full px-2 py-0.5 font-medium"
:class="eligibility.can_auto_create
@@ -213,7 +213,7 @@ const hasDiagnosticDetails = computed(() => Boolean(
</section>
<section
v-if="hasDiagnosticDetails"
class="rounded-lg border border-slate-200 bg-slate-50 p-3 text-xs dark:border-slate-700 dark:bg-slate-950/40"
class="rounded-lg border border-default bg-surface-soft p-3 text-xs dark:bg-slate-950/40"
>
<div v-if="eligibility.assessment?.missing_required_fields?.length" class="mt-2">
<div class="font-medium">{{ t('chat.shippingOrderReview.workbench.requiredFields') }}</div>
@@ -230,7 +230,7 @@ const hasDiagnosticDetails = computed(() => Boolean(
<ul class="mt-1 list-disc pl-4">
<li v-for="(issue, index) in nonConflictIssues" :key="index">
{{ issueLabel(issue) }}
<span v-if="issue.explainability?.message || issue.message" class="text-slate-600 dark:text-slate-300">
<span v-if="issue.explainability?.message || issue.message" class="text-secondary">
— {{ issue.explainability?.message || issue.message }}
</span>
</li>
@@ -249,7 +249,7 @@ const hasDiagnosticDetails = computed(() => Boolean(
<li
v-for="conflict in props.fieldConflicts"
:key="conflict.conflict_key"
class="rounded border border-rose-200 bg-white px-2 py-1.5 dark:border-rose-900 dark:bg-slate-900"
class="rounded border border-rose-200 bg-surface px-2 py-1.5 dark:border-rose-900"
>
<div class="font-semibold">
<span v-if="conflict.line_index != null">{{ t('chat.shippingOrderReview.line', { index: conflict.line_index + 1 }) }} · </span>
@@ -273,9 +273,9 @@ const hasDiagnosticDetails = computed(() => Boolean(
</section>
<article
v-for="line in orderedLines"
:key="String(line.line_key || line.line_index)"
class="rounded-lg border border-slate-200 p-3 text-xs dark:border-slate-700"
:data-testid="`review-eligibility-detail-line-${line.line_key || line.line_index}`"
:key="String(line.line_no)"
class="rounded-lg border border-default p-3 text-xs"
:data-testid="`review-eligibility-detail-line-${line.line_no}`"
>
<div class="flex flex-wrap items-center justify-between gap-2">
<button
@@ -302,20 +302,20 @@ const hasDiagnosticDetails = computed(() => Boolean(
</div>
<dl class="mt-2 grid gap-1">
<div>
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.routingStatusLabel') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.routingStatusLabel') }}:</dt>
<dd class="inline">{{ routingStatusLabel(line.routing_status) }}</dd>
</div>
<div v-if="line.block_reason">
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.blockReason') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.blockReason') }}:</dt>
<dd class="inline">{{ blockReasonLabel(line.block_reason) }}</dd>
</div>
<div v-if="line.candidate_inventory_source_codes?.length">
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.candidates') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.candidates') }}:</dt>
<dd class="inline font-mono">{{ line.candidate_inventory_source_codes.join(', ') }}</dd>
</div>
</dl>
</article>
<p v-if="!orderedLines.length" class="text-xs text-slate-500">
<p v-if="!orderedLines.length" class="text-xs text-muted">
{{ t('chat.shippingOrderReview.workbench.noLineChecks') }}
</p>
</div>
@@ -87,13 +87,13 @@ const blockingSummary = computed(() => {
/>
<section
v-if="eligibility"
class="rounded-xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-4 shadow-sm"
data-testid="review-build-eligibility-panel"
>
<header class="mb-3 flex flex-wrap items-center justify-between gap-2">
<div>
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.buildEligibility.title') }}</h2>
<p class="mt-0.5 text-xs text-slate-500 dark:text-slate-400">
<p class="mt-0.5 text-xs text-muted">
{{ t('chat.shippingOrderReview.buildEligibility.subtitle') }}
</p>
</div>
@@ -112,7 +112,7 @@ const blockingSummary = computed(() => {
</span>
</header>
<dl class="grid gap-2 text-xs text-slate-600 dark:text-slate-400 sm:grid-cols-2">
<dl class="grid gap-2 text-xs text-secondary sm:grid-cols-2">
<div>
<dt class="inline font-medium">{{ t('chat.shippingOrderReview.buildEligibility.statusLabel') }}:</dt>
<dd class="inline">{{ statusLabel(eligibility.status) }}</dd>
@@ -134,14 +134,14 @@ const blockingSummary = computed(() => {
</div>
<div v-if="eligibility.line_projections.length" class="mt-3 space-y-2">
<div class="text-xs font-semibold text-slate-500 dark:text-slate-400">
<div class="text-xs font-semibold text-muted">
{{ t('chat.shippingOrderReview.buildEligibility.lineProjections') }}
</div>
<article
v-for="line in eligibility.line_projections"
:key="String(line.line_key || line.line_index)"
class="rounded-lg border border-slate-200 p-3 text-xs dark:border-slate-700"
:data-testid="`review-build-eligibility-line-${line.line_key || line.line_index}`"
:key="String(line.line_no)"
class="rounded-lg border border-default p-3 text-xs"
:data-testid="`review-build-eligibility-line-${line.line_no}`"
>
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="font-medium">
@@ -162,27 +162,27 @@ const blockingSummary = computed(() => {
</div>
<dl class="mt-2 grid gap-1 sm:grid-cols-2">
<div>
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.reservation') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.reservation') }}:</dt>
<dd class="inline font-mono">{{ line.effective_reservation_id || '—' }}</dd>
</div>
<div>
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.routingStatusLabel') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.routingStatusLabel') }}:</dt>
<dd class="inline">{{ routingStatusLabel(line.routing_status) }}</dd>
</div>
<div v-if="line.inventory_source_hint" class="sm:col-span-2">
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.sourceHint') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.sourceHint') }}:</dt>
<dd class="inline">{{ line.inventory_source_hint }}</dd>
</div>
<div v-if="line.candidate_inventory_source_codes?.length" class="sm:col-span-2">
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.candidates') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.candidates') }}:</dt>
<dd class="inline font-mono">{{ line.candidate_inventory_source_codes.join(', ') }}</dd>
</div>
<div v-if="line.block_reason" class="sm:col-span-2">
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.blockReason') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.blockReason') }}:</dt>
<dd class="inline">{{ blockReasonLabel(line.block_reason) }}</dd>
</div>
<div v-if="line.selection_mode === 'manual' && line.manual_reason" class="sm:col-span-2">
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.manualReason') }}:</dt>
<dt class="inline text-muted">{{ t('chat.shippingOrderReview.buildEligibility.manualReason') }}:</dt>
<dd class="inline">{{ line.manual_reason }}</dd>
</div>
</dl>
@@ -206,7 +206,7 @@ const gateChecklist = computed(() => {
<template>
<section
v-if="eligibility"
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
data-testid="review-build-eligibility-summary"
>
<header class="flex flex-wrap items-center justify-between gap-2">
@@ -214,7 +214,7 @@ const gateChecklist = computed(() => {
<span
class="rounded-full px-2.5 py-1 text-xs font-medium"
:class="eligibility.can_build === null
? 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200'
? 'bg-surface-strong text-secondary '
: eligibility.can_build
? 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100'
: 'bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100'"
@@ -325,7 +325,7 @@ const gateChecklist = computed(() => {
<button
type="button"
class="mt-2 w-full rounded border border-slate-300 px-2 py-1.5 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="mt-2 w-full rounded border border-default px-2 py-1.5 text-xs hover-surface-soft"
data-testid="review-open-eligibility-details"
@click="emit('open-details')"
>
@@ -56,7 +56,7 @@ async function onConfirm() {
try {
const result = await closeWorkspaceShippingOrderReviewLineFulfillment(props.caseNo, {
reason: trimmed,
line_keys: props.lineKeys.length ? props.lineKeys : undefined,
draft_line_ids: props.lineKeys.length ? props.lineKeys : undefined,
expected_draft_version: props.draftVersion ?? undefined,
});
showReviewResumeOutcome(
@@ -92,7 +92,7 @@ function onCancel() {
data-testid="review-close-fulfillment-dialog"
@click.self="onCancel"
>
<div class="w-full max-w-md rounded-xl border border-slate-200 bg-white p-4 shadow-xl dark:border-slate-800 dark:bg-slate-900">
<div class="w-full max-w-md rounded-xl border border-default bg-surface p-4 shadow-xl">
<h2 class="text-sm font-semibold">{{ title }}</h2>
<p class="mt-1 text-xs text-muted">{{ t('chat.shippingOrderReview.closeFulfillment.subtitle') }}</p>
<label class="mt-3 block text-xs font-medium text-secondary">
@@ -36,7 +36,7 @@ function checkLabel(code: string): string {
<template>
<details
v-if="visible"
class="rounded-xl border border-slate-200 bg-white p-2 text-xs dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-2 text-xs"
:open="defaultOpen"
data-testid="review-completed-checks"
>
@@ -9,7 +9,8 @@
(与投影同源或后端 automation 运行态),空态自然落到「待机/状态待确认」,
禁止把读取占位误述为「系统处理中」,也不做骨架→真值的二次刷新;
loading 仅在挂载期抑制可执行动作,等权威投影到达后再放行(fail-closed);
由 ShippingOrderReviewView 在 mountCurrentProcessingCard 时挂载。
由 ShippingOrderReviewView 在 mountCurrentProcessingCard 时挂载;
v2 新增 statusDetail:状态块内嵌动态说明(隐藏裁决在视图侧,见 spec §5.2)。
-->
<script setup lang="ts">
import { computed } from 'vue';
@@ -61,10 +62,12 @@ const props = defineProps<{
} | null;
showRetry?: boolean;
loading?: boolean;
/** 状态块内嵌动态说明(Run 级 lifecycle_progress 解析结果);null/空文本不渲染,显隐裁决在视图侧。 */
statusDetail?: { text: string } | null;
}>();
const emit = defineEmits<{
locate: [lineKey?: string | null, fieldId?: string | null];
locate: [draftLineId?: string | null, fieldId?: string | null];
action: [code: string, parameters?: Record<string, unknown>];
}>();
@@ -312,20 +315,20 @@ function handleBusinessActionClick() {
}
/**
* 辅助导航「定位明细」:仅当后端在 primary_action.parameters 里提供 line_key 或 field_id 才显示。
* 辅助导航「定位明细」:仅当后端在 primary_action.parameters 里提供 draft_line_id 或 field_id 才显示。
*/
const showLocateAction = computed(() => {
if (props.loading) return false;
if (props.taskMissing) return false;
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
const hasLineKey = typeof params.line_key === 'string' && params.line_key.length > 0;
const hasDraftLineId = typeof params.draft_line_id === 'string' && params.draft_line_id.length > 0;
const hasFieldId = typeof params.field_id === 'string' && params.field_id.length > 0;
return hasLineKey || hasFieldId;
return hasDraftLineId || hasFieldId;
});
const locateTargetLineKey = computed(() => {
const locateTargetDraftLineId = computed(() => {
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
return typeof params.line_key === 'string' ? params.line_key : null;
return typeof params.draft_line_id === 'string' ? params.draft_line_id : null;
});
const locateTargetFieldId = computed(() => {
@@ -334,7 +337,7 @@ const locateTargetFieldId = computed(() => {
});
function handleLocateClick() {
emit('locate', locateTargetLineKey.value, locateTargetFieldId.value);
emit('locate', locateTargetDraftLineId.value, locateTargetFieldId.value);
}
type ReviewCurrentUserStatus =
@@ -379,6 +382,13 @@ type ReviewCurrentUserStatus =
/>
{{ statusLabel }}
</dd>
<!-- v2:状态块内嵌动态说明(弱文本一行,不加标题/图标/区块;显隐裁决在视图侧)。 -->
<p
v-if="statusDetail?.text"
class="w-full text-[11px] leading-4 text-muted"
data-testid="review-current-task-status-detail"
aria-live="polite"
>{{ statusDetail.text }}</p>
</div>
</dl>
@@ -451,7 +461,7 @@ type ReviewCurrentUserStatus =
v-for="action in recoveryActions"
:key="action.code"
type="button"
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-white px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-surface px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
:data-testid="`review-current-task-recovery-${action.code}`"
:disabled="retrying || locating"
@click="$emit('action', action.code, action.parameters || {})"
@@ -461,7 +471,7 @@ type ReviewCurrentUserStatus =
<button
v-if="showLocateAction"
type="button"
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-white px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-surface px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
data-testid="review-current-task-locate-action"
:disabled="locating"
@click="handleLocateClick"
@@ -175,7 +175,7 @@ async function onRetry() {
<template>
<section
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
data-testid="review-customer-resolution-panel"
:data-compact="compact && resolved ? 'true' : 'false'"
>
@@ -240,13 +240,13 @@ const coordinateIssueLabels = computed(() => {
const panelClass = computed(() => {
if (props.docked) {
return [
'relative flex min-h-[320px] min-w-0 flex-col overflow-hidden rounded-xl border border-slate-200',
'bg-white shadow-sm xl:min-h-[520px] dark:border-slate-800 dark:bg-slate-900',
'relative flex min-h-[320px] min-w-0 flex-col overflow-hidden rounded-xl border border-default',
'bg-surface shadow-sm xl:min-h-[520px] ',
].join(' ');
}
return [
'fixed z-30 flex flex-col overflow-hidden rounded-xl border border-slate-200',
'bg-white shadow-2xl dark:border-slate-700 dark:bg-slate-900',
'fixed z-30 flex flex-col overflow-hidden rounded-xl border border-default',
'bg-surface shadow-2xl ',
].join(' ');
});
@@ -590,7 +590,7 @@ onBeforeUnmount(() => {
:data-height="Math.round(geom.height)"
>
<div
class="flex shrink-0 flex-col gap-1.5 border-b border-slate-200 px-3 py-2 dark:border-slate-800"
class="flex shrink-0 flex-col gap-1.5 border-b border-default px-3 py-2"
:class="docked ? '' : 'cursor-grab active:cursor-grabbing select-none'"
data-testid="review-evidence-drag-handle"
@pointerdown="onDragStart"
@@ -599,16 +599,16 @@ onBeforeUnmount(() => {
<div class="min-w-0">
<div
id="review-evidence-drawer-title"
class="text-xs font-semibold text-slate-700 dark:text-slate-200"
class="text-xs font-semibold text-secondary"
>
{{ t('chat.shippingOrderReview.evidenceDrawer.title') }}
</div>
<p class="truncate text-[11px] text-slate-500">{{ pageLabel }}</p>
<p class="truncate text-[11px] text-muted">{{ pageLabel }}</p>
</div>
<button
ref="closeButtonRef"
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-evidence-close"
@click="emit('close')"
>
@@ -620,19 +620,19 @@ onBeforeUnmount(() => {
<div class="flex items-center gap-1" data-testid="review-evidence-nav-group">
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-evidence-prev"
:disabled="!canPrev"
@click="emit('prev-evidence')"
>
{{ t('chat.shippingOrderReview.evidenceDrawer.prevEvidence') }}
</button>
<span class="text-[11px] text-slate-500" data-testid="review-evidence-ordinal">
<span class="text-[11px] text-muted" data-testid="review-evidence-ordinal">
{{ evidenceOrdinal }}/{{ evidenceList.length || 0 }}
</span>
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-evidence-next"
:disabled="!canNext"
@click="emit('next-evidence')"
@@ -645,7 +645,7 @@ onBeforeUnmount(() => {
<button
v-if="!docked"
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-evidence-toggle-expand"
:title="expanded
? t('chat.shippingOrderReview.workbench.collapsePdfHint')
@@ -658,7 +658,7 @@ onBeforeUnmount(() => {
</button>
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-evidence-toggle-dock"
:title="docked
? t('chat.shippingOrderReview.workbench.undockPdfHint')
@@ -672,7 +672,7 @@ onBeforeUnmount(() => {
<div class="relative">
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-evidence-more"
:aria-expanded="moreOpen ? 'true' : 'false'"
@click="moreOpen = !moreOpen"
@@ -681,13 +681,13 @@ onBeforeUnmount(() => {
</button>
<div
v-if="moreOpen"
class="absolute right-0 z-40 mt-1 min-w-[10rem] rounded-md border border-slate-200 bg-white py-1 text-xs shadow-lg dark:border-slate-700 dark:bg-slate-900"
class="absolute right-0 z-40 mt-1 min-w-[10rem] rounded-md border border-default bg-surface py-1 text-xs shadow-lg"
data-testid="review-evidence-more-menu"
>
<button
v-if="!docked"
type="button"
class="block w-full px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-slate-800"
class="block w-full px-3 py-1.5 text-left hover-surface-soft"
data-testid="review-evidence-toggle-side"
@click="emit('toggle-side'); moreOpen = false"
>
@@ -697,7 +697,7 @@ onBeforeUnmount(() => {
</button>
<button
type="button"
class="block w-full px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-slate-800"
class="block w-full px-3 py-1.5 text-left hover-surface-soft"
data-testid="review-evidence-toggle-pin"
@click="emit('toggle-pin'); moreOpen = false"
>
@@ -708,7 +708,7 @@ onBeforeUnmount(() => {
<button
v-if="showAiActions"
type="button"
class="block w-full px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-slate-800"
class="block w-full px-3 py-1.5 text-left hover-surface-soft"
data-testid="review-evidence-request-ai"
@click="emit('request-ai'); moreOpen = false"
>
@@ -717,7 +717,7 @@ onBeforeUnmount(() => {
<button
v-if="showAiActions"
type="button"
class="block w-full px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-slate-800"
class="block w-full px-3 py-1.5 text-left hover-surface-soft"
data-testid="review-evidence-restore-machine"
@click="emit('restore-machine'); moreOpen = false"
>
@@ -736,10 +736,10 @@ onBeforeUnmount(() => {
sandbox=""
referrerpolicy="no-referrer"
:title="fieldLabel || t('chat.shippingOrderReview.evidenceDrawer.title')"
class="min-h-0 h-full w-full border-0 bg-white"
class="min-h-0 h-full w-full border-0 bg-surface"
data-testid="review-email-evidence-html"
/>
<div v-else-if="emailPreview" class="min-h-0 overflow-auto whitespace-pre-wrap p-4 font-mono text-xs leading-6 text-slate-700 dark:text-slate-200" data-testid="review-email-evidence-preview">
<div v-else-if="emailPreview" class="min-h-0 overflow-auto whitespace-pre-wrap p-4 font-mono text-xs leading-6 text-secondary" data-testid="review-email-evidence-preview">
{{ emailPreview.text }}
</div>
<ReviewDocumentPreview
@@ -754,48 +754,48 @@ onBeforeUnmount(() => {
/>
<div
v-else
class="flex min-h-[140px] items-center justify-center p-4 text-sm text-slate-500"
class="flex min-h-[140px] items-center justify-center p-4 text-sm text-muted"
>
{{ t('chat.shippingOrderReview.previewUnavailable') }}
</div>
<details
class="shrink-0 border-t border-slate-200 text-xs dark:border-slate-800"
class="shrink-0 border-t border-default text-xs"
data-testid="review-evidence-details"
:open="detailsOpen"
@toggle="detailsOpen = ($event.target as HTMLDetailsElement).open"
>
<summary class="cursor-pointer px-3 py-2 font-medium text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800/60">
<summary class="cursor-pointer px-3 py-2 font-medium text-secondary hover-surface-soft dark:hover:bg-slate-800/60">
{{ t('chat.shippingOrderReview.evidenceDrawer.detailsToggle') }}
<span v-if="fieldLabel" class="ml-1 font-normal text-slate-500">· {{ fieldLabel }}</span>
<span v-if="fieldLabel" class="ml-1 font-normal text-muted">· {{ fieldLabel }}</span>
</summary>
<div class="space-y-2 px-3 pb-2">
<div v-if="fieldLabel" class="font-medium text-slate-700 dark:text-slate-200">
<div v-if="fieldLabel" class="font-medium text-secondary">
{{ t('chat.shippingOrderReview.evidenceDrawer.field', { field: fieldLabel }) }}
</div>
<dl class="grid gap-1 text-slate-600 dark:text-slate-300">
<dl class="grid gap-1 text-secondary">
<div class="flex gap-2">
<dt class="shrink-0 text-slate-500">{{ t('chat.shippingOrderReview.evidenceDrawer.currentValue') }}</dt>
<dt class="shrink-0 text-muted">{{ t('chat.shippingOrderReview.evidenceDrawer.currentValue') }}</dt>
<dd class="min-w-0 break-words">{{ draftValue || t('chat.shippingOrderReview.emptyValue') }}</dd>
</div>
<div class="flex gap-2">
<dt class="shrink-0 text-slate-500">{{ t('chat.shippingOrderReview.evidenceDrawer.machineValue') }}</dt>
<dt class="shrink-0 text-muted">{{ t('chat.shippingOrderReview.evidenceDrawer.machineValue') }}</dt>
<dd class="min-w-0 break-words">{{ machineValue || t('chat.shippingOrderReview.emptyValue') }}</dd>
</div>
<div class="flex gap-2">
<dt class="shrink-0 text-slate-500">{{ t('chat.shippingOrderReview.evidenceDrawer.highlightQuality') }}</dt>
<dt class="shrink-0 text-muted">{{ t('chat.shippingOrderReview.evidenceDrawer.highlightQuality') }}</dt>
<dd data-testid="review-evidence-highlight-quality">{{ highlightQualityLabel }}</dd>
</div>
<div class="flex gap-2">
<dt class="shrink-0 text-slate-500">{{ t('chat.shippingOrderReview.evidenceDrawer.highlightSource') }}</dt>
<dt class="shrink-0 text-muted">{{ t('chat.shippingOrderReview.evidenceDrawer.highlightSource') }}</dt>
<dd data-testid="review-evidence-highlight-source">{{ highlightSourceLabel }}</dd>
</div>
<div v-if="valueSourceLabel" class="flex gap-2">
<dt class="shrink-0 text-slate-500">{{ t('chat.shippingOrderReview.evidenceDrawer.source') }}</dt>
<dt class="shrink-0 text-muted">{{ t('chat.shippingOrderReview.evidenceDrawer.source') }}</dt>
<dd>{{ valueSourceLabel }}</dd>
</div>
<div v-if="evidence?.table_id || evidence?.cell_id" class="flex gap-2">
<dt class="shrink-0 text-slate-500">{{ t('chat.shippingOrderReview.evidenceDrawer.layoutPath') }}</dt>
<dt class="shrink-0 text-muted">{{ t('chat.shippingOrderReview.evidenceDrawer.layoutPath') }}</dt>
<dd class="min-w-0 break-all font-mono text-[11px]">
{{ [evidence?.table_id, evidence?.cell_id].filter(Boolean).join(' / ') }}
</dd>
@@ -180,10 +180,10 @@ function onSelect(caseNo: string) {
data-testid="review-document-navigation"
:data-nav-mode="mode"
:class="mode === 'tabs'
? 'rounded-xl border border-slate-200 bg-white p-2 shadow-sm dark:border-slate-800 dark:bg-slate-900'
? 'rounded-xl border border-default bg-surface p-2 shadow-sm '
: mode === 'narrow'
? ''
: ['sticky top-3 flex max-h-[calc(100vh-6rem)] w-full shrink-0 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-[width] duration-200 dark:border-slate-800 dark:bg-slate-900', collapsed ? 'lg:w-20' : 'lg:w-64']"
: ['sticky top-3 flex max-h-[calc(100vh-6rem)] w-full shrink-0 flex-col rounded-xl border border-default bg-surface shadow-sm transition-[width] duration-200 ', collapsed ? 'lg:w-20' : 'lg:w-64']"
>
<!-- 2–4:顶部标签 -->
<div
@@ -198,7 +198,7 @@ function onSelect(caseNo: string) {
class="inline-flex min-w-[9rem] max-w-[240px] shrink-0 flex-col gap-0.5 rounded-lg border px-2.5 py-1.5 text-left text-xs transition-colors"
:class="activeCaseNo === item.case_no
? 'border-sky-500 bg-sky-50 text-sky-950 ring-1 ring-sky-400 dark:border-sky-700 dark:bg-sky-950/40 dark:text-sky-100'
: 'border-slate-200 text-slate-700 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800'"
: 'border-default text-secondary hover-surface-soft '"
:data-testid="`review-doc-nav-${item.case_no}`"
@click="onSelect(item.case_no)"
>
@@ -220,12 +220,12 @@ function onSelect(caseNo: string) {
/>
<Circle
v-else
class="h-3 w-3 shrink-0 text-slate-400"
class="h-3 w-3 shrink-0 text-muted"
aria-hidden="true"
/>
<span class="truncate">{{ item.file_name || t('chat.shippingOrderReview.unnamedDocument') }}</span>
</span>
<span class="truncate text-[10px] text-slate-500 dark:text-slate-400">
<span class="truncate text-[10px] text-muted">
{{ [
item.po_number,
lifecycleStageLabel(item),
@@ -238,13 +238,13 @@ function onSelect(caseNo: string) {
<!-- ≥5:左侧列表 -->
<template v-else-if="mode === 'sidebar' || mode === 'sidebar_search'">
<div class="flex items-center justify-between gap-2 border-b border-slate-100 px-2 py-2 dark:border-slate-800">
<div class="flex items-center justify-between gap-2 border-b border-subtle px-2 py-2">
<span class="text-xs font-semibold text-primary">
{{ t('chat.shippingOrderReview.otNav.listTitle', { count: items.length }) }}
</span>
<button
type="button"
class="rounded p-1 text-muted hover:bg-slate-100 dark:hover:bg-slate-800"
class="rounded p-1 text-muted hover-surface-strong"
data-testid="review-doc-nav-collapse"
:aria-label="collapsed ? t('chat.shippingOrderReview.documentNavigation') : t('chat.shippingOrderReview.documentNavigation')"
@click="collapsed = !collapsed"
@@ -262,21 +262,21 @@ function onSelect(caseNo: string) {
<div
v-if="!collapsed && mode === 'sidebar_search'"
class="space-y-2 border-b border-slate-100 px-2 py-2 dark:border-slate-800"
class="space-y-2 border-b border-subtle px-2 py-2"
>
<label class="relative block">
<Search class="pointer-events-none absolute left-2 top-1.5 h-3.5 w-3.5 text-muted" />
<input
v-model="searchQuery"
type="search"
class="w-full rounded-md border border-slate-200 bg-white py-1 pl-7 pr-2 text-[11px] dark:border-slate-700 dark:bg-slate-950"
class="w-full rounded-md border border-default bg-surface py-1 pl-7 pr-2 text-[11px]"
:placeholder="t('chat.shippingOrderReview.otNav.searchPlaceholder')"
data-testid="review-doc-nav-search"
>
</label>
<select
v-model="statusFilter"
class="w-full rounded-md border border-slate-200 bg-white px-2 py-1 text-[11px] dark:border-slate-700 dark:bg-slate-950"
class="w-full rounded-md border border-default bg-surface px-2 py-1 text-[11px]"
data-testid="review-doc-nav-filter"
>
<option value="all">{{ t('chat.shippingOrderReview.otNav.filterAll') }}</option>
@@ -299,7 +299,7 @@ function onSelect(caseNo: string) {
class="mb-1 flex w-full items-start gap-2 rounded-lg border px-2 py-1.5 text-left text-xs transition-colors"
:class="activeCaseNo === item.case_no
? 'border-sky-500 bg-sky-50 dark:border-sky-700 dark:bg-sky-950/40'
: 'border-transparent hover:bg-slate-50 dark:hover:bg-slate-800'"
: 'border-transparent hover-surface-soft '"
:title="collapsed
? `${item.file_name || item.case_no} · ${caseStatusLabel(item.status)}`
: undefined"
@@ -308,11 +308,11 @@ function onSelect(caseNo: string) {
>
<span
v-if="collapsed"
class="flex h-12 w-full min-w-0 flex-col items-center justify-center rounded-md bg-slate-100 px-1 text-[10px] dark:bg-slate-800"
class="flex h-12 w-full min-w-0 flex-col items-center justify-center rounded-md bg-surface-strong px-1 text-[10px]"
:title="`${index + 1}. ${item.file_name || item.case_no}`"
>
<span class="font-semibold">{{ index + 1 }}</span>
<span class="mt-0.5 w-full truncate text-center text-[9px] font-medium text-slate-600 dark:text-slate-300">
<span class="mt-0.5 w-full truncate text-center text-[9px] font-medium text-secondary">
{{ (item.file_name || item.case_no).replace(/\.[^.]+$/, '').slice(0, 7) }}
</span>
</span>
@@ -331,7 +331,7 @@ function onSelect(caseNo: string) {
/>
<Circle
v-else
class="mt-0.5 h-3 w-3 shrink-0 text-slate-400"
class="mt-0.5 h-3 w-3 shrink-0 text-muted"
/>
<span class="min-w-0 flex-1">
<span class="block truncate font-medium text-primary">
@@ -354,7 +354,7 @@ function onSelect(caseNo: string) {
<template v-else-if="mode === 'narrow'">
<button
type="button"
class="inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-white px-3 py-2 text-xs font-medium shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="inline-flex items-center gap-2 rounded-xl border border-default bg-surface px-3 py-2 text-xs font-medium shadow-sm"
data-testid="review-doc-nav-narrow-trigger"
@click="drawerOpen = true"
>
@@ -391,7 +391,7 @@ function onSelect(caseNo: string) {
class="flex w-full flex-col rounded-lg border px-3 py-2 text-left text-xs"
:class="activeCaseNo === item.case_no
? 'border-sky-500 bg-sky-50'
: 'border-slate-200'"
: 'border-default'"
:data-testid="`review-doc-nav-${item.case_no}`"
@click="onSelect(item.case_no)"
>
@@ -373,25 +373,25 @@ watch(
<template>
<div
class="relative flex flex-1 flex-col overflow-hidden bg-slate-100 dark:bg-slate-950"
class="relative flex flex-1 flex-col overflow-hidden bg-surface-strong"
:class="drawerMode ? 'min-h-[200px]' : 'min-h-[180px] xl:min-h-[360px]'"
:data-drawer-mode="drawerMode ? 'true' : 'false'"
>
<div class="flex shrink-0 items-center justify-between gap-1 border-b border-slate-200 bg-white/95 px-2 py-1.5 text-xs dark:border-slate-800 dark:bg-slate-900/95">
<div class="flex shrink-0 items-center justify-between gap-1 border-b border-default bg-white/95 px-2 py-1.5 text-xs dark:bg-slate-900/95">
<div class="flex items-center gap-1">
<button
type="button"
class="rounded border px-2 py-1 hover:bg-slate-50 disabled:opacity-40 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border px-2 py-1 hover-surface-soft disabled:opacity-40"
data-testid="review-pdf-prev-page"
:disabled="currentPage <= 1"
@click="prevPage"
>‹</button>
<span class="min-w-16 text-center text-slate-600 dark:text-slate-300" data-testid="review-pdf-page-label">
<span class="min-w-16 text-center text-secondary" data-testid="review-pdf-page-label">
{{ currentPage }} / {{ pageCount || '—' }}
</span>
<button
type="button"
class="rounded border px-2 py-1 hover:bg-slate-50 disabled:opacity-40 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border px-2 py-1 hover-surface-soft disabled:opacity-40"
data-testid="review-pdf-next-page"
:disabled="!pageCount || currentPage >= pageCount"
@click="nextPage"
@@ -402,13 +402,13 @@ watch(
type="number"
min="1"
:max="pageCount || undefined"
class="w-12 rounded border border-slate-300 px-1 py-0.5 text-center dark:border-slate-700 dark:bg-slate-950"
class="w-12 rounded border border-default px-1 py-0.5 text-center"
data-testid="review-pdf-page-jump"
:aria-label="t('chat.shippingOrderReview.previewZoom.jumpPage')"
>
<button
type="submit"
class="rounded border px-1.5 py-0.5 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border px-1.5 py-0.5 hover-surface-soft"
data-testid="review-pdf-page-jump-go"
>{{ t('chat.shippingOrderReview.previewZoom.go') }}</button>
</form>
@@ -416,33 +416,33 @@ watch(
<div class="flex flex-wrap items-center gap-1">
<button
type="button"
class="rounded border px-1.5 py-1 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border px-1.5 py-1 hover-surface-soft"
data-testid="review-pdf-zoom-fit-width"
:title="t('chat.shippingOrderReview.previewZoom.fitWidth')"
@click="fitWidth"
>{{ t('chat.shippingOrderReview.previewZoom.fitWidthShort') }}</button>
<button
type="button"
class="rounded border px-1.5 py-1 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border px-1.5 py-1 hover-surface-soft"
data-testid="review-pdf-zoom-fit-page"
:title="t('chat.shippingOrderReview.previewZoom.fitPage')"
@click="fitPage"
>{{ t('chat.shippingOrderReview.previewZoom.fitPageShort') }}</button>
<button
type="button"
class="rounded border px-1.5 py-1 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border px-1.5 py-1 hover-surface-soft"
data-testid="review-pdf-zoom-actual"
:title="t('chat.shippingOrderReview.previewZoom.actual')"
@click="zoomActual"
>100%</button>
<button type="button" class="rounded border px-2 py-1 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800" data-testid="review-pdf-zoom-out" @click="zoomOut">−</button>
<span class="min-w-12 text-center text-slate-600 dark:text-slate-300" data-testid="review-pdf-zoom-label">{{ zoomLabel }}</span>
<button type="button" class="rounded border px-2 py-1 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800" data-testid="review-pdf-zoom-in" @click="zoomIn">+</button>
<button type="button" class="rounded border px-2 py-1 hover-surface-soft" data-testid="review-pdf-zoom-out" @click="zoomOut">−</button>
<span class="min-w-12 text-center text-secondary" data-testid="review-pdf-zoom-label">{{ zoomLabel }}</span>
<button type="button" class="rounded border px-2 py-1 hover-surface-soft" data-testid="review-pdf-zoom-in" @click="zoomIn">+</button>
</div>
</div>
<div
v-if="showCandidateBanner || showVerifiedLegend"
class="flex shrink-0 flex-wrap items-center gap-2 border-b border-slate-200 bg-white/90 px-2 py-1 text-[11px] dark:border-slate-800 dark:bg-slate-900/90"
class="flex shrink-0 flex-wrap items-center gap-2 border-b border-default bg-white/90 px-2 py-1 text-[11px] dark:bg-slate-900/90"
data-testid="review-pdf-highlight-legend"
>
<span
@@ -471,8 +471,8 @@ watch(
@pointerdown="onPanStart"
>
<!-- Keep the canvas mounted while PDF.js is loading; otherwise nextTick cannot obtain a render target. -->
<canvas ref="canvas" :aria-label="title" class="bg-white shadow select-none" :class="{ invisible: loading || failed }" />
<span v-if="loading" class="absolute text-sm text-slate-500">{{ loadingText }}</span>
<canvas ref="canvas" :aria-label="title" class="bg-surface shadow select-none" :class="{ invisible: loading || failed }" />
<span v-if="loading" class="absolute text-sm text-muted">{{ loadingText }}</span>
<span v-else-if="failed" class="absolute text-sm text-rose-600">{{ unavailableText }}</span>
<div
v-else-if="showCandidateBanner && !loading && !failed"
@@ -165,7 +165,7 @@ defineExpose({
<div
v-if="primaryMatch"
class="mt-2 rounded-lg border border-amber-200 bg-white/90 px-2.5 py-2 text-xs text-secondary dark:border-amber-900 dark:bg-slate-900"
class="mt-2 rounded-lg border border-amber-200 bg-white/90 px-2.5 py-2 text-xs text-secondary dark:border-amber-900"
data-testid="review-duplicate-match"
>
<div class="font-medium text-primary">
@@ -44,7 +44,7 @@ function fieldLabel(issue: FieldCompletenessIssue): string {
<template>
<section
v-if="visible"
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
data-testid="review-field-completeness-panel"
:data-status="status"
>
@@ -24,7 +24,7 @@ const props = defineProps<{
const emit = defineEmits<{
refreshed: [];
'focus-conflict': [payload: { fieldCode: string; lineIndex: number | null; lineKey: string | null }];
'focus-conflict': [payload: { fieldCode: string; lineIndex: number | null; draftLineId: string | null }];
}>();
const { t, te } = useI18n();
@@ -90,7 +90,7 @@ function onFocus(conflict: ShippingOrderReviewFieldConflict) {
emit('focus-conflict', {
fieldCode: conflict.field_code,
lineIndex: conflict.line_index ?? null,
lineKey: conflict.line_key ?? null,
draftLineId: conflict.draft_line_id ?? null,
});
}
@@ -212,7 +212,7 @@ async function submitCustom(conflict: ShippingOrderReviewFieldConflict) {
<li
v-for="conflict in openConflicts"
:key="conflict.conflict_key"
class="rounded-lg border border-rose-200 bg-white/95 px-2.5 py-2 dark:border-rose-900 dark:bg-slate-900"
class="rounded-lg border border-rose-200 bg-white/95 px-2.5 py-2 dark:border-rose-900"
:data-testid="`review-field-conflict-${conflict.conflict_key}`"
>
<div class="flex flex-wrap items-center justify-between gap-2">
@@ -247,7 +247,7 @@ async function submitCustom(conflict: ShippingOrderReviewFieldConflict) {
class="rounded px-1 py-0.5 text-[10px] font-medium"
:class="option.evidence_role === 'primary_pdf'
? 'bg-sky-100 text-sky-800 dark:bg-sky-950 dark:text-sky-200'
: 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200'"
: 'bg-surface-strong text-secondary '"
:data-testid="`review-field-conflict-evidence-role-${idx}`"
:data-evidence-role="option.evidence_role"
>
@@ -315,7 +315,7 @@ async function submitCustom(conflict: ShippingOrderReviewFieldConflict) {
<li
v-for="issue in openEvidenceIssues"
:key="`${issue.conflict_key}-${issue.reason}`"
class="flex flex-wrap items-center justify-between gap-2 rounded border border-amber-200 bg-white/95 px-2.5 py-2 text-xs dark:border-amber-900 dark:bg-slate-900"
class="flex flex-wrap items-center justify-between gap-2 rounded border border-amber-200 bg-white/95 px-2.5 py-2 text-xs dark:border-amber-900"
>
<span class="text-amber-950 dark:text-amber-50">
<span class="text-muted">{{ scopeLabel(issue.scope) }} · </span>
@@ -5,12 +5,12 @@ import { useI18n } from 'vue-i18n';
import type { ShippingOrderReviewLineFulfillment } from '@/features/chat/types/shipping.api.types';
const props = defineProps<{ caseNo: string; draftVersion: number | null | undefined; lineFulfillment: ShippingOrderReviewLineFulfillment | null | undefined; editable: boolean }>();
const emit = defineEmits<{ refreshed: []; 'open-close-dialog': [lineKeys: string[]] }>();
const emit = defineEmits<{ refreshed: []; 'open-close-dialog': [draftLineIds: string[]] }>();
const { t } = useI18n();
const TERMINAL_STATUSES = new Set(['task_created', 'fulfilled', 'closed_unfulfillable']);
const openLines = computed(() => (props.lineFulfillment?.lines || []).filter((line) => !TERMINAL_STATUSES.has(String(line.line_status || ''))));
const visible = computed(() => Boolean(props.lineFulfillment?.has_open_lines || props.lineFulfillment?.has_shortage));
function onCloseRemaining() { emit('open-close-dialog', openLines.value.map((line) => line.line_key)); }
function onCloseRemaining() { emit('open-close-dialog', openLines.value.map((line) => line.draft_line_id)); }
</script>
<template>
@@ -25,6 +25,6 @@ function onCloseRemaining() { emit('open-close-dialog', openLines.value.map((lin
<div class="rounded-lg bg-white/70 px-2.5 py-2 dark:bg-slate-900/50">{{ t('chat.shippingOrderReview.fulfillmentDecision.autoProgressCount', { count: lineFulfillment?.auto_progress_count ?? 0 }) }}</div>
<div class="rounded-lg bg-white/70 px-2.5 py-2 dark:bg-slate-900/50">{{ t('chat.shippingOrderReview.fulfillmentDecision.summaryHint') }}</div>
</div>
<div v-if="editable && openLines.length" class="mt-3"><button type="button" class="rounded-xl border border-rose-300 bg-white px-3 py-1.5 text-sm text-rose-800 hover:bg-rose-50 dark:border-rose-800 dark:bg-slate-900 dark:text-rose-200" data-testid="review-fulfillment-close-remaining" @click="onCloseRemaining">{{ t('chat.shippingOrderReview.fulfillmentDecision.closeRemaining') }}</button></div>
<div v-if="editable && openLines.length" class="mt-3"><button type="button" class="rounded-xl border border-rose-300 bg-surface px-3 py-1.5 text-sm text-rose-800 hover:bg-rose-50 dark:border-rose-800 dark:text-rose-200" data-testid="review-fulfillment-close-remaining" @click="onCloseRemaining">{{ t('chat.shippingOrderReview.fulfillmentDecision.closeRemaining') }}</button></div>
</section>
</template>
@@ -47,7 +47,7 @@ watch(
>
<div
v-if="loading"
class="rounded-xl border border-dashed border-slate-300 bg-slate-50 p-4 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-300"
class="rounded-xl border border-dashed border-default bg-surface-soft p-4 text-sm text-secondary dark:bg-slate-900/40"
data-testid="intake-parse-loading"
>
{{ t('chat.shippingOrderReview.lifecycle.intakeParse.loading') }}
@@ -70,38 +70,38 @@ watch(
</div>
<template v-else-if="context">
<section class="rounded-xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900">
<section class="rounded-xl border border-default bg-surface p-4 shadow-sm">
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.lifecycle.intakeParse.email') }}</h2>
<template v-if="context.email">
<p class="mt-1 text-xs text-slate-500">{{ context.email.filename }}</p>
<p class="mt-1 text-xs text-muted">{{ context.email.filename }}</p>
<iframe
v-if="context.email.render_kind === 'safe_html' && context.email.preview_url"
:src="context.email.preview_url"
sandbox=""
referrerpolicy="no-referrer"
:title="t('chat.shippingOrderReview.lifecycle.intakeParse.emailPreviewTitle')"
class="mt-3 h-72 w-full rounded border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-950"
class="mt-3 h-72 w-full rounded border border-default bg-surface"
data-testid="intake-parse-email-html"
/>
<pre
v-else
class="mt-3 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-slate-50 p-3 text-xs text-slate-700 dark:bg-slate-950/50 dark:text-slate-200"
class="mt-3 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-surface-soft p-3 text-xs text-secondary dark:bg-slate-950/50"
data-testid="intake-parse-email-body"
>{{ context.email.text }}</pre>
</template>
<p
v-else
class="mt-2 text-sm text-slate-500"
class="mt-2 text-sm text-muted"
data-testid="intake-parse-no-email"
>
{{ t('chat.shippingOrderReview.lifecycle.intakeParse.noEmail') }}
</p>
</section>
<section class="rounded-xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900">
<section class="rounded-xl border border-default bg-surface p-4 shadow-sm">
<h2 class="text-sm font-semibold" data-testid="intake-parse-attachment-heading">
{{ t('chat.shippingOrderReview.lifecycle.intakeParse.attachment') }} ·
<span class="font-normal text-slate-500 dark:text-slate-400">{{ context.attachment.filename }}</span>
<span class="font-normal text-muted">{{ context.attachment.filename }}</span>
</h2>
<div
@@ -111,7 +111,7 @@ watch(
>
<p
v-if="previewLoading"
class="mt-2 text-sm text-slate-500"
class="mt-2 text-sm text-muted"
data-testid="intake-parse-preview-loading"
>
{{ t('chat.shippingOrderReview.lifecycle.intakeParse.previewLoading') }}
@@ -120,12 +120,12 @@ watch(
v-else-if="previewUrl"
:src="previewUrl"
:title="context.attachment.filename"
class="mt-2 h-[32rem] w-full rounded border border-slate-200 dark:border-slate-700"
class="mt-2 h-[32rem] w-full rounded border border-default"
/>
<button
v-else
type="button"
class="mt-2 rounded border border-slate-300 px-2.5 py-1 text-xs hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="mt-2 rounded border border-default px-2.5 py-1 text-xs hover-surface-soft"
data-testid="intake-parse-load-preview"
@click="emit('load-preview')"
>
@@ -134,7 +134,7 @@ watch(
</div>
<p
v-else
class="mt-4 rounded bg-slate-50 p-3 text-sm text-slate-500 dark:bg-slate-950/50"
class="mt-4 rounded bg-surface-soft p-3 text-sm text-muted dark:bg-slate-950/50"
data-testid="intake-parse-preview-unsupported"
>
{{ t('chat.shippingOrderReview.lifecycle.intakeParse.previewUnsupported') }}
@@ -18,7 +18,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(e: 'reroute', lineKey?: string): void;
(e: 'reroute', draftLineId?: string): void;
}>();
const { t, te } = useI18n();
@@ -84,8 +84,8 @@ function unavailableReasonLabel(line: ShippingOrderReviewBuildEligibilityLinePro
* 触发行级重新匹配路由。
*/
function rerouteLine(line: ShippingOrderReviewBuildEligibilityLineProjection) {
const lineKey = String(line.line_key || '').trim();
emit('reroute', lineKey || undefined);
const draftLineId = String(line.draft_line_id || '').trim();
emit('reroute', draftLineId || undefined);
}
</script>
@@ -98,24 +98,24 @@ function rerouteLine(line: ShippingOrderReviewBuildEligibilityLineProjection) {
>
<header class="mb-3">
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.inventoryCandidates.title') }}</h2>
<p class="mt-0.5 text-xs text-slate-600 dark:text-slate-400">
<p class="mt-0.5 text-xs text-secondary">
{{ t('chat.shippingOrderReview.inventoryCandidates.subtitle') }}
</p>
<p class="mt-1 text-xs text-slate-500 dark:text-slate-400">
<p class="mt-1 text-xs text-muted">
{{ t('chat.shippingOrderReview.inventoryRouting.rerouteHint') }}
</p>
</header>
<article
v-for="line in lines"
:key="String(line.line_key || line.line_index)"
class="mb-3 rounded-lg border border-slate-200 bg-white p-3 last:mb-0 dark:border-slate-700 dark:bg-slate-900"
:data-testid="`review-inventory-candidates-line-${line.line_key || line.line_index}`"
:key="String(line.line_no)"
class="mb-3 rounded-lg border border-default bg-surface p-3 last:mb-0"
:data-testid="`review-inventory-candidates-line-${line.line_no}`"
>
<div class="flex flex-wrap items-center justify-between gap-2 text-sm">
<span class="font-medium">
{{ t('chat.shippingOrderReview.line', { index: (line.line_index ?? 0) + 1 }) }}
<span v-if="line.effective_reservation_id" class="ml-1 text-xs text-slate-500">
<span v-if="line.effective_reservation_id" class="ml-1 text-xs text-muted">
{{ line.effective_reservation_id }}
</span>
</span>
@@ -126,7 +126,7 @@ function rerouteLine(line: ShippingOrderReviewBuildEligibilityLineProjection) {
<p
v-if="line.inventory_source_hint"
class="mt-2 text-xs text-slate-600 dark:text-slate-300"
class="mt-2 text-xs text-secondary"
data-testid="review-inventory-routing-hint"
>
{{ t('chat.shippingOrderReview.inventoryRouting.hint') }}:
@@ -138,14 +138,14 @@ function rerouteLine(line: ShippingOrderReviewBuildEligibilityLineProjection) {
>{{ sourceCodeLabel(String(line.inventory_source_hint)) }}</span>
</p>
<div class="mt-2 space-y-2 text-xs text-slate-600 dark:text-slate-300">
<div class="mt-2 space-y-2 text-xs text-secondary">
<div v-if="matchedRuleCodes(line).length" data-testid="review-inventory-matched-rules">
<div class="font-medium">{{ t('chat.shippingOrderReview.inventoryRouting.matchedRules') }}</div>
<div class="mt-1 flex flex-wrap gap-1.5">
<span
v-for="ruleCode in matchedRuleCodes(line)"
:key="`rule-${ruleCode}`"
class="rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 font-mono text-[11px] dark:border-slate-600 dark:bg-slate-800"
class="rounded border border-default bg-surface-soft px-1.5 py-0.5 font-mono text-[11px]"
>{{ ruleCode }}</span>
</div>
</div>
@@ -155,11 +155,11 @@ function rerouteLine(line: ShippingOrderReviewBuildEligibilityLineProjection) {
<div
v-for="code in line.raw_rule_source_codes"
:key="`raw-${code}`"
class="rounded-md border border-slate-200 bg-white px-2 py-1.5 dark:border-slate-600 dark:bg-slate-950"
class="rounded-md border border-default bg-surface px-2 py-1.5"
>
<div class="truncate font-medium text-slate-700 dark:text-slate-200">{{ sourceBusinessName(String(code)) }}</div>
<div class="truncate font-medium text-secondary">{{ sourceBusinessName(String(code)) }}</div>
<div
class="mt-0.5 font-mono text-[11px] text-slate-500"
class="mt-0.5 font-mono text-[11px] text-muted"
:data-source-code="sourceCodeLabel(String(code))"
>{{ sourceCodeLabel(String(code)) }}</div>
</div>
@@ -203,7 +203,7 @@ function rerouteLine(line: ShippingOrderReviewBuildEligibilityLineProjection) {
<div class="mt-3 flex flex-wrap items-center justify-end gap-2">
<button
type="button"
class="rounded border border-slate-300 bg-white px-3 py-1.5 text-xs text-slate-700 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-950 dark:text-slate-200"
class="rounded border border-default bg-surface px-3 py-1.5 text-xs text-secondary disabled:opacity-50"
data-testid="review-inventory-routing-reroute"
:disabled="!editable || saving"
@click="rerouteLine(line)"
@@ -66,7 +66,7 @@ const reasonLabel = computed(() => {
</p>
<button
type="button"
class="mt-3 w-full rounded-xl border border-amber-300 bg-white px-3 py-1.5 text-sm text-amber-950 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-800 dark:bg-slate-900 dark:text-amber-50"
class="mt-3 w-full rounded-xl border border-amber-300 bg-surface px-3 py-1.5 text-sm text-amber-950 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-800 dark:text-amber-50"
data-testid="review-inventory-fallback-retry"
:disabled="busy"
@click="emit('retry-preparation')"
@@ -40,7 +40,7 @@ function blockReasonLabel(reason?: string | null): string {
<template>
<section
v-if="lines.length"
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
data-testid="review-inventory-issue-list"
>
<header class="mb-2 flex items-center justify-between gap-2">
@@ -58,9 +58,9 @@ function blockReasonLabel(reason?: string | null): string {
<ul v-if="!summaryOnly" class="space-y-1.5">
<li
v-for="line in lines"
:key="String(line.line_key || line.line_index)"
:key="String(line.line_no)"
class="rounded-lg border border-amber-200 bg-amber-50/70 px-2.5 py-2 text-xs dark:border-amber-900 dark:bg-amber-950/30"
:data-testid="`review-inventory-issue-${line.line_key || line.line_index}`"
:data-testid="`review-inventory-issue-${line.line_no}`"
>
<button
type="button"
@@ -54,11 +54,11 @@ const showEnterInventory = computed(() => (
<template>
<section
v-if="visible"
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
data-testid="review-line-fulfillment-aggregate-card"
>
<header class="mb-2">
<h2 class="text-sm font-semibold text-slate-900 dark:text-slate-50">
<h2 class="text-sm font-semibold text-primary dark:text-slate-50">
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.title') }}
</h2>
<p class="mt-0.5 text-xs text-muted">
@@ -104,7 +104,7 @@ const showEnterInventory = computed(() => (
<button
v-if="showEnterInventory"
type="button"
class="mt-3 w-full rounded-xl border border-slate-300 bg-slate-50 px-3 py-1.5 text-sm text-slate-900 hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-50 dark:hover:bg-slate-800"
class="mt-3 w-full rounded-xl border border-default bg-surface-soft px-3 py-1.5 text-sm text-primary hover-surface-strong dark:text-slate-50"
data-testid="review-line-fulfillment-aggregate-enter-inventory"
@click="emit('enter-inventory')"
>
@@ -120,19 +120,19 @@ function formatTime(value: string | null | undefined): string {
<template>
<div
class="rounded-md border border-slate-200 bg-slate-50/80 px-3 py-2 text-xs dark:border-slate-700 dark:bg-slate-950/50"
class="rounded-md border border-default bg-slate-50/80 px-3 py-2 text-xs dark:bg-slate-950/50"
data-testid="review-line-fulfillment-summary"
role="region"
:aria-label="t('chat.shippingOrderReview.lineFulfillmentDetail.title')"
>
<div class="mb-2 flex items-center justify-between gap-2">
<p class="font-medium text-slate-700 dark:text-slate-200">
<p class="font-medium text-secondary">
{{ t('chat.shippingOrderReview.lineFulfillmentDetail.title') }}
</p>
<div class="flex items-center gap-2">
<button
type="button"
class="rounded border border-slate-300 px-2 py-0.5 text-[11px] text-sky-700 hover:bg-white dark:border-slate-600 dark:text-sky-300 dark:hover:bg-slate-900"
class="rounded border border-default px-2 py-0.5 text-[11px] text-sky-700 hover:bg-white dark:text-sky-300"
data-testid="review-line-fulfillment-open-audit"
@click="emit('open-audit')"
>
@@ -140,7 +140,7 @@ function formatTime(value: string | null | undefined): string {
</button>
<button
type="button"
class="rounded px-2 py-0.5 text-[11px] text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-800"
class="rounded px-2 py-0.5 text-[11px] text-muted hover-surface-strong"
data-testid="review-line-fulfillment-summary-close"
@click="emit('close')"
>
@@ -155,9 +155,9 @@ function formatTime(value: string | null | undefined): string {
class="min-w-0 rounded bg-white/70 px-2 py-1.5 dark:bg-slate-900/60"
:data-testid="`review-line-fulfillment-field-${row.key}`"
>
<dt class="text-[10px] font-medium text-slate-500 dark:text-slate-400">{{ row.label }}</dt>
<dt class="text-[10px] font-medium text-muted">{{ row.label }}</dt>
<dd
class="mt-0.5 break-words text-[11px] text-slate-800 dark:text-slate-100"
class="mt-0.5 break-words text-[11px] text-primary"
:class="row.emphasize ? 'font-medium text-rose-700 dark:text-rose-300' : ''"
>
{{ row.value }}
@@ -89,7 +89,7 @@ onBeforeUnmount(() => {
v-if="showMore"
ref="moreBtnRef"
type="button"
class="rounded p-1.5 hover:bg-slate-100 disabled:opacity-50 dark:hover:bg-slate-800"
class="rounded p-1.5 hover-surface-strong disabled:opacity-50"
data-testid="review-line-more-actions"
:disabled="!editable || busy || taskRunning"
:aria-label="t('chat.shippingOrderReview.lineOps.moreActions')"
@@ -103,7 +103,7 @@ onBeforeUnmount(() => {
<Teleport to="body">
<div
v-if="moreMenuOpen && showMore"
class="rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-slate-700 dark:bg-slate-900"
class="rounded-md border border-default bg-surface py-1 shadow-lg"
role="menu"
data-testid="review-line-more-menu"
:style="moreMenuStyle"
@@ -54,18 +54,18 @@ const verbatimOk = computed(() => {
<template>
<div class="grid gap-3 md:grid-cols-3" data-testid="review-llm-evidence-comparison">
<div class="rounded-lg border border-slate-200 bg-slate-50 p-3">
<p class="text-xs font-medium uppercase tracking-wide text-slate-500">
<div class="rounded-lg border border-default bg-surface-soft p-3">
<p class="text-xs font-medium uppercase tracking-wide text-muted">
{{ t('chat.shippingOrderReview.llmSuggestion.currentDraft') }}
</p>
<p class="mt-2 text-sm font-semibold text-slate-900">{{ props.fieldLabel }}</p>
<p class="mt-1 text-sm text-slate-700">{{ draftDisplay }}</p>
<p class="mt-2 text-sm font-semibold text-primary">{{ props.fieldLabel }}</p>
<p class="mt-1 text-sm text-secondary">{{ draftDisplay }}</p>
</div>
<div class="rounded-lg border border-indigo-200 bg-indigo-50/60 p-3">
<p class="text-xs font-medium uppercase tracking-wide text-indigo-600">
{{ t('chat.shippingOrderReview.llmSuggestion.aiSuggestion') }}
</p>
<p class="mt-2 text-sm font-semibold text-slate-900">{{ suggestedValue }}</p>
<p class="mt-2 text-sm font-semibold text-primary">{{ suggestedValue }}</p>
<p class="mt-1 text-xs" :class="verbatimOk ? 'text-emerald-700' : 'text-amber-700'">
{{
verbatimOk
@@ -74,12 +74,12 @@ const verbatimOk = computed(() => {
}}
</p>
</div>
<div class="rounded-lg border border-slate-200 bg-white p-3">
<p class="text-xs font-medium uppercase tracking-wide text-slate-500">
<div class="rounded-lg border border-default bg-surface p-3">
<p class="text-xs font-medium uppercase tracking-wide text-muted">
{{ t('chat.shippingOrderReview.llmSuggestion.sourceEvidence') }}
</p>
<p class="mt-2 text-sm text-slate-800">{{ evidenceQuote }}</p>
<p class="mt-1 text-xs text-slate-500">{{ evidenceLocation }}</p>
<p class="mt-2 text-sm text-primary">{{ evidenceQuote }}</p>
<p class="mt-1 text-xs text-muted">{{ evidenceLocation }}</p>
</div>
</div>
</template>
@@ -163,11 +163,11 @@ onBeforeUnmount(() => {
>
<div
ref="panelRef"
class="max-h-[80vh] w-full max-w-3xl overflow-auto rounded-lg bg-white p-4 shadow-lg dark:bg-slate-900"
class="max-h-[80vh] w-full max-w-3xl overflow-auto rounded-lg bg-surface p-4 shadow-lg"
data-testid="review-llm-suggestion-panel"
>
<h3 class="text-base font-semibold">{{ t('chat.shippingOrderReview.llmSuggestion.dialogTitle') }}</h3>
<p class="mt-1 text-xs text-slate-500">
<p class="mt-1 text-xs text-muted">
{{ t('chat.shippingOrderReview.llmSuggestion.dialogHint') }}
· {{ evidenceLevelText }}
</p>
@@ -199,12 +199,12 @@ onBeforeUnmount(() => {
<input
v-if="decision === 'modify'"
v-model="modifiedValue"
class="mt-2 w-full rounded border p-2 text-sm dark:border-slate-700 dark:bg-slate-950"
class="mt-2 w-full rounded border p-2 text-sm"
:placeholder="t('chat.shippingOrderReview.llmSuggestion.modifiedValue')"
/>
<textarea
v-model="reason"
class="mt-2 w-full rounded border p-2 text-sm dark:border-slate-700 dark:bg-slate-950"
class="mt-2 w-full rounded border p-2 text-sm"
rows="2"
:placeholder="
decision === 'accept'
@@ -46,12 +46,12 @@ const { t } = useI18n();
data-testid="review-llm-suggestion-drawer"
@click.self="emit('close')"
>
<aside class="flex h-full w-full max-w-lg flex-col bg-white shadow-xl dark:bg-slate-900">
<header class="flex items-center justify-between gap-2 border-b border-slate-200 px-4 py-3 dark:border-slate-800">
<aside class="flex h-full w-full max-w-lg flex-col bg-surface shadow-xl">
<header class="flex items-center justify-between gap-2 border-b border-default px-4 py-3">
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.llmSuggestion.panelTitle') }}</h2>
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-llm-drawer-close"
@click="emit('close')"
>
@@ -3,7 +3,7 @@
用途:AI 建议列表与裁决内容(布局重构后作为抽屉内容组件,非常驻主区大卡片)。
依赖:vue-i18n、ReviewLlmSuggestionDialog、ShippingOrderReview* 类型。
逻辑:由 ReviewLlmSuggestionDrawer 挂载;请求须用户主动触发;仅 validated 可接受;
validation_failed 仅可拒绝;provider_unavailable 明示原因;证据按 field_id + line_key/line_index 绑定。
validation_failed 仅可拒绝;provider_unavailable 明示原因;证据按 field_id + draft_line_id/line_index 绑定。
-->
<script setup lang="ts">
import { computed, ref } from 'vue';
@@ -130,8 +130,8 @@ function evidenceMatchesFieldLine(
const selectedEvidence = computed(() => {
const items = props.evidence || [];
const fieldId = String(selected.value?.field_id || props.focusedFieldId || '');
const lineKey = selected.value?.line_key ?? props.focusedLineKey;
return items.find((item) => evidenceMatchesFieldLine(item, fieldId, lineKey)) || null;
const draftLineId = selected.value?.draft_line_id ?? props.focusedLineKey;
return items.find((item) => evidenceMatchesFieldLine(item, fieldId, draftLineId)) || null;
});
/**
@@ -153,12 +153,12 @@ function readContainerDraftValue(container: Record<string, unknown> | null | und
*/
const dialogDraftValue = computed(() => {
const fieldId = String(selected.value?.field_id || props.focusedFieldId || '');
const lineKey = selected.value?.line_key ?? props.focusedLineKey;
const draftLineId = selected.value?.draft_line_id ?? props.focusedLineKey;
const draft = props.activeCase?.draft;
if (!draft || !fieldId) return props.draftValue ?? null;
if (lineKey) {
if (draftLineId) {
const lines = Array.isArray(draft.lines) ? draft.lines : [];
const line = lines.find((item) => String((item as { line_key?: string }).line_key || '') === String(lineKey));
const line = lines.find((item) => String((item as { draft_line_id?: string }).draft_line_id || '') === String(draftLineId));
return readContainerDraftValue(line as Record<string, unknown> | undefined, fieldId);
}
return readContainerDraftValue(draft.header_values as Record<string, unknown> | undefined, fieldId);
@@ -180,8 +180,8 @@ function suggestionFieldLabel(item: ShippingOrderReviewLlmSuggestion): string {
const fields = props.activeCase?.schema?.fields || [];
const hit = fields.find((field) => String(field.field_id || '') === fieldId);
const name = String(hit?.display_name || hit?.field_code || '').trim();
if (name && item.line_key) {
return `${name} · ${item.line_key}`;
if (name && item.draft_line_id) {
return `${name} · ${item.draft_line_id}`;
}
return name || t('chat.shippingOrderReview.unknownField');
}
@@ -214,11 +214,11 @@ function onDecide(payload: { decision: 'accept' | 'modify' | 'reject'; reason: s
</script>
<template>
<section class="rounded-xl border border-slate-200 bg-white p-3 text-sm shadow-sm dark:border-slate-800 dark:bg-slate-900">
<section class="rounded-xl border border-default bg-surface p-3 text-sm shadow-sm">
<div class="flex flex-wrap items-center justify-between gap-2">
<div>
<div class="font-semibold">{{ t('chat.shippingOrderReview.llmSuggestion.panelTitle') }}</div>
<div class="mt-1 text-xs text-slate-500">
<div class="mt-1 text-xs text-muted">
{{ t('chat.shippingOrderReview.llmSuggestion.panelHint') }}
· {{ evidenceLevelLabel(selected?.evidence_level || 'L1_field') }}
· {{ statusLabel }}
@@ -289,7 +289,7 @@ function onDecide(payload: { decision: 'accept' | 'modify' | 'reject'; reason: s
</div>
<button
type="button"
class="shrink-0 rounded border border-sky-300 bg-white px-2 py-0.5 text-xs text-sky-700 dark:border-sky-700 dark:bg-slate-900 dark:text-sky-200"
class="shrink-0 rounded border border-sky-300 bg-surface px-2 py-0.5 text-xs text-sky-700 dark:border-sky-700 dark:text-sky-200"
:disabled="!canRequest"
:aria-label="t('chat.shippingOrderReview.llmSuggestion.request')"
@click="emit('requestSuggestion')"
@@ -301,7 +301,7 @@ function onDecide(payload: { decision: 'accept' | 'modify' | 'reject'; reason: s
</ul>
<p
v-if="!pendingSuggestions.length && !failedSuggestions.length && !unavailableSuggestions.length && !gatedFailedSuggestions.length"
class="mt-3 text-xs text-slate-500"
class="mt-3 text-xs text-muted"
>
{{ t('chat.shippingOrderReview.llmSuggestion.empty') }}
</p>
@@ -309,7 +309,7 @@ function onDecide(payload: { decision: 'accept' | 'modify' | 'reject'; reason: s
<li
v-for="item in pendingSuggestions"
:key="item.suggestion_no"
class="flex items-center justify-between gap-2 rounded border border-slate-200 px-2 py-1.5 dark:border-slate-700"
class="flex items-center justify-between gap-2 rounded border border-default px-2 py-1.5"
>
<div class="min-w-0 truncate text-xs">
<span class="font-medium">{{ suggestionFieldLabel(item) }}</span>
@@ -85,7 +85,7 @@ const selectedLabel = computed(() => {
<template>
<section
v-if="visible"
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
data-testid="review-profile-match-panel"
:data-status="String(profileMatch?.status || '')"
>
@@ -126,7 +126,7 @@ const selectedLabel = computed(() => {
<template v-if="isAdminView && candidateCount">
<button
type="button"
class="mt-3 flex w-full items-center justify-between rounded-lg border border-default bg-surface-soft px-2.5 py-2 text-left text-xs font-medium text-secondary transition-colors hover:bg-slate-50 dark:hover:bg-slate-800"
class="mt-3 flex w-full items-center justify-between rounded-lg border border-default bg-surface-soft px-2.5 py-2 text-left text-xs font-medium text-secondary transition-colors hover-surface-soft"
data-testid="review-profile-match-candidates-toggle"
:aria-expanded="candidatesExpanded"
@click="toggleCandidates"
@@ -110,7 +110,7 @@ async function onRevalidate() {
<li
v-for="(issue, idx) in issues"
:key="`${issue.code}-${issue.line_index}-${idx}`"
class="rounded border border-violet-200 bg-white/90 px-2 py-1 dark:border-violet-900 dark:bg-slate-900"
class="rounded border border-violet-200 bg-white/90 px-2 py-1 dark:border-violet-900"
>
<span v-if="issue.line_index != null">#{{ issue.line_index + 1 }} · </span>
{{ issue.message || issueLabel(issue.code) }}
@@ -132,7 +132,7 @@ async function onRevalidate() {
<tbody>
<tr
v-for="line in lines"
:key="String(line.line_key || line.line_index)"
:key="String(line.draft_line_id || line.line_index)"
class="border-t border-violet-100 dark:border-violet-900"
:class="line.needs_attention ? 'bg-amber-50/80 dark:bg-amber-950/20' : ''"
>
@@ -151,7 +151,7 @@ async function onRevalidate() {
<div v-if="editable" class="mt-3 flex flex-wrap gap-2">
<button
type="button"
class="rounded-xl border border-violet-300 bg-white px-3 py-1.5 text-sm text-violet-950 hover:bg-violet-100 disabled:opacity-60 dark:border-violet-800 dark:bg-slate-900 dark:text-violet-100 dark:hover:bg-violet-950"
class="rounded-xl border border-violet-300 bg-surface px-3 py-1.5 text-sm text-violet-950 hover:bg-violet-100 disabled:opacity-60 dark:border-violet-800 dark:text-violet-100 dark:hover:bg-violet-950"
data-testid="review-reservation-revalidate"
:disabled="busy || draftVersion == null"
@click="onRevalidate"
@@ -32,12 +32,12 @@ const { t } = useI18n();
data-testid="review-version-history-drawer"
@click.self="emit('close')"
>
<aside class="flex h-full w-full max-w-md flex-col bg-white shadow-xl dark:bg-slate-900">
<header class="flex items-center justify-between gap-2 border-b border-slate-200 px-4 py-3 dark:border-slate-800">
<aside class="flex h-full w-full max-w-md flex-col bg-surface shadow-xl">
<header class="flex items-center justify-between gap-2 border-b border-default px-4 py-3">
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.versionHistory.title') }}</h2>
<button
type="button"
class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-xs hover-surface-soft"
data-testid="review-version-history-close"
@click="emit('close')"
>
@@ -52,25 +52,25 @@ function selectVersion(version: ShippingWorkflowItemVersion) {
<template>
<section
class="rounded-xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900"
class="rounded-xl border border-default bg-surface p-4 shadow-sm"
data-testid="review-version-history-panel"
:aria-label="t('chat.shippingOrderReview.versionHistory.title')"
>
<header class="mb-3 flex items-center justify-between gap-2">
<div>
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.versionHistory.title') }}</h2>
<p v-if="itemNo" class="mt-0.5 text-xs text-slate-500 dark:text-slate-400">
<p v-if="itemNo" class="mt-0.5 text-xs text-muted">
{{ t('chat.shippingOrderReview.versionHistory.itemNo', { itemNo }) }}
</p>
</div>
</header>
<div v-if="loading" class="py-4 text-sm text-slate-500">{{ t('chat.shippingProcessing.loading') }}</div>
<div v-if="loading" class="py-4 text-sm text-muted">{{ t('chat.shippingProcessing.loading') }}</div>
<template v-else>
<p class="mb-2 text-xs text-slate-500 dark:text-slate-400">
<p class="mb-2 text-xs text-muted">
{{ t('chat.shippingProcessing.versionHistoryNote') }}
</p>
<p v-if="!versions.length" class="py-4 text-sm text-slate-500">
<p v-if="!versions.length" class="py-4 text-sm text-muted">
{{ t('chat.shippingSessionWorkItem.noVersions') }}
</p>
@@ -81,7 +81,7 @@ function selectVersion(version: ShippingWorkflowItemVersion) {
class="rounded-lg border p-3 text-sm"
:class="activeCaseNo === version.case_no
? 'border-sky-500 bg-sky-50 dark:border-sky-700 dark:bg-sky-950/30'
: 'border-slate-200 dark:border-slate-700'"
: 'border-default '"
:data-testid="`review-version-row-${version.case_no}`"
>
<div class="flex flex-wrap items-start justify-between gap-2">
@@ -98,19 +98,19 @@ function selectVersion(version: ShippingWorkflowItemVersion) {
</span>
<span
v-else-if="version.is_readonly"
class="rounded-full bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600 dark:bg-slate-800 dark:text-slate-300"
class="rounded-full bg-surface-strong px-2 py-0.5 text-[11px] text-secondary"
>
{{ t('chat.shippingSessionWorkItem.readonlyVersion') }}
</span>
</div>
<p class="mt-1 truncate text-xs text-slate-500 dark:text-slate-400">
<p class="mt-1 truncate text-xs text-muted">
{{ version.run_no || version.case_no }}
</p>
</div>
<button
v-if="activeCaseNo !== version.case_no"
type="button"
class="shrink-0 rounded border border-slate-200 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="shrink-0 rounded border border-default px-2 py-1 text-xs hover-surface-soft"
@click="selectVersion(version)"
>
{{ version.is_readonly
@@ -119,7 +119,7 @@ function selectVersion(version: ShippingWorkflowItemVersion) {
</button>
</div>
<dl class="mt-2 grid gap-1 text-xs text-slate-600 dark:text-slate-400 sm:grid-cols-2">
<dl class="mt-2 grid gap-1 text-xs text-secondary sm:grid-cols-2">
<div>
<dt class="inline">{{ t('chat.shippingOrderReview.versionHistory.result') }}:</dt>
<dd class="inline">{{ resultLabel(version.case_status) }}</dd>
@@ -97,7 +97,7 @@ const canWriteCaseActions = computed(() => props.actionsExecutable && !props.isR
<template>
<footer
v-if="showFooter"
class="sticky bottom-0 z-20 flex shrink-0 flex-col gap-3 border-t border-slate-200 bg-white/95 p-3 shadow-[0_-4px_12px_rgba(15,23,42,0.06)] backdrop-blur sm:flex-row sm:items-center sm:justify-between dark:border-slate-800 dark:bg-slate-900/95"
class="sticky bottom-0 z-20 flex shrink-0 flex-col gap-3 border-t border-default bg-white/95 p-3 shadow-[0_-4px_12px_rgba(15,23,42,0.06)] backdrop-blur sm:flex-row sm:items-center sm:justify-between dark:bg-slate-900/95"
data-testid="review-footer-actions"
:data-automating="automating ? '1' : '0'"
:data-flow-busy="flowBusy ? '1' : '0'"
@@ -127,7 +127,7 @@ const canWriteCaseActions = computed(() => props.actionsExecutable && !props.isR
v-if="showParseDispositions && hasAction('reparse')"
type="button"
:disabled="controlsBusy"
class="inline-flex items-center gap-1 rounded border border-slate-300 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 disabled:opacity-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
class="inline-flex items-center gap-1 rounded border border-default px-3 py-2 text-sm text-secondary hover-surface-soft disabled:opacity-50"
@click="emit('reparse')"
>
<RefreshCw class="h-4 w-4" />{{ t('chat.shippingOrderReview.reparse') }}
@@ -139,7 +139,7 @@ const canWriteCaseActions = computed(() => props.actionsExecutable && !props.isR
:key="`${item.intent}-${item.actionCode}`"
type="button"
:disabled="controlsBusy"
class="rounded border border-slate-300 px-3 py-2 text-sm text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
class="rounded border border-default px-3 py-2 text-sm text-secondary hover-surface-soft disabled:opacity-50"
:data-testid="`review-footer-flow-${item.intent}`"
:data-intent="item.intent"
@click="emit('flow-action', item)"
@@ -31,10 +31,10 @@ const { t } = useI18n();
</script>
<template>
<header class="flex shrink-0 items-center gap-3 border-b border-slate-200 bg-white px-4 py-3 dark:border-slate-800 dark:bg-slate-900">
<header class="flex shrink-0 items-center gap-3 border-b border-default bg-surface px-4 py-3">
<button
type="button"
class="rounded-md p-1 hover:bg-slate-100 dark:hover:bg-slate-800"
class="rounded-md p-1 hover-surface-strong"
:aria-label="t('chat.shippingOrderReview.backToSession')"
@click="emit('back')"
>
@@ -44,14 +44,14 @@ const { t } = useI18n();
<h1 class="text-base font-semibold">{{ t('chat.shippingOrderReview.title') }}</h1>
<p
v-if="selectedOrderSummary"
class="truncate text-xs text-slate-600 dark:text-slate-300"
class="truncate text-xs text-secondary"
data-testid="review-selected-order-summary"
>{{ selectedOrderSummary }}</p>
</div>
<button
v-if="showAuditTrail"
type="button"
class="rounded border border-slate-200 px-2.5 py-1.5 text-xs hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border border-default px-2.5 py-1.5 text-xs hover-surface-soft"
data-testid="review-open-audit-trail"
@click="emit('open-audit-trail')"
>
@@ -60,7 +60,7 @@ const { t } = useI18n();
<button
v-if="showVersionHistory"
type="button"
class="rounded border border-slate-200 px-2.5 py-1.5 text-xs hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
class="rounded border border-default px-2.5 py-1.5 text-xs hover-surface-soft"
data-testid="review-open-version-history"
@click="emit('open-version-history')"
>
@@ -85,7 +85,7 @@ const { t } = useI18n();
</span>
<span
v-if="isReadOnly"
class="shrink-0 rounded-full bg-slate-100 px-2 py-0.5 text-xs text-slate-600 dark:bg-slate-800 dark:text-slate-300"
class="shrink-0 rounded-full bg-surface-strong px-2 py-0.5 text-xs text-secondary"
>
{{ t('chat.shippingOrderReview.readOnly') }}
</span>
@@ -38,11 +38,11 @@ function setMode(next: ReviewWorkbenchMode) {
<template>
<!-- 产品契约:工作台模式条始终可见,便于发现库存/证据模式入口。 -->
<div
class="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-slate-200 bg-white px-3 py-2 text-xs dark:border-slate-800 dark:bg-slate-900"
class="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-default bg-surface px-3 py-2 text-xs"
data-testid="review-workbench-mode"
:data-workbench-mode="mode"
>
<span class="font-medium text-slate-600 dark:text-slate-300">
<span class="font-medium text-secondary">
{{ modeLabel }}
</span>
<div class="flex flex-wrap items-center gap-2">
@@ -58,7 +58,7 @@ function setMode(next: ReviewWorkbenchMode) {
<button
v-if="mode === 'evidence' || mode === 'inventory'"
type="button"
class="rounded border border-slate-300 px-2 py-1 text-slate-700 hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-800"
class="rounded border border-default px-2 py-1 text-secondary hover-surface-soft"
data-testid="review-return-standard-mode"
@click="setMode('standard')"
>
@@ -4,7 +4,7 @@
* 依赖:vue-i18n、ConversationProcessingProjection、conversationProcessingState、
* conversationProcessingDisplay、actionPresentation、shippingProcessingLabels、SidebarProgressInline。
* 逻辑:由 ShippingWorkflowTimeline 嵌入;只消费统一 projection / workItems;
* 统一「订单识别任务」+ 主文件副标题;处理记录默认折叠(已完成/历史版本/已取消);
* 统一「本次订单文件处理」+ 主文件副标题;处理记录默认折叠(已完成/历史版本/已取消);
* UI-02:有文件对象时次要入口仅为「展开文件详情」,无文件对象时才「查看详情」;
* 有 workItem 时由其统一 Gate / Action 投影常驻渲染人工恢复按钮;
* 点击/展开任务只更新本地焦点与详情,不写服务端 viewed/focus 审计,不得改变同一 Gate 的按钮可见性;
@@ -42,6 +42,12 @@ import {
} from '@/features/shipping-progress/actionPresentation';
import SidebarProgressInline from '@/features/shipping-progress/components/SidebarProgressInline.vue';
import type { ActionPresentation, ActionPresentationItem } from '@/features/shipping-progress/types';
// [统一阶段口径] 5 段业务标签映射唯一来自共享模块(后端 LIFECYCLE_STAGE_BY_PROCESSING_STAGE 镜像)。
import {
LIFECYCLE_STAGE_CODES,
LIFECYCLE_STAGE_LABEL_KEYS,
type LifecycleStageCode,
} from '@/features/shipping-progress/stageMapping';
const props = defineProps<{
projection: ConversationProcessingProjection | null;
@@ -85,6 +91,8 @@ const { t, te } = useI18n();
const uiState = createConversationProcessingUiState();
/** 处理记录整组默认折叠。 */
const historySectionExpanded = ref(false);
/** 已忽略附件默认折叠,避免干扰仍需处理的订单文件。 */
const ignoredSectionExpanded = ref(false);
/** 批次中心文件叶子行;EML 仅是聚合容器,文件状态、原因与动作必须取叶子自身投影。 */
type WorkbenchFileRow = {
@@ -97,16 +105,9 @@ type WorkbenchFileRow = {
po_number?: string | null;
projection?: ShippingProcessingProjection;
};
const LIFECYCLE_STAGE_CODES = ['intake_parse', 'order_review', 'fulfillment_prep', 'freight_upload', 'upload_complete'] as const;
type LifecycleStageCode = typeof LIFECYCLE_STAGE_CODES[number];
const LIFECYCLE_STAGE_LABEL_KEYS: Record<string, string> = {
intake_parse: 'intakeParse',
order_review: 'orderReview',
fulfillment_prep: 'fulfillmentPrep',
freight_upload: 'freightUpload',
upload_complete: 'uploadComplete',
};
/** 批次分区状态来自后端 PDF 叶子事实,EML 父卡不可反向决定文件归属。 */
type WorkbenchFileGroup = 'failed' | 'waiting_human' | 'processing' | 'completed' | 'cancelled' | 'archived' | 'ignored';
/** 唯一进度源:统一 conversation_processing / work_items 合成投影。 */
const activeProjection = computed((): ConversationProcessingProjection | null => (
props.projection || null
@@ -117,22 +118,59 @@ const hasContent = computed(() => Boolean(
));
const statusGroups = computed(() => activeProjection.value?.status_groups || null);
const completedTasks = computed(() => statusGroups.value?.completed || []);
const historyTasks = computed(() => [
...(statusGroups.value?.cancelled || []),
...(statusGroups.value?.archived || []),
]);
/** EML 卡的状态分区必须完全遵循后端 status_groups,禁止旧四组回退重判。 */
const failedTasks = computed(() => statusGroups.value?.failed || []);
const waitingHumanTasks = computed(() => statusGroups.value?.waiting_human || []);
const processingTasks = computed(() => statusGroups.value?.processing || []);
function partitionIgnoredTasks(
tasks: ConversationProcessingUserTask[],
includeIgnored: boolean,
): ConversationProcessingUserTask[] {
return tasks.flatMap((task) => {
const children = task.aggregateChildren || [];
if (!children.length) {
const projection = projectionForTask(task);
return Boolean(projection && isIgnoredNonOrderAttachment(projection)) === includeIgnored ? [task] : [];
}
const selectedChildren = children.filter((child) => isIgnoredNonOrderAttachment(child) === includeIgnored);
if (!selectedChildren.length) return [];
return [{
...task,
// 已忽略是前端只读视觉分区;必须同步父任务标识,供工作台叶子过滤按同一分区保留 Excel。
// ignored is a presentation-only bucket; keep the domain task group type intact.
group: task.group,
userGroup: task.userGroup,
file_count: selectedChildren.length,
aggregateChildren: selectedChildren,
aggregateSummary: task.aggregateSummary
? { ...task.aggregateSummary, inGroup: selectedChildren.length }
: task.aggregateSummary,
}];
});
}
const processingTasks = computed(() => partitionIgnoredTasks(statusGroups.value?.processing || [], false));
const completedTasks = computed(() => partitionIgnoredTasks(statusGroups.value?.completed || [], false));
const historyTasks = computed(() => partitionIgnoredTasks([
...(statusGroups.value?.cancelled || []),
...(statusGroups.value?.archived || []),
], false));
const ignoredTasks = computed(() => partitionIgnoredTasks([
...(statusGroups.value?.failed || []),
...(statusGroups.value?.waiting_human || []),
...(statusGroups.value?.processing || []),
...(statusGroups.value?.completed || []),
...(statusGroups.value?.cancelled || []),
...(statusGroups.value?.archived || []),
], true));
/** 任务只要含一个命中附件即保留,避免筛选后打散同一封 EML 的上下文。 */
function taskMatchesLifecycleFilter(task: ConversationProcessingUserTask): boolean {
const filter = props.lifecycleFilter || 'all';
const query = String(props.fileSearchQuery || '').trim().toLowerCase();
// 非批次中心保留历史任务卡兼容展示;只有批次中心才按叶子文件筛选。
if (!props.workbenchMode && filter === 'all' && !query) return true;
// 未筛选时优先信任 status_groups;若实时 work_items 尚未同步,允许其显式叶子快照
// 兜底,但历史 document_names 不能伪造成可操作文件行。
if (filter === 'all' && !query) {
return !props.workbenchMode || Boolean(task.aggregateChildren?.length || workbenchFileRows(task).length);
}
return workbenchFileRows(task).some((file) => {
if (filter !== 'all' && String(file.projection?.uiState?.lifecycleStage || '') !== filter) return false;
return !query || [file.filename, file.label, file.po_number]
@@ -142,6 +180,7 @@ function taskMatchesLifecycleFilter(task: ConversationProcessingUserTask): boole
const visibleFailedTasks = computed(() => failedTasks.value.filter(taskMatchesLifecycleFilter));
const visibleWaitingHumanTasks = computed(() => waitingHumanTasks.value.filter(taskMatchesLifecycleFilter));
const visibleProcessingTasks = computed(() => processingTasks.value.filter(taskMatchesLifecycleFilter));
const visibleIgnoredTasks = computed(() => ignoredTasks.value.filter(taskMatchesLifecycleFilter));
const visibleCompletedTasks = computed(() => completedTasks.value.filter(taskMatchesLifecycleFilter));
/** history 中非取消 →「历史版本」。 */
@@ -156,10 +195,11 @@ const cancelledHistoryTasks = computed(() => historyTasks.value.filter(
const visibleHistoryVersionTasks = computed(() => historyVersionTasks.value.filter(taskMatchesLifecycleFilter));
const visibleCancelledHistoryTasks = computed(() => cancelledHistoryTasks.value.filter(taskMatchesLifecycleFilter));
/** 处理记录标题计数:当前返回的 completed + history。 */
const recordTaskCount = computed(() => (
completedTasks.value.length + historyTasks.value.length
));
/** 处理记录标题按 PDF 文件数统计,与对话流状态分区和批次总览保持同一口径。 */
const recordFileCount = computed(() => groupFileCount([
...completedTasks.value,
...historyTasks.value,
]));
/**
* history 未返回条数:summary.history - 当前 history[];不可靠时为 0(不猜数)。
@@ -195,6 +235,7 @@ watch(
if (next === prev) return;
resetConversationProcessingUiState(uiState);
historySectionExpanded.value = false;
ignoredSectionExpanded.value = false;
},
);
@@ -292,12 +333,22 @@ function groupTitle(task: ConversationProcessingUserTask): string {
return task.title || taskLabel(task);
}
/** 工作台文件行:只展示后端 document objects,避免用任务标题冒充文件。 */
/** 状态区内的 EML 标题显示局部/总附件数,明确同一邮件跨区是展示分组而非重复处理。 */
function workbenchGroupTitle(task: ConversationProcessingUserTask): string {
const title = groupTitle(task);
const summary = task.aggregateSummary;
const total = Number(summary?.total || 0);
const inGroup = Number(summary?.inGroup ?? (summary as typeof summary & { in_group?: number } | null)?.in_group ?? 0);
return total > 0 && inGroup > 0 && inGroup < total
? `${title} · ${t('chat.shippingProcessing.batchWorkbench.inGroupCount', { inGroup, total })}`
: title;
}
/** 工作台文件行:展示实时正式文件与后端明确标记的未识别诊断附件,避免用任务标题冒充文件。 */
function workbenchFileRows(task: ConversationProcessingUserTask): WorkbenchFileRow[] {
const children = task.aggregateChildren || [];
// [AUTHORITY] 批次模式只以实时 work_items 作为文件行真相。Conversation task 的
// children / objects / document_names 是 Run 级兼容快照,可用于非批次卡历史展示,
// 但不得重建批次中的文件名、状态、阶段或操作。
// [AUTHORITY] 批次模式优先以实时 work_items 作为文件行真相。若其尚未同步,才使用
// 同次响应 status_groups 已裁决的 aggregate_children 只读兜底,避免概览有数而状态区空白。
if (props.workbenchMode) {
const taskNo = String(task.user_task_no || '').trim();
const liveLeaves = (props.workItems || []).flatMap((item) => {
@@ -311,15 +362,37 @@ function workbenchFileRows(task: ConversationProcessingUserTask): WorkbenchFileR
: [item];
}).filter((item) => (
Number(item.sourceSummary?.documentId || 0) > 0
// 已选但未物化的附件没有 documentId;后端显式标记后才允许作为只读诊断行展示。
|| item.facts?.recognized === false
));
const seenLiveDocumentIds = new Set<number>();
const seenLiveLeafKeys = new Set<string>();
const uniqueLiveLeaves = liveLeaves.filter((item) => {
const documentId = Number(item.sourceSummary?.documentId || 0);
if (seenLiveDocumentIds.has(documentId)) return false;
seenLiveDocumentIds.add(documentId);
const key = documentId > 0
? `document:${documentId}`
: `pending:${String(item.workItemNo || item.sourceSummary?.filename || '').trim()}`;
if (!key || seenLiveLeafKeys.has(key)) return false;
seenLiveLeafKeys.add(key);
return true;
});
return uniqueLiveLeaves.map((item, index) => {
const groupedLeafKeys = new Set((task.aggregateChildren || []).map((child) => {
const documentId = Number(child.sourceSummary?.documentId || 0);
return documentId > 0
? `document:${documentId}`
: `pending:${String(child.workItemNo || child.sourceSummary?.filename || '').trim()}`;
}).filter(Boolean));
const groupedLiveLeaves = uniqueLiveLeaves.filter((item) => {
if (!groupedLeafKeys.size) return true;
const documentId = Number(item.sourceSummary?.documentId || 0);
const key = documentId > 0
? `document:${documentId}`
: `pending:${String(item.workItemNo || item.sourceSummary?.filename || '').trim()}`;
return groupedLeafKeys.has(key);
});
const displayLeaves = groupedLiveLeaves.length
? groupedLiveLeaves
: flattenBusinessFileProjections(children);
return displayLeaves.map((item, index) => {
const documentId = Number(item.sourceSummary?.documentId || 0);
const filename = String(item.sourceSummary?.filename || '').trim();
return {
@@ -406,12 +479,31 @@ function workbenchFileRows(task: ConversationProcessingUserTask): WorkbenchFileR
}));
}
/** 将后端叶子状态映射为批次分区;未知状态不进入任何状态区,避免误报完成。 */
function workbenchFileGroup(file: WorkbenchFileRow): WorkbenchFileGroup | null {
if (isIgnoredNonOrderAttachment(file.projection)) return 'ignored';
const status = String(file.projection?.uiState?.status || file.projection?.userStatus || file.projection?.status || file.status_label || '')
.trim().toLowerCase();
if (status === 'retryable' || status === 'failed') return 'failed';
if (status === 'waiting_human' || status === 'idle') return 'waiting_human';
if (status === 'running' || status === 'processing') return 'processing';
if (status === 'completed') return 'completed';
if (status === 'cancelled') return 'cancelled';
if (status === 'archived') return 'archived';
return null;
}
/** 阶段筛选只收窄附件行,EML 卡本身仍保留以便用户识别邮件来源。 */
function visibleWorkbenchFileRows(task: ConversationProcessingUserTask): WorkbenchFileRow[] {
const filter = props.lifecycleFilter || 'all';
const rows = workbenchFileRows(task);
const query = String(props.fileSearchQuery || '').trim().toLowerCase();
const taskGroup = String(task.userGroup || task.group || '').trim().toLowerCase();
const hasBackendLeafPartition = (task.aggregateChildren || []).length > 0;
return rows.filter((file) => {
// 新投影已由后端下发本分区的叶子白名单;旧夹具/旧响应没有该白名单时保留
// 原兼容展示,避免前端凭不完整字段重判并把文件错误隐藏。
if (props.workbenchMode && hasBackendLeafPartition && workbenchFileGroup(file) !== taskGroup) return false;
if (filter !== 'all' && String(file.projection?.uiState?.lifecycleStage || '') !== filter) return false;
if (!query) return true;
return [file.filename, file.label, file.po_number].some((value) => String(value || '').toLowerCase().includes(query));
@@ -426,8 +518,27 @@ function isDownloadSelected(taskNo: string): boolean {
return (props.selectedDownloadTaskNos || []).includes(taskNo);
}
/** 状态组标题按文件计数,与批次总览保持同一口径。 */
/** 单个状态任务的文件数与对话流一致:优先数后端已裁决的叶子,否则回退 file_count。 */
function taskStatusFileCount(task: ConversationProcessingUserTask): number {
const children = (task.aggregateChildren || []).filter((child) => !String(
child.sourceSummary?.filename || '',
).trim().toLowerCase().endsWith('.eml'));
if (children.length) {
const ids = new Set(children.map((child) => String(
child.sourceSummary?.documentId || child.workItemNo || '',
).trim()).filter(Boolean));
return ids.size || children.length;
}
return Math.max(0, Number(task.file_count || 0));
}
/** 状态组标题按文件计数,与对话流和批次总览保持同一口径。 */
function groupFileCount(tasks: ConversationProcessingUserTask[]): number {
const filter = props.lifecycleFilter || 'all';
const query = String(props.fileSearchQuery || '').trim();
if (filter === 'all' && !query) {
return tasks.reduce((total, task) => total + taskStatusFileCount(task), 0);
}
const seen = new Set<string>();
return tasks.reduce((total, task) => total + visibleWorkbenchFileRows(task).reduce((count, file) => {
const filename = String(file.filename || file.label || '').trim().toLowerCase();
@@ -441,12 +552,29 @@ function groupFileCount(tasks: ConversationProcessingUserTask[]): number {
}
function workbenchFileStatus(file: WorkbenchFileRow, task: ConversationProcessingUserTask): string {
if (isIgnoredNonOrderAttachment(file.projection)) {
return t('chat.shippingProcessing.ignoredNonOrderAttachment');
}
if (file.projection?.facts?.recognized === false) {
return t('chat.shippingProcessing.notRecognized');
}
const status = file.projection
? (file.projection.uiState?.status || file.projection.userStatus || file.projection.status)
: (file.status_label || task.status_label || '');
return resolveShippingProcessingStatusLabel(String(status), te, t);
}
function ignoredWorkbenchFileRows(task: ConversationProcessingUserTask): WorkbenchFileRow[] {
return visibleWorkbenchFileRows(task).filter((file) => isIgnoredNonOrderAttachment(file.projection));
}
/** Excel 附件不进入订单 PDF 识别;仅作为只读诊断行展示。 */
function isIgnoredNonOrderAttachment(item?: ShippingProcessingProjection): boolean {
if (item?.facts?.recognized !== false) return false;
const filename = String(item.sourceSummary?.filename || '').trim().toLowerCase();
return filename.endsWith('.xls') || filename.endsWith('.xlsx');
}
function workbenchFileReason(file: WorkbenchFileRow, task: ConversationProcessingUserTask): string {
if (file.projection) {
const reason = file.projection.uiState
@@ -683,6 +811,7 @@ function shouldShowTaskLevelActions(task: ConversationProcessingUserTask): boole
*/
function recordViewDetailsItem(task: ConversationProcessingUserTask): ActionPresentationItem | null {
if (String(task.status_label || '').trim().toLowerCase() === 'cancelled') return null;
if (String(task.group || '').trim().toLowerCase() === 'completed') return null;
const presentation = taskActionPresentation(task);
const candidates = [
presentation.primary,
@@ -692,9 +821,7 @@ function recordViewDetailsItem(task: ConversationProcessingUserTask): ActionPres
return candidates.find((item) => {
const code = String(item.actionCode || '').trim().toLowerCase();
return code === 'view_details' || code === 'view_result';
}) || (String(task.group || '') === 'completed'
? { intent: 'view_result', actionCode: 'view_result', labelKey: 'chat.shippingProcessing.action.view_result' }
: null);
}) || null;
}
/**
@@ -759,6 +886,14 @@ function toggleHistorySection() {
historySectionExpanded.value = !historySectionExpanded.value;
}
/**
* 切换只读已忽略附件分区。
* 核心逻辑:已忽略附件不参与订单处理,默认收起;用户需要核对时才展开明细。
*/
function toggleIgnoredSection() {
ignoredSectionExpanded.value = !ignoredSectionExpanded.value;
}
/**
* Intake 阶段文案。
*/
@@ -770,7 +905,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
<template>
<div
v-if="hasContent"
class="space-y-3"
class="flex flex-col gap-3"
data-testid="shipping-conversation-processing-card"
>
<section
@@ -800,7 +935,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
@click="onSelectTask(task)"
>
<div class="text-sm font-semibold text-primary">
{{ workbenchMode ? groupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
{{ workbenchMode ? workbenchGroupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
</div>
<div v-if="!workbenchMode" class="mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-secondary">
<span v-if="fileCountLabel(task)">{{ fileCountLabel(task) }}</span>
@@ -904,7 +1039,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
:data-focused="focusedTaskNo === task.user_task_no ? '1' : '0'"
>
<button type="button" class="w-full text-left" @click="onSelectTask(task)">
<div class="text-sm font-semibold text-primary">{{ workbenchMode ? groupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}</div>
<div class="text-sm font-semibold text-primary">{{ workbenchMode ? workbenchGroupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}</div>
<div v-if="!workbenchMode" class="mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-secondary">
<span v-if="fileCountLabel(task)">{{ fileCountLabel(task) }}</span>
</div>
@@ -963,7 +1098,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
@click="onSelectTask(task)"
>
<div class="text-sm font-semibold text-primary">
{{ workbenchMode ? groupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
{{ workbenchMode ? workbenchGroupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
</div>
<div v-if="!workbenchMode" class="mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-secondary">
<span v-if="fileCountLabel(task)">{{ fileCountLabel(task) }}</span>
@@ -1077,19 +1212,62 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
</section>
<section
v-if="recordTaskCount > 0"
v-if="visibleIgnoredTasks.length"
class="order-last"
data-testid="shipping-processing-group-ignored"
>
<button
type="button"
class="mb-1.5 flex w-full items-center gap-1 text-left text-[11px] font-semibold uppercase tracking-wide text-muted"
data-testid="shipping-processing-ignored-toggle"
@click="toggleIgnoredSection"
>
<ChevronDown v-if="ignoredSectionExpanded" class="h-3 w-3 shrink-0" />
<ChevronRight v-else class="h-3 w-3 shrink-0" />
<span>{{ t('chat.shippingProcessing.groupIgnored', { count: groupFileCount(visibleIgnoredTasks) }) }}</span>
</button>
<div v-if="ignoredSectionExpanded" class="space-y-2" data-testid="shipping-processing-ignored-body">
<article
v-for="task in visibleIgnoredTasks"
:key="task.user_task_no"
class="rounded-lg border border-default bg-surface-soft px-2.5 py-2 dark:bg-slate-900/50"
:data-testid="`shipping-processing-task-ignored-${task.user_task_no}`"
>
<div class="text-sm font-semibold text-primary">
{{ workbenchMode ? workbenchGroupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
</div>
<div class="mt-2 space-y-1 border-t border-default pt-2">
<div
v-for="file in ignoredWorkbenchFileRows(task)"
:key="file.object_key"
class="flex items-start justify-between gap-3 rounded-md bg-white/70 px-2 py-1.5 text-[11px] dark:bg-slate-950/30"
:data-testid="`shipping-processing-file-${file.object_key}`"
>
<div class="min-w-0">
<div class="truncate font-medium text-primary">{{ file.filename || file.label }}</div>
<div class="text-secondary">{{ t('chat.shippingProcessing.ignoredNonOrderAttachmentHint') }}</div>
</div>
<span class="shrink-0 rounded-full bg-surface-strong px-2 py-0.5 font-medium text-secondary">{{ workbenchFileStatus(file, task) }}</span>
</div>
</div>
</article>
</div>
</section>
<section
v-if="recordFileCount > 0"
data-testid="shipping-processing-group-history"
>
<button
type="button"
class="mb-1.5 flex w-full items-center justify-between gap-2 text-left text-[11px] font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300"
class="mb-1.5 flex w-full items-center justify-between gap-2 text-left text-[11px] font-semibold uppercase tracking-wide text-secondary"
data-testid="shipping-processing-history-toggle"
@click="toggleHistorySection"
>
<span class="inline-flex min-w-0 items-center gap-1">
<ChevronDown v-if="historySectionExpanded" class="h-3 w-3 shrink-0" />
<ChevronRight v-else class="h-3 w-3 shrink-0" />
<span>{{ resolveShippingProcessingMessage('groupProcessingRecords', te, t, { count: recordTaskCount }) }}</span>
<span>{{ resolveShippingProcessingMessage('groupProcessingRecords', te, t, { count: recordFileCount }) }}</span>
</span>
<span
v-if="hiddenHistoryCount > 0"
@@ -1119,9 +1297,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
:data-testid="`shipping-processing-task-${task.user_task_no}`"
data-record="1"
>
<div class="text-sm font-semibold text-primary">
{{ resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
</div>
<div class="text-sm font-semibold text-primary">{{ workbenchMode ? workbenchGroupTitle(task) : resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}</div>
<div class="mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-secondary">
<span v-if="fileCountLabel(task)">{{ fileCountLabel(task) }}</span>
<span>{{ statusLabel(task) }}</span>
@@ -1162,7 +1338,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
v-if="visibleHistoryVersionTasks.length"
data-testid="shipping-processing-history-versions"
>
<div class="mb-1 text-[11px] font-medium text-slate-600 dark:text-slate-300">
<div class="mb-1 text-[11px] font-medium text-secondary">
{{ resolveShippingProcessingMessage('groupRecordHistoryVersions', te, t) }}
</div>
<div class="space-y-2">
@@ -1204,7 +1380,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
v-if="visibleCancelledHistoryTasks.length"
data-testid="shipping-processing-history-cancelled"
>
<div class="mb-1 text-[11px] font-medium text-slate-500 dark:text-slate-400">
<div class="mb-1 text-[11px] font-medium text-muted">
{{ resolveShippingProcessingMessage('groupRecordCancelled', te, t) }}
</div>
<div class="space-y-2">
@@ -42,7 +42,7 @@ const statusTone = computed(() => {
case 'cancelled':
return 'border-rose-200 bg-rose-50/70 text-rose-900 dark:border-rose-800 dark:bg-rose-950/25 dark:text-rose-100';
default:
return 'border-slate-200 bg-slate-50/70 text-slate-900 dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-100';
return 'border-default bg-slate-50/70 text-primary dark:bg-slate-900/40 ';
}
});
@@ -1,6 +1,6 @@
/**
* features/chat/components/shipping/ShippingOrderExtractionCard.vue
* 用途:聊天主区「订单识别任务」摘要卡——标题、文件数+状态、一行 handling 摘要、唯一主 CTA、查看详情。
* 用途:聊天主区「本次订单文件处理」摘要卡——标题、文件数+状态、一行 handling 摘要、唯一主 CTA、查看详情。
* 依赖:订单抽取 Run 状态卡 DTO、shipping.api 文档/进度接口、ShippingOrderExtractionDetailsDrawer、vue-router、vue-i18n。
* 逻辑:对话区默认展示状态-EML 聚合;批次工作台打开后切换为紧凑摘要,长进度/Gate/刷新取消由工作台承接。
*/
@@ -15,14 +15,17 @@ import type {
ShippingOrderExtractionState,
} from '../../types/chat.types';
import type {
ConversationProcessingUserTask,
ShippingOrderExtractionDocumentResult,
ShippingOrderExtractionProgressEvent,
} from '../../types/shipping.api.types';
import type { ShippingProcessingProjection } from '../../types/shipping.api.types';
import { SHIPPING_WORKFLOW_KEY } from '../../shipping/useShippingNoticeWorkflow';
import { resolveOrderExtractionRunStageKey } from '../../shipping/orderExtractionProgressDisplay';
import {
resolveShippingProcessingReasonLabel,
resolveShippingProcessingStageLabel,
resolveShippingLifecycleStageLabel,
isGenericBlockingReason,
} from '../../shipping/shippingProcessingLabels';
import {
listWorkspaceShippingOrderExtractionDocuments,
@@ -70,7 +73,7 @@ const conversationProjectionLoading = computed(() => Boolean(
) || (hasAuthoritativeConversationProvider.value && !conversationProcessing.value));
const conversationStatusGroups = computed<ConversationStatusGroups | null>(() => conversationProcessing.value?.status_groups || null);
const hasConversationStatusGroups = computed(() => Boolean(conversationStatusGroups.value));
const statusGroupDefs = [
const sourceStatusGroupDefs = [
{ key: 'failed', label: 'chat.shippingProcessing.groupFailed' },
{ key: 'waiting_human', label: 'chat.shippingProcessing.groupWaitingHuman' },
{ key: 'processing', label: 'chat.shippingProcessing.groupProcessing' },
@@ -78,13 +81,76 @@ const statusGroupDefs = [
{ key: 'cancelled', label: 'chat.shippingProcessing.groupCancelled' },
{ key: 'archived', label: 'chat.shippingProcessing.groupHistoryRecords' },
] as const;
const statusGroupDefs = [
...sourceStatusGroupDefs,
{ key: 'ignored', label: 'chat.shippingProcessing.groupIgnored' },
] as const;
const expandedStatusGroups = ref(new Set<string>(['failed', 'waiting_human', 'processing']));
const expandedEmlTasks = ref(new Set<string>());
function statusGroupTasks(key: typeof statusGroupDefs[number]['key']) {
return conversationStatusGroups.value?.[key] || [];
type ConversationStatusGroupKey = typeof statusGroupDefs[number]['key'];
/**
* 将兼容响应中的混合状态 EML 防御性拆成 PDF 状态分区。
*
* 触发时机:后端热更新/旧响应暂时仍将同一 EML 的多种状态附件放在一个父行时使用;
* 新响应已拆分时原样保持。该函数只生成聊天展示副本,状态、附件与动作仍来自后端叶子 DTO。
*/
function statusGroupTasks(key: ConversationStatusGroupKey): ConversationProcessingUserTask[] {
const groups = conversationStatusGroups.value;
if (!groups) return [];
const result = new Map<string, ConversationProcessingUserTask>();
for (const sourceGroup of sourceStatusGroupDefs) {
for (const task of groups[sourceGroup.key] || []) {
const children = task.aggregateChildren || [];
if (!children.length) {
if (sourceGroup.key === key) result.set(task.user_task_no, task);
continue;
}
const matchingChildren = children.filter((child) => {
const status = displayProjectionStatus(child);
const childGroup = isIgnoredNonOrderAttachment(child) ? 'ignored'
: status === 'running' ? 'processing'
: status === 'retryable' ? 'failed'
: status;
return childGroup === key;
});
if (!matchingChildren.length) continue;
const existing = result.get(task.user_task_no);
const mergedChildren = existing
? [...(existing.aggregateChildren || []), ...matchingChildren]
: matchingChildren;
const uniqueChildren = [...new Map(mergedChildren.map((child) => [
String(child.sourceSummary?.documentId || child.workItemNo || ''), child,
])).values()];
const summary = task.aggregateSummary
? {
...task.aggregateSummary,
inGroup: uniqueChildren.length,
completed: key === 'completed' ? uniqueChildren.length : 0,
processing: key === 'processing' ? uniqueChildren.length : 0,
needsAction: key === 'waiting_human' ? uniqueChildren.length : 0,
failed: key === 'failed' ? uniqueChildren.length : 0,
}
: task.aggregateSummary;
result.set(task.user_task_no, {
...task,
group: key === 'ignored' ? 'processing'
: key === 'waiting_human' || key === 'failed'
? 'needs_action'
: key === 'cancelled' || key === 'archived' ? 'history' : key,
userGroup: key === 'ignored' ? 'processing' : key,
file_count: uniqueChildren.length,
aggregateChildren: uniqueChildren,
aggregateSummary: summary,
});
}
}
return [...result.values()];
}
function statusGroupLabel(key: typeof statusGroupDefs[number]['key']) {
const count = statusGroupTasks(key).length;
function statusGroupLabel(key: ConversationStatusGroupKey) {
const tasks = statusGroupTasks(key);
// 状态分组按“状态 → EML → 文件”展示,标题必须统计叶子文件而不是 EML 容器数。
const count = tasks.reduce((total, task) => total + taskFileCount(task), 0);
return t(statusGroupDefs.find((item) => item.key === key)!.label, { count });
}
function toggleStatusGroup(key: string) {
@@ -125,11 +191,12 @@ function taskFileCount(task: { aggregateChildren?: ShippingProcessingProjection[
}
function childStatusLabel(child: ShippingProcessingProjection) {
const status = displayProjectionStatus(child);
if (status === 'completed' && child.facts?.uploadState === 'succeeded') return t('chat.shippingProcessing.aggregate.completed', { count: 1 });
if (status === 'completed') return t('chat.shippingProcessing.groupRecordCompleted');
if (status === 'failed' || status === 'retryable') return t('chat.shippingProcessing.aggregate.failed', { count: 1 });
if (status === 'waiting_human') return t('chat.shippingProcessing.aggregate.needsAction', { count: 1 });
return t('chat.shippingProcessing.aggregate.processing', { count: 1 });
if (isIgnoredNonOrderAttachment(child)) return t('chat.shippingProcessing.ignoredNonOrderAttachment');
if (isUnrecognizedProjection(child)) return t('chat.shippingProcessing.notRecognized');
if (status === 'completed') return t('chat.shippingProcessing.statusBadge.completed');
if (status === 'failed' || status === 'retryable') return t('chat.shippingProcessing.statusBadge.failed');
if (status === 'waiting_human') return t('chat.shippingProcessing.statusBadge.needsAction');
return t('chat.shippingProcessing.statusBadge.processing');
}
function displayReason(
reason?: import('../../types/shipping.api.types').ShippingProcessingBlockingReason | null,
@@ -142,6 +209,16 @@ function displayProjectionStatus(item: ShippingProcessingProjection): string {
? item.uiState.status
: (item.userStatus || item.status || '')).trim().toLowerCase();
}
function isUnrecognizedProjection(item: ShippingProcessingProjection): boolean {
// 冻结选择计划中「已选但尚未物化/未识别」的附件诊断标记。
return item.facts?.recognized === false;
}
/** Excel 附件不进入订单 PDF 识别;保留诊断行但明确其不在识别队列中。 */
function isIgnoredNonOrderAttachment(item: ShippingProcessingProjection): boolean {
if (!isUnrecognizedProjection(item)) return false;
const filename = String(item.sourceSummary?.filename || '').trim().toLowerCase();
return filename.endsWith('.xls') || filename.endsWith('.xlsx');
}
function isFailedProjection(item: ShippingProcessingProjection): boolean {
const status = displayProjectionStatus(item);
return status === 'failed' || status === 'retryable';
@@ -156,8 +233,12 @@ function taskReason(task: { uiState?: { blocking_reason: import('../../types/shi
return task.uiState ? task.uiState.blocking_reason : task.blockingReason;
}
function childStageLabel(child: ShippingProcessingProjection) {
const stage = String(child.uiState?.stage || child.userStage || child.stage || '').trim();
return resolveShippingProcessingStageLabel(stage, te, t);
const stage = String(child.uiState?.lifecycleStage || child.uiState?.stage || child.userStage || child.stage || '').trim();
return resolveShippingLifecycleStageLabel(stage, te, t);
}
/** 行内仅展示「具体、非兜底」的阻塞原因,避免与状态芯片重复。 */
function hasSpecificReason(item: Parameters<typeof taskReason>[0]): boolean {
return !isGenericBlockingReason(taskReason(item), te);
}
function statusTaskProjection(task: { user_task_no?: string | null; aggregateSummary?: { intakeNo?: string | null } | null }) {
const items = shippingWorkflow?.processingWorkItems.value || [];
@@ -218,16 +299,15 @@ const emlAggregate = computed(() => (
const emlAggregateChildren = computed(() => emlAggregate.value?.aggregateChildren || []);
const emlAggregateExpanded = ref(false);
function aggregateStageLabel(item: ShippingProcessingProjection): string {
const stage = String(item.uiState ? item.uiState.stage : (item.userStage || item.stage || '')).trim();
return resolveShippingProcessingStageLabel(stage, te, t);
const stage = String(item.uiState?.lifecycleStage || item.uiState?.stage || item.userStage || item.stage || '').trim();
return resolveShippingLifecycleStageLabel(stage, te, t);
}
function aggregateChildStatusLabel(item: ShippingProcessingProjection): string {
const status = displayProjectionStatus(item);
if (status === 'completed' && item.facts?.uploadState === 'succeeded') return t('chat.shippingProcessing.aggregate.completed', { count: 1 });
if (status === 'completed') return t('chat.shippingProcessing.groupRecordCompleted');
if (status === 'failed' || status === 'retryable') return t('chat.shippingProcessing.aggregate.failed', { count: 1 });
if (status === 'waiting_human') return t('chat.shippingProcessing.aggregate.needsAction', { count: 1 });
return t('chat.shippingProcessing.aggregate.processing', { count: 1 });
if (status === 'completed') return t('chat.shippingProcessing.statusBadge.completed');
if (status === 'failed' || status === 'retryable') return t('chat.shippingProcessing.statusBadge.failed');
if (status === 'waiting_human') return t('chat.shippingProcessing.statusBadge.needsAction');
return t('chat.shippingProcessing.statusBadge.processing');
}
function aggregateSummaryLabel(item: ShippingProcessingProjection): string {
const summary = item.aggregateSummary;
@@ -308,33 +388,131 @@ const failedRows = computed(() => fileRows.value.filter((row) => (
isFailedParseRow(row)
&& !emailRows.value.some((email) => childRows(email).some((child) => child.unitId === row.unitId))
)));
const processedCount = computed(() => {
if (hasConversationStatusGroups.value) {
const summary = conversationProcessing.value?.summary;
// [AUTHORITY] “已处理/完成率”只表示已经完成通知生命周期的业务文件。
// waiting_human / failed 只是后端裁决出的待处理事项,不能借用历史 Run 的
// “处理过”口径累计为完成,否则会与批次进度中心的 completed_files 冲突。
return Math.max(0, Number(summary?.completed_files || 0));
}
// 当前 Run 仅表达抽取/候选状态,不能把 candidate_ready 或历史复核 Case 伪装成
// 已完成通知生命周期;生命周期完成数只由会话权威投影下发。
if (hasCurrentBusinessFileRows.value) return 0;
return emlAggregate.value?.aggregateSummary?.completed
?? (props.state.summary.completedDocuments + props.state.summary.reviewRequiredDocuments);
});
const progressPercent = computed(() => {
const total = batchFileCount.value;
return total > 0 ? Math.min(100, Math.round((processedCount.value / total) * 100)) : 0;
});
/** 新版会话批次的业务文件数由后端汇总;旧 Run 卡仍保留历史兼容计数。 */
const batchFileCount = computed(() => {
if (hasConversationStatusGroups.value) {
return Math.max(0, Number(conversationProcessing.value?.summary?.total_files || 0));
const summary = conversationProcessing.value?.summary;
// 主计数改用提交基 submitted_files(物化前即 ≥1、单调),旧后端未下发时回退 total_files。
return Math.max(0, Number(summary?.submitted_files ?? summary?.total_files ?? 0));
}
if (hasCurrentBusinessFileRows.value) return currentBusinessFileRows.value.length;
return Math.max(0, Number(emlAggregate.value?.sourceSummary.documentCount ?? props.state.summary.totalDocuments));
});
/**
* 已识别/活跃文件数(total_files):由物化文档裁决,随识别演化;作为完成率分母与「已识别 n/N」的 n。
*/
const recognizedFileCount = computed(() => {
if (!hasConversationStatusGroups.value) return null;
return Math.max(0, Number(conversationProcessing.value?.summary?.total_files || 0));
});
/** 提交基主计数(submitted_files);供「已识别 n/N」与空窗占位裁决。 */
const submittedFileCount = computed(() => {
if (!hasConversationStatusGroups.value) return null;
const summary = conversationProcessing.value?.summary;
return Math.max(0, Number(summary?.submitted_files ?? summary?.total_files ?? 0));
});
/** 任一状态组是否已有任务;空窗期(刚发送、尚未识别出附件)时用于显示识别占位。 */
const hasAnyStatusGroupTask = computed(() => (
statusGroupDefs.some((group) => statusGroupTasks(group.key).length > 0)
));
/**
* 空窗占位:已提交(submitted>0)但尚未识别出任何文件(无任务行)时,
* 正文显示「正在识别附件…」,避免向用户呈现「0 个文件」的误导性状态。
*/
const recognizingPlaceholderVisible = computed(() => (
hasConversationStatusGroups.value
&& !props.compactProgress
&& !hasAnyStatusGroupTask.value
&& (submittedFileCount.value ?? 0) > 0
));
/** 「已识别 n / N」次级提示:识别数落后于提交数时展示。 */
const recognizedHint = computed(() => {
const submitted = submittedFileCount.value;
const recognized = recognizedFileCount.value;
if (submitted == null || recognized == null) return null;
if (submitted <= 0 || recognized >= submitted) return null;
return t('chat.shippingProcessing.recognizedOfTotal', { recognized, submitted });
});
/**
* 收集会话投影中的附件叶子,并按稳定文件标识去重。
* 核心逻辑:只读取 status_groups 自带的 aggregateChildren;EML 父行是容器,不可作为订单文件参与顶部完成态。
* @returns 当前会话的附件叶子数组;缺少叶子时返回空数组,保留后端 ui_state 的展示裁决。
*/
function conversationAttachmentLeaves(): ShippingProcessingProjection[] {
const groups = conversationStatusGroups.value;
if (!groups) return [];
const unique = new Map<string, ShippingProcessingProjection>();
for (const group of sourceStatusGroupDefs) {
for (const task of groups[group.key] || []) {
for (const child of task.aggregateChildren || []) {
const key = String(child.sourceSummary?.documentId || child.workItemNo || '').trim();
if (key && !unique.has(key)) unique.set(key, child);
}
}
}
return [...unique.values()];
}
/** 参与订单处理的附件;Excel 计划附件只作诊断展示,不应阻塞批次完成态。 */
const conversationBusinessFiles = computed(() => (
conversationAttachmentLeaves().filter((file) => !isIgnoredNonOrderAttachment(file))
));
/**
* 会话级后端仍标记 running、但业务订单文件均完成时的顶部展示完成态。
* 核心逻辑:仅覆盖 Excel 已忽略这一前端视觉例外;未识别 PDF、失败或待人工均不满足 completed 条件。
*/
const conversationBusinessFilesCompleted = computed(() => (
hasConversationStatusGroups.value
&& conversationBusinessFiles.value.length > 0
&& conversationBusinessFiles.value.every((file) => displayProjectionStatus(file) === 'completed')
));
/** 已完成订单文件与已忽略附件同时存在时,替换容易误解的“已识别 n/N”摘要。 */
const completedAndIgnoredFileSummary = computed(() => {
if (!conversationBusinessFilesCompleted.value) return '';
const ignored = ignoredAttachmentCount.value;
if (!ignored) return '';
return t('chat.shippingProcessing.completedAndIgnoredFileSummary', {
completed: conversationBusinessFiles.value.length,
ignored,
});
});
/** 已忽略的非订单附件数;顶部摘要在所有会话状态中均须保留该诊断事实。 */
const ignoredAttachmentCount = computed(() => (
conversationAttachmentLeaves().filter(isIgnoredNonOrderAttachment).length
));
const ignoredAttachmentSummary = computed(() => {
if (!ignoredAttachmentCount.value) return '';
return t('chat.shippingProcessing.ignoredFileSummary', { count: ignoredAttachmentCount.value });
});
/**
* 会话投影可用时的批次摘要:仅汇总本批文件数量,绝不展示单个文件的当前阶段。
* 文件阶段由下方展开行分别呈现,避免多个文件处于不同阶段时造成批次误导。
*/
const batchSummaryLine = computed(() => {
if (!hasConversationStatusGroups.value) return null;
const summary = conversationProcessing.value?.summary;
const recognized = Math.max(0, Number(summary?.total_files || 0));
const failed = Number(summary?.failed_files || 0);
if (conversationBusinessFilesCompleted.value) {
return t('chat.shippingProcessing.batchSummaryCompleted', { recognized });
}
if (failed <= 0) {
return t('chat.shippingProcessing.batchSummaryProcessing', { recognized });
}
return t('chat.shippingProcessing.batchSummaryIncomplete', { recognized, failed });
});
/**
* 是否为「仅重复关联已有任务、无需人工复核」终态通知。
*/
@@ -363,7 +541,8 @@ function rowStatusLabel(row: ShippingOrderExtractionFileState): string {
if (row.status === 'candidate_ready') return t('chat.shippingProcessing.candidateReady');
if (isFailedParseRow(row)) return t('chat.shippingProcessing.batchException');
if (row.status === 'review_required') return t('chat.shippingProcessing.waitingReview');
const stageKey = `chat.shippingOrderExtractionUserStage.${String(row.userVisibleStage || '').trim()}`;
// v2:key 构造改走共享出口(输出不变契约),保留 UserStage 文案适配器。
const stageKey = resolveOrderExtractionRunStageKey(row.userVisibleStage, '');
if (row.userVisibleStage && te(stageKey)) return t(stageKey);
return t('chat.shippingProcessing.batchProcessing');
}
@@ -371,7 +550,7 @@ function rowStatusLabel(row: ShippingOrderExtractionFileState): string {
function rowStatusClass(row: ShippingOrderExtractionFileState): string {
if (row.status === 'candidate_ready') return 'text-emerald-500';
if (isFailedParseRow(row)) return 'text-rose-500';
return 'text-blue-500';
return 'text-brand-500';
}
/**
@@ -397,6 +576,7 @@ function handlingTitle(item: ShippingOrderExtractionHandlingItemState): string {
*/
const statusNotice = computed(() => {
if (hasConversationStatusGroups.value) {
if (conversationBusinessFilesCompleted.value) return t('chat.shippingSessionSummary.processNoticeCompleted');
const status = String(conversationProcessing.value?.ui_state?.status || '').trim().toLowerCase();
if (status === 'completed') return t('chat.shippingSessionSummary.processNoticeCompleted');
if (status === 'failed' || status === 'retryable') return t('chat.shippingSessionSummary.processNoticeFailed');
@@ -633,83 +813,85 @@ async function onPrimaryChatAction() {
<template>
<div
v-if="conversationProjectionLoading"
class="mb-3 animate-pulse overflow-hidden rounded-xl border border-slate-200 bg-white/90 shadow-md dark:border-slate-700 dark:bg-slate-900/90"
class="mb-3 animate-pulse overflow-hidden rounded-xl border border-default bg-white/90 shadow-md dark:bg-slate-900/90"
data-testid="shipping-order-extraction-projection-loading"
>
<!-- 读取权威 Projection 不是业务状态;只显示结构骨架,避免伪造“系统处理中”。 -->
<div class="border-b border-slate-200 bg-indigo-50/70 px-5 py-4 dark:border-slate-700 dark:bg-indigo-950/30">
<div class="h-6 w-36 rounded bg-slate-200 dark:bg-slate-700" />
<div class="mt-3 h-4 w-2/3 rounded bg-slate-200 dark:bg-slate-700" />
<div class="mt-5 h-2 w-full rounded bg-slate-200 dark:bg-slate-700" />
<div class="border-b border-default bg-brand-50/70 px-5 py-4 dark:bg-brand-950/30">
<div class="h-6 w-36 rounded bg-surface-strong" />
<div class="mt-3 h-4 w-2/3 rounded bg-surface-strong" />
<div class="mt-5 h-2 w-full rounded bg-surface-strong" />
</div>
<div class="space-y-3 p-4">
<div class="h-12 rounded-lg bg-slate-100 dark:bg-slate-800" />
<div class="h-12 rounded-lg bg-slate-100 dark:bg-slate-800" />
<div class="h-12 rounded-lg bg-surface-strong" />
<div class="h-12 rounded-lg bg-surface-strong" />
</div>
</div>
<div
v-else
class="mb-3 overflow-hidden rounded-xl border border-slate-200 bg-white/90 text-slate-900 shadow-md backdrop-blur-sm dark:border-slate-700 dark:bg-slate-900/90 dark:text-slate-100"
class="mb-3 overflow-hidden rounded-xl border border-default bg-white/90 text-primary shadow-md backdrop-blur-sm dark:bg-slate-900/90"
data-testid="shipping-order-extraction-card"
>
<div class="border-b border-slate-200 bg-indigo-50/70 px-5 py-4 dark:border-slate-700 dark:bg-indigo-950/30">
<div class="border-b border-default bg-brand-50/70 px-5 py-4 dark:bg-brand-950/30">
<div class="flex items-center justify-between gap-3">
<div class="flex items-center gap-2 text-lg font-semibold">
<LoaderCircle v-if="hasConversationStatusGroups ? conversationProcessing?.ui_state?.status === 'running' : emlAggregate ? emlAggregate.userStatus === 'running' : state.status === 'queued' || state.status === 'processing'" class="h-5 w-5 animate-spin text-blue-600" />
<CheckCircle2 v-else-if="hasConversationStatusGroups ? conversationProcessing?.ui_state?.status === 'completed' : emlAggregate ? emlAggregate.userStatus === 'completed' : state.status === 'completed'" class="h-5 w-5 text-emerald-500" />
<LoaderCircle v-if="hasConversationStatusGroups ? !conversationBusinessFilesCompleted && conversationProcessing?.ui_state?.status === 'running' : emlAggregate ? emlAggregate.userStatus === 'running' : state.status === 'queued' || state.status === 'processing'" class="h-5 w-5 animate-spin text-brand-600" />
<CheckCircle2 v-else-if="hasConversationStatusGroups ? conversationBusinessFilesCompleted || conversationProcessing?.ui_state?.status === 'completed' : emlAggregate ? emlAggregate.userStatus === 'completed' : state.status === 'completed'" class="h-5 w-5 text-emerald-500" />
<TriangleAlert v-else class="h-5 w-5 text-amber-500" />
<span>{{ t('chat.shippingProcessing.multiPdfTaskTitle') }}</span>
</div>
<span class="rounded-full bg-slate-200 px-3 py-1 text-xs font-medium text-slate-600 dark:bg-slate-700 dark:text-slate-200">
{{ t('chat.shippingProcessing.batchFilesTotal', { count: batchFileCount }) }}
<span class="rounded-full bg-surface-strong px-3 py-1 text-xs font-medium text-secondary">
<template v-if="completedAndIgnoredFileSummary">{{ completedAndIgnoredFileSummary }}</template>
<template v-else>{{ t('chat.shippingProcessing.batchFilesTotal', { count: batchFileCount }) }}<template v-if="recognizedHint"> · {{ recognizedHint }}</template><template v-if="ignoredAttachmentSummary"> · {{ ignoredAttachmentSummary }}</template></template>
</span>
</div>
<p class="mt-1 text-sm text-slate-600 dark:text-slate-300">{{ t('chat.shippingProcessing.batchStatusTitle') }} · {{ statusNotice }}</p>
<p class="mt-1 text-sm text-secondary">{{ batchSummaryLine || statusNotice }}</p>
<div v-for="tip in healthTips" :key="tip.code" class="mt-1 text-sm font-medium text-amber-600">{{ t(`chat.shippingOrderExtractionHealthTip.${tip.code}`) }}</div>
<div v-if="handlingSummaryLine" class="mt-1 text-sm text-slate-600 dark:text-slate-300">{{ handlingSummaryLine }}</div>
<div class="mt-4 flex items-end justify-between">
<span class="text-lg font-medium text-blue-600">{{ progressPercent }}% {{ t('chat.shippingProcessing.batchComplete') }}</span>
<span class="text-sm text-slate-600 dark:text-slate-300">{{ processedCount }}/{{ batchFileCount }} {{ t('chat.shippingProcessing.batchProcessed') }}</span>
</div>
<div class="mt-3 h-2 overflow-hidden rounded-full bg-slate-200 dark:bg-slate-700">
<div class="h-full rounded-full bg-blue-600 transition-all" :style="{ width: `${progressPercent}%` }" />
</div>
<div v-if="handlingSummaryLine && !hasConversationStatusGroups" class="mt-1 text-sm text-secondary">{{ handlingSummaryLine }}</div>
</div>
<div v-if="hasConversationStatusGroups && !compactProgress" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-status-groups">
<div v-if="hasConversationStatusGroups && !compactProgress" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-status-groups">
<div v-if="recognizingPlaceholderVisible" class="flex items-center gap-2 rounded-lg border border-default bg-surface p-3 text-sm text-muted">
<LoaderCircle class="h-4 w-4 animate-spin text-brand-500" />
<span data-testid="shipping-order-extraction-recognizing-placeholder">{{ t('chat.shippingProcessing.recognizingAttachments') }}</span>
</div>
<template v-for="group in statusGroupDefs" :key="group.key">
<section v-if="statusGroupTasks(group.key).length" class="overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-900">
<section v-if="statusGroupTasks(group.key).length" class="overflow-hidden rounded-lg border border-default bg-surface">
<button type="button" class="flex w-full items-center justify-between px-3 py-3 text-left" @click="toggleStatusGroup(group.key)">
<span class="text-sm font-semibold" :class="group.key === 'failed' ? 'text-rose-600' : group.key === 'waiting_human' ? 'text-amber-700' : group.key === 'completed' ? 'text-emerald-600' : 'text-slate-700 dark:text-slate-200'">{{ statusGroupLabel(group.key) }}</span>
<span class="text-sm font-semibold" :class="group.key === 'failed' ? 'text-rose-600' : group.key === 'waiting_human' ? 'text-amber-700' : group.key === 'completed' ? 'text-emerald-600' : group.key === 'ignored' ? 'text-muted' : 'text-secondary '">{{ statusGroupLabel(group.key) }}</span>
<ChevronDown class="h-4 w-4 transition-transform" :class="expandedStatusGroups.has(group.key) ? 'rotate-180' : ''" />
</button>
<div v-if="expandedStatusGroups.has(group.key)" class="space-y-2 border-t border-slate-200 p-2 dark:border-slate-700">
<article v-for="task in statusGroupTasks(group.key)" :key="task.user_task_no" class="overflow-hidden rounded-lg border border-slate-300 bg-white shadow-sm dark:border-slate-700 dark:bg-slate-900" :data-testid="`shipping-order-extraction-eml-${group.key}-${task.user_task_no}`">
<div class="flex items-start gap-3 border-b border-slate-200 bg-blue-50/50 p-3 dark:border-slate-700 dark:bg-blue-950/20">
<Mail class="mt-0.5 h-5 w-5 text-blue-600" />
<div v-if="expandedStatusGroups.has(group.key)" class="space-y-2 border-t border-default p-2">
<article v-for="task in statusGroupTasks(group.key)" :key="task.user_task_no" class="overflow-hidden rounded-lg border border-default bg-surface shadow-sm" :data-testid="`shipping-order-extraction-eml-${group.key}-${task.user_task_no}`">
<div class="flex items-start gap-3 border-b border-default bg-surface-soft p-3 dark:bg-slate-950/30">
<Mail class="mt-0.5 h-5 w-5 text-muted" />
<div class="min-w-0 flex-1">
<button type="button" class="flex w-full items-center justify-between gap-3 text-left" @click="toggleEmlTask(task.user_task_no)">
<span class="truncate font-medium">{{ task.title || task.user_task_no }}</span>
<ChevronDown class="h-4 w-4 shrink-0 transition-transform" :class="expandedEmlTasks.has(task.user_task_no) ? 'rotate-180' : ''" />
</button>
<div class="mt-1 text-xs text-slate-600 dark:text-slate-300">{{ t('chat.shippingProcessing.taskFiles', { count: taskFileCount(task) }) }}<span v-if="task.aggregateSummary"> · {{ aggregateStatusLabelFromSummary(task.aggregateSummary) }}</span></div>
<div v-if="taskReason(task)" class="mt-1 text-xs text-rose-600">{{ displayReason(taskReason(task)) }}</div>
<div class="mt-1 text-xs text-secondary">{{ t('chat.shippingProcessing.taskFiles', { count: taskFileCount(task) }) }}<span v-if="task.aggregateSummary"> · {{ aggregateStatusLabelFromSummary(task.aggregateSummary) }}</span></div>
<div v-if="hasSpecificReason(task)" class="mt-1 text-xs text-rose-600">{{ displayReason(taskReason(task)) }}</div>
</div>
</div>
<div v-if="expandedEmlTasks.has(task.user_task_no) && taskChildren(task).length" class="mx-4 my-2 space-y-1 border-l-2 border-blue-200 bg-slate-50 p-3 pl-4 dark:border-blue-800 dark:bg-blue-950/30" data-testid="shipping-order-extraction-eml-children">
<div v-if="expandedEmlTasks.has(task.user_task_no) && taskChildren(task).length" class="mx-4 my-2 space-y-1 border-l-2 border-default bg-surface-soft p-3 pl-4 dark:border-slate-700 dark:bg-slate-950/30" data-testid="shipping-order-extraction-eml-children">
<div v-for="child in taskChildren(task).filter((item) => !String(item.sourceSummary?.filename || '').toLowerCase().endsWith('.eml'))" :key="child.workItemNo" class="flex items-start justify-between gap-3 py-1 text-sm">
<div class="flex min-w-0 items-start gap-2">
<LoaderCircle v-if="!isFailedProjection(child) && !isWaitingProjection(child) && !isCompletedProjection(child)" class="mt-0.5 h-4 w-4 shrink-0 animate-spin text-blue-500" />
<FileText v-if="isIgnoredNonOrderAttachment(child)" class="mt-0.5 h-4 w-4 shrink-0 text-muted" />
<AlertCircle v-else-if="isUnrecognizedProjection(child)" class="mt-0.5 h-4 w-4 shrink-0 text-amber-500" />
<LoaderCircle v-else-if="!isFailedProjection(child) && !isWaitingProjection(child) && !isCompletedProjection(child)" class="mt-0.5 h-4 w-4 shrink-0 animate-spin text-brand-500" />
<AlertCircle v-else-if="isFailedProjection(child)" class="mt-0.5 h-4 w-4 shrink-0 text-rose-500" />
<CheckCircle2 v-else-if="isCompletedProjection(child)" class="mt-0.5 h-4 w-4 shrink-0 text-emerald-500" />
<TriangleAlert v-else class="mt-0.5 h-4 w-4 shrink-0 text-amber-500" />
<div class="min-w-0">
<div class="truncate">{{ child.sourceSummary.filename || child.workItemNo }}</div>
<div class="text-xs text-slate-500">{{ childStageLabel(child) }}</div>
<div v-if="taskReason(child)" class="text-xs text-rose-600">{{ displayReason(taskReason(child)) }}</div>
<div class="text-xs text-muted">{{ childStageLabel(child) }}</div>
<div v-if="isIgnoredNonOrderAttachment(child)" class="text-xs text-muted">{{ t('chat.shippingProcessing.ignoredNonOrderAttachmentHint') }}</div>
<div v-else-if="isUnrecognizedProjection(child)" class="text-xs text-amber-600">{{ t('chat.shippingProcessing.notRecognizedHint') }}</div>
<div v-else-if="hasSpecificReason(child)" class="text-xs text-rose-600">{{ displayReason(taskReason(child)) }}</div>
</div>
</div>
<span :data-testid="`shipping-order-extraction-child-status-${child.workItemNo}`" class="shrink-0" :class="isFailedProjection(child) ? 'text-rose-600' : isWaitingProjection(child) ? 'text-amber-700' : isCompletedProjection(child) ? 'text-emerald-600' : 'text-blue-600'">{{ childStatusLabel(child) }}</span>
<span :data-testid="`shipping-order-extraction-child-status-${child.workItemNo}`" class="shrink-0" :class="isIgnoredNonOrderAttachment(child) ? 'text-muted' : isUnrecognizedProjection(child) ? 'text-amber-600' : isFailedProjection(child) ? 'text-rose-600' : isWaitingProjection(child) ? 'text-amber-700' : isCompletedProjection(child) ? 'text-emerald-600' : 'text-brand-600'">{{ childStatusLabel(child) }}</span>
</div>
</div>
</article>
@@ -717,49 +899,49 @@ async function onPrimaryChatAction() {
</section>
</template>
</div>
<div v-else-if="!compactProgress && emlAggregate" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-eml-aggregate">
<article class="overflow-hidden rounded-lg border border-slate-300 bg-white shadow-sm dark:border-slate-700 dark:bg-slate-900">
<div class="flex items-start gap-3 border-b border-slate-200 bg-blue-50/50 p-3 dark:border-slate-700 dark:bg-blue-950/20">
<Mail class="mt-0.5 h-5 w-5 text-blue-600" />
<div v-else-if="!compactProgress && emlAggregate" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-eml-aggregate">
<article class="overflow-hidden rounded-lg border border-default bg-surface shadow-sm">
<div class="flex items-start gap-3 border-b border-default bg-surface-soft p-3 dark:bg-slate-950/30">
<Mail class="mt-0.5 h-5 w-5 text-muted" />
<div class="min-w-0 flex-1">
<div class="flex items-center justify-between gap-3">
<span class="truncate font-medium">{{ t('chat.shippingProcessing.emailPrefix') }}{{ emlAggregate.sourceSummary.filename || emlAggregate.intakeNo }}</span>
<span class="rounded border px-2 py-0.5 text-xs" :class="emlAggregate.userStatus === 'failed' || emlAggregate.userStatus === 'retryable' ? 'border-rose-200 bg-rose-100/70 text-rose-600' : emlAggregate.userStatus === 'waiting_human' ? 'border-amber-200 bg-amber-100/70 text-amber-700' : emlAggregate.userStatus === 'completed' ? 'border-emerald-200 bg-emerald-100/70 text-emerald-600' : 'border-blue-200 bg-blue-100/70 text-blue-600'">
<span class="rounded border px-2 py-0.5 text-xs" :class="emlAggregate.userStatus === 'failed' || emlAggregate.userStatus === 'retryable' ? 'border-rose-200 bg-rose-100/70 text-rose-600' : emlAggregate.userStatus === 'waiting_human' ? 'border-amber-200 bg-amber-100/70 text-amber-700' : emlAggregate.userStatus === 'completed' ? 'border-emerald-200 bg-emerald-100/70 text-emerald-600' : 'border-brand-200 bg-brand-100/70 text-brand-600'">
{{ emlAggregate.userStatus === 'completed' ? t('chat.shippingProcessing.aggregate.completed', { count: emlAggregate.aggregateSummary?.completed || 0 }) : emlAggregate.userStatus === 'failed' || emlAggregate.userStatus === 'retryable' ? t('chat.shippingProcessing.batchException') : emlAggregate.userStatus === 'waiting_human' ? t('chat.shippingProcessing.waitingReview') : t('chat.shippingProcessing.systemProcessing') }}
</span>
</div>
<div class="mt-1 text-xs text-slate-600 dark:text-slate-300">{{ aggregateSummaryLabel(emlAggregate) }}</div>
<div v-if="taskReason(emlAggregate)" class="mt-1 text-xs text-rose-600">{{ displayReason(taskReason(emlAggregate)) }}</div>
<div class="mt-1 text-xs text-secondary">{{ aggregateSummaryLabel(emlAggregate) }}</div>
<div v-if="hasSpecificReason(emlAggregate)" class="mt-1 text-xs text-rose-600">{{ displayReason(taskReason(emlAggregate)) }}</div>
</div>
</div>
<button type="button" class="flex w-full items-center justify-between px-3 py-2 text-left text-sm" @click="emlAggregateExpanded = !emlAggregateExpanded">
<span>{{ t('chat.shippingProcessing.taskFiles', { count: emlAggregate.sourceSummary.documentCount || 0 }) }}</span>
<ChevronDown class="h-4 w-4 transition-transform" :class="emlAggregateExpanded ? 'rotate-180' : ''" />
</button>
<div v-if="emlAggregateExpanded" class="space-y-1 border-t border-slate-200 px-3 py-2 dark:border-slate-700">
<div v-if="emlAggregateExpanded" class="space-y-1 border-t border-default px-3 py-2">
<div v-for="child in emlAggregateChildren" :key="child.workItemNo" class="flex items-center justify-between gap-3 py-1 text-sm">
<span class="min-w-0 truncate">{{ child.sourceSummary.filename || child.workItemNo }}</span>
<span class="shrink-0 text-xs" :class="isFailedProjection(child) ? 'text-rose-600' : isWaitingProjection(child) ? 'text-amber-700' : isCompletedProjection(child) ? 'text-emerald-600' : 'text-blue-600'">{{ aggregateChildStatusLabel(child) }} · {{ aggregateStageLabel(child) }}</span>
<span class="shrink-0 text-xs" :class="isFailedProjection(child) ? 'text-rose-600' : isWaitingProjection(child) ? 'text-amber-700' : isCompletedProjection(child) ? 'text-emerald-600' : 'text-brand-600'">{{ aggregateChildStatusLabel(child) }} · {{ aggregateStageLabel(child) }}</span>
</div>
</div>
</article>
</div>
<div v-else-if="!compactProgress" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30">
<div v-for="row in activeEmailRows" :key="row.unitId" class="overflow-hidden rounded-lg border border-slate-300 bg-white shadow-sm dark:border-slate-700 dark:bg-slate-900">
<div class="flex items-start gap-3 border-b border-slate-200 bg-blue-50/50 p-3 dark:border-slate-700 dark:bg-blue-950/20"><Mail class="mt-0.5 h-5 w-5 text-blue-600" /><div class="min-w-0 flex-1"><div class="flex items-center justify-between gap-3"><span class="font-medium">{{ t('chat.shippingProcessing.emailPrefix') }}{{ row.fileName }}</span><span class="rounded border px-2 py-0.5 text-xs" :class="isFailedParseRow(row) || emailHasFailedChild(row) ? 'border-rose-200 bg-rose-100/70 text-rose-600' : emailIsCompleted(row) ? 'border-emerald-200 bg-emerald-100/70 text-emerald-600' : 'border-blue-200 bg-blue-100/70 text-blue-600'">{{ isFailedParseRow(row) || emailHasFailedChild(row) ? t('chat.shippingProcessing.batchException') : emailIsCompleted(row) ? t('chat.shippingProcessing.batchExtracted') : t('chat.shippingProcessing.parsingAttachments') }}</span></div><span class="mt-1 block font-mono text-xs text-slate-500">{{ t('chat.shippingProcessing.emailMeta') }}</span></div></div>
<div class="mx-4 my-2 flex flex-col gap-2 border-l-2 border-blue-200 bg-slate-50 p-3 pl-4 dark:border-blue-800 dark:bg-blue-950/30"><div v-for="child in childRows(row)" :key="`child-${child.unitId}`" class="flex items-center justify-between gap-3 text-sm"><span class="flex min-w-0 items-center gap-2"><CheckCircle2 v-if="child.status === 'candidate_ready'" class="h-4 w-4 text-emerald-500" /><LoaderCircle v-else-if="!isFailedParseRow(child)" class="h-4 w-4 animate-spin text-blue-500" /><AlertCircle v-else class="h-4 w-4 text-rose-500" /><span class="truncate">{{ child.fileName }}</span></span><span :class="rowStatusClass(child)">{{ rowStatusLabel(child) }}</span></div></div>
<div v-else-if="!compactProgress" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30">
<div v-for="row in activeEmailRows" :key="row.unitId" class="overflow-hidden rounded-lg border border-default bg-surface shadow-sm">
<div class="flex items-start gap-3 border-b border-default bg-surface-soft p-3 dark:bg-slate-950/30"><Mail class="mt-0.5 h-5 w-5 text-muted" /><div class="min-w-0 flex-1"><div class="flex items-center justify-between gap-3"><span class="font-medium">{{ t('chat.shippingProcessing.emailPrefix') }}{{ row.fileName }}</span><span class="rounded border px-2 py-0.5 text-xs" :class="isFailedParseRow(row) || emailHasFailedChild(row) ? 'border-rose-200 bg-rose-100/70 text-rose-600' : emailIsCompleted(row) ? 'border-emerald-200 bg-emerald-100/70 text-emerald-600' : 'border-brand-200 bg-brand-100/70 text-brand-600'">{{ isFailedParseRow(row) || emailHasFailedChild(row) ? t('chat.shippingProcessing.batchException') : emailIsCompleted(row) ? t('chat.shippingProcessing.batchExtracted') : t('chat.shippingProcessing.parsingAttachments') }}</span></div><span class="mt-1 block font-mono text-xs text-muted">{{ t('chat.shippingProcessing.emailMeta') }}</span></div></div>
<div class="mx-4 my-2 flex flex-col gap-2 border-l-2 border-default bg-surface-soft p-3 pl-4 dark:border-slate-700 dark:bg-slate-950/30"><div v-for="child in childRows(row)" :key="`child-${child.unitId}`" class="flex items-center justify-between gap-3 text-sm"><span class="flex min-w-0 items-center gap-2"><CheckCircle2 v-if="child.status === 'candidate_ready'" class="h-4 w-4 text-emerald-500" /><LoaderCircle v-else-if="!isFailedParseRow(child)" class="h-4 w-4 animate-spin text-brand-500" /><AlertCircle v-else class="h-4 w-4 text-rose-500" /><span class="truncate">{{ child.fileName }}</span></span><span :class="rowStatusClass(child)">{{ rowStatusLabel(child) }}</span></div></div>
</div>
<div v-for="row in standaloneRows" :key="row.unitId" class="flex items-center justify-between gap-3 rounded-lg border border-slate-200 bg-white p-3 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-900"><span class="flex min-w-0 items-center gap-3"><FileText class="h-5 w-5 text-slate-500" /><span class="truncate">{{ row.fileName }}</span></span><span class="flex items-center gap-2" :class="rowStatusClass(row)">{{ rowStatusLabel(row) }}<RefreshCw v-if="!isFailedParseRow(row)" class="h-4 w-4 animate-spin" /></span></div>
<div v-if="!fileRows.length" class="rounded-lg border border-slate-200 bg-white p-3 text-sm text-slate-500 dark:border-slate-700 dark:bg-slate-900">{{ t('chat.shippingProcessing.batchFilesUnavailable') }}</div>
<div v-for="row in standaloneRows" :key="row.unitId" class="flex items-center justify-between gap-3 rounded-lg border border-default bg-surface p-3 transition-colors hover-surface-soft"><span class="flex min-w-0 items-center gap-3"><FileText class="h-5 w-5 text-muted" /><span class="truncate">{{ row.fileName }}</span></span><span class="flex items-center gap-2" :class="rowStatusClass(row)">{{ rowStatusLabel(row) }}<RefreshCw v-if="!isFailedParseRow(row)" class="h-4 w-4 animate-spin" /></span></div>
<div v-if="!fileRows.length" class="rounded-lg border border-default bg-surface p-3 text-sm text-muted">{{ t('chat.shippingProcessing.batchFilesUnavailable') }}</div>
<div v-for="row in failedRows" :key="`failed-${row.unitId}`" class="rounded-lg border border-rose-200 bg-rose-50 p-3 dark:border-rose-800 dark:bg-rose-950/30"><div class="flex items-center justify-between text-rose-600"><span class="flex items-center gap-2 font-medium"><AlertCircle class="h-5 w-5" />{{ row.fileName }}</span><span class="rounded bg-rose-100 px-2 py-0.5 text-xs">{{ t('chat.shippingProcessing.batchException') }}</span></div><p class="mt-2 pl-7 text-sm">{{ row.explainability?.message || t('chat.shippingProcessing.batchManualVerify') }}</p></div>
</div>
<div class="flex justify-end border-t border-slate-200 bg-indigo-50/60 p-3 dark:border-slate-700 dark:bg-indigo-950/20">
<div class="flex justify-end border-t border-default bg-brand-50/60 p-3 dark:bg-brand-950/20">
<div class="flex items-center gap-3">
<button
v-if="!compactProgress && (hasConversationStatusGroups || String(props.runNo || '').trim())"
type="button"
class="inline-flex items-center gap-2 rounded-lg bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-sm hover:bg-blue-700"
class="inline-flex items-center gap-2 rounded-lg bg-brand-600 px-5 py-2.5 text-sm font-medium text-white shadow-sm hover:bg-brand-700"
data-testid="shipping-order-extraction-open-batch-workbench"
@click="emit('open-batch-workbench')"
>
@@ -202,17 +202,17 @@ onBeforeUnmount(() => {
>
<aside
ref="panelRef"
class="flex h-full w-full max-w-[560px] flex-col bg-white shadow-2xl dark:bg-slate-900"
class="flex h-full w-full max-w-[560px] flex-col bg-surface shadow-2xl"
role="dialog"
aria-modal="true"
:aria-label="t('chat.shippingOrderExtractionDetailsTitle')"
>
<header class="flex items-start justify-between border-b border-slate-200 px-4 py-3 dark:border-slate-800">
<header class="flex items-start justify-between border-b border-default px-4 py-3">
<div class="min-w-0">
<h3 class="text-sm font-semibold text-slate-900 dark:text-slate-100">
<h3 class="text-sm font-semibold text-primary">
{{ t('chat.shippingOrderExtractionDetailsTitle') }}
</h3>
<div class="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-slate-600 dark:text-slate-300">
<div class="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-secondary">
<span>{{ t('chat.shippingOrderExtractionSummary.total', { count: state.summary.totalDocuments }) }}</span>
<span>{{ t('chat.shippingOrderExtractionSummary.completed', { count: state.summary.completedDocuments }) }}</span>
<span>{{ t('chat.shippingOrderExtractionSummary.reviewRequired', { count: state.summary.reviewRequiredDocuments }) }}</span>
@@ -234,7 +234,7 @@ onBeforeUnmount(() => {
<button
ref="closeButtonRef"
type="button"
class="rounded-md p-1 text-slate-500 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-slate-100"
class="rounded-md p-1 text-muted hover-surface-strong hover:text-slate-900 dark:hover:text-slate-100"
:aria-label="t('chat.shippingOrderExtractionCloseDetails')"
data-testid="shipping-order-extraction-details-close"
@click="handleClose"
@@ -244,7 +244,7 @@ onBeforeUnmount(() => {
</header>
<div class="flex-1 space-y-3 overflow-y-auto px-4 py-4">
<div v-if="loading" class="rounded-lg border border-dashed border-slate-300 px-3 py-4 text-sm text-slate-600 dark:border-slate-700 dark:text-slate-300">
<div v-if="loading" class="rounded-lg border border-dashed border-default px-3 py-4 text-sm text-secondary">
{{ t('chat.shippingOrderExtractionDocumentsLoading') }}
</div>
<div
@@ -262,7 +262,7 @@ onBeforeUnmount(() => {
{{ t('chat.shippingOrderExtractionDetailsRetry') }}
</button>
</div>
<div v-else-if="documents.length === 0" class="rounded-lg border border-dashed border-slate-300 px-3 py-4 text-sm text-slate-600 dark:border-slate-700 dark:text-slate-300">
<div v-else-if="documents.length === 0" class="rounded-lg border border-dashed border-default px-3 py-4 text-sm text-secondary">
{{ t('chat.shippingOrderExtractionNoDocuments') }}
</div>
<ShippingOrderDocumentResultItem
@@ -273,15 +273,15 @@ onBeforeUnmount(() => {
/>
<details
:open="timelineOpen"
class="rounded-lg border border-slate-200 bg-white px-3 py-3 dark:border-slate-700 dark:bg-slate-950/40"
class="rounded-lg border border-default bg-surface px-3 py-3 dark:bg-slate-950/40"
@toggle="timelineOpen = ($event.currentTarget as HTMLDetailsElement).open"
>
<summary class="cursor-pointer text-xs font-semibold text-slate-900 dark:text-slate-100">
<summary class="cursor-pointer text-xs font-semibold text-primary">
{{ t('chat.shippingOrderExtractionTimelineTitle') }}
</summary>
<div
v-if="state.selectionPlan?.totalAttachmentCount || state.unitSummary?.technicalFailureReasonCodes?.length"
class="mt-3 rounded-lg bg-slate-50 px-3 py-3 text-xs text-slate-700 dark:bg-slate-900/60 dark:text-slate-200"
class="mt-3 rounded-lg bg-surface-soft px-3 py-3 text-xs text-secondary dark:bg-slate-900/60"
>
<div v-if="state.selectionPlan?.totalAttachmentCount">
{{ t('chat.shippingOrderExtractionPlanSummary', {
@@ -302,7 +302,7 @@ onBeforeUnmount(() => {
</div>
<div
v-if="progressLoading"
class="mt-2 text-sm text-slate-600 dark:text-slate-300"
class="mt-2 text-sm text-secondary"
>
{{ t('chat.shippingOrderExtractionTimelineLoading') }}
</div>
@@ -323,16 +323,16 @@ onBeforeUnmount(() => {
</div>
<div
v-else-if="progressEvents.length === 0"
class="mt-2 text-sm text-slate-600 dark:text-slate-300"
class="mt-2 text-sm text-secondary"
>
{{ t('chat.shippingOrderExtractionTimelineEmpty') }}
</div>
<div v-else class="mt-3 space-y-3">
<section v-for="group in timelineGroups" :key="group.documentId == null ? 'run' : group.documentId" class="rounded-md border border-slate-200 px-3 py-2 dark:border-slate-700">
<h4 class="text-xs font-semibold text-slate-900 dark:text-slate-100">{{ group.fileName }}</h4>
<section v-for="group in timelineGroups" :key="group.documentId == null ? 'run' : group.documentId" class="rounded-md border border-default px-3 py-2">
<h4 class="text-xs font-semibold text-primary">{{ group.fileName }}</h4>
<ol class="mt-2 space-y-3">
<li v-for="event in group.events" :key="`${event.event_code}-${event.unit_id || 0}-${event.document_id || 0}-${event.occurred_at}`" class="border-l-2 border-slate-200 pl-3 text-xs text-slate-700 dark:border-slate-700 dark:text-slate-200">
<div class="flex flex-wrap items-center gap-2"><span class="rounded-full bg-slate-100 px-2 py-0.5 text-[11px] font-medium text-slate-700 dark:bg-slate-800 dark:text-slate-200">{{ t(eventCategoryKey(event)) }}</span><div class="font-medium text-slate-900 dark:text-slate-100">{{ eventActivityLabel(event) }}</div></div>
<li v-for="event in group.events" :key="`${event.event_code}-${event.unit_id || 0}-${event.document_id || 0}-${event.occurred_at}`" class="border-l-2 border-default pl-3 text-xs text-secondary">
<div class="flex flex-wrap items-center gap-2"><span class="rounded-full bg-surface-strong px-2 py-0.5 text-[11px] font-medium text-secondary">{{ t(eventCategoryKey(event)) }}</span><div class="font-medium text-primary">{{ eventActivityLabel(event) }}</div></div>
<div v-if="eventContextLabel(event)" class="mt-1 opacity-85">{{ eventContextLabel(event) }}</div>
<div class="mt-1 opacity-70">{{ eventOccurredAtLabel(event.occurred_at) }}</div>
</li>
@@ -34,6 +34,7 @@ import {
} from '@/features/chat/api/shipping.api';
import type {
ConversationProcessingUserTask,
ConversationProcessingProjection,
LifecycleWorkbenchStage,
ShippingProcessingLifecycleEntry,
ShippingProcessingProjection,
@@ -125,6 +126,26 @@ function statusGroupTasks(...groups: ConversationStatusGroup[]): ConversationPro
if (!statusGroups) return [];
return groups.flatMap((group) => statusGroups[group] || []);
}
/**
* 统计未识别的 Excel 附件,供批次概览与提交文件数对账。
* 核心逻辑:已忽略附件不属于订单文件 summary,只能从各状态组的 EML 子附件读取并按文档去重。
* @param projection - 后端一次返回的会话处理投影。
* @returns 当前批次只读诊断附件数量,不参与订单完成率。
*/
function ignoredAttachmentCount(projection: ConversationProcessingProjection | null): number {
const seen = new Set<string>();
for (const group of ['failed', 'waiting_human', 'processing', 'completed', 'cancelled', 'archived'] as const) {
for (const task of projection?.status_groups?.[group] || []) {
for (const child of task.aggregateChildren || []) {
const filename = String(child.sourceSummary?.filename || '').trim().toLowerCase();
if (child.facts?.recognized !== false || (!filename.endsWith('.xls') && !filename.endsWith('.xlsx'))) continue;
const key = String(child.sourceSummary?.documentId || child.workItemNo || '').trim();
if (key) seen.add(key);
}
}
}
return seen.size;
}
/** 五阶段后端编码为 snake_case,语言资源键沿用 camelCase;映射仅做展示翻译,不参与状态裁决。 */
const BATCH_LIFECYCLE_I18N_KEYS: Record<string, string> = {
intake_parse: 'intakeParse',
@@ -139,9 +160,18 @@ function batchLifecycleLabelKey(code: string): string {
function selectLifecycleFilter(code: 'intake_parse' | 'order_review' | 'fulfillment_prep' | 'freight_upload' | 'upload_complete') {
lifecycleFilter.value = lifecycleFilter.value === code ? 'all' : code;
}
/** 阶段卡仅展示后端统计总数;状态、阻塞和推进语义由颜色与边框表达。 */
/**
* 阶段卡优先展示后端统计中的最高关注状态,避免仅显示数字而无法辨识处理中或待处理。
* @param node - 后端五阶段节点及其汇总。
* @returns 国际化状态摘要。
*/
function stageTotalText(node: NonNullable<typeof batchLifecycleNodes.value>[number]): string {
return String(Number(node.summary?.total || 0));
const summary = node.summary;
const needsAction = Number(summary?.needs_action || 0) + Number(summary?.failed || 0);
if (needsAction > 0) return t('chat.shippingProcessing.batchWorkbench.stageSummary.needsAction', { count: needsAction });
if (Number(summary?.processing || 0) > 0) return t('chat.shippingProcessing.batchWorkbench.stageSummary.processing', { count: summary?.processing });
if (Number(summary?.completed || 0) > 0) return t('chat.shippingProcessing.batchWorkbench.stageSummary.completed', { count: summary?.completed });
return t('chat.shippingProcessing.batchWorkbench.stageSummary.total', { count: Number(summary?.total || 0) });
}
/** 下载资格仅来自后端 output_artifacts 的授权动作;筛选仅影响展示,不缩减授权集合。 */
const downloadableTaskNos = computed(() => {
@@ -202,10 +232,14 @@ const batchOverview = computed(() => {
// [AUTHORITY] 摘要投影的统计与状态组同由服务端一次裁决;不能从展开行重算,
// 否则 EML 聚合、历史版本去重与五阶段筛选会再次发生口径漂移。
return {
// 总文件数卡用「提交基」submitted_files(物化前即 ≥1、单调),与聊天卡全局一致。
totalFiles: Number(summary?.submitted_files ?? summary?.total_files ?? 0),
// 完成率分母保留 total_files(已识别数),避免排除文件导致进度永远到不了 100%。
total: Number(summary?.total_files || 0),
processing: Number(summary?.processing_files || 0),
completed: Number(summary?.completed_files || 0),
needsAction: Number(summary?.failed_files || 0) + Number(summary?.waiting_human_files || 0),
ignored: ignoredAttachmentCount(displayProcessing.value),
};
});
/** 初始加载:首次打开投影仍为空时显示摘要占位。 */
@@ -910,8 +944,8 @@ watch(
class="mb-4 space-y-3"
data-testid="shipping-workflow-loading"
>
<div class="grid grid-cols-2 gap-3 xl:grid-cols-4">
<div v-for="index in 4" :key="index" class="h-24 animate-pulse rounded-xl border border-default bg-surface-muted" />
<div class="grid grid-cols-2 gap-3 xl:grid-cols-5">
<div v-for="index in 5" :key="index" class="h-24 animate-pulse rounded-xl border border-default bg-surface-muted" />
</div>
<div class="h-32 animate-pulse rounded-xl border border-default bg-surface-muted" />
</div>
@@ -927,13 +961,14 @@ watch(
</div>
<div
v-if="displayProcessing"
class="mb-4 grid grid-cols-2 gap-3 xl:grid-cols-4"
class="mb-4 grid grid-cols-2 gap-3 xl:grid-cols-5"
data-testid="shipping-workflow-overview"
>
<div class="rounded-xl border border-default bg-surface p-4"><div class="text-xs text-secondary">{{ t('chat.shippingProcessing.batchWorkbench.overview.totalFiles') }}</div><div class="mt-1 text-2xl font-semibold text-primary">{{ batchOverview.total }}</div></div>
<div class="rounded-xl border border-default bg-surface p-4"><div class="text-xs text-secondary">{{ t('chat.shippingProcessing.batchWorkbench.overview.totalFiles') }}</div><div class="mt-1 text-2xl font-semibold text-primary">{{ batchOverview.totalFiles }}</div></div>
<div class="rounded-xl border border-brand-200 bg-brand-50/60 p-4"><div class="text-xs text-secondary">{{ t('chat.shippingProcessing.batchWorkbench.overview.processing') }}</div><div class="mt-1 text-2xl font-semibold text-brand-700">{{ batchOverview.processing }}</div></div>
<div class="rounded-xl border border-emerald-200 bg-emerald-50/70 p-4"><div class="text-xs text-secondary">{{ t('chat.shippingProcessing.batchWorkbench.overview.completed') }}</div><div class="mt-1 text-2xl font-semibold text-emerald-700">{{ batchOverview.completed }}</div></div>
<div class="rounded-xl border border-rose-200 bg-rose-50/70 p-4"><div class="text-xs text-secondary">{{ t('chat.shippingProcessing.batchWorkbench.overview.needsAction') }}</div><div class="mt-1 text-2xl font-semibold text-rose-700">{{ batchOverview.needsAction }}</div></div>
<div class="rounded-xl border border-default bg-surface-soft p-4 dark:bg-slate-900/50"><div class="text-xs text-secondary">{{ t('chat.shippingProcessing.batchWorkbench.overview.ignored') }}</div><div class="mt-1 text-2xl font-semibold text-secondary">{{ batchOverview.ignored }}</div></div>
</div>
<div
v-if="displayProcessing"
@@ -942,7 +977,7 @@ watch(
>
<div class="mb-2 flex items-center justify-between text-xs font-medium text-secondary">
<span>{{ t('chat.shippingProcessing.batchWorkbench.overview.completion', { percent: Math.min(100, Math.round((batchOverview.completed / Math.max(1, batchOverview.total)) * 100)) }) }}</span>
<span>{{ t('chat.shippingProcessing.batchWorkbench.overview.processedOfTotal', { completed: batchOverview.completed, total: batchOverview.total }) }}</span>
<span>{{ batchOverview.ignored > 0 ? t('chat.shippingProcessing.batchWorkbench.overview.processedOfTotalWithIgnored', { completed: batchOverview.completed, total: batchOverview.total, ignored: batchOverview.ignored }) : t('chat.shippingProcessing.batchWorkbench.overview.processedOfTotal', { completed: batchOverview.completed, total: batchOverview.total }) }}</span>
</div>
<div class="h-3 overflow-hidden rounded-full bg-surface">
<div
File diff suppressed because it is too large. Load diff