fix(shipping-notice): 工作台五阶段定位只进不退并保留最近投影
提交订单后的刷新窗口内,extractionLifecycleProgress 会被 Run 级 lifecycle_progress(两段模型,恒为 intake_parse)短暂覆盖,五阶段页签 闪回「接收解析」后再跳「通知准备」。 - lifecycleProgressForView 保持最近一次非空投影兜底,不再回落 Run 级旧值; - 新增 lifecycleStageFloor 只进不退下限:自动定位永不回跳已越过的更早 阶段;显式 route 请求(用户手动点击阶段入口)不受限,可回看前置阶段。
This commit is contained in:
1 parent
c27379d933
commit
22bee49346
1 file changed
+36
-3
@@ -108,6 +108,7 @@ import type {
|
||||
ShippingOrderReviewDraftFieldMeta,
|
||||
ShippingOrderReviewEvidence,
|
||||
ShippingOrderReviewValueSource,
|
||||
ShippingOrderExtractionLifecycleProgress,
|
||||
ShippingProcessingLifecycleEntry,
|
||||
ShippingTaskDetail,
|
||||
ShippingFreightNoticeGroup,
|
||||
@@ -365,16 +366,40 @@ const lifecycleCurrentStageCode = computed<ReviewLifecycleStageCode | null>(() =
|
||||
function lifecycleEntryIsEnterable(entry: { state?: string | null } | undefined): boolean {
|
||||
return entry?.state === 'current' || entry?.state === 'available';
|
||||
}
|
||||
// [只进不退] 自动定位的阶段序号下限:一旦到达过后道阶段,自动跳转永不回显示
|
||||
// 前道阶段;仅显式 route 请求(用户手动点击阶段入口)可进入前置阶段可回看视图。
|
||||
const lifecycleStageFloor = ref(-1);
|
||||
const lifecycleActiveStageCode = computed<ReviewLifecycleStageCode | null>(() => {
|
||||
const requested = String(route.query.lifecycle_stage || '').trim() as ReviewLifecycleStageCode;
|
||||
const requestedStage = String(route.query.lifecycle_stage || '').trim();
|
||||
const manualRequested = requestedStage !== '';
|
||||
const requested = requestedStage as ReviewLifecycleStageCode;
|
||||
const entry = lifecycleUiState.value.entries.find((item) => item.code === requested);
|
||||
if (requested === 'intake_parse' && lifecycleUiState.value.intakeParseAuthorized === true) {
|
||||
lifecycleStageFloor.value = Math.max(lifecycleStageFloor.value, 0);
|
||||
return 'intake_parse';
|
||||
}
|
||||
const current = lifecycleCurrentStageCode.value;
|
||||
// 用户可回看后端已授权的 available 前置阶段;自动推进由下方 watcher 在
|
||||
// 「路由仍停留原 current 阶段且用户未固定查看」时处理,不能在这里抢占用户选择。
|
||||
return lifecycleEntryIsEnterable(entry) ? requested : current;
|
||||
const candidate = lifecycleEntryIsEnterable(entry) ? requested : current;
|
||||
if (!candidate) {
|
||||
return null;
|
||||
}
|
||||
// [只进不退] 非手动请求的自动定位不得回跳到已越过的更早阶段:保持在已到达
|
||||
// 的最远阶段,等待投影收敛(回归:提交订单后页签闪回「接收解析」)。
|
||||
if (!manualRequested) {
|
||||
const candidateIdx = LIFECYCLE_STAGE_CODES.indexOf(candidate);
|
||||
if (candidateIdx >= 0 && candidateIdx < lifecycleStageFloor.value) {
|
||||
return LIFECYCLE_STAGE_CODES[lifecycleStageFloor.value] ?? null;
|
||||
}
|
||||
}
|
||||
return candidate ?? null;
|
||||
});
|
||||
// [只进不退] 已到达阶段序号只升不降:自动定位永不回跳前道阶段(手动点击前道
|
||||
// 阶段是显式回看,不下调下限)。
|
||||
watch(lifecycleActiveStageCode, (code) => {
|
||||
const idx = LIFECYCLE_STAGE_CODES.indexOf(code as ReviewLifecycleStageCode);
|
||||
if (idx >= 0) lifecycleStageFloor.value = Math.max(lifecycleStageFloor.value, idx);
|
||||
});
|
||||
/** 当前后端投影明确在自动推进时,五阶段导航只为该阶段展示 Spinner,不改变授权。 */
|
||||
const lifecycleProcessingStageCode = computed<ReviewLifecycleStageCode | null>(() => {
|
||||
@@ -2333,11 +2358,19 @@ const showWorkbenchGrid = computed(
|
||||
() => workbenchMode.value === 'formal_task' || !isConfirmProgressPrimary.value,
|
||||
);
|
||||
|
||||
const lastLifecycleProgress = ref<ShippingOrderExtractionLifecycleProgress | null>(null);
|
||||
// [阶段防回跳] 提交订单后的刷新窗口内,extractionLifecycleProgress 会被 Run 级
|
||||
// lifecycle_progress(两段模型,恒为 intake_parse)短暂覆盖,页签因此闪回
|
||||
// 「接收解析」。此处保持最近一次非空投影作为兜底,不再回落到 Run 级旧值;
|
||||
// 数据到达后自然收敛到真实当前阶段(如通知准备)。
|
||||
const lifecycleProgressForView = computed(() => (
|
||||
extractionLifecycleProgress.value
|
||||
|| reviewRun.value?.lifecycle_progress
|
||||
|| lastLifecycleProgress.value
|
||||
|| null
|
||||
));
|
||||
watch(lifecycleProgressForView, (value) => {
|
||||
if (value) lastLifecycleProgress.value = value;
|
||||
});
|
||||
|
||||
const lifecycleProgressStageItems = computed<ReviewLifecycleStageItem[]>(() => {
|
||||
const progress = lifecycleProgressForView.value;
|
||||
|
||||
Reference in new issue
Block a user