本次提交完整实现货代发货通知的自动化批量处理能力: 1. 新增发货单票后台任务类型与专用worker队列,实现任务持久化调度 2. 实现发货批次后台编排器,支持上传后自动逐票推进解析、匹配、导出全流程 3. 新增单票重试、批次待处理重试的API与前端操作界面 4. 补充全量多语言翻译,新增重试、任务列表、状态展示相关文案 5. 优化上传交互逻辑,改为后台自动处理任务,无需手动触发解析指令 6. 修复文件检核工具无数据预检逻辑,避免创建空检核批次 7. 调整发货工作流细节,优化Excel生成幂等性与任务状态同步 8. 更新环境配置与API文档,修正货代工具接口地址端口
552 lines
23 KiB
Vue
552 lines
23 KiB
Vue
<script setup lang="ts">
|
|
/**
|
|
* features/workspace/views/ShippingNoticeView.vue
|
|
* 用途:货代发货任务只读工作台,提供任务筛选、详情查看与跳转 Chat 继续处理入口。
|
|
* 依赖:ShippingWorkflowStepper、ShippingParseReviewMessage、ShippingMatchResultCard、shipping.api。
|
|
* 逻辑:先拉取任务列表与详情,再复用 Chat 区的发货组件展示步骤、匹配结果和 parse review。
|
|
*/
|
|
import { computed, onMounted, ref, watch } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import { useI18n } from 'vue-i18n';
|
|
import { ArrowLeft, Download, ExternalLink, RefreshCw } from 'lucide-vue-next';
|
|
import ShippingWorkflowStepper from '@/features/chat/components/ShippingWorkflowStepper.vue';
|
|
import ShippingParseReviewMessage, {
|
|
type ShippingParseReviewHandlers,
|
|
} from '@/features/chat/components/messages/ShippingParseReviewMessage.vue';
|
|
import ShippingMatchResultCard from '@/features/chat/components/messages/ShippingMatchResultCard.vue';
|
|
import {
|
|
addWorkspaceShippingNoticeLine,
|
|
autoProgressWorkspaceShippingTask,
|
|
generateWorkspaceShippingExcel,
|
|
getShippingChatActions,
|
|
getWorkspaceShippingTask,
|
|
listWorkspaceShippingTasks,
|
|
markWorkspaceShippingManualUploaded,
|
|
matchWorkspaceShippingInventory,
|
|
removeWorkspaceShippingNoticeLine,
|
|
retryWorkspaceShippingTask,
|
|
SHIPPING_NOTICE_AGENT_NAME,
|
|
submitWorkspaceShippingDecision,
|
|
updateWorkspaceShippingNoticeFields,
|
|
updateWorkspaceShippingNoticeLine,
|
|
workspaceShippingExportUrl,
|
|
type ShippingChatAction,
|
|
type ShippingCurrentStepProgress,
|
|
type ShippingNoticeHeader,
|
|
type ShippingNoticeLine,
|
|
type ShippingTaskDetail,
|
|
type ShippingTaskSummary,
|
|
} from '@/features/chat/api/shipping.api';
|
|
import type { ChatMessage } from '@/features/chat/types/chat.types';
|
|
import type { ShippingParseReviewPayload } from '@/features/chat/types/shipping.types';
|
|
import { getAuthHeaders } from '@/shared/utils/auth';
|
|
import { useMessage } from '@/shared/composables/useMessage';
|
|
import { buildShippingWorkflowSteps, shippingActionButtonClass } from '@/features/chat/shipping';
|
|
|
|
const props = defineProps<{
|
|
embedded?: boolean;
|
|
}>();
|
|
|
|
const router = useRouter();
|
|
const { t } = useI18n();
|
|
const msg = useMessage();
|
|
|
|
const loading = ref(false);
|
|
const detailLoading = ref(false);
|
|
const tasks = ref<ShippingTaskSummary[]>([]);
|
|
const selectedTaskNo = ref<string | null>(null);
|
|
const detail = ref<ShippingTaskDetail | null>(null);
|
|
const detailSaving = ref(false);
|
|
const detailActionBusy = ref(false);
|
|
const detailRetrying = ref(false);
|
|
const detailActionButtons = ref<ShippingChatAction[]>([]);
|
|
const statusFilter = ref('all');
|
|
const chatAgentId = ref<number | null>(null);
|
|
const batchProgressLabel = computed(() => {
|
|
if (!detail.value?.batch_index || !detail.value?.batch_total) return '';
|
|
return t('chat.shippingNoticeUi.batchProgress', {
|
|
index: detail.value.batch_index,
|
|
total: detail.value.batch_total,
|
|
});
|
|
});
|
|
|
|
const statusOptions = computed(() => [
|
|
{ value: 'all', label: t('workspace.shippingNotice.status.all') },
|
|
{ value: 'created', label: t('workspace.shippingNotice.status.created') },
|
|
{ value: 'waiting_inventory', label: t('workspace.shippingNotice.status.waitingInventory') },
|
|
{ value: 'inventory_ready', label: t('workspace.shippingNotice.status.inventoryReady') },
|
|
{ value: 'matched', label: t('workspace.shippingNotice.status.matched') },
|
|
{ value: 'waiting_upload', label: t('workspace.shippingNotice.status.waitingUpload') },
|
|
{ value: 'uploaded', label: t('workspace.shippingNotice.status.uploaded') },
|
|
{ value: 'upload_failed', label: t('workspace.shippingNotice.status.uploadFailed') },
|
|
]);
|
|
|
|
const statusBadge = (status: string) => {
|
|
const map: Record<string, { cls: string; label: string }> = {
|
|
created: { cls: 'bg-slate-100 text-secondary', label: t('workspace.shippingNotice.status.created') },
|
|
waiting_inventory: { cls: 'bg-amber-100 text-amber-700', label: t('workspace.shippingNotice.status.waitingInventory') },
|
|
inventory_ready: { cls: 'bg-blue-100 text-blue-700', label: t('workspace.shippingNotice.status.inventoryReady') },
|
|
matched: { cls: 'bg-emerald-100 text-emerald-700', label: t('workspace.shippingNotice.status.matched') },
|
|
waiting_upload: { cls: 'bg-amber-100 text-amber-700', label: t('workspace.shippingNotice.status.waitingUpload') },
|
|
uploaded: { cls: 'bg-emerald-100 text-emerald-700', label: t('workspace.shippingNotice.status.uploaded') },
|
|
upload_failed: { cls: 'bg-rose-100 text-rose-700', label: t('workspace.shippingNotice.status.uploadFailed') },
|
|
};
|
|
return map[status] || { cls: 'bg-slate-100 text-secondary', label: status };
|
|
};
|
|
|
|
const detailWorkflowSteps = computed(() => buildShippingWorkflowSteps(detail.value));
|
|
const detailStepProgress = computed<ShippingCurrentStepProgress | null>(() => {
|
|
const payload = detail.value?.step_payload;
|
|
if (!payload || typeof payload !== 'object') return null;
|
|
const progress = (payload as Record<string, unknown>).current_step_progress;
|
|
return progress && typeof progress === 'object' ? progress as ShippingCurrentStepProgress : null;
|
|
});
|
|
const detailStepHasPercent = computed(() =>
|
|
typeof detailStepProgress.value?.progress_percent === 'number',
|
|
);
|
|
|
|
const loadCases = async () => {
|
|
loading.value = true;
|
|
try {
|
|
tasks.value = await listWorkspaceShippingTasks({
|
|
process_status: statusFilter.value === 'all' ? undefined : statusFilter.value,
|
|
limit: 100,
|
|
});
|
|
} catch {
|
|
tasks.value = [];
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
|
|
const loadDetail = async (taskNo: string) => {
|
|
detailLoading.value = true;
|
|
try {
|
|
const [taskDetail, chatActions] = await Promise.all([
|
|
getWorkspaceShippingTask(taskNo),
|
|
getShippingChatActions(taskNo).catch(() => null),
|
|
]);
|
|
detail.value = taskDetail;
|
|
detailActionButtons.value = chatActions?.action_buttons || [];
|
|
} catch {
|
|
detail.value = null;
|
|
detailActionButtons.value = [];
|
|
} finally {
|
|
detailLoading.value = false;
|
|
}
|
|
};
|
|
|
|
const resolveChatAgent = async () => {
|
|
try {
|
|
const res = await fetch('/api/agents', { headers: getAuthHeaders() });
|
|
if (!res.ok) return;
|
|
const agents = (await res.json()) as Array<{ id: number; name: string }>;
|
|
const found = agents.find((a) => a.name === SHIPPING_NOTICE_AGENT_NAME);
|
|
if (found) chatAgentId.value = found.id;
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
};
|
|
|
|
const openInChat = (taskNo: string, conversationId?: string | null, batchNo?: string | null) => {
|
|
if (!chatAgentId.value) return;
|
|
const query: Record<string, string> = { task_id: taskNo };
|
|
const normalizedBatchNo = String(batchNo || '').trim();
|
|
if (normalizedBatchNo) query.batch_no = normalizedBatchNo;
|
|
const cid = String(conversationId || '').trim();
|
|
if (/^[0-9a-f]{32}$/i.test(cid)) query.conversation_id = cid;
|
|
router.push({ path: `/chat/${chatAgentId.value}`, query });
|
|
};
|
|
|
|
const downloadExport = async (taskNo: string) => {
|
|
const url = workspaceShippingExportUrl(taskNo);
|
|
const res = await fetch(url, { headers: getAuthHeaders() });
|
|
if (!res.ok) return;
|
|
const blob = await res.blob();
|
|
const a = document.createElement('a');
|
|
a.href = URL.createObjectURL(blob);
|
|
a.download = detail.value?.export_file_name || `${taskNo}.xlsx`;
|
|
a.click();
|
|
URL.revokeObjectURL(a.href);
|
|
};
|
|
|
|
const parseReviewPayload = computed<ShippingParseReviewPayload | null>(() => {
|
|
if (!detail.value || detail.value.review_status !== 'pending_confirm') return null;
|
|
return {
|
|
taskId: detail.value.task_no,
|
|
checkpoint: 'parse_review',
|
|
header: {
|
|
customer_name: detail.value.customer_name ?? null,
|
|
customer_code: detail.value.customer_code ?? null,
|
|
ship_to: detail.value.ship_to ?? null,
|
|
po_number: detail.value.po_number ?? null,
|
|
required_date: detail.value.required_date ?? null,
|
|
},
|
|
lines: Array.isArray(detail.value.lines) ? detail.value.lines : [],
|
|
saving: detailSaving.value,
|
|
};
|
|
});
|
|
|
|
const parseReviewMessage = computed<ChatMessage>(() => ({
|
|
role: 'assistant',
|
|
type: 'shipping-parse-review',
|
|
content: `${t('chat.shippingNoticeUi.parseReviewIntro')}\n${t('chat.shippingNoticeUi.taskId', { taskId: detail.value?.task_no || '' })}`.trim(),
|
|
payload: parseReviewPayload.value || undefined,
|
|
}));
|
|
|
|
const parseReviewHandlers: ShippingParseReviewHandlers = {
|
|
getPayload: () => parseReviewPayload.value,
|
|
updateHeader: async (_msg, fields: Partial<ShippingNoticeHeader>) => {
|
|
if (!detail.value || detailSaving.value) return false;
|
|
detailSaving.value = true;
|
|
try {
|
|
await updateWorkspaceShippingNoticeFields(detail.value.task_no, fields, '工作台订单表修订');
|
|
await Promise.all([loadDetail(detail.value.task_no), loadCases()]);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
} finally {
|
|
detailSaving.value = false;
|
|
}
|
|
},
|
|
updateLine: async (_msg, lineIndex: number, patch: Partial<ShippingNoticeLine>) => {
|
|
if (!detail.value || detailSaving.value) return false;
|
|
detailSaving.value = true;
|
|
try {
|
|
await updateWorkspaceShippingNoticeLine(detail.value.task_no, lineIndex, patch, '工作台订单表修订');
|
|
await Promise.all([loadDetail(detail.value.task_no), loadCases()]);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
} finally {
|
|
detailSaving.value = false;
|
|
}
|
|
},
|
|
addLine: async (_msg, line: Partial<ShippingNoticeLine>) => {
|
|
if (!detail.value || detailSaving.value) return false;
|
|
detailSaving.value = true;
|
|
try {
|
|
await addWorkspaceShippingNoticeLine(detail.value.task_no, line, '工作台订单表新增行');
|
|
await Promise.all([loadDetail(detail.value.task_no), loadCases()]);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
} finally {
|
|
detailSaving.value = false;
|
|
}
|
|
},
|
|
removeLine: async (_msg, lineIndex: number) => {
|
|
if (!detail.value || detailSaving.value) return false;
|
|
detailSaving.value = true;
|
|
try {
|
|
await removeWorkspaceShippingNoticeLine(detail.value.task_no, lineIndex, '工作台订单表删除行');
|
|
await Promise.all([loadDetail(detail.value.task_no), loadCases()]);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
} finally {
|
|
detailSaving.value = false;
|
|
}
|
|
},
|
|
};
|
|
|
|
const shortageLines = computed(() => detail.value?.shortage?.lines || []);
|
|
const hasMatchCard = computed(() =>
|
|
!!detail.value && (
|
|
(Array.isArray(detail.value.line_results) && detail.value.line_results.length > 0)
|
|
|| shortageLines.value.length > 0
|
|
),
|
|
);
|
|
|
|
const handleWorkspaceAction = async (action: ShippingChatAction) => {
|
|
if (!detail.value || detailActionBusy.value) return;
|
|
const taskNo = detail.value.task_no;
|
|
detailActionBusy.value = true;
|
|
try {
|
|
if (action.id === 'download_excel') {
|
|
await downloadExport(taskNo);
|
|
return;
|
|
}
|
|
if (action.id === 'generate_excel') {
|
|
await generateWorkspaceShippingExcel(taskNo);
|
|
} else if (action.id === 'match_inventory') {
|
|
await matchWorkspaceShippingInventory(taskNo);
|
|
} else if (action.id === 'mark_manual_uploaded') {
|
|
await markWorkspaceShippingManualUploaded(taskNo);
|
|
} else if (action.id === 'refresh') {
|
|
await loadDetail(taskNo);
|
|
return;
|
|
} else if (action.id === 'confirm_inventory_mapping') {
|
|
await autoProgressWorkspaceShippingTask(taskNo);
|
|
} else if ([
|
|
'confirm',
|
|
'reject',
|
|
'reparse',
|
|
'correct_inventory_mapping',
|
|
'reparse_inventory',
|
|
'rematch',
|
|
].includes(action.id)) {
|
|
await submitWorkspaceShippingDecision(taskNo, action.id);
|
|
} else {
|
|
openInChat(taskNo, detail.value.conversation_id, detail.value.batch_no);
|
|
return;
|
|
}
|
|
await Promise.all([loadDetail(taskNo), loadCases()]);
|
|
} finally {
|
|
detailActionBusy.value = false;
|
|
}
|
|
};
|
|
|
|
const handleRetryCurrentTask = async () => {
|
|
if (!detail.value || detailRetrying.value) return;
|
|
detailRetrying.value = true;
|
|
try {
|
|
const result = await retryWorkspaceShippingTask(detail.value.task_no, '工作台重试当前票');
|
|
msg.success(result.message || t('workspace.shippingNotice.retryCurrentDone'));
|
|
await Promise.all([loadDetail(detail.value.task_no), loadCases()]);
|
|
} catch (error) {
|
|
msg.error(error instanceof Error ? error.message : t('workspace.shippingNotice.retryFailed'));
|
|
} finally {
|
|
detailRetrying.value = false;
|
|
}
|
|
};
|
|
|
|
watch(selectedTaskNo, (val) => {
|
|
if (val) loadDetail(val);
|
|
else detail.value = null;
|
|
});
|
|
|
|
onMounted(async () => {
|
|
await Promise.all([loadCases(), resolveChatAgent()]);
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="space-y-5 animate-fade-in-up">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<div class="flex items-center gap-3">
|
|
<button
|
|
v-if="!embedded"
|
|
type="button"
|
|
class="inline-flex h-9 w-9 items-center justify-center rounded-xl border border-default text-secondary hover:bg-surface-soft"
|
|
@click="router.push('/workspace')"
|
|
>
|
|
<ArrowLeft class="h-4 w-4" />
|
|
</button>
|
|
<div>
|
|
<h2 class="text-2xl font-bold text-primary">{{ $t('workspace.shippingNotice.title') }}</h2>
|
|
<p class="text-sm text-muted">{{ $t('workspace.shippingNotice.subtitle') }}</p>
|
|
</div>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
class="inline-flex items-center gap-1.5 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft"
|
|
@click="loadCases"
|
|
>
|
|
<RefreshCw class="h-3.5 w-3.5" />
|
|
{{ $t('workspace.shippingNotice.refresh') }}
|
|
</button>
|
|
</div>
|
|
|
|
<div class="flex flex-wrap items-end gap-3 rounded-2xl border border-default/80 bg-surface/70 px-4 py-3 shadow-sm">
|
|
<div>
|
|
<label class="mb-1 block text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.filters.status') }}</label>
|
|
<select v-model="statusFilter" class="rounded-xl border border-default bg-surface px-3 py-2 text-sm">
|
|
<option v-for="opt in statusOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
|
|
</select>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white hover:bg-brand-700"
|
|
@click="loadCases"
|
|
>
|
|
{{ $t('workspace.shippingNotice.search') }}
|
|
</button>
|
|
</div>
|
|
|
|
<div class="grid gap-5 lg:grid-cols-5">
|
|
<div class="lg:col-span-2 space-y-2">
|
|
<div v-if="loading" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">
|
|
{{ $t('workspace.shippingNotice.loading') }}
|
|
</div>
|
|
<div v-else-if="tasks.length === 0" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">
|
|
{{ $t('workspace.shippingNotice.empty') }}
|
|
</div>
|
|
<button
|
|
v-for="item in tasks"
|
|
:key="item.task_no"
|
|
type="button"
|
|
class="w-full rounded-2xl border px-4 py-3 text-left transition-colors"
|
|
:class="selectedTaskNo === item.task_no ? 'border-brand-400 bg-brand-50/60' : 'border-default hover:bg-surface-soft/70'"
|
|
@click="selectedTaskNo = item.task_no"
|
|
>
|
|
<div class="flex items-center justify-between gap-2">
|
|
<span class="font-mono text-sm font-semibold text-primary">{{ item.task_no }}</span>
|
|
<span class="rounded-full px-2 py-0.5 text-xs font-medium" :class="statusBadge(item.process_status).cls">
|
|
{{ statusBadge(item.process_status).label }}
|
|
</span>
|
|
</div>
|
|
<div class="mt-1 truncate text-sm text-secondary">{{ item.customer_name || '—' }}</div>
|
|
<div class="mt-1 flex flex-wrap items-center gap-2 text-xs text-muted">
|
|
<span>{{ item.created_at || '' }}</span>
|
|
<span v-if="item.batch_index && item.batch_total" class="rounded-full bg-sky-50 px-2 py-0.5 font-medium text-sky-700">
|
|
{{ t('chat.shippingNoticeUi.batchProgress', { index: item.batch_index, total: item.batch_total }) }}
|
|
</span>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="lg:col-span-3 rounded-2xl border border-default bg-surface/50 p-5">
|
|
<div v-if="!selectedTaskNo" class="py-16 text-center text-sm text-muted">
|
|
{{ $t('workspace.shippingNotice.selectCase') }}
|
|
</div>
|
|
<div v-else-if="detailLoading" class="py-16 text-center text-sm text-muted">
|
|
{{ $t('workspace.shippingNotice.loading') }}
|
|
</div>
|
|
<div v-else-if="!detail" class="py-16 text-center text-sm text-muted">
|
|
{{ $t('workspace.shippingNotice.loadFailed') }}
|
|
</div>
|
|
<div v-else class="space-y-4">
|
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
|
<div>
|
|
<div class="font-mono text-lg font-bold text-primary">{{ detail.task_no }}</div>
|
|
<div class="flex flex-wrap items-center gap-2 text-sm text-muted">
|
|
<span>{{ detail.customer_name }} · {{ detail.customer_code || '—' }}</span>
|
|
<span v-if="batchProgressLabel" class="rounded-full bg-sky-50 px-2 py-0.5 text-xs font-medium text-sky-700">
|
|
{{ batchProgressLabel }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-wrap gap-2">
|
|
<button
|
|
type="button"
|
|
class="inline-flex items-center gap-1 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60"
|
|
:disabled="detailRetrying"
|
|
@click="handleRetryCurrentTask"
|
|
>
|
|
<RefreshCw class="h-3.5 w-3.5" />
|
|
{{ detailRetrying ? $t('workspace.shippingNotice.retrying') : $t('workspace.shippingNotice.retryCurrentTask') }}
|
|
</button>
|
|
<button
|
|
v-if="chatAgentId"
|
|
type="button"
|
|
class="inline-flex items-center gap-1 rounded-xl border border-brand-300 bg-brand-50 px-3 py-1.5 text-sm font-medium text-brand-700 hover:bg-brand-100"
|
|
@click="openInChat(detail.task_no, detail.conversation_id, detail.batch_no)"
|
|
>
|
|
<ExternalLink class="h-3.5 w-3.5" />
|
|
{{ $t('workspace.shippingNotice.openChat') }}
|
|
</button>
|
|
<button
|
|
v-if="detail.export_file_name"
|
|
type="button"
|
|
class="inline-flex items-center gap-1 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary hover:bg-surface-soft"
|
|
@click="downloadExport(detail.task_no)"
|
|
>
|
|
<Download class="h-3.5 w-3.5" />
|
|
{{ $t('workspace.shippingNotice.download') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<ShippingWorkflowStepper :steps="detailWorkflowSteps" />
|
|
|
|
<div
|
|
v-if="detailStepProgress"
|
|
class="rounded-2xl border border-default/80 bg-surface px-4 py-3"
|
|
>
|
|
<div class="flex items-center justify-between gap-3 text-xs">
|
|
<div class="font-medium text-primary">
|
|
{{ detailStepProgress.step_title || t('chat.shippingNoticeUi.stepDetail.title') }}
|
|
</div>
|
|
<div v-if="detailStepHasPercent" class="text-muted">
|
|
{{ detailStepProgress.progress_percent }}%
|
|
</div>
|
|
</div>
|
|
<div class="mt-1 text-sm text-secondary">
|
|
{{ detailStepProgress.message || t('chat.shippingNoticeUi.processing') }}
|
|
</div>
|
|
<div v-if="detailStepProgress.detail" class="mt-1 text-xs text-muted">
|
|
{{ detailStepProgress.detail }}
|
|
</div>
|
|
<div
|
|
v-if="detailStepProgress.current && detailStepProgress.total"
|
|
class="mt-1 text-xs text-muted"
|
|
>
|
|
{{ t('chat.shippingNoticeUi.stepDetail.counter', { current: detailStepProgress.current, total: detailStepProgress.total }) }}
|
|
</div>
|
|
<div
|
|
v-if="detailStepHasPercent"
|
|
class="mt-2 h-2 overflow-hidden rounded-full bg-slate-200"
|
|
>
|
|
<div
|
|
class="h-full rounded-full bg-sky-500 transition-all"
|
|
:style="{ width: `${detailStepProgress.progress_percent}%` }"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<dl class="grid gap-3 sm:grid-cols-2 text-sm">
|
|
<div><dt class="text-muted">{{ $t('workspace.shippingNotice.fields.status') }}</dt><dd>{{ detail.process_status }}</dd></div>
|
|
<div><dt class="text-muted">{{ $t('workspace.shippingNotice.fields.match') }}</dt><dd>{{ detail.match_status || '—' }}</dd></div>
|
|
<div><dt class="text-muted">{{ $t('workspace.shippingNotice.fields.shipTo') }}</dt><dd>{{ detail.ship_to || '—' }}</dd></div>
|
|
<div><dt class="text-muted">{{ $t('workspace.shippingNotice.fields.freightRef') }}</dt><dd>{{ detail.freight_ref_no || '—' }}</dd></div>
|
|
</dl>
|
|
|
|
<div v-if="detail.error_message" class="rounded-xl border border-rose-200 bg-rose-50 px-3 py-2 text-sm text-rose-700">
|
|
{{ detail.error_message }}
|
|
</div>
|
|
|
|
<ShippingMatchResultCard
|
|
v-if="hasMatchCard"
|
|
:task-id="detail.task_no"
|
|
:match-status="detail.match_status"
|
|
:line-results="detail.line_results"
|
|
:shortage-lines="shortageLines"
|
|
:action-buttons="detailActionButtons"
|
|
:action-busy="detailActionBusy"
|
|
:action-button-class="shippingActionButtonClass"
|
|
:on-action-click="handleWorkspaceAction"
|
|
/>
|
|
|
|
<div v-if="parseReviewPayload">
|
|
<ShippingParseReviewMessage
|
|
:message="parseReviewMessage"
|
|
:handlers="parseReviewHandlers"
|
|
/>
|
|
</div>
|
|
|
|
<div v-else-if="detail.lines?.length">
|
|
<h3 class="mb-2 text-sm font-semibold text-secondary">{{ $t('workspace.shippingNotice.lines') }}</h3>
|
|
<div class="overflow-x-auto rounded-xl border border-default">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="bg-surface-soft text-left text-xs text-muted">
|
|
<tr>
|
|
<th class="px-3 py-2">{{ $t('workspace.shippingNotice.columns.sku') }}</th>
|
|
<th class="px-3 py-2">{{ $t('workspace.shippingNotice.qty') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(line, idx) in detail.lines" :key="idx" class="border-t border-default/60">
|
|
<td class="px-3 py-2 font-mono">{{ line.sku || '—' }}</td>
|
|
<td class="px-3 py-2">{{ line.qty ?? '—' }}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div v-if="detail.events?.length">
|
|
<h3 class="mb-2 text-sm font-semibold text-secondary">{{ $t('workspace.shippingNotice.events') }}</h3>
|
|
<ul class="max-h-48 space-y-1 overflow-y-auto text-xs text-muted">
|
|
<li v-for="(ev, idx) in [...detail.events].reverse()" :key="idx">
|
|
<span class="font-medium text-secondary">{{ ev.event_type }}</span>
|
|
<span class="ml-2">{{ ev.created_at }}</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|