feat(shipping-notice): 完成货代发货通知全门禁恢复MVP收口
完成全门禁恢复MVP版本交付:调整自动上传与重试配置,重构正式执行链路;修复多处代码bug,新增测试与审计工具;更新全流程文档与契约规范。
This commit is contained in:
1 parent
8e0bbf7a81
commit
c94d173f92
181 files changed
+12947
-1724
No files matched your search
@@ -19,7 +19,7 @@ import { computed, defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, r
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { Check, CircleX, Crosshair, Plus, RefreshCw, Undo2, Copy, Trash2 } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError, resolveLocalizedErrorMessage } from '@/shared/api/client';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { useChatPageContext } from '@/features/chat/composables/chat.context';
|
||||
import {
|
||||
@@ -35,7 +35,6 @@ import {
|
||||
retryWorkspaceConversationAutoProgress,
|
||||
retryWorkspaceShippingOrderStpAutoCreate,
|
||||
retryWorkspaceShippingTask,
|
||||
retryWorkspaceShippingTaskLine,
|
||||
viewWorkspaceShippingOrderReviewHighlightDiagnostic,
|
||||
} from '../api/shipping.api';
|
||||
import type {
|
||||
@@ -55,6 +54,7 @@ import ReviewInventoryIssueFallbackCard from '../components/shipping-review/Revi
|
||||
import ReviewAuditTrailDrawer from '../components/shipping-review/ReviewAuditTrailDrawer.vue';
|
||||
import ReviewCompletedChecksPanel from '../components/shipping-review/ReviewCompletedChecksPanel.vue';
|
||||
import ReviewCurrentProcessingCard from '../components/shipping-review/ReviewCurrentProcessingCard.vue';
|
||||
import ReviewConversationRetryDrawer from '../components/shipping-review/ReviewConversationRetryDrawer.vue';
|
||||
import ReviewDocumentNavigation, {
|
||||
type ReviewDocumentNavMode,
|
||||
} from '../components/shipping-review/ReviewDocumentNavigation.vue';
|
||||
@@ -66,6 +66,7 @@ import ReviewWorkbenchModeToggle from '../components/shipping-review/ReviewWorkb
|
||||
import ReviewUnsavedSwitchDialog from '../components/shipping-review/ReviewUnsavedSwitchDialog.vue';
|
||||
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
|
||||
import TaskTodoPanel from '@/features/workspace/shipping-task-center/TaskTodoPanel.vue';
|
||||
import ManualUploadEvidenceDialog from '@/features/workspace/shipping-task-center/ManualUploadEvidenceDialog.vue';
|
||||
import { downloadWorkspaceShippingExcelFile } from '@/features/workspace/api/shipping-tasks.api';
|
||||
import ReviewLineNoOverrideDialog, {
|
||||
type LineNoOverridePayload,
|
||||
@@ -111,6 +112,7 @@ const {
|
||||
shippingProcessingProjection,
|
||||
authoritativeOrderTaskNo,
|
||||
refreshShippingProcessing,
|
||||
shippingProcessingLoading,
|
||||
workflowProgressPolling,
|
||||
versions,
|
||||
statusMessage,
|
||||
@@ -285,7 +287,8 @@ const displayHeaderValues = computed(() => (
|
||||
const displayDraftLines = computed(() => displayCase.value?.draft?.lines || []);
|
||||
|
||||
const showWorkbenchCaseShell = computed(() => Boolean(displayCase.value));
|
||||
const caseContentSkeleton = computed(() => caseSwitchLoading.value || caseSwitchFailed.value);
|
||||
/** 切换期间和失败回退均保留旧快照;无稳定 Case 时才进入空状态骨架。 */
|
||||
const caseContentSkeleton = computed(() => caseSwitchFailed.value && !activeCase.value);
|
||||
|
||||
/** can_build && can_auto_create 时底栏隐藏「确认建单」;文案仅表示资格达标等待入队,不等于正在推进。 */
|
||||
/** queued|running|已有正式 OT|task_missing 时隐藏「确认并创建任务」。 */
|
||||
@@ -459,9 +462,12 @@ const confirmSuccess = ref<{
|
||||
} | null>(null);
|
||||
const progressRetrying = ref(false);
|
||||
const conversationRetrying = ref(false);
|
||||
const conversationRetryResultOpen = ref(false);
|
||||
const conversationRetryDrawerOpen = ref(false);
|
||||
const conversationRetryToastOpen = ref(false);
|
||||
let conversationRetryToastTimer: ReturnType<typeof window.setTimeout> | undefined;
|
||||
const conversationRetryError = ref('');
|
||||
const conversationRetryResult = ref<{
|
||||
summary: { total: number; retried: number; skipped: number; failed: number };
|
||||
summary: { total: number; retried: number; skipped: number; failed: number; blocked?: number };
|
||||
items: Array<{
|
||||
object_type: string;
|
||||
object_ref: string;
|
||||
@@ -471,6 +477,19 @@ const conversationRetryResult = ref<{
|
||||
}>;
|
||||
} | null>(null);
|
||||
|
||||
const hasConversationRetryAttention = computed(() => (
|
||||
Number(conversationRetryResult.value?.summary.failed || 0) > 0
|
||||
|| Number(conversationRetryResult.value?.summary.blocked || 0) > 0
|
||||
));
|
||||
|
||||
function showConversationRetryToast() {
|
||||
if (conversationRetryToastTimer) window.clearTimeout(conversationRetryToastTimer);
|
||||
conversationRetryToastOpen.value = true;
|
||||
conversationRetryToastTimer = window.setTimeout(() => {
|
||||
conversationRetryToastOpen.value = false;
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 题9A:already_running 响应本地冷却(任务号 → 过期毫秒时间戳)。
|
||||
* 当服务端返回 noop.already_running 时写对应 task 条目;按钮禁用在此有效期内叠加,避免「投影 refresh 有 2-3s 滞后期间用户再次点击」。
|
||||
@@ -1165,104 +1184,7 @@ function displayAvailableQty(line: ShippingOrderReviewLineFulfillmentLine | null
|
||||
return String(line.available_qty);
|
||||
}
|
||||
|
||||
const lineOpsBusyKey = ref<string | null>(null);
|
||||
|
||||
/** 任务整体 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;不传内部动作码。
|
||||
* 题3B / 题10A:行 REMATCH 不受整单 running 源阻塞;但此处仍按行按钮互斥和行冷却独立判断。
|
||||
*/
|
||||
async function retryLineUnified(lineKey: string) {
|
||||
const key = String(lineKey || '').trim();
|
||||
if (!key || caseSwitchLoading.value) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
|
||||
return;
|
||||
}
|
||||
// 题3B:整单正在 running → 仅 fetch_inventory(缺快照) 受影响;此处仅用 inventory_source_unstable 或 task_missing 全局阻塞
|
||||
if (Boolean(activeCase.value?.task_missing)) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
|
||||
return;
|
||||
}
|
||||
const taskNo = String(
|
||||
confirmedNoticeTaskNo.value
|
||||
|| activeCase.value?.confirmed_task_no
|
||||
|| formalOtRetryTaskNo.value
|
||||
|| '',
|
||||
).trim();
|
||||
if (!taskNo) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
|
||||
return;
|
||||
}
|
||||
if (lineOpsBusyKey.value) return;
|
||||
// 行级冷却:taskNo + lineKey
|
||||
if (isLineRunningCooldownActive(taskNo, key)) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryAlreadyRunning', { lineKey: key }));
|
||||
return;
|
||||
}
|
||||
lineOpsBusyKey.value = key;
|
||||
try {
|
||||
const result = await retryWorkspaceShippingTaskLine(taskNo, key);
|
||||
const status = String(result?.status || '').trim().toLowerCase();
|
||||
const reasonCode = String(result?.reason_code || '').trim().toLowerCase();
|
||||
if (status === 'noop' && reasonCode === 'already_running') {
|
||||
markLineRunningCooldown(taskNo, key, TASK_RUNNING_COOLDOWN_MS);
|
||||
msg.warning(
|
||||
String(result?.message || t('chat.shippingOrderReview.lineOps.retryAlreadyRunning', { lineKey: key })),
|
||||
);
|
||||
void refreshShippingProcessing();
|
||||
return;
|
||||
}
|
||||
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
|
||||
? resolveLocalizedErrorMessage(error.code, error.message)
|
||||
: t('chat.shippingOrderReview.lineOps.retryRpaFailed'),
|
||||
);
|
||||
} finally {
|
||||
lineOpsBusyKey.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** 行级 already_running 冷却(taskNo + lineKey 组合 → 过期毫秒)。 */
|
||||
const lineRunningCooldownUntilMs = ref<Record<string, number>>({});
|
||||
|
||||
function markLineRunningCooldown(taskNo: string | null | undefined, lineKey: string | null | undefined, durationMs: number = TASK_RUNNING_COOLDOWN_MS) {
|
||||
const t = String(taskNo || '').trim();
|
||||
const l = String(lineKey || '').trim();
|
||||
if (!t || !l) return;
|
||||
const key = `${t}::${l}`;
|
||||
lineRunningCooldownUntilMs.value = {
|
||||
...lineRunningCooldownUntilMs.value,
|
||||
[key]: Date.now() + durationMs,
|
||||
};
|
||||
}
|
||||
|
||||
function isLineRunningCooldownActive(taskNo: string | null | undefined, lineKey: string | null | undefined): boolean {
|
||||
const t = String(taskNo || '').trim();
|
||||
const l = String(lineKey || '').trim();
|
||||
if (!t || !l) return false;
|
||||
const key = `${t}::${l}`;
|
||||
const until = Number(lineRunningCooldownUntilMs.value[key] || 0) || 0;
|
||||
return until > Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* Case 级库存兜底卡「重试」:走任务级统一决策器(无行键时)。
|
||||
*/
|
||||
/** Case 级库存兜底卡:统一由当前 Gate 卡提供精确动作。 */
|
||||
async function retryCaseInventoryFallback() {
|
||||
await retryFormalOtAutoProgress();
|
||||
}
|
||||
@@ -1325,6 +1247,24 @@ async function handleCurrentTaskAction(
|
||||
) {
|
||||
const params = (parameters || {}) as Record<string, unknown>;
|
||||
switch (code) {
|
||||
case 'download_excel': {
|
||||
const taskNo = (params.task_no as string | undefined) || confirmedNoticeTaskNo.value;
|
||||
if (!taskNo) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return;
|
||||
}
|
||||
await downloadWorkspaceShippingExcelFile(taskNo);
|
||||
msg.success(t('chat.shippingOrderReview.workbench.actionSuccess'));
|
||||
break;
|
||||
}
|
||||
case 'view_result':
|
||||
case 'open_fulfillment':
|
||||
case 'view_details':
|
||||
workbenchMode.value = 'formal_task';
|
||||
if (!(await ensureFormalTaskDetailReady())) return;
|
||||
await nextTick();
|
||||
scrollWorkbenchAnchor('review-formal-task-result-region');
|
||||
break;
|
||||
case 'open_inventory_source_review':
|
||||
if (hasCreatedShippingTask.value) {
|
||||
workbenchMode.value = 'formal_task';
|
||||
@@ -1364,6 +1304,9 @@ async function handleCurrentTaskAction(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'mark_manual_uploaded':
|
||||
await formalTodoPanelRef.value?.invokeActionByCode('mark_manual_uploaded');
|
||||
break;
|
||||
default:
|
||||
msg.info(t('chat.shippingOrderReview.currentTask.actionUnknown', { code }));
|
||||
}
|
||||
@@ -1659,6 +1602,51 @@ const confirmedNoticeTaskNo = computed(() => String(
|
||||
/** 确认后履约待办详情;任务中心不再挂工作台,由本工作台承接。 */
|
||||
const formalTaskDetail = ref<ShippingTaskDetail | null>(null);
|
||||
const formalTaskDetailLoading = ref(false);
|
||||
const manualUploadRegistrationOpen = ref(false);
|
||||
|
||||
/** 完成态结果摘要:与正式 ShippingTask 详情同源,禁止从进度条重新推导业务结果。 */
|
||||
const formalResultLineResults = computed(() => formalTaskDetail.value?.line_results || []);
|
||||
const formalResultShortageCount = computed(() => formalResultLineResults.value.filter(
|
||||
(line) => Number(line.shortage_qty || 0) > 0 || String(line.line_status || '').toLowerCase() === 'shortage',
|
||||
).length);
|
||||
const formalResultMatchedCount = computed(() => formalResultLineResults.value.filter(
|
||||
(line) => Number(line.shortage_qty || 0) <= 0 && String(line.line_status || '').toLowerCase() !== 'shortage',
|
||||
).length);
|
||||
const formalResultArtifact = computed(() => formalTaskDetail.value?.export_artifacts?.[0] || null);
|
||||
const formalResultCompletedAt = computed(() => (
|
||||
formalTaskDetail.value?.upload_attempts?.find((attempt) => String(attempt.status || '').toLowerCase() === 'succeeded')?.finished_at
|
||||
|| formalTaskDetail.value?.updated_at
|
||||
|| formalTaskDetail.value?.created_at
|
||||
|| null
|
||||
));
|
||||
const formalResultIsCompleted = computed(() => {
|
||||
const status = String(formalTaskDetail.value?.process_status || '').toLowerCase();
|
||||
return ['completed', 'uploaded', 'closed'].includes(status)
|
||||
|| String(formalTaskDetail.value?.upload_status || '').toLowerCase() === 'uploaded';
|
||||
});
|
||||
|
||||
/** 直接在订单复核页打开人工上传登记,避免依赖仅在 formal_task 模式挂载的 TaskTodoPanel ref。 */
|
||||
function openManualUploadRegistration() {
|
||||
if (!confirmedNoticeTaskNo.value) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return;
|
||||
}
|
||||
manualUploadRegistrationOpen.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工上传登记成功后刷新完整工作台状态。
|
||||
* 先重新拉取 Review Case(顶部阶段与 Gate 的权威投影),再刷新任务详情和统一处理投影;
|
||||
* 不能只刷新 OT 详情,否则登记已落库但页面仍会显示旧的人工上传阻断状态。
|
||||
*/
|
||||
async function handleManualUploadSuccess() {
|
||||
manualUploadRegistrationOpen.value = false;
|
||||
await reloadLatestDraft();
|
||||
await Promise.all([
|
||||
loadFormalTaskDetail(),
|
||||
refreshShippingProcessing(),
|
||||
]);
|
||||
}
|
||||
const formalTodoPanelRef = ref<{
|
||||
invokeActionByCode: (actionId: string) => Promise<void>;
|
||||
openCustomerDialog: () => Promise<void>;
|
||||
@@ -1686,7 +1674,9 @@ async function loadFormalTaskDetail() {
|
||||
watch(
|
||||
[confirmedNoticeTaskNo, workbenchMode, hasCreatedShippingTask],
|
||||
([taskNo, mode, created]) => {
|
||||
if (taskNo && created && (mode === 'formal_task' || mode === 'confirm_progress')) {
|
||||
const completed = String(displayCase.value?.current_stage?.code || '').trim().toLowerCase() === 'completed'
|
||||
|| String(displayCase.value?.user_status || '').trim().toLowerCase() === 'completed';
|
||||
if (taskNo && created && (mode === 'formal_task' || mode === 'confirm_progress' || completed)) {
|
||||
void loadFormalTaskDetail();
|
||||
return;
|
||||
}
|
||||
@@ -2115,50 +2105,33 @@ const retryStpAutoCreate = async () => {
|
||||
|
||||
/**
|
||||
* 对话级「重试自动推进」:扫描会话下可恢复 Case/正式 OT。
|
||||
* 核心逻辑:调用 retryWorkspaceConversationAutoProgress;打开结果弹窗;刷新草稿与处理投影。
|
||||
* 核心逻辑:调用 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;
|
||||
conversationRetryError.value = '';
|
||||
try {
|
||||
const result = await retryWorkspaceConversationAutoProgress(id);
|
||||
conversationRetryResult.value = {
|
||||
summary: result.summary,
|
||||
items: result.items || [],
|
||||
};
|
||||
conversationRetryResultOpen.value = true;
|
||||
// 结果只以短暂提示反馈;逐项详情由用户主动打开右侧抽屉,避免占用复核主内容。
|
||||
showConversationRetryToast();
|
||||
await reloadLatestDraft();
|
||||
await refreshShippingProcessing();
|
||||
} catch (error) {
|
||||
msg.error(resolveReviewErrorMessage(error));
|
||||
// 批量动作失败只影响本次扫描;错误以内嵌提示展示,避免 toast 遮挡并允许继续切换任务。
|
||||
conversationRetryError.value = resolveReviewErrorMessage(error);
|
||||
showConversationRetryToast();
|
||||
} 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)。
|
||||
*/
|
||||
@@ -2319,6 +2292,7 @@ const onUnifiedProcessingAction = async (item: ActionPresentationItem) => {
|
||||
const resultEl = document.querySelector('[data-testid="review-formal-task-result-region"]');
|
||||
if (resultEl) {
|
||||
resultEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
msg.info(t('chat.shippingOrderReview.workbench.actionSuccess'));
|
||||
} else {
|
||||
scrollWorkbenchAnchor('review-formal-task-todo-panel');
|
||||
msg.info(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
@@ -2353,10 +2327,14 @@ const onUnifiedProcessingAction = async (item: ActionPresentationItem) => {
|
||||
}
|
||||
|
||||
if (behavior === 'todo_panel') {
|
||||
const todoCode = entry.todoActionCode || item.actionCode;
|
||||
if (todoCode === 'mark_manual_uploaded') {
|
||||
openManualUploadRegistration();
|
||||
return;
|
||||
}
|
||||
workbenchMode.value = 'formal_task';
|
||||
if (!(await ensureFormalTaskDetailReady())) return;
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-formal-task-todo-panel');
|
||||
const todoCode = entry.todoActionCode || item.actionCode;
|
||||
await formalTodoPanelRef.value?.invokeActionByCode(todoCode);
|
||||
return;
|
||||
}
|
||||
@@ -2877,10 +2855,12 @@ watch(
|
||||
:conversation-retry-eligible-count="conversationRetryEligibleCount"
|
||||
:conversation-retrying="conversationRetrying"
|
||||
:conversation-retry-disabled="caseSwitchLoading || progressRetrying"
|
||||
:has-conversation-retry-result="hasConversationRetryAttention"
|
||||
@back="back"
|
||||
@open-version-history="openVersionHistory"
|
||||
@open-audit-trail="openAuditTrail"
|
||||
@retry-conversation-auto-progress="() => void retryConversationAutoProgress()"
|
||||
@open-conversation-retry-result="conversationRetryDrawerOpen = true"
|
||||
/>
|
||||
|
||||
<div
|
||||
@@ -2991,6 +2971,7 @@ watch(
|
||||
:item="reviewProgressContext"
|
||||
:task-no="authoritativeOrderTaskNo"
|
||||
:polling="workflowProgressPolling"
|
||||
:refreshing="shippingProcessingLoading"
|
||||
:processing-projection="shippingProcessingProjection"
|
||||
:has-formal-ot="hasFormalOt"
|
||||
data-testid="review-shipping-processing-strip"
|
||||
@@ -2999,7 +2980,7 @@ watch(
|
||||
/>
|
||||
|
||||
<section
|
||||
v-if="hasCreatedShippingTask && workbenchMode === 'formal_task' && formalTaskDetail"
|
||||
v-if="hasCreatedShippingTask && formalTaskDetail && (workbenchMode === 'formal_task' || formalResultIsCompleted)"
|
||||
class="rounded-xl border border-default bg-surface p-3"
|
||||
data-testid="review-formal-task-todo-panel"
|
||||
>
|
||||
@@ -3010,13 +2991,69 @@ watch(
|
||||
<div v-if="formalTaskDetailLoading" class="py-4 text-center text-xs text-muted">
|
||||
{{ t('workspace.shippingNotice.loading') }}
|
||||
</div>
|
||||
<section
|
||||
v-else-if="formalResultIsCompleted"
|
||||
class="mb-3 rounded-xl border border-emerald-200 bg-emerald-50/60 p-3 dark:border-emerald-900 dark:bg-emerald-950/20"
|
||||
data-testid="review-formal-task-result-panel"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<h3 class="text-sm font-semibold text-emerald-900 dark:text-emerald-100">
|
||||
{{ t('chat.shippingOrderReview.workbench.resultTitle') }}
|
||||
</h3>
|
||||
<span class="rounded-full bg-emerald-600 px-2 py-0.5 text-[11px] font-medium text-white">
|
||||
{{ t('chat.shippingOrderReview.workbench.resultCompleted') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-3 grid gap-2 text-xs text-emerald-950 dark:text-emerald-50 sm:grid-cols-3">
|
||||
<div>
|
||||
<div class="text-emerald-700/80 dark:text-emerald-200/80">{{ t('chat.shippingOrderReview.workbench.resultLines') }}</div>
|
||||
<div class="mt-0.5 font-semibold">{{ formalResultLineResults.length }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-emerald-700/80 dark:text-emerald-200/80">{{ t('chat.shippingOrderReview.workbench.resultMatched') }}</div>
|
||||
<div class="mt-0.5 font-semibold">{{ formalResultMatchedCount }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-emerald-700/80 dark:text-emerald-200/80">{{ t('chat.shippingOrderReview.workbench.resultShortage') }}</div>
|
||||
<div class="mt-0.5 font-semibold">{{ formalResultShortageCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="formalResultLineResults.length" class="mt-3 overflow-x-auto rounded-lg border border-emerald-200/80 bg-white/70 dark:border-emerald-900 dark:bg-slate-950/30">
|
||||
<table class="min-w-full text-xs">
|
||||
<thead class="border-b border-emerald-200/80 text-left dark:border-emerald-900">
|
||||
<tr>
|
||||
<th class="px-2 py-1.5 font-medium">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th>
|
||||
<th class="px-2 py-1.5 font-medium">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th>
|
||||
<th class="px-2 py-1.5 font-medium">{{ t('chat.shippingOrderReview.workbench.resultStatus') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="line in formalResultLineResults" :key="`${line.reservation_id || ''}-${line.part_number}`" class="border-b border-emerald-100 last:border-0 dark:border-emerald-950">
|
||||
<td class="px-2 py-1.5">{{ line.part_number || '-' }}</td>
|
||||
<td class="px-2 py-1.5">{{ line.reservation_id || '-' }}</td>
|
||||
<td class="px-2 py-1.5">{{ Number(line.shortage_qty || 0) > 0 ? t('chat.shippingOrderReview.workbench.resultShortage') : t('chat.shippingOrderReview.workbench.resultMatched') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-3 flex flex-wrap items-center justify-between gap-2 text-xs">
|
||||
<span>{{ t('chat.shippingOrderReview.workbench.resultArtifact', { file: formalResultArtifact?.file_name || formalTaskDetail.export_file_name || '-' }) }}</span>
|
||||
<button v-if="formalResultArtifact || formalTaskDetail.export_file_name" type="button" class="rounded-lg border border-emerald-300 bg-white px-2.5 py-1.5 font-medium text-emerald-800 hover:bg-emerald-100 dark:border-emerald-800 dark:bg-slate-900 dark:text-emerald-100" data-testid="review-formal-task-result-download" @click="() => void downloadWorkspaceShippingExcelFile(confirmedNoticeTaskNo)">
|
||||
{{ t('workspace.shippingNotice.todo.downloadExcel') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="formalResultCompletedAt" class="mt-2 text-[11px] text-emerald-700/80 dark:text-emerald-200/80">
|
||||
{{ t('chat.shippingOrderReview.workbench.resultCompletedAt', { time: formalResultCompletedAt }) }}
|
||||
</div>
|
||||
</section>
|
||||
<TaskTodoPanel
|
||||
v-else-if="formalTaskDetail"
|
||||
v-else
|
||||
ref="formalTodoPanelRef"
|
||||
:detail="formalTaskDetail"
|
||||
:gate-can-handle="false"
|
||||
:gate-can-handle="workbenchActionsExecutable"
|
||||
:actions-executable="workbenchActionsExecutable"
|
||||
:hide-primary-actions="true"
|
||||
:hide-gate-card="true"
|
||||
:expected-notice-task-no="confirmedNoticeTaskNo"
|
||||
:expected-order-task-no="authoritativeOrderTaskNo"
|
||||
:expected-review-case-no="activeCase?.case_no || null"
|
||||
@@ -3224,11 +3261,13 @@ watch(
|
||||
</div>
|
||||
<div
|
||||
v-if="showWorkbenchCaseShell"
|
||||
class="relative space-y-2"
|
||||
class="relative space-y-2 transition-opacity duration-150"
|
||||
:class="caseSwitchLoading ? 'pointer-events-none opacity-70' : ''"
|
||||
data-testid="review-case-workbench-shell"
|
||||
:data-case-switching="caseSwitchLoading ? '1' : '0'"
|
||||
:data-case-switch-failed="caseSwitchFailed ? '1' : '0'"
|
||||
:data-case-projection-version="caseProjectionVersion ?? ''"
|
||||
:aria-busy="caseSwitchLoading ? 'true' : 'false'"
|
||||
>
|
||||
<ReviewWorkbenchModeToggle
|
||||
v-if="workbenchMode === 'evidence' || workbenchMode === 'inventory'"
|
||||
@@ -3254,30 +3293,16 @@ watch(
|
||||
:automation="displayCase?.automation"
|
||||
:show-retry="showObjectRetryOnRail"
|
||||
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
|
||||
:retryable="shippingProcessingProjection?.retryable ?? showObjectRetryOnRail"
|
||||
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
|
||||
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
|
||||
:primary-action="shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action"
|
||||
:retrying="taskRetryButtonDisabled || progressRetrying || caseSwitchLoading"
|
||||
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
|
||||
:retrying="displayCase?.process_gate?.current_blocking_gate
|
||||
? (progressRetrying || caseSwitchLoading)
|
||||
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
|
||||
:retry-exhausted-sources="taskInventoryExhaustedSources"
|
||||
:loading="caseContentSkeleton"
|
||||
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
|
||||
/>
|
||||
<ReviewInventoryIssueFallbackCard
|
||||
v-if="hasFormalOt && displayCase?.inventory_issue_fallback && !displayCase?.line_fulfillment?.has_line_inventory_projection"
|
||||
:fallback="displayCase.inventory_issue_fallback"
|
||||
:busy="Boolean(lineOpsBusyKey)"
|
||||
@retry-preparation="() => void retryCaseInventoryFallback()"
|
||||
/>
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!reparseProgressActive && showHumanBlockingGate && displayCase?.process_gate"
|
||||
:summary="displayCase.process_gate"
|
||||
:can-handle="false"
|
||||
:navigation-context="reviewGateNavigationContext"
|
||||
:field-labels="reviewFieldLabels"
|
||||
@refreshed="reloadLatestDraft"
|
||||
@refresh-needed="reloadLatestDraft"
|
||||
@confirm-customer="(taskNo) => void page.openShippingCustomerDialog?.(taskNo)"
|
||||
/>
|
||||
<ReviewCustomerResolutionPanel
|
||||
v-if="activeCase && !activeCase.customer_resolution?.resolved && showEligibilityAsPrimary"
|
||||
ref="customerResolutionPanelRef"
|
||||
@@ -3705,9 +3730,7 @@ watch(
|
||||
<ReviewLineInventoryOps
|
||||
:line="lineFulfillmentFor(String(line.line_key || ''))"
|
||||
:editable="editable"
|
||||
:busy="lineOpsBusyKey === String(line.line_key || '') || saving"
|
||||
:task-running="taskAutomationRunning"
|
||||
@retry-line="() => void retryLineUnified(String(line.line_key || ''))"
|
||||
:busy="saving"
|
||||
@close-line="openCloseFulfillmentDialog([String(line.line_key || '')])"
|
||||
/>
|
||||
</div>
|
||||
@@ -3813,16 +3836,35 @@ watch(
|
||||
:has-formal-ot="shippingProcessingProjection?.hasFormalOt ?? hasFormalOt"
|
||||
:shipping-notice-no="shippingProcessingProjection?.shippingNoticeNo ?? confirmedNoticeTaskNo"
|
||||
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
|
||||
:retryable="shippingProcessingProjection?.retryable ?? showObjectRetryOnRail"
|
||||
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
|
||||
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
|
||||
:primary-action="shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action"
|
||||
:retrying="taskRetryButtonDisabled || progressRetrying || caseSwitchLoading"
|
||||
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
|
||||
:retrying="displayCase?.process_gate?.current_blocking_gate
|
||||
? (progressRetrying || caseSwitchLoading)
|
||||
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
|
||||
:retry-exhausted-sources="taskInventoryExhaustedSources"
|
||||
:loading="caseContentSkeleton"
|
||||
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
|
||||
@locate="(lineKey, fieldId) => handleCurrentTaskLocate(lineKey, fieldId)"
|
||||
@action="(code, params) => void handleCurrentTaskAction(code, params)"
|
||||
/>
|
||||
<ReviewInventoryIssueFallbackCard
|
||||
v-if="hasFormalOt && displayCase?.inventory_issue_fallback && !displayCase?.line_fulfillment?.has_line_inventory_projection"
|
||||
:fallback="displayCase.inventory_issue_fallback"
|
||||
:busy="false"
|
||||
@retry-preparation="() => void retryCaseInventoryFallback()"
|
||||
/>
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!reparseProgressActive && showHumanBlockingGate && displayCase?.process_gate && hasCreatedShippingTask"
|
||||
:summary="displayCase.process_gate"
|
||||
:can-handle="workbenchActionsExecutable"
|
||||
:navigation-context="reviewGateNavigationContext"
|
||||
:field-labels="reviewFieldLabels"
|
||||
@refreshed="reloadLatestDraft"
|
||||
@refresh-needed="reloadLatestDraft"
|
||||
@confirm-customer="(taskNo) => void page.openShippingCustomerDialog?.(taskNo)"
|
||||
@manual-upload="() => void openManualUploadRegistration()"
|
||||
/>
|
||||
<ReviewProfileMatchPanel
|
||||
:profile-match="displayCase?.profile_match"
|
||||
/>
|
||||
@@ -3948,6 +3990,20 @@ watch(
|
||||
@open-audit="() => { processDetailOpen = false; auditTrailOpen = true; }"
|
||||
/>
|
||||
|
||||
<ManualUploadEvidenceDialog
|
||||
v-model:open="manualUploadRegistrationOpen"
|
||||
:task-no="confirmedNoticeTaskNo"
|
||||
:artifact-id="formalTaskDetail?.export_artifacts?.[0]?.id || null"
|
||||
:disabled="!workbenchActionsExecutable"
|
||||
@success="() => { void handleManualUploadSuccess(); }"
|
||||
/>
|
||||
|
||||
<ReviewConversationRetryDrawer
|
||||
:open="conversationRetryDrawerOpen"
|
||||
:result="conversationRetryResult"
|
||||
@close="conversationRetryDrawerOpen = false"
|
||||
/>
|
||||
|
||||
<ReviewUnsavedSwitchDialog
|
||||
:open="unsavedSwitchOpen"
|
||||
:unsaved-count="unsavedEditCount"
|
||||
@@ -3958,52 +4014,26 @@ watch(
|
||||
/>
|
||||
|
||||
<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"
|
||||
v-if="conversationRetryToastOpen"
|
||||
class="fixed right-4 top-16 z-50 max-w-xs rounded-full border border-slate-200 bg-white px-3 py-1.5 text-[11px] shadow-md dark:border-slate-700 dark:bg-slate-900"
|
||||
data-testid="review-conversation-retry-toast"
|
||||
role="status"
|
||||
>
|
||||
<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">
|
||||
<div class="flex items-center gap-2">
|
||||
<RefreshCw class="h-3.5 w-3.5 shrink-0 text-amber-600" />
|
||||
<p v-if="conversationRetryError" class="text-rose-700 dark:text-rose-300">{{ conversationRetryError }}</p>
|
||||
<p v-else class="text-slate-700 dark:text-slate-200">
|
||||
{{ conversationRetryError || t('chat.shippingOrderReview.conversationRetry.toast', { retried: conversationRetryResult?.summary.retried || 0 }) }}
|
||||
<button
|
||||
v-if="hasConversationRetryAttention"
|
||||
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()"
|
||||
class="ml-2 font-medium text-sky-700 hover:underline dark:text-sky-300"
|
||||
data-testid="review-conversation-retry-toast-open"
|
||||
@click="conversationRetryDrawerOpen = true"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.conversationRetry.closeAndRefresh') }}
|
||||
{{ t('chat.shippingOrderReview.conversationRetry.viewResult') }}
|
||||
</button>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user