feat(shipping-notice): 优化货运订单履约流程与用户体验

- 优化聊天附件列表为横向可滚动布局并新增配套测试用例
- 移除自动填充默认用户消息逻辑,空备注时不再伪造默认正文
- 修复流程Gate动作展示逻辑,隐藏历史遗留操作与自动阶段无效按钮
- 完善库存匹配重试与订单快照冻结校验流程
- 优化进度展示优先级,优先显示人工待处理状态
- 移除Excel导出自动推导金额逻辑,强制使用Schema配置字段
- 新增货代通用报表RPA详细设计文档
- 更新相关测试用例与断言逻辑
This commit is contained in:
hugo committed 2026-08-13 00:17:01 +08:00
1 parent dc282f3b1d
commit 11cef575b4
51 files changed
+2197 -112

No files matched your search

@@ -310,7 +310,8 @@ vi.mock('../components/shipping-review/ReviewInventoryCandidatesPanel.vue', () =
vi.mock('@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue', () => ({
default: {
name: 'ProcessGateRecoveryCard',
template: '<div data-testid="mock-process-gate" />',
props: ['showActions'],
template: '<div data-testid="mock-process-gate" :data-actions="showActions === false ? \'hidden\' : \'shown\'" />',
},
}));
@@ -642,6 +643,7 @@ function resetActiveCaseFixture() {
task_missing: false,
recovery_available: null,
post_confirm_auto_progress: null,
process_gate: null,
current_stage: null,
technical_progress: null,
automation: { status: 'idle', can_auto_create: false, can_build: true },
@@ -659,6 +661,38 @@ describe('ShippingOrderReviewView layout phase 1', () => {
reviewProgressContext.value = null;
});
it('uses the current-task card as the only Gate action entry for every formal-OT Gate', async () => {
activeCase.value = {
...activeCase.value,
status: 'confirmed',
has_formal_ot: true,
task_missing: false,
confirmed_task_id: 88,
confirmed_task_no: 'SN-GATE-1',
process_gate: {
execution_no: 'EXEC-GATE-1',
status: 'blocked',
owner_type: 'human',
technical_auto_only: false,
current_blocking_gate: { gate_code: 'customer_confirmation', status: 'blocked' },
primary_action: {
code: 'confirm_customer',
label_key: 'chat.shippingNotice.processGate.actionCodes.confirm_customer',
kind: 'current_gate',
dispatch: 'mutation',
},
},
automation: { status: 'manual_fallback', can_auto_create: false, can_build: true },
};
const wrapper = await mountView();
await flushPromises();
// 任意正式 OT Gate 的可执行入口只保留在“当前任务”;待处理事项只读说明仍保留。
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="mock-process-gate"]').attributes('data-actions')).toBe('hidden');
});
it('shows restored version as current and latest version only as failed attempt', async () => {
reviewProgressContext.value = {
item_no: 'WFI-1',
@@ -8,7 +8,7 @@
ReviewCustomerResolutionPanel / ReviewCurrentProcessingCard / ReviewCompletedChecksPanel /
ReviewBuildEligibilitySummary、ReviewInventory*、
ReviewLineInventoryOps(履约操作并入明细右侧列)、ReviewLineFulfillmentDetail(行内履约摘要)、
ProcessGateRecoveryCard;formal_task 仅显式动作挂载 TaskTodoPanel(主写在 Footer);
formal_task 仅显式动作挂载 TaskTodoPanel(主写在 Footer);
shipping.api.retryWorkspaceConversationAutoProgress(对话级重试)。
逻辑:建单前订单检查为主卡;正式 OT 后保持 standard,不自动切 formal_task 空壳;
对话级「重试自动推进」在顶栏;当前 Case 对象级重试优先右栏 CurrentProcessingCard,
@@ -65,6 +65,7 @@ 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 { useShippingProcessGateRecovery } from '@/features/shipping-process-gates/composables/useShippingProcessGateRecovery';
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';
@@ -103,6 +104,7 @@ const route = useRoute();
const router = useRouter();
const page = useChatPageContext();
const { t, te } = useI18n();
const { submitPrimaryAction: submitProcessGatePrimaryAction } = useShippingProcessGateRecovery();
const {
reviewRun,
activeCase,
@@ -233,11 +235,6 @@ const agentId = computed(() => String(route.params.agentId || ''));
const conversationId = computed(() => String(page.conversationId || route.query.conversation_id || ''));
const itemNoFromQuery = computed(() => String(route.query.item_no || ''));
const reviewFocus = computed(() => String(route.query.focus || '').trim());
/** Gate 恢复卡片导航上下文(复核台深链)。 */
const reviewGateNavigationContext = computed(() => ({
agentId: agentId.value,
conversationId: conversationId.value,
}));
const focusedEvidenceRef = ref<{ fieldId: string; lineIndex?: number } | null>(null);
const workbenchMode = ref<ReviewWorkbenchMode>('standard');
@@ -355,21 +352,47 @@ const caseContentSkeleton = computed(() => caseSwitchFailed.value && !activeCase
));
/**
* 是否挂载右侧/窄屏「当前处理」卡:task_missing、正式 OT、或自动化进行中/失败态。
* 核心逻辑:对象级重试优先挂在此卡上,未挂载时才回落底栏。
* 是否挂载右侧/窄屏「当前处理」卡:task_missing、正式 OT、自动化进行中/失败态,或人工 Gate。
* 核心逻辑:当前任务是本页唯一 Gate 写入口,对象级重试优先挂在此卡上,未挂载时才回落底栏。
*/
const mountCurrentProcessingCard = computed(() => {
if (!displayCase.value) return false;
if (caseContentSkeleton.value) return true;
if (Boolean(displayCase.value.task_missing)) return true;
if (hasFormalOt.value) return true;
const gate = displayCase.value.process_gate;
if (
gate?.current_blocking_gate
&& !gate.technical_auto_only
&& String(gate.owner_type || '') !== 'system'
) return true;
const status = String(displayCase.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);
const showObjectRetryOnRail = computed(() => showStpRetry.value && mountCurrentProcessingCard.value);
const showObjectRetryOnFooter = computed(() => showStpRetry.value && !mountCurrentProcessingCard.value);
/** 当前任务卡是复核页唯一 Gate 写入口;Gate 主动作优先于泛化自动重试。 */
const currentTaskPrimaryAction = computed(() => (
displayCase.value?.process_gate?.primary_action
?? shippingProcessingProjection.value?.primaryAction
?? displayCase.value?.primary_action
?? null
));
const currentTaskRetryable = computed(() => (
showObjectRetryOnRail.value
|| (
Boolean(shippingProcessingProjection.value?.retryable)
&& !String(currentTaskPrimaryAction.value?.code || '').trim()
)
));
const currentTaskRecoveryActions = computed(() => (
(displayCase.value?.process_gate?.recovery_targets || []).map((target) => ({
code: String(target.action_code || '').trim(),
})).filter((action) => action.code)
));
/** 管理员诊断:后端 technical_progress / automation.technical 仅 admin 投影。 */
const showAdminTaskMissingDiagnosis = computed(() => (
@@ -1289,10 +1312,30 @@ async function handleCurrentTaskAction(
}
break;
}
case 'retry_inventory_matching': {
const summary = displayCase.value?.process_gate;
if (!summary) return;
const result = await submitProcessGatePrimaryAction(summary, { actionCode: code });
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
await reloadLatestDraft();
await refreshShippingProcessing();
}
break;
}
case 'mark_manual_uploaded':
await formalTodoPanelRef.value?.invokeActionByCode('mark_manual_uploaded');
break;
default:
if (code.startsWith('retry_') || code.startsWith('recheck_') || code.startsWith('regenerate_')) {
const summary = displayCase.value?.process_gate;
if (!summary) return;
const result = await submitProcessGatePrimaryAction(summary, { actionCode: code });
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
await reloadLatestDraft();
await refreshShippingProcessing();
}
break;
}
msg.info(t('chat.shippingOrderReview.currentTask.actionUnknown', { code }));
}
}
@@ -3272,15 +3315,17 @@ watch(
:automation="displayCase?.automation"
:show-retry="showObjectRetryOnRail"
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
:retryable="currentTaskRetryable"
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
:primary-action="currentTaskPrimaryAction"
:recovery-actions="currentTaskRecoveryActions"
:retrying="displayCase?.process_gate?.current_blocking_gate
? (progressRetrying || caseSwitchLoading)
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
:retry-exhausted-sources="taskInventoryExhaustedSources"
:loading="caseContentSkeleton"
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
@action="(code, params) => void handleCurrentTaskAction(code, params)"
/>
<ReviewCustomerResolutionPanel
v-if="activeCase && !activeCase.customer_resolution?.resolved && showEligibilityAsPrimary"
@@ -3753,9 +3798,10 @@ watch(
:has-formal-ot="shippingProcessingProjection?.hasFormalOt ?? hasFormalOt"
:shipping-notice-no="shippingProcessingProjection?.shippingNoticeNo ?? confirmedNoticeTaskNo"
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
:retryable="currentTaskRetryable"
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
:primary-action="currentTaskPrimaryAction"
:recovery-actions="currentTaskRecoveryActions"
:retrying="displayCase?.process_gate?.current_blocking_gate
? (progressRetrying || caseSwitchLoading)
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
@@ -3772,16 +3818,10 @@ watch(
@retry-preparation="() => void retryCaseInventoryFallback()"
/>
<ProcessGateRecoveryCard
v-if="!reparseProgressActive && showHumanBlockingGate && displayCase?.process_gate && hasCreatedShippingTask"
v-if="showHumanBlockingGate && displayCase?.process_gate"
:summary="displayCase.process_gate"
:can-handle="workbenchActionsExecutable"
:navigation-context="reviewGateNavigationContext"
inventory-upload-mode="local"
:field-labels="reviewFieldLabels"
@refreshed="reloadLatestDraft"
@refresh-needed="reloadLatestDraft"
@confirm-customer="(taskNo) => void page.openShippingCustomerDialog?.(taskNo)"
@manual-upload="() => void openManualUploadRegistration()"
:can-handle="false"
:show-actions="false"
/>
<ReviewProfileMatchPanel
:profile-match="displayCase?.profile_match"