fix(shipping-notice): 任务中心OT直链补case_no锚点并修复工作台装配期懒加载竞态
This commit is contained in:
1 parent
65f751daf4
commit
0333d713e0
6 files changed
+136
-26
No files matched your search
@@ -1186,8 +1186,11 @@ export function useShippingOrderReview(options: {
|
||||
statusMessage.value = null;
|
||||
}
|
||||
} finally {
|
||||
if (generation !== caseLoadGeneration) return;
|
||||
// [2026-09-17] initialLoading 仅由 isInitialLoad 的本 load 置位,必须无条件收尾:
|
||||
// 被 loadReviewCase 等懒加载路径接管代际时,代际守卫之后的清旗会被跳过,
|
||||
// 首屏永久卡在「正在加载复核结果...」。
|
||||
if (isInitialLoad) initialLoading.value = false;
|
||||
if (generation !== caseLoadGeneration) return;
|
||||
runLoading.value = false;
|
||||
// 跨 Run 的 beginCrossRunSwitch 会提前打开 caseSwitchLoading;整页 load 收尾必须关掉。
|
||||
caseSwitchLoading.value = false;
|
||||
|
||||
@@ -1363,6 +1363,9 @@ onMounted(() => {
|
||||
document.addEventListener('keydown', onExceptionNavKeydown, true);
|
||||
// [PERF] 深链进入时尽早并行发起任务详情,与 load() 重叠,削减首屏串行加载。
|
||||
prefetchDeepLinkedTaskDetail();
|
||||
// OT 直链(无 case_no)下 confirmedNoticeTaskNo 恒空、watch(hasFormalOt) 永不触发;
|
||||
// 挂载即消费深链预取(复用同一请求,不重复拉取),任务详情才能落地驱动五阶段页签。
|
||||
if (deepLinkOrderTaskNo.value) void loadFormalTaskDetail();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
@@ -2430,6 +2433,15 @@ const confirmedNoticeTaskNo = computed(() => String(
|
||||
|| '',
|
||||
).trim());
|
||||
|
||||
/**
|
||||
* 深链显式携带的 OT 号(任务中心抽屉等 OT 直链)。
|
||||
* 仅认 OT- 前缀;Notice 的 SN 号不是 work-item 键,与 externalOrderTaskNo 同一口径。
|
||||
*/
|
||||
const deepLinkOrderTaskNo = computed(() => {
|
||||
const taskNo = String(route.query.task_no || '').trim();
|
||||
return taskNo.startsWith('OT-') ? taskNo : '';
|
||||
});
|
||||
|
||||
const freightNoticeGroups = ref<ShippingFreightNoticeGroup[]>([]);
|
||||
const freightNoticeGroupsLoading = ref(false);
|
||||
const freightNoticeGroupsReason = ref<string | null>(null);
|
||||
@@ -2845,7 +2857,12 @@ async function handleManualUploadSuccess() {
|
||||
* 拉取确认后的 Notice 履约详情,供 Gate Action 与 Artifact 视图使用。
|
||||
*/
|
||||
async function loadFormalTaskDetail() {
|
||||
const taskNo = confirmedNoticeTaskNo.value;
|
||||
// 深链 OT 兜底:无 case_no 的 OT 直链下选法 2 不拉 Case,activeCase/displayCase
|
||||
// 均为空、confirmedNoticeTaskNo 恒空;此时必须消费深链 task_no,否则挂载预取的
|
||||
// 任务详情被丢弃、五阶段页签无身份可裁决(全锁死)。一旦存在任何 Case 上下文
|
||||
// 则禁止回退,防止深链 OT 串到用户切换后的其他文件。
|
||||
const taskNo = confirmedNoticeTaskNo.value
|
||||
|| (displayCase.value ? '' : deepLinkOrderTaskNo.value);
|
||||
const generation = ++formalTaskDetailGeneration;
|
||||
if (!taskNo) {
|
||||
formalTaskDetail.value = null;
|
||||
@@ -4539,8 +4556,13 @@ watch(
|
||||
// 用户查看面(含回看已完成阶段)驱动 Case 懒加载:选法 2 正式下游切 PDF 后 activeCase
|
||||
// 为 null,回看接收解析/订单复核/通知准备时必须按需补拉目标 Case,否则这些工作面
|
||||
// 只能渲染空白或残留上一份 PDF 的数据。
|
||||
lifecycleActiveStageCode,
|
||||
(stage) => {
|
||||
// [2026-09-17] 初次装配(initialLoading/runLoading)未完成前必须让位:loadReviewCase
|
||||
// 会自增 caseLoadGeneration,令在途 load() 的 finally 跳过 initialLoading 清旗,
|
||||
// 首屏永久卡在「正在加载复核结果...」且 run/queue 永不装配。装配完成后由旗标
|
||||
// 翻转重新触发本 watcher,按当前 stage 补拉 Case。
|
||||
[lifecycleActiveStageCode, initialLoading, runLoading],
|
||||
([stage]) => {
|
||||
if (initialLoading.value || runLoading.value) return;
|
||||
if (!stage || !REVIEW_EDITOR_NEEDED_STAGES.includes(stage)) return;
|
||||
// 禁止使用 displayCase 兜底:它可能停留在上一份 PDF 的快照上造成串味;
|
||||
// 目标一律取当前工作面的 activeCase 或切换管线的 requestedCaseNo。
|
||||
|
||||
@@ -142,6 +142,16 @@ const lineRows = computed(() => {
|
||||
return Array.isArray(item?.notice_line_summary) ? item!.notice_line_summary : [];
|
||||
});
|
||||
|
||||
/**
|
||||
* 数量/缺口展示值:后端 Numeric(24,8) 透出形如 "24.00000000",
|
||||
* 统一转 number 去尾零(24.00000000→24、2.50000000→2.5),缺失保持 —。
|
||||
*/
|
||||
function formatQty(value: unknown): string {
|
||||
if (value === null || value === undefined || value === '') return '—';
|
||||
const num = Number(value);
|
||||
return Number.isFinite(num) ? String(num) : String(value);
|
||||
}
|
||||
|
||||
watch(() => props.item, (item) => {
|
||||
if (!item) return;
|
||||
const stage = defaultLifecycleTarget(item);
|
||||
@@ -173,7 +183,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onEsc));
|
||||
data-testid="my-todos-drawer-scrim"
|
||||
@click="emit('close')"
|
||||
/>
|
||||
<aside class="flex w-[34rem] max-w-[94vw] flex-col bg-surface shadow-2xl">
|
||||
<aside class="flex w-[52rem] max-w-[94vw] flex-col bg-surface shadow-2xl">
|
||||
<div class="border-b border-default px-5 py-4">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<h3 class="break-all font-mono text-base font-bold text-primary" data-testid="my-todos-drawer-title">
|
||||
@@ -238,14 +248,14 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onEsc));
|
||||
<table class="w-full border-collapse text-xs" data-testid="my-todos-drawer-lines">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft/60 text-left text-muted">
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.lineNo') }}</th>
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.partNumber') }}</th>
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.customerPartNumber') }}</th>
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.reservationId') }}</th>
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.shipmentQty') }}</th>
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.availableQty') }}</th>
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.shortageQty') }}</th>
|
||||
<th class="px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.status') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.lineNo') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.partNumber') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.customerPartNumber') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.reservationId') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.shipmentQty') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.availableQty') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.shortageQty') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.status') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -255,18 +265,18 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onEsc));
|
||||
class="border-b border-[#f0f3f8]"
|
||||
>
|
||||
<td class="px-2.5 py-2 font-mono">{{ line.line_no }}</td>
|
||||
<td class="px-2.5 py-2 font-mono">{{ line.part_number || '—' }}</td>
|
||||
<td class="px-2.5 py-2">{{ line.customer_part_number || '—' }}</td>
|
||||
<td class="px-2.5 py-2 font-mono">{{ line.reservation_id || '—' }}</td>
|
||||
<td class="px-2.5 py-2 tabular-nums">{{ line.shipment_qty ?? '—' }}</td>
|
||||
<td class="px-2.5 py-2 tabular-nums">{{ line.available_qty ?? '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 font-mono">{{ line.part_number || '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2">{{ line.customer_part_number || '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 font-mono">{{ line.reservation_id || '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 tabular-nums">{{ formatQty(line.shipment_qty) }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 tabular-nums">{{ formatQty(line.available_qty) }}</td>
|
||||
<td
|
||||
class="px-2.5 py-2 tabular-nums"
|
||||
class="whitespace-nowrap px-2.5 py-2 tabular-nums"
|
||||
:class="Number(line.shortage_qty || 0) > 0 ? 'font-bold text-red-600' : ''"
|
||||
>
|
||||
{{ line.shortage_qty ?? '—' }}
|
||||
{{ formatQty(line.shortage_qty) }}
|
||||
</td>
|
||||
<td class="px-2.5 py-2">{{ line.inventory_status || '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2">{{ line.inventory_status || '—' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in new issue
Block a user