feat(shipping-notice): 落地 XFA 统一视觉拆分确认门禁与处理投影收敛

闭合拆分预览令牌单次消费、样本 checksum 绑定与确认审计;正式提取改为 bindings-only。
同步统一标注工作台交互,并补齐进度投影/任务中心与迁移文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-06 10:21:25 +08:00
1 parent d2b3d74def
commit 84a881b554
195 files changed
+20269 -3463

No files matched your search

@@ -1,11 +1,12 @@
/**
* features/chat/components/shipping/ShippingOrderExtractionCard.vue
* 用途:聊天主区批次进度卡——摘要计数、Run 级处理事项、当前文件阶段、健康提醒与动作。
* 用途:聊天主区批次进度卡——摘要计数、Run 级诊断事项、当前文件阶段、健康提醒与动作。
* 依赖:订单抽取 Run 状态卡 DTO、shipping.api 文档/进度接口、ShippingOrderExtractionDetailsDrawer、
* orderExtractionProgressDisplay、vue-router、vue-i18n、ProcessGateRecoveryCard。
* 逻辑:回退 handling_items / primary_notice / Run summary;
* Run 失败优先展示 errorExplainability.message;详情抽屉证据入口携带 focus+document_id;
* Gate confirm_customer 经 ChatPage 打开客户选择弹窗;不再读取 Workflow 空壳 counts。
* orderExtractionProgressDisplay、vue-router、vue-i18n、ChatProgressSummary;
* ProcessGateRecoveryCard 仅兼容保留(runLevelProcessGate 当前恒为空)。
* 逻辑:有统一投影时按当前 Run 根 OT 展示全部 PDF/OT 紧凑进度,主操作仅来自投影;
* handlingItems 保留诊断信息,不再渲染与投影平级的 primaryAction 主按钮;
* Run 失败优先展示 errorExplainability.message;详情抽屉证据入口携带 focus+document_id。
*/
<script setup lang="ts">
import { computed, inject, ref } from 'vue';
@@ -23,6 +24,12 @@ import type {
ShippingProcessGateUserSummary,
} from '../../types/shipping.api.types';
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
import ChatProgressSummary from '@/features/shipping-progress/components/ChatProgressSummary.vue';
import {
SHIPPING_WORKFLOW_KEY,
} from '@/features/chat/shipping/useShippingNoticeWorkflow';
import type { ShippingProcessingProjection } from '../../types/shipping.api.types';
import type { ActionPresentationItem } from '@/features/shipping-progress/types';
import {
listWorkspaceShippingOrderExtractionDocuments,
listWorkspaceShippingOrderExtractionProgressEvents,
@@ -47,6 +54,8 @@ const props = defineProps<{
/** 新版 Run 已替代旧版时,历史卡仅允许查看详情。 */
readonly?: boolean;
readonlyReason?: string | null;
/** 可选统一投影;缺省时从 SHIPPING_WORKFLOW_KEY 解析。 */
processingProjection?: ShippingProcessingProjection | null;
}>();
const emit = defineEmits<{
@@ -59,6 +68,54 @@ const { t, te } = useI18n();
const route = useRoute();
const router = useRouter();
const chatPage = inject(CHAT_PAGE_KEY, null);
const shippingWorkflow = inject(SHIPPING_WORKFLOW_KEY, null);
/**
* 解析当前 Run/任务对应的全部统一 ShippingProcessing 投影。
* 核心逻辑:显式 prop 优先;根 OT 同时匹配自身与 rootOrderTaskNo 相同的兄弟 OT;
* Candidate 前回退本会话 order_intake,禁止用 find() 丢失同 Run 的其他 PDF。
*/
const resolvedProcessingProjections = computed((): ShippingProcessingProjection[] => {
if (props.processingProjection) return [props.processingProjection];
const items = shippingWorkflow?.processingWorkItems?.value || [];
if (!items.length) return [];
const taskNo = String(props.state.userTaskNo || '').trim();
if (taskNo) {
const matched = items.filter((item) => (
item.workItemType === 'order_task'
&& (
String(item.workItemNo || '').trim() === taskNo
|| String(item.rootOrderTaskNo || '').trim() === taskNo
)
));
if (matched.length) return matched;
}
return items.filter((item) => item.workItemType === 'order_intake');
});
const hasProcessingProjection = computed(() => resolvedProcessingProjections.value.length > 0);
/** 进度行标题优先使用 PDF 文件名,其次使用 PO,最后使用工作项号。 */
function processingProjectionTitle(item: ShippingProcessingProjection): string {
return String(
item.sourceSummary?.filename
|| item.sourceSummary?.poNumber
|| item.workItemNo,
).trim();
}
/**
* 统一进度摘要动作:刷新 / 进入复核等由宿主路由承接。
*/
function onChatProgressAction(item: ActionPresentationItem) {
if (item.intent === 'refresh') {
emit('refresh');
return;
}
if (item.intent === 'open_order_review') {
void openOrderReview();
}
}
const confirmCancelOpen = ref(false);
const cancelReason = ref('');
@@ -92,7 +149,21 @@ const displaySummary = computed(() => props.state.summary);
const workflowStageLabel = computed(() => '');
const workflowLastActivityLabel = computed(() => '');
const handlingItems = computed(() => props.state.handlingItems || []);
const handlingItems = computed(() => {
const items = props.state.handlingItems || [];
// [UI-04] 有 OT 统一投影时,隐藏已被 Gate/进度表达的复核类事项,仅保留未归属异常。
if (!hasProcessingProjection.value) return items;
const covered = new Set([
'manual_review',
'field_conflict',
'customer_confirmation',
'candidate_confirmation',
'duplicate_check',
'inventory_source',
'review_required',
]);
return items.filter((item) => !covered.has(String(item.category || '').trim()));
});
/**
* 是否为「仅重复关联已有任务、无需人工复核」终态通知。
@@ -528,7 +599,7 @@ function openCancelConfirm() {
</div>
<ProcessGateRecoveryCard
v-if="runLevelProcessGate?.current_blocking_gate"
v-if="runLevelProcessGate?.current_blocking_gate && !hasProcessingProjection"
class="mt-2"
:summary="runLevelProcessGate"
:can-handle="!readonly"
@@ -538,6 +609,25 @@ function openCancelConfirm() {
@confirm-customer="(taskNo) => void onGateConfirmCustomer(taskNo)"
/>
<div
v-if="hasProcessingProjection"
class="mt-2 space-y-2"
data-testid="chat-progress-summary-list"
>
<div
v-for="projection in resolvedProcessingProjections"
:key="projection.workItemNo"
>
<div class="truncate text-[11px] font-semibold opacity-90">
{{ processingProjectionTitle(projection) }}
</div>
<ChatProgressSummary
:projection="projection"
@action="onChatProgressAction"
/>
</div>
</div>
<div
v-if="handlingItems.length"
class="mt-2 space-y-1.5"
@@ -558,9 +648,10 @@ function openCancelConfirm() {
<span class="ml-1 opacity-80">{{ t('chat.shippingOrderExtractionHandling.count', { count: item.count }) }}</span>
</div>
<button
v-if="item.primaryAction && !readonly && (item.primaryAction !== 'review_candidate' || !handlingItems.some((other) => other.primaryAction === 'enter_manual_review'))"
v-if="item.primaryAction && !readonly && !hasProcessingProjection && (item.primaryAction !== 'review_candidate' || !handlingItems.some((other) => other.primaryAction === 'enter_manual_review'))"
type="button"
class="shrink-0 rounded-md border border-current/20 px-2 py-0.5 text-[11px] font-medium hover:bg-black/5 dark:hover:bg-white/5"
data-testid="shipping-order-extraction-handling-primary-action"
@click="handleHandlingAction(item)"
>
{{ (item.primaryAction === 'review_candidate' || item.primaryAction === 'enter_manual_review')