feat(shipping-notice): 实现对话级批量重试自动推进功能,优化库存与PDF匹配逻辑

- 新增对话级批量重试自动推进的完整链路:后端服务、API、数据投影逻辑
- 前端新增对话级重试按钮、多语言国际化支持与API类型定义
- 优化行级库存重试控制,新增retryable字段统一管控重试按钮展示,清理废弃的view_fulfillment_detail动作,标准化前端动作码排序逻辑
- 修复PDF坐标匹配的fail-close防护逻辑,避免生成伪精确匹配分数
- 调整订单确认后流程,提前进入库存获取阶段,移除冗余的确认建单按钮,优化用户流转体验
- 新增对应单元测试用例覆盖核心业务逻辑
This commit is contained in:
hugo committed 2026-08-07 16:30:45 +08:00
1 parent fd6a23f870
commit 1008911a7e
41 files changed
+3956 -1256

No files matched your search

@@ -9,9 +9,11 @@
ReviewCurrentProcessingCard、ReviewCompletedChecksPanel、ReviewFieldCompletenessPanel、
ReviewAutomationStatusPanel、ReviewBuildEligibilitySummary、ReviewInventory*、
ReviewLineInventoryOps(履约操作并入明细右侧列)、ReviewLineFulfillmentDetail(行内履约摘要)、
ProcessGateRecoveryCard;formal_task 仅显式动作挂载 TaskTodoPanel(主写在 Footer)。
ProcessGateRecoveryCard;formal_task 仅显式动作挂载 TaskTodoPanel(主写在 Footer);
shipping.api.retryWorkspaceConversationAutoProgress(对话级重试)。
逻辑:建单前订单检查为主卡;正式 OT 后保持 standard,不自动切 formal_task 空壳;
不挂当前处理/履约摘要重复卡;库存动作仅明细行浮层;写操作仅底栏。
对话级「重试自动推进」在顶栏;当前 Case 对象级重试优先右栏 CurrentProcessingCard,
仅当未挂载该卡时回落到底栏;库存动作仅明细行浮层;写操作仅底栏。
-->
<script setup lang="ts">
import { computed, defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
@@ -28,16 +30,16 @@ import {
import {
auditWorkspaceShippingOrderReviewEligibilityDetails,
auditWorkspaceShippingOrderReviewVersionHistory,
autoProgressWorkspaceShippingTask,
attemptWorkspaceShippingOrderReviewFieldLocate,
decideWorkspaceShippingOrderReviewLineFulfillment,
getWorkspaceShippingOrderReviewEvidenceItem,
getWorkspaceShippingTask,
retryWorkspaceConversationAutoProgress,
retryWorkspaceShippingOrderStpAutoCreate,
retryWorkspaceShippingTask,
retryWorkspaceShippingTaskLine,
viewWorkspaceShippingOrderReviewHighlightDiagnostic,
} from '../api/shipping.api';
import type {
ShippingOrderReviewLineFulfillmentDecisionCode,
ShippingOrderReviewLineFulfillmentLine,
} from '../types/shipping.api.types';
import ReviewActionConfirmDialog, {
@@ -71,7 +73,6 @@ import ReviewWorkbenchHeader from '../components/shipping-review/ReviewWorkbench
import ReviewWorkbenchModeToggle from '../components/shipping-review/ReviewWorkbenchModeToggle.vue';
import ReviewUnsavedSwitchDialog from '../components/shipping-review/ReviewUnsavedSwitchDialog.vue';
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
import { postWorkspaceProcessGateAction } from '@/features/shipping-process-gates/api/process-gates.api';
import TaskTodoPanel from '@/features/workspace/shipping-task-center/TaskTodoPanel.vue';
import { downloadWorkspaceShippingExcelFile } from '@/features/workspace/api/shipping-tasks.api';
import ReviewLineNoOverrideDialog, {
@@ -312,6 +313,42 @@ const evidenceFocusConsumed = ref(false);
return Boolean(automation?.retryable) || (activeCase.value?.available_actions || []).includes('retry_stp_auto_create');
});
/**
* 对话级重试动作:后端 conversation_allowed_actions 中 retry_auto_progress 且 eligible_count>0。
*/
const conversationRetryAction = computed(() => {
const actions = activeCase.value?.conversation_allowed_actions || [];
return actions.find((item) => (
item.code === 'retry_auto_progress' && Number(item.eligible_count || 0) > 0
)) || null;
});
/** 顶栏是否展示对话级「重试自动推进」。 */
const showConversationRetry = computed(() => (
Boolean(conversationRetryAction.value) && Boolean(String(conversationId.value || '').trim())
));
/** 对话级可重试对象数量(徽标)。 */
const conversationRetryEligibleCount = computed(() => (
Number(conversationRetryAction.value?.eligible_count || 0)
));
/**
* 是否挂载右侧/窄屏「当前处理」卡:task_missing、正式 OT、或自动化进行中/失败态。
* 核心逻辑:对象级重试优先挂在此卡上,未挂载时才回落底栏。
*/
const mountCurrentProcessingCard = computed(() => {
if (!activeCase.value) return false;
if (Boolean(activeCase.value.task_missing)) return true;
if (hasFormalOt.value) return true;
const status = String(activeCase.value.automation?.status || '').trim().toLowerCase();
return ['waiting_to_start', 'queued', 'running', 'failed', 'manual_fallback'].includes(status);
});
/** 对象级重试:有当前处理卡时放右栏/窄屏主卡;否则回落底栏。 */
const showObjectRetryOnRail = computed(() => showStpRetry.value && mountCurrentProcessingCard.value);
const showObjectRetryOnFooter = computed(() => showStpRetry.value && !mountCurrentProcessingCard.value);
/**
* 正式 OT 后履约/库存卡片是否展开:仅 human + 可执行 blocking 时展开对应卡;
* 系统等待/排队/运行默认折叠。
@@ -435,10 +472,23 @@ const confirmSuccess = ref<{
restoredFromProjection?: boolean;
} | null>(null);
const progressRetrying = ref(false);
const conversationRetrying = ref(false);
const conversationRetryResultOpen = ref(false);
const conversationRetryResult = ref<{
summary: { total: number; retried: number; skipped: number; failed: number };
items: Array<{
object_type: string;
object_ref: string;
action?: string | null;
outcome: string;
reason_code?: string | null;
}>;
} | null>(null);
/**
* 从 Case 投影恢复「已建单但仍待推进」琥珀色重试条(覆盖页面刷新场景)。
* 核心逻辑:仅当 post_confirm_auto_progress.needs_retry 时写入;不覆盖同会话即时 confirm 结果。
* 注:确认成功琥珀色 UI 已移除(避免与对话级/对象级重试重复);本 hydrate 仍供内部状态与流程动作使用。
*/
function hydrateConfirmProgressFromCase() {
const caseRow = activeCase.value;
@@ -924,16 +974,6 @@ const openAuditTrail = () => {
auditTrailOpen.value = true;
};
/**
* 切换行内履约摘要:只展开当前行,不进入库存工作台。
* @param lineKey - 明细行键
*/
function toggleFulfillmentDetail(lineKey: string) {
const key = String(lineKey || '').trim();
if (!key) return;
fulfillmentDetailLineKey.value = fulfillmentDetailLineKey.value === key ? null : key;
}
/**
* 收起行内履约摘要。
*/
@@ -1001,73 +1041,6 @@ function displayShortageQty(line: ShippingOrderReviewLineFulfillmentLine | null)
return String(line.shortage_qty);
}
/**
* 归一化用户态状态码(与文案/badge 共用)。
*/
function resolveUserLineStatusCode(line: ShippingOrderReviewLineFulfillmentLine | null): string {
if (!line) return '';
const inventoryPending = (
line.display_available === 'pending'
|| ['preparing', 'mapping_failed', 'source_conflict', 'unavailable', 'invalid_key'].includes(
String(line.inventory_status || ''),
)
);
let code = String(line.user_line_status || '').trim();
if (inventoryPending && (!code || code === 'pending_decision')) {
code = 'inventory_pending';
} else if (!code) {
code = String(line.line_status || '').trim();
}
return code;
}
/**
* 用户态履约/库存状态文案(优先 user_line_status;库存未就绪时不展示「待决定」)。
* 核心逻辑:display_available=pending 或 preparing/conflict 等 → inventory_pending;
* 仅在库存数字已就绪后才信任 pending_decision / line_status。
*/
function userLineStatusLabel(line: ShippingOrderReviewLineFulfillmentLine | null): string {
const code = resolveUserLineStatusCode(line);
if (!code) return '—';
const key = `chat.shippingOrderReview.fulfillmentDecision.userLineStatus.${code}`;
if (te(key)) return t(key);
const legacy = `chat.shippingOrderReview.fulfillmentDecision.lineStatus.${code}`;
return te(legacy) ? t(legacy) : code;
}
/**
* 状态列 badge 视觉层级(UI-4):短缺/失败强调,进度次之,终态弱化。
*/
function userLineStatusBadgeClass(line: ShippingOrderReviewLineFulfillmentLine | null): string {
const code = resolveUserLineStatusCode(line);
const base = 'inline-flex max-w-full items-center rounded-md px-1.5 py-0.5 text-[11px] font-medium leading-tight';
switch (code) {
case 'shortage':
case 'auto_fulfill_failed':
case 'inventory_file_expired':
return `${base} bg-rose-100 text-rose-800 dark:bg-rose-950/60 dark:text-rose-200`;
case 'source_conflict':
case 'invalid':
case 'inventory_source_unrecognized':
case 'inventory_file_missing':
case 'inventory_match_failed':
return `${base} bg-amber-100 text-amber-900 dark:bg-amber-950/50 dark:text-amber-100`;
case 'inventory_pending':
case 'acquiring_inventory':
case 'auto_fulfilling':
return `${base} bg-sky-100 text-sky-900 dark:bg-sky-950/50 dark:text-sky-100`;
case 'wave_created':
case 'ready_to_fulfill':
case 'inventory_matched':
return `${base} bg-emerald-100 text-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`;
case 'fulfilled':
case 'closed':
return `${base} bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-300`;
default:
return `${base} bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200`;
}
}
/**
* 只读库存源展示(后端 inventory_source;禁止前端推断)。
*/
@@ -1084,6 +1057,15 @@ function displayInventorySource(line: ShippingOrderReviewLineFulfillmentLine | n
if (label && code) return `${label}(${code})`;
if (label) return label;
if (code) return code;
// 建单后最终行级库存源尚未匹配时,展示建单前已冻结的候选集合,
// 避免把“已识别候选”误显示为空;最终 source 仍只由后端履约投影提供。
const candidate = (buildEligibility.value?.line_projections || []).find(
(item) => String(item.line_key || '') === String(line.line_key || ''),
);
const candidates = (candidate?.candidate_inventory_source_codes || [])
.map((item) => String(item || '').trim())
.filter(Boolean);
if (candidates.length) return candidates.join(', ');
return '—';
}
@@ -1100,27 +1082,44 @@ function displayAvailableQty(line: ShippingOrderReviewLineFulfillmentLine | null
const lineOpsBusyKey = ref<string | null>(null);
/** 库存文件缺失/过期或库存匹配失败时,复用当前 Process Gate 的 RPA 重试动作。 */
async function retryLineInventoryRpa(lineKey: string, actionCode: string) {
const gate = activeCase.value?.process_gate;
const executionNo = String(gate?.execution_no || '').trim();
const blockingGate = gate?.current_blocking_gate;
const gateCode = String(blockingGate?.gate_code || '').trim();
const expectedVersion = Number(blockingGate?.evaluation_version || 0);
if (!executionNo || !gateCode || !actionCode || !Number.isFinite(expectedVersion) || expectedVersion < 1) {
/** 任务整体 queued/running:行级写操作隐藏/禁用。 */
const taskAutomationRunning = computed(() => {
const status = String(activeCase.value?.automation?.status || '').trim().toLowerCase();
return ['queued', 'running', 'processing', 'automating'].includes(status);
});
/**
* 明细行统一「重试」:POST .../lines/{line_key}/retry;不传内部动作码。
*/
async function retryLineUnified(lineKey: string) {
const key = String(lineKey || '').trim();
if (!key || taskAutomationRunning.value || caseSwitchLoading.value) {
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
return;
}
lineOpsBusyKey.value = lineKey;
const taskNo = String(
confirmedNoticeTaskNo.value
|| activeCase.value?.confirmed_task_no
|| formalOtRetryTaskNo.value
|| '',
).trim();
if (!taskNo) {
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
return;
}
lineOpsBusyKey.value = key;
try {
await postWorkspaceProcessGateAction(executionNo, gateCode, {
action_code: actionCode,
expected_gate_version: expectedVersion,
idempotency_key: crypto.randomUUID(),
payload: { line_key: lineKey },
});
msg.success(t('chat.shippingOrderReview.lineOps.retryRpaSubmitted'));
const result = await retryWorkspaceShippingTaskLine(taskNo, key);
const status = String(result?.status || '').trim().toLowerCase();
if (status === 'needs_human') {
msg.warning(String(result?.message || t('chat.shippingOrderReview.autoProgress.status.needs_human')));
} else if (status === 'failed') {
msg.warning(String(result?.message || t('chat.shippingOrderReview.lineOps.retryRpaFailed')));
} else {
msg.success(t('chat.shippingOrderReview.lineOps.retryRpaSubmitted'));
}
await reloadLatestDraft();
void refreshShippingProcessing();
} catch (error) {
msg.error(
error instanceof BusinessError
@@ -1133,40 +1132,10 @@ async function retryLineInventoryRpa(lineKey: string, actionCode: string) {
}
/**
* 行内履约决定(等待/关闭);换源只导航。
* Case 级库存兜底卡「重试」:走任务级统一决策器(无行键时)。
*/
async function onLineFulfillmentDecide(
lineKey: string,
code: ShippingOrderReviewLineFulfillmentDecisionCode,
) {
if (code === 'close_unfulfillable') {
openCloseFulfillmentDialog([lineKey]);
return;
}
// 更换库存源已取消:客户指定源不可覆盖,不再导航库存工作台。
if (code === 'change_inventory_source') {
return;
}
const caseNo = String(activeCase.value?.case_no || '').trim();
if (!caseNo || lineOpsBusyKey.value) return;
lineOpsBusyKey.value = lineKey;
try {
await decideWorkspaceShippingOrderReviewLineFulfillment(caseNo, {
line_key: lineKey,
decision_code: code,
expected_draft_version: activeCase.value?.draft?.draft_version ?? undefined,
});
msg.success(t('chat.shippingOrderReview.fulfillmentDecision.decideSuccess'));
await reloadLatestDraft();
} catch (error) {
msg.error(
error instanceof BusinessError
? resolveLocalizedErrorMessage(error.code, error.message)
: t('chat.shippingOrderReview.fulfillmentDecision.decideFailed'),
);
} finally {
lineOpsBusyKey.value = null;
}
async function retryCaseInventoryFallback() {
await retryFormalOtAutoProgress();
}
/**
@@ -1324,8 +1293,8 @@ const canEnterInventory = computed(() => {
});
const availableActions = computed(() => activeCase.value?.available_actions || []);
/** 订单处理工作台写权限(只读查看为 false)。 */
const workbenchActionsExecutable = computed(() => !isReadOnly.value);
/** 订单处理工作台写权限(只读查看 / Case 切换中为 false)。 */
const workbenchActionsExecutable = computed(() => !isReadOnly.value && !caseSwitchLoading.value);
/** 当前 Case 面板可用性,供注册表 requiresPanel 守卫。 */
const workbenchPanelAvailability = computed((): WorkbenchPanelAvailability => {
@@ -1566,7 +1535,7 @@ const linesTableMinWidthClass = computed(() => {
const linesTableColumnCount = computed(() => {
let count = 1 + visibleLineSchemaFields.value.length + 1; // # + schema + ops
if (!showLineInventoryColumns.value) return count;
count += 2; // inventory source + status
count += 1; // inventory source only(available/shortage 已由 qty 字段计入)
if (hasVisibleQtyField.value) {
count += visibleLineSchemaFields.value.filter((field) => isQtySchemaField(field)).length * 2;
} else {
@@ -1798,46 +1767,13 @@ const actionDialogOpen = ref(false);
const lineNoOverrideOpen = ref(false);
const pendingLineNoEdit = ref<{ lineKey: string; fieldId: string; value: string } | null>(null);
/** 将自动推进结果映射为本地化状态;服务端 message 继续作为具体停留原因。 */
const autoProgressStatusLabel = (status: string) => {
const normalized = String(status || '').trim();
const key = `chat.shippingOrderReview.autoProgress.status.${normalized}`;
return normalized && te(key) ? t(key) : t('chat.shippingOrderReview.autoProgress.status.unknown');
};
/**
* 确认后主路径留在复核页:统一动作栏驱动重试/刷新/任务台;返回对话仅作次要链接。
*/
const openTaskProgress = (orderTaskNo: string, noticeNo?: string) => {
const focusNo = String(orderTaskNo || '').trim();
const notice = String(noticeNo || '').trim();
// [UI-01] 无 OT 时禁止用 Notice 编号冒充 focus_task_no。
if (!focusNo) return;
const activeConversationId = String(route.query.conversation_id || conversationId.value || '').trim();
const bannerNo = focusNo || notice;
// [STEP] toast + focus_task_no=OT;禁止用 SN Notice 编号选中进度卡。
msg.success(t('chat.shippingOrderReview.autoProgress.returnedFocusHint', { taskNo: bannerNo }));
void router.replace({
name: 'Chat',
params: { agentId: agentId.value },
query: {
conversation_id: activeConversationId || undefined,
focus_task_no: focusNo || undefined,
focus_notice_no: notice || undefined,
focus_run_no: String(runNo.value || '').trim() || undefined,
focus_notice: '1',
},
});
};
/**
* 正式 OT auto-progress 共用重试:POST /shipping-tasks/<taskNo>/auto-progress。
* 核心逻辑:taskNo 来自参数 / confirmed_task_no / post_confirm;不依赖即时 confirmSuccess;
* task_missing 或无 task_no 时不请求。
* @param preferredTaskNo - 即时确认条可传入 outcome.taskNo
* 正式 OT 用户侧重试:POST /shipping-tasks/<taskNo>/retry(统一决策器)。
* 核心逻辑:禁止再调 auto-progress;task_missing 或无 task_no 时不请求。
* @param preferredTaskNo - 可选任务号覆盖
*/
const retryFormalOtAutoProgress = async (preferredTaskNo?: string | null) => {
if (Boolean(activeCase.value?.task_missing) || progressRetrying.value) return;
if (Boolean(activeCase.value?.task_missing) || progressRetrying.value || caseSwitchLoading.value) return;
const taskNo = String(
preferredTaskNo
|| formalOtRetryTaskNo.value
@@ -1847,7 +1783,7 @@ const retryFormalOtAutoProgress = async (preferredTaskNo?: string | null) => {
if (!taskNo) return;
progressRetrying.value = true;
try {
const result = await autoProgressWorkspaceShippingTask(taskNo);
const result = await retryWorkspaceShippingTask(taskNo);
const status = String(result?.status || 'ok');
const progressFailed = ['failed', 'enqueue_failed', 'sync_execution_failed'].includes(status);
if (confirmSuccess.value?.taskNo === taskNo || confirmSuccess.value) {
@@ -1866,6 +1802,8 @@ const retryFormalOtAutoProgress = async (preferredTaskNo?: string | null) => {
}
if (progressFailed) {
msg.warning(t('chat.shippingOrderReview.confirmProgressFailed', { taskNo }));
} else if (status === 'needs_human') {
msg.warning(String(result?.message || t('chat.shippingOrderReview.autoProgress.status.needs_human')));
} else {
msg.success(t('chat.shippingOrderReview.autoProgress.retrySuccess'));
}
@@ -1879,16 +1817,7 @@ const retryFormalOtAutoProgress = async (preferredTaskNo?: string | null) => {
};
/**
* 即时确认条重试:保留原入口,内部委托共用封装。
*/
const retryAutoProgressAfterConfirm = async () => {
const outcome = confirmSuccess.value;
if (!outcome?.taskNo || progressRetrying.value) return;
await retryFormalOtAutoProgress(outcome.taskNo);
};
/**
* 底栏「重试自动推进」:正式 OT 走 auto-progress;建单前走 STP retry。
* 底栏对象级「重试」兜底:正式 OT 走统一 /retry;建单前走 STP。
*/
const onFooterRetryAutomation = async () => {
if (hasFormalOt.value) {
@@ -1904,7 +1833,7 @@ const onFooterRetryAutomation = async () => {
*/
const retryStpAutoCreate = async () => {
const caseNo = String(activeCase.value?.case_no || '').trim();
if (!caseNo || progressRetrying.value) return;
if (!caseNo || progressRetrying.value || caseSwitchLoading.value) return;
progressRetrying.value = true;
try {
const result = await retryWorkspaceShippingOrderStpAutoCreate(caseNo);
@@ -1921,6 +1850,52 @@ const retryStpAutoCreate = async () => {
}
};
/**
* 对话级「重试自动推进」:扫描会话下可恢复 Case/正式 OT。
* 核心逻辑:调用 retryWorkspaceConversationAutoProgress;打开结果弹窗;刷新草稿与处理投影。
*/
const retryConversationAutoProgress = async () => {
const id = String(conversationId.value || '').trim();
if (!id || conversationRetrying.value || !showConversationRetry.value) return;
if (caseSwitchLoading.value || progressRetrying.value) return;
conversationRetrying.value = true;
try {
const result = await retryWorkspaceConversationAutoProgress(id);
conversationRetryResult.value = {
summary: result.summary,
items: result.items || [],
};
conversationRetryResultOpen.value = true;
await reloadLatestDraft();
await refreshShippingProcessing();
} catch (error) {
msg.error(resolveReviewErrorMessage(error));
} finally {
conversationRetrying.value = false;
}
};
/**
* 「关闭并刷新」:关闭对话级重试结果弹窗并重新拉取工作台投影。
*/
const closeConversationRetryResult = async () => {
conversationRetryResultOpen.value = false;
conversationRetryResult.value = null;
await reloadLatestDraft();
await refreshShippingProcessing();
};
/**
* 对话级重试跳过原因文案:优先 i18n reason.*,否则回退原始 reason_code。
* @param reasonCode - 后端 reason_code
*/
const conversationRetrySkipReasonLabel = (reasonCode?: string | null) => {
const code = String(reasonCode || '').trim();
if (!code) return '';
const key = `chat.shippingOrderReview.conversationRetry.reason.${code}`;
return te(key) ? t(key) : code;
};
/**
* 滚动到工作台锚点(data-testid)。
*/
@@ -2109,7 +2084,7 @@ const onUnifiedProcessingAction = async (item: ActionPresentationItem) => {
}
if (behavior === 'retry') {
await retryAutoProgressAfterConfirm();
await retryFormalOtAutoProgress();
await refreshShippingProcessing();
return;
}
@@ -2626,9 +2601,14 @@ watch(
:is-read-only="isReadOnly"
:show-version-history="Boolean(activeCase)"
:show-audit-trail="Boolean(activeCase)"
:show-conversation-retry="showConversationRetry"
:conversation-retry-eligible-count="conversationRetryEligibleCount"
:conversation-retrying="conversationRetrying"
:conversation-retry-disabled="caseSwitchLoading || progressRetrying"
@back="back"
@open-version-history="openVersionHistory"
@open-audit-trail="openAuditTrail"
@retry-conversation-auto-progress="() => void retryConversationAutoProgress()"
/>
<div
@@ -2707,63 +2687,6 @@ watch(
</p>
</div>
<div
v-if="confirmSuccess"
class="mx-4 mt-3 rounded-xl px-3 py-2 text-sm"
:class="confirmSuccess.progressFailed
? 'border border-amber-300 bg-amber-50 text-amber-950 dark:border-amber-800 dark:bg-amber-950/50 dark:text-amber-100'
: 'border border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-100'"
data-testid="review-confirm-outcome"
:data-progress-failed="confirmSuccess.progressFailed ? 'true' : 'false'"
>
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<p>
{{ confirmSuccess.progressFailed
? t('chat.shippingOrderReview.confirmProgressFailed', { taskNo: confirmSuccess.taskNo })
: confirmSuccess.autoProgress
? t('chat.shippingOrderReview.confirmAutoProgress', { taskNo: confirmSuccess.taskNo })
: t('chat.shippingOrderReview.confirmSuccess', { taskNo: confirmSuccess.taskNo }) }}
</p>
<p v-if="confirmSuccess.progressStatus" class="mt-1 text-xs">
{{ t('chat.shippingOrderReview.autoProgress.result', { status: autoProgressStatusLabel(confirmSuccess.progressStatus) }) }}
</p>
<p v-if="confirmSuccess.progressMessage" class="mt-1 text-xs">{{ confirmSuccess.progressMessage }}</p>
<p v-if="confirmSuccess.checkpoint" class="mt-1 text-xs text-amber-800 dark:text-amber-200">
{{ t('chat.shippingOrderReview.autoProgress.checkpoint', { checkpoint: confirmSuccess.checkpoint }) }}
</p>
<p
v-if="shippingProcessingSummaryLabel"
class="mt-1 text-xs"
data-testid="review-shipping-processing-summary"
>
{{ shippingProcessingSummaryLabel }}
</p>
</div>
<div class="flex shrink-0 flex-wrap items-center gap-2">
<button
v-if="confirmSuccess.progressFailed"
type="button"
class="inline-flex items-center gap-1 rounded border border-amber-500 bg-amber-100/80 px-2.5 py-1.5 text-xs font-medium hover:bg-amber-100 disabled:opacity-50 dark:bg-amber-900/40 dark:hover:bg-amber-900"
:disabled="progressRetrying"
data-testid="retry-auto-progress-after-confirm"
@click="retryAutoProgressAfterConfirm"
>
<RefreshCw class="h-3.5 w-3.5" />{{ t('chat.shippingOrderReview.autoProgress.retry') }}
</button>
<button
v-if="confirmSuccess.orderTaskNo"
type="button"
class="text-xs font-medium text-emerald-800 underline hover:text-emerald-950 dark:text-emerald-200 dark:hover:text-emerald-50"
data-testid="open-confirmed-task-progress-link"
@click="openTaskProgress(confirmSuccess.orderTaskNo, confirmSuccess.taskNo)"
>
{{ t('chat.shippingOrderReview.autoProgress.returnToChat') }}
</button>
</div>
</div>
</div>
<!-- 确认后统一进度主路径留在本页;返回对话仅作次要聚焦链接。 -->
<div v-if="loading" class="p-8 text-sm text-slate-600 dark:text-slate-300">{{ t('chat.shippingOrderReview.loading') }}</div>
@@ -3037,13 +2960,13 @@ watch(
@set-mode="onWorkbenchModeChange"
/>
<!-- 窄屏:仅展示真正阻断卡;正式 OT 后不挂当前处理/履约摘要重复卡 -->
<!-- 窄屏:阻断卡 + 当前处理卡(对象级重试优先于此) -->
<div
class="space-y-2 xl:hidden"
data-testid="review-primary-blockers-narrow"
>
<ReviewCurrentProcessingCard
v-if="!hasFormalOt && activeCase?.task_missing"
v-if="mountCurrentProcessingCard"
:stage-code="currentProcessingStageDisplay.code"
:stage-label-key="currentProcessingStageDisplay.labelKey"
:stage-inconsistent="currentProcessingStageDisplay.inconsistent"
@@ -3052,15 +2975,15 @@ watch(
:confirmed-task-id="activeCase?.confirmed_task_id"
:show-admin-diagnosis="showAdminTaskMissingDiagnosis"
:automation="activeCase?.automation"
:show-retry="false"
:retrying="progressRetrying"
@retry="() => void retryFormalOtAutoProgress()"
:show-retry="showObjectRetryOnRail"
:retrying="progressRetrying || caseSwitchLoading"
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
/>
<ReviewInventoryIssueFallbackCard
v-if="hasFormalOt && activeCase?.inventory_issue_fallback && !activeCase?.line_fulfillment?.has_line_inventory_projection"
:fallback="activeCase.inventory_issue_fallback"
:busy="Boolean(lineOpsBusyKey)"
@retry-preparation="() => void retryLineInventoryRpa('case', 'retry_inventory_preparation')"
@retry-preparation="() => void retryCaseInventoryFallback()"
/>
<ProcessGateRecoveryCard
v-if="!reparseProgressActive && showHumanBlockingGate && activeCase?.process_gate"
@@ -3337,12 +3260,6 @@ watch(
{{ t('chat.shippingOrderReview.fulfillmentDecision.shortage') }}
</th>
</template>
<th
v-if="showLineInventoryColumns"
class="min-w-24 border-b border-slate-200 px-2 py-1.5 font-medium dark:border-slate-800"
>
{{ t('chat.shippingOrderReview.fulfillmentDecision.status') }}
</th>
<th class="sticky right-0 z-10 min-w-28 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-slate-800 dark:bg-slate-950">
<span class="sr-only">{{ t('chat.shippingOrderReview.fulfillmentDecision.actions') }}</span>
</th>
@@ -3484,14 +3401,6 @@ watch(
{{ displayShortageQty(lineFulfillmentFor(String(line.line_key || ''))) }}
</td>
</template>
<td v-if="showLineInventoryColumns" class="px-2 py-1.5 align-middle">
<span
:class="userLineStatusBadgeClass(lineFulfillmentFor(String(line.line_key || '')))"
data-testid="review-line-status-badge"
>
{{ userLineStatusLabel(lineFulfillmentFor(String(line.line_key || ''))) }}
</span>
</td>
<td class="sticky right-0 z-10 min-w-28 whitespace-nowrap bg-white px-2 py-1.5 dark:bg-slate-900">
<div class="flex items-center justify-end gap-0.5">
<button
@@ -3520,9 +3429,9 @@ watch(
:line="lineFulfillmentFor(String(line.line_key || ''))"
:editable="editable"
:busy="lineOpsBusyKey === String(line.line_key || '') || saving"
@retry-inventory="(actionCode) => void retryLineInventoryRpa(String(line.line_key || ''), actionCode)"
:task-running="taskAutomationRunning"
@retry-line="() => void retryLineUnified(String(line.line_key || ''))"
@close-line="openCloseFulfillmentDialog([String(line.line_key || '')])"
@view-fulfillment="toggleFulfillmentDetail(String(line.line_key || ''))"
/>
</div>
</td>
@@ -3569,10 +3478,10 @@ watch(
data-testid="review-build-gate-rail"
:aria-label="t('chat.shippingOrderReview.workbench.summaryRail')"
>
<!-- 宽屏侧栏:建单前订单检查;正式 OT 后不挂当前处理/履约摘要重复卡 -->
<!-- 宽屏侧栏:建单前订单检查 + 当前处理卡(对象级重试优先于此) -->
<div class="hidden space-y-2 xl:block" data-testid="review-primary-blockers-wide">
<ReviewCurrentProcessingCard
v-if="!hasFormalOt && activeCase?.task_missing"
v-if="mountCurrentProcessingCard"
:stage-code="currentProcessingStageDisplay.code"
:stage-label-key="currentProcessingStageDisplay.labelKey"
:stage-inconsistent="currentProcessingStageDisplay.inconsistent"
@@ -3581,15 +3490,15 @@ watch(
:confirmed-task-id="activeCase?.confirmed_task_id"
:show-admin-diagnosis="showAdminTaskMissingDiagnosis"
:automation="activeCase?.automation"
:show-retry="false"
:retrying="progressRetrying"
@retry="() => void retryFormalOtAutoProgress()"
:show-retry="showObjectRetryOnRail"
:retrying="progressRetrying || caseSwitchLoading"
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
/>
<ReviewInventoryIssueFallbackCard
v-if="hasFormalOt && activeCase?.inventory_issue_fallback && !activeCase?.line_fulfillment?.has_line_inventory_projection"
:fallback="activeCase.inventory_issue_fallback"
:busy="Boolean(lineOpsBusyKey)"
@retry-preparation="() => void retryLineInventoryRpa('case', 'retry_inventory_preparation')"
@retry-preparation="() => void retryCaseInventoryFallback()"
/>
<ReviewCustomerResolutionPanel
v-if="activeCase && !activeCase.customer_resolution?.resolved && showEligibilityAsPrimary"
@@ -3845,7 +3754,7 @@ watch(
:can-confirm-build="canConfirmBuild"
:hide-confirm-because-auto-gate="hideConfirmBecauseAutoGate"
:show-auto-gate-hint="showAutoGateHint"
:show-stp-retry="showStpRetry"
:show-stp-retry="showObjectRetryOnFooter"
:auto-gate-hint="t(autoGateHintKey)"
:saving="saving"
:is-read-only="isReadOnly"
@@ -3884,6 +3793,56 @@ watch(
@save-and-switch="() => { void saveAndSwitchCase(); }"
/>
<div
v-if="conversationRetryResultOpen && conversationRetryResult"
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4"
data-testid="review-conversation-retry-result"
role="dialog"
aria-modal="true"
>
<div class="w-full max-w-md rounded-xl border border-slate-200 bg-white p-4 shadow-xl dark:border-slate-700 dark:bg-slate-900">
<h2 class="text-sm font-semibold text-slate-900 dark:text-slate-100">
{{ t('chat.shippingOrderReview.conversationRetry.title') }}
</h2>
<dl class="mt-3 space-y-1 text-xs text-slate-700 dark:text-slate-200">
<div class="flex justify-between gap-3">
<dt>{{ t('chat.shippingOrderReview.conversationRetry.retried') }}</dt>
<dd data-testid="review-conversation-retry-retried">{{ conversationRetryResult.summary.retried }}</dd>
</div>
<div class="flex justify-between gap-3">
<dt>{{ t('chat.shippingOrderReview.conversationRetry.skipped') }}</dt>
<dd data-testid="review-conversation-retry-skipped">{{ conversationRetryResult.summary.skipped }}</dd>
</div>
<div class="flex justify-between gap-3">
<dt>{{ t('chat.shippingOrderReview.conversationRetry.failed') }}</dt>
<dd data-testid="review-conversation-retry-failed">{{ conversationRetryResult.summary.failed }}</dd>
</div>
</dl>
<ul
v-if="conversationRetryResult.items.some((item) => item.outcome === 'skipped')"
class="mt-3 max-h-40 space-y-1 overflow-y-auto text-xs text-slate-600 dark:text-slate-300"
data-testid="review-conversation-retry-skip-list"
>
<li
v-for="item in conversationRetryResult.items.filter((row) => row.outcome === 'skipped')"
:key="`${item.object_type}:${item.object_ref}`"
>
{{ item.object_ref }}:{{ conversationRetrySkipReasonLabel(item.reason_code) || t('chat.shippingOrderReview.conversationRetry.skipped') }}
</li>
</ul>
<div class="mt-4 flex justify-end">
<button
type="button"
class="rounded bg-sky-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-sky-500"
data-testid="review-conversation-retry-close-refresh"
@click="() => void closeConversationRetryResult()"
>
{{ t('chat.shippingOrderReview.conversationRetry.closeAndRefresh') }}
</button>
</div>
</div>
</div>
<ReviewActionConfirmDialog
v-if="actionDialogOpen && pendingAction"
v-model="actionDialogOpen"