feat(shipping-notice): 收敛复核阶段同源投影与 OT 后履约推进
统一 Case/Progress 阶段 label_key、修复 Job 成功未推进 OT 的可重试失败投影与写路径,并落地 OT 后行级匹配/波次履约与版面诊断开关。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
74270adc22
commit
fd6a23f870
100 files changed
+12138
-1017
No files matched your search
@@ -153,4 +153,29 @@ describe('ReviewProgressStrip', () => {
|
||||
await wrapper.get('[data-testid="review-progress-open-details"]').trigger('click');
|
||||
expect(wrapper.emitted('open-process-details')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('places process-details CTA on the title row', () => {
|
||||
const wrapper = mountStrip(buildProjection());
|
||||
const titleRow = wrapper.get('[data-testid="review-progress-title"]').element.parentElement;
|
||||
const details = wrapper.get('[data-testid="review-progress-open-details"]').element;
|
||||
expect(titleRow?.contains(details)).toBe(true);
|
||||
});
|
||||
|
||||
it('places current-need inside the title row text (not a separate block)', () => {
|
||||
const wrapper = mountStrip(buildProjection({
|
||||
status: 'waiting',
|
||||
currentGate: {
|
||||
gateCode: 'freight_upload',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'retry_freight_upload_rpa',
|
||||
blockingReasonCode: null,
|
||||
attemptNo: 1,
|
||||
},
|
||||
}));
|
||||
const titleEl = wrapper.get('[data-testid="review-progress-title"]');
|
||||
const need = wrapper.get('[data-testid="review-progress-current-need"]');
|
||||
expect(titleEl.element.contains(need.element)).toBe(true);
|
||||
expect(need.text()).toContain('当前需要');
|
||||
expect(need.classes()).not.toContain('sr-only');
|
||||
});
|
||||
});
|
||||
@@ -1,10 +1,9 @@
|
||||
<!--
|
||||
features/shipping-progress/components/ReviewProgressStrip.vue
|
||||
用途:订单处理工作台只读进度——宽屏仅 15 阶主进度;窄屏摘要版。
|
||||
依赖:vue-i18n、ShippingProcessingProjection、progressWindow、stageNodesAuthority、gateReasonLabel.resolveCurrentNeedLabel。
|
||||
逻辑:由 ReviewWorkflowProgressPanel 挂载;禁止点击节点;宽屏隐藏五域与 n/15 文案;
|
||||
窄屏不展示 15 阶横条;有阻断 Gate 且非自动推进时显示「当前需要」(优先级 C);
|
||||
「查看流程详情/完整流程」同一 emit;写操作只在 Footer。
|
||||
用途:订单处理工作台只读进度——xl 等宽 15 阶;md 横向滚动;窄屏仅 N/15。
|
||||
依赖:vue-i18n、ShippingProcessingProjection、progressWindow、stageNodesAuthority、gateReasonLabel。
|
||||
逻辑:由 ReviewWorkflowProgressPanel 挂载;禁止点击节点;「当前需要」并入标题行文案;
|
||||
「查看流程详情」在标题行右侧;正式 OT 后抑制「请确认建单」;写操作只在 Footer。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue';
|
||||
@@ -13,7 +12,7 @@ import type {
|
||||
ShippingProcessingProjection,
|
||||
ShippingProcessingStageNodeStatus,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
import { shippingProcessingStageKey } from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
import { shippingProcessingStageKey, resolveShippingProcessingStageLabel } from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
import { buildProgressRangeHint } from '../progressWindow';
|
||||
import {
|
||||
readAuthoritativeStageNodes,
|
||||
@@ -25,6 +24,8 @@ const props = defineProps<{
|
||||
projection: ShippingProcessingProjection;
|
||||
/** 宿主轮询中提示(显示在标题行)。 */
|
||||
polling?: boolean;
|
||||
/** 正式 OT 已创建时禁止再投影「请确认建单」类当前需要。 */
|
||||
hasFormalOt?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -35,23 +36,38 @@ const emit = defineEmits<{
|
||||
const { t, te } = useI18n();
|
||||
|
||||
const AUTOMATING_STATUSES = new Set(['processing', 'automating', 'queued']);
|
||||
const CONFIRM_BUILD_ACTION_CODES = new Set([
|
||||
'confirm_create',
|
||||
'confirm_build',
|
||||
'open_order_review',
|
||||
'confirm_order',
|
||||
]);
|
||||
const SYSTEM_TECH_ACTION_PREFIXES = ['retry_', 'poll_'];
|
||||
|
||||
/** 权威 15 阶;非法时 null(fail-closed)。 */
|
||||
const stageNodes = computed(() => readAuthoritativeStageNodes(props.projection));
|
||||
|
||||
const rangeHint = computed(() => buildProgressRangeHint(props.projection, 'workbench'));
|
||||
|
||||
const isAutomating = computed(() => (
|
||||
AUTOMATING_STATUSES.has(String(props.projection.status || '').trim().toLowerCase())
|
||||
&& !props.projection.currentGate?.nextActionCode
|
||||
));
|
||||
|
||||
const stageLabel = computed(() => {
|
||||
const stage = props.projection.stage;
|
||||
const key = shippingProcessingStageKey(stage);
|
||||
return te(key) ? t(key) : String(stage || '');
|
||||
/**
|
||||
* 是否处于系统自动推进(含技术重试/轮询动作,避免被 nextAction 误判为人工待办)。
|
||||
*/
|
||||
const isAutomating = computed(() => {
|
||||
const status = String(props.projection.status || '').trim().toLowerCase();
|
||||
if (!AUTOMATING_STATUSES.has(status)) return false;
|
||||
const next = String(props.projection.currentGate?.nextActionCode || '').trim().toLowerCase();
|
||||
if (!next) return true;
|
||||
if (SYSTEM_TECH_ACTION_PREFIXES.some((prefix) => next.startsWith(prefix))) return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
const stageLabel = computed(() => resolveShippingProcessingStageLabel(
|
||||
props.projection.stage,
|
||||
te,
|
||||
t,
|
||||
props.projection.stageLabelKey,
|
||||
));
|
||||
|
||||
/**
|
||||
* 单行标题:自动推进用「系统处理中 · 阶段」;否则「订单处理进度 · 阶段」。
|
||||
*/
|
||||
@@ -65,11 +81,18 @@ const titleLine = computed(() => {
|
||||
|
||||
/**
|
||||
* 有阻断 Gate 且非自动推进时展示「当前需要」。
|
||||
* 正式 OT 已创建后禁止再显示确认建单类文案。
|
||||
*/
|
||||
const showCurrentNeed = computed(() => {
|
||||
if (isAutomating.value) return false;
|
||||
const gate = props.projection.currentGate;
|
||||
if (!gate) return false;
|
||||
const next = String(gate.nextActionCode || '').trim().toLowerCase();
|
||||
if (props.hasFormalOt && CONFIRM_BUILD_ACTION_CODES.has(next)) return false;
|
||||
if (props.hasFormalOt) {
|
||||
const reason = String(gate.blockingReasonCode || '').trim().toLowerCase();
|
||||
if (reason === 'waiting_review' || reason.includes('confirm')) return false;
|
||||
}
|
||||
return Boolean(
|
||||
String(gate.blockingReasonCode || '').trim()
|
||||
|| String(gate.nextActionCode || '').trim(),
|
||||
@@ -110,26 +133,32 @@ function nodeToneClass(status: ShippingProcessingStageNodeStatus, isCurrent: boo
|
||||
}
|
||||
|
||||
/**
|
||||
* 节点展示短标签。
|
||||
* 节点展示短标签(允许两行,不再截断到 4 字硬砍)。
|
||||
*/
|
||||
function nodeShortLabel(stage: string): string {
|
||||
const key = shippingProcessingStageKey(stage);
|
||||
const label = te(key) ? t(key) : stage;
|
||||
return String(label).slice(0, 4);
|
||||
return te(key) ? t(key) : stage;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="space-y-2"
|
||||
class="space-y-1.5"
|
||||
data-testid="review-progress-strip"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5">
|
||||
<div
|
||||
class="min-w-0 text-sm font-semibold text-primary"
|
||||
class="min-w-0 flex-1 text-sm font-semibold text-primary"
|
||||
data-testid="review-progress-title"
|
||||
>
|
||||
{{ titleLine }}
|
||||
<span
|
||||
v-if="showCurrentNeed && currentNeed"
|
||||
class="ml-2 font-semibold text-amber-800 dark:text-amber-200"
|
||||
data-testid="review-progress-current-need"
|
||||
>
|
||||
· {{ t('chat.shippingProcessing.progress.currentNeedLabel') }}{{ currentNeed }}
|
||||
</span>
|
||||
<span
|
||||
v-if="polling"
|
||||
class="ml-2 text-[11px] font-normal text-muted"
|
||||
@@ -138,25 +167,37 @@ function nodeShortLabel(stage: string): string {
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.polling') }}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="isAutomating"
|
||||
type="button"
|
||||
class="shrink-0 rounded-lg border border-default bg-surface px-2.5 py-1 text-[11px] font-medium text-secondary hover:bg-surface-muted"
|
||||
data-testid="review-progress-refresh"
|
||||
@click="emit('refresh')"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.action.refresh') }}
|
||||
</button>
|
||||
<div class="flex shrink-0 flex-wrap items-center gap-2">
|
||||
<button
|
||||
v-if="isAutomating"
|
||||
type="button"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-1 text-[11px] font-medium text-secondary hover:bg-surface-muted"
|
||||
data-testid="review-progress-refresh"
|
||||
@click="emit('refresh')"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.action.refresh') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-1 text-[11px] font-medium text-brand-700 hover:bg-surface-muted dark:text-brand-300"
|
||||
data-testid="review-progress-open-details"
|
||||
@click="emit('open-process-details')"
|
||||
>
|
||||
<span class="hidden md:inline">{{ t('chat.shippingProcessing.progress.viewProcessDetails') }}</span>
|
||||
<span class="md:hidden">{{ t('chat.shippingProcessing.progress.viewFullProcess') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 宽屏:唯一主进度 = 15 阶只读条。 -->
|
||||
<!-- xl:15 阶等宽铺满 -->
|
||||
<div
|
||||
v-if="stageNodes"
|
||||
class="hidden lg:block"
|
||||
class="hidden xl:block"
|
||||
data-testid="review-progress-stage-nodes"
|
||||
>
|
||||
<div
|
||||
class="flex gap-1 overflow-x-auto pb-1"
|
||||
class="grid gap-1"
|
||||
style="grid-template-columns: repeat(15, minmax(0, 1fr));"
|
||||
role="list"
|
||||
aria-label="shipping-processing-stages"
|
||||
>
|
||||
@@ -164,7 +205,7 @@ function nodeShortLabel(stage: string): string {
|
||||
v-for="node in stageNodes"
|
||||
:key="node.stage"
|
||||
role="listitem"
|
||||
class="min-w-[3.25rem] shrink-0 select-none rounded-md px-1.5 py-1 text-center text-[10px] leading-tight pointer-events-none"
|
||||
class="min-w-0 select-none rounded-md px-0.5 py-1 text-center text-[10px] leading-tight pointer-events-none"
|
||||
:class="nodeToneClass(node.status, node.stage === projection.stage)"
|
||||
:data-stage="node.stage"
|
||||
:data-status="node.status"
|
||||
@@ -172,22 +213,51 @@ function nodeShortLabel(stage: string): string {
|
||||
:title="te(shippingProcessingStageKey(node.stage)) ? t(shippingProcessingStageKey(node.stage)) : node.stage"
|
||||
>
|
||||
<div class="font-semibold">{{ node.absoluteIndex + 1 }}</div>
|
||||
<div class="truncate">{{ nodeShortLabel(node.stage) }}</div>
|
||||
<div class="line-clamp-2 break-words">{{ nodeShortLabel(node.stage) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- md–xl:横向滚动、节点等宽 -->
|
||||
<div
|
||||
v-if="stageNodes"
|
||||
class="hidden overflow-x-auto pb-1 md:block xl:hidden"
|
||||
data-testid="review-progress-stage-nodes-scroll"
|
||||
>
|
||||
<div
|
||||
class="flex gap-1"
|
||||
role="list"
|
||||
aria-label="shipping-processing-stages"
|
||||
>
|
||||
<div
|
||||
v-for="node in stageNodes"
|
||||
:key="`scroll-${node.stage}`"
|
||||
role="listitem"
|
||||
class="w-14 shrink-0 select-none rounded-md px-1 py-1 text-center text-[10px] leading-tight pointer-events-none"
|
||||
:class="nodeToneClass(node.status, node.stage === projection.stage)"
|
||||
:data-stage="node.stage"
|
||||
:data-status="node.status"
|
||||
:data-current="node.stage === projection.stage ? '1' : '0'"
|
||||
:title="te(shippingProcessingStageKey(node.stage)) ? t(shippingProcessingStageKey(node.stage)) : node.stage"
|
||||
>
|
||||
<div class="font-semibold">{{ node.absoluteIndex + 1 }}</div>
|
||||
<div class="line-clamp-2 break-words">{{ nodeShortLabel(node.stage) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p
|
||||
v-else
|
||||
class="hidden text-[11px] text-amber-800 lg:block dark:text-amber-200"
|
||||
class="hidden text-[11px] text-amber-800 md:block dark:text-amber-200"
|
||||
data-testid="review-progress-stage-nodes-unavailable"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.progress.stageNodesUnavailable') }}
|
||||
</p>
|
||||
|
||||
<!-- 窄屏摘要:仅已完成 n/15(宽屏由节点色表达,不重复文案)。 -->
|
||||
<!-- <md:仅已完成 N/15 + 标题中的当前阶段 -->
|
||||
<p
|
||||
v-if="rangeHint"
|
||||
class="text-[11px] text-secondary lg:hidden"
|
||||
class="text-[11px] text-secondary md:hidden"
|
||||
data-testid="review-progress-completed-summary"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.progress.completedOfTotal', {
|
||||
@@ -196,25 +266,5 @@ function nodeShortLabel(stage: string): string {
|
||||
}) }}
|
||||
</p>
|
||||
|
||||
<p
|
||||
v-if="showCurrentNeed && currentNeed"
|
||||
class="text-[11px] text-amber-800 dark:text-amber-200"
|
||||
data-testid="review-progress-current-need"
|
||||
>
|
||||
<span class="font-medium text-secondary">{{ t('chat.shippingProcessing.progress.currentNeedLabel') }}</span>
|
||||
{{ currentNeed }}
|
||||
</p>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-1 text-[11px] font-medium text-brand-700 hover:bg-surface-muted dark:text-brand-300"
|
||||
data-testid="review-progress-open-details"
|
||||
@click="emit('open-process-details')"
|
||||
>
|
||||
<span class="hidden lg:inline">{{ t('chat.shippingProcessing.progress.viewProcessDetails') }}</span>
|
||||
<span class="lg:hidden">{{ t('chat.shippingProcessing.progress.viewFullProcess') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user