perf(shipping-notice): 优化发货任务性能,修复上传流程与终态问题

This commit is contained in:
hugo committed 2026-08-27 19:25:16 +08:00
1 parent 434c04ed2d
commit bcdd8285ae
29 files changed
+1074 -128

No files matched your search

@@ -198,6 +198,11 @@ const msg = useMessage();
* 无论哪一路都带 label_key,禁止把 code 当用户文案。
*/
const currentProcessingStageDisplay = computed(() => {
// 正式任务已明确通知完成时,该终态优先于可能迟到的 Processing 投影,
// 右侧不能再退化为“处理中 / 待机”。此处直接读取详情,避免引用后方生命周期 computed。
if (formalTaskDetail.value?.ui_state?.lifecycle_stage === 'upload_complete') {
return { code: 'completed', labelKey: 'completed', inconsistent: false };
}
const projection = shippingProcessingProjection.value;
if (projection?.stage) {
return {
@@ -309,7 +314,10 @@ const lifecycleActiveStageCode = computed<ReviewLifecycleStageCode | null>(() =>
if (requested === 'intake_parse' && lifecycleUiState.value.intakeParseAuthorized === true) {
return 'intake_parse';
}
return lifecycleEntryIsEnterable(entry) ? requested : lifecycleCurrentStageCode.value;
const current = lifecycleCurrentStageCode.value;
// 用户可回看后端已授权的 available 前置阶段;自动推进由下方 watcher 在
// 「路由仍停留原 current 阶段且用户未固定查看」时处理,不能在这里抢占用户选择。
return lifecycleEntryIsEnterable(entry) ? requested : current;
});
/** 当前后端投影明确在自动推进时,五阶段导航只为该阶段展示 Spinner,不改变授权。 */
const lifecycleProcessingStageCode = computed<ReviewLifecycleStageCode | null>(() => {
@@ -376,6 +384,17 @@ const isLifecycleIntakeParse = computed(() => (
const isLifecycleFulfillmentPrep = computed(() => lifecycleActiveStageCode.value === 'fulfillment_prep');
const isLifecycleFreightUpload = computed(() => lifecycleActiveStageCode.value === 'freight_upload');
const isLifecycleUploadComplete = computed(() => lifecycleActiveStageCode.value === 'upload_complete');
/** 正式任务已通知完成时,即使用户回看前置阶段也只能查看,不能再修改已产出通知。 */
const isCompletedFormalTask = computed(() => lifecycleCurrentStageCode.value === 'upload_complete');
const isReviewContentReadOnly = computed(() => isReadOnly.value || isCompletedFormalTask.value);
/**
* 统一字段写权限,确保通知完成后的前置阶段回看不会绕过只读边界。
* @param fieldId - 后端 Schema 下发的字段标识。
* @returns 当前字段是否允许编辑。
*/
function canEditReviewField(fieldId: string): boolean {
return !isReviewContentReadOnly.value && isFieldEditable(fieldId);
}
/** 当前阶段重试只取 Case 的服务端授权,不从输入框附件卡或本地状态推断。 */
const intakeParseRetryAvailable = computed(() => (
isLifecycleIntakeParse.value
@@ -451,7 +470,7 @@ async function syncPendingReleaseAutoAdvance(): Promise<boolean> {
async function selectLifecycleStage(code: ReviewLifecycleStageCode, options: { replace?: boolean } = {}) {
const target = lifecycleStageItems.value.find((item) => item.code === code);
if (!target || target.state === 'blocked') return;
// 用户主动回看已完成阶段时,异步投影抵达不得将其强制带回当前阶段。
// 用户主动回看后端 available 或已完成阶段时,异步投影抵达不得将其强制带回当前阶段。
// 自动推进均使用 replace,不会写入该意图。
if (!options.replace) {
const caseNo = String(activeCase.value?.case_no || '').trim() || null;
@@ -675,6 +694,7 @@ const currentTaskPrimaryAction = computed(() => {
return null;
});
const currentTaskUserStatus = computed(() => {
if (formalTaskDetail.value?.ui_state?.lifecycle_stage === 'upload_complete') return 'completed';
// 已确认 OT 且权威投影在途时,先消费后端 automation 运行态(queued/running → running,
// failed/manual_fallback → failed),状态行即显真实值,不应退回「正在获取最新状态」骨架;
// authority 仍以右侧投影为准,投影到达后覆盖。
@@ -686,11 +706,13 @@ const currentTaskUserStatus = computed(() => {
return null;
});
const currentTaskBlockingReason = computed(() => {
if (formalTaskDetail.value?.ui_state?.lifecycle_stage === 'upload_complete') return null;
if (formalTaskProjectionPending.value) return null;
return currentTaskUiState.value?.blocking_reason ?? null;
});
/** 当前 Gate 状态必须与右栏动作同源,均来自统一处理 Projection。 */
const currentTaskGateStatus = computed(() => {
if (formalTaskDetail.value?.ui_state?.lifecycle_stage === 'upload_complete') return null;
if (formalTaskProjectionPending.value) return null;
const projection = shippingProcessingProjection.value;
if (projection?.currentGate?.status) return projection.currentGate.status;
@@ -728,13 +750,13 @@ const currentTaskRecoveryActions = computed(() => {
* @returns 当前工作面允许交给 ReviewCurrentProcessingCard 展示的动作。
*/
const visibleCurrentTaskPrimaryAction = computed(() => (
isLifecycleUploadComplete.value ? null : currentTaskPrimaryAction.value
isCompletedFormalTask.value ? null : currentTaskPrimaryAction.value
));
const visibleCurrentTaskRecoveryActions = computed(() => (
isLifecycleUploadComplete.value ? [] : currentTaskRecoveryActions.value
isCompletedFormalTask.value ? [] : currentTaskRecoveryActions.value
));
const visibleCurrentTaskRetryable = computed(() => (
isLifecycleUploadComplete.value ? false : currentTaskRetryable.value
isCompletedFormalTask.value ? false : currentTaskRetryable.value
));
/** 管理员诊断:后端 technical_progress / automation.technical 仅 admin 投影。 */
@@ -1156,6 +1178,8 @@ const onExceptionNavKeydown = (event: KeyboardEvent) => {
onMounted(() => {
document.addEventListener('keydown', onExceptionNavKeydown, true);
// [PERF] 深链进入时尽早并行发起任务详情,与 load() 重叠,削减首屏串行加载。
prefetchDeepLinkedTaskDetail();
});
onBeforeUnmount(() => {
@@ -1899,9 +1923,9 @@ const canEnterInventory = computed(() => {
});
const availableActions = computed(() => activeCase.value?.available_actions || []);
/** 订单处理工作台写权限(只读查看 / Case 切换中为 false)。 */
/** 订单处理工作台写权限(历史查看、通知完成回看或 Case 切换中均为 false)。 */
const workbenchActionsExecutable = computed(() => (
!isReadOnly.value
!isReviewContentReadOnly.value
&& !runLoading.value
&& !caseSwitchLoading.value
&& !progressRetrying.value
@@ -2246,6 +2270,19 @@ const formalTaskDetailLoadFailed = ref(false);
*/
let formalTaskDetailGeneration = 0;
const manualUploadRegistrationOpen = ref(false);
/** 深链预取:批次进度中心已带 task_no 时,挂载即并行发起任务详情读取,与 load() 重叠。
* [PERF] 订单生命周期工作台首屏的关键路径是 load() 完成后才轮到 loadFormalTaskDetail
* (getWorkspaceShippingTask)。提前发起让这两个重型请求并行,消除串行叠加;
* 结果仅在被 loadFormalTaskDetail 认领且任务号一致时使用,避免双源身份。 */
const deepLinkTaskPrefetch = ref<{ taskNo: string; promise: Promise<ShippingTaskDetail | null> } | null>(null);
function prefetchDeepLinkedTaskDetail() {
const taskNo = String(route.query.task_no || route.query.task_id || '').trim();
if (!taskNo) return;
const promise = getWorkspaceShippingTask(taskNo, { view: 'workbench' })
.then((detail) => detail)
.catch(() => null);
deepLinkTaskPrefetch.value = { taskNo, promise };
}
/**
* 通知准备优先消费正式任务 ui_state;详情摘要暂时为空时,仅回退到当前 Case 的
@@ -2462,10 +2499,28 @@ async function loadFormalTaskDetail() {
if (formalTaskDetail.value?.task_no !== taskNo) {
formalTaskDetail.value = null;
}
// [PERF] 复用深链预取的任务详情:首次进入时它与 load() 并行发起,避免任务详情在
// load() 完成之后再串行重拉;仅当预取与当前确认任务号一致时使用,用完即清空,
// 后续 Gate 动作后的写后刷新仍走正常网络读取,保证新鲜度。
const prefetch = deepLinkTaskPrefetch.value;
if (prefetch && prefetch.taskNo === taskNo) {
deepLinkTaskPrefetch.value = null;
const prefetched = await prefetch.promise;
if (
prefetched
&& String(prefetched.task_no || '').trim() === taskNo
&& generation === formalTaskDetailGeneration
) {
formalTaskDetail.value = prefetched;
formalTaskDetailLoadFailed.value = false;
formalTaskDetailLoading.value = false;
return;
}
}
formalTaskDetailLoadFailed.value = false;
formalTaskDetailLoading.value = true;
try {
const detail = await getWorkspaceShippingTask(taskNo);
const detail = await getWorkspaceShippingTask(taskNo, { view: 'workbench' });
if (generation !== formalTaskDetailGeneration) return;
// 同代也必须核对任务身份;服务端异常返回或旧请求均不能成为当前生命周期事实。
if (String(detail?.task_no || '').trim() !== taskNo) {
@@ -2511,12 +2566,83 @@ async function loadFreightNoticeGroups(taskNo: string) {
}
}
// [STEP] 货代上传面板独立、轻量轮询(解耦):仅货代上传工作面激活时每 5s 重拉,达到终态即停。
// 各数据源独立轮询,避免把两个网络请求串进同一个 tick(串行 await 会拖慢单个轮询)。
const FREIGHT_GROUPS_POLL_MS = 5000;
const freightGroupsPollTimer = ref<ReturnType<typeof window.setInterval> | null>(null);
function stopFreightGroupsPolling() {
if (freightGroupsPollTimer.value != null) {
window.clearInterval(freightGroupsPollTimer.value);
freightGroupsPollTimer.value = null;
}
}
function startFreightGroupsPolling() {
stopFreightGroupsPolling();
if (!isLifecycleFreightUpload.value) return;
const taskNo = String(confirmedNoticeTaskNo.value || '').trim();
if (!taskNo) return;
const tick = () => {
if (freightNoticeGroupsLoading.value) return;
const no = String(confirmedNoticeTaskNo.value || '').trim();
if (no) void loadFreightNoticeGroups(no);
};
tick();
freightGroupsPollTimer.value = window.setInterval(tick, FREIGHT_GROUPS_POLL_MS);
}
// 货代上传工作面激活/切出时启停独立轮询。
watch(isLifecycleFreightUpload, (active) => {
if (active) startFreightGroupsPolling();
else stopFreightGroupsPolling();
});
// 货代分组达到终态后只停止分组轮询。RPA 回调成功/失败不代表整个任务结束,
// 后续 Gate 仍可能自动推进,任务级工作流轮询必须继续由统一投影裁决。
watch(freightNoticeGroups, (groups) => {
if (!isLifecycleFreightUpload.value || !groups.length) return;
const terminal = groups.every((group) => {
const st = String(group.upload_status || '').trim().toLowerCase();
const reason = group.upload_error_message || group.upload_error_code || null;
if (['uploaded', 'succeeded', 'success'].includes(st)) return true;
if (st === 'failed') return true;
return Boolean(reason);
});
if (terminal) {
stopFreightGroupsPolling();
}
});
onBeforeUnmount(() => stopFreightGroupsPolling());
function toggleFreightNoticeSelection(businessNo: string, checked: boolean) {
selectedFreightBusinessNos.value = checked
? Array.from(new Set([...selectedFreightBusinessNos.value, businessNo]))
: selectedFreightBusinessNos.value.filter((item) => item !== businessNo);
}
/**
* 判断通知单是否已有后端确认的上传成功事实。
* 核心逻辑:仅消费当前分组的 upload_status;已上传通知不得再次发起 RPA 或人工确认。
* @param group - 后端下发的发货通知单聚合行。
* @returns 是否已上传成功。
*/
function isFreightNoticeUploaded(group: ShippingFreightNoticeGroup): boolean {
return ['uploaded', 'succeeded', 'success'].includes(
String(group.upload_status || '').trim().toLowerCase(),
);
}
/** 已选通知单中任一已上传时,批量写入动作必须 fail-closed,避免重复提交成功通知。 */
const selectedFreightNoticesContainUploaded = computed(() => {
const selected = new Set(selectedFreightBusinessNos.value);
return freightNoticeGroups.value.some((group) => (
selected.has(group.business_no) && isFreightNoticeUploaded(group)
));
});
async function downloadFreightNotice(businessNo: string) {
try {
await downloadWorkspaceShippingNoticeExcelFile(businessNo);
@@ -2527,6 +2653,7 @@ async function downloadFreightNotice(businessNo: string) {
async function runFreightBatchAction(action: 'download' | 'confirm' | 'rpa') {
if (!selectedFreightBusinessNos.value.length || freightBatchBusy.value) return;
if (action !== 'download' && selectedFreightNoticesContainUploaded.value) return;
freightBatchBusy.value = action;
try {
if (action === 'download') {
@@ -2540,6 +2667,9 @@ async function runFreightBatchAction(action: 'download' | 'confirm' | 'rpa') {
if (action === 'confirm' || action === 'rpa') {
const taskNo = String(confirmedNoticeTaskNo.value || '').trim();
if (taskNo) await loadFreightNoticeGroups(taskNo);
// 启动 5 秒轮询:RPA 上传结果/失败原因异步回传后自动刷新,无需手动刷新页面。
startWorkflowProgressPolling();
startFreightGroupsPolling();
}
await Promise.all([loadFormalTaskDetail(), refreshShippingProcessing()]);
} catch (error) {
@@ -2561,6 +2691,7 @@ async function runFreightNoticeAction(
action: 'confirm' | 'rpa' | 'regenerate',
) {
if (freightBatchBusy.value) return;
if (action !== 'regenerate' && isFreightNoticeUploaded(group)) return;
freightBatchBusy.value = action;
try {
if (action === 'confirm') {
@@ -2575,6 +2706,9 @@ async function runFreightNoticeAction(
// 确认/RPA 后重拉同 PO 通知聚合,使通知完成面能立即呈现最新 uploaded 状态。
const taskNo = String(confirmedNoticeTaskNo.value || '').trim();
if (taskNo) await loadFreightNoticeGroups(taskNo);
// 启动 5 秒轮询:RPA 上传结果/失败原因异步回传后自动刷新,无需手动刷新页面。
startWorkflowProgressPolling();
startFreightGroupsPolling();
await Promise.all([loadFormalTaskDetail(), refreshShippingProcessing()]);
} catch (error) {
msg.warning(error instanceof Error ? error.message : t('chat.shippingOrderReview.workbench.resultNotReady'));
@@ -2592,6 +2726,19 @@ function canRegenerateFreightNotice(group: ShippingFreightNoticeGroup): boolean
));
}
/**
* 判断单条通知单是否存在可展开的更多操作。
* 核心逻辑:已上传通知一律不展示更多按钮;其他状态仅在后端授权了至少一个动作时展示,避免空白菜单。
* @param group - 当前发货通知单聚合行。
* @returns 是否显示更多操作入口。
*/
function hasFreightNoticeMoreActions(group: ShippingFreightNoticeGroup): boolean {
if (isFreightNoticeUploaded(group)) return false;
return canRunFreightNoticeAction(group, 'retry_freight_upload_rpa')
|| canRunFreightNoticeAction(group, 'mark_manual_uploaded')
|| canRegenerateFreightNotice(group);
}
/** 仅展示 Notice 聚合接口下发的已授权动作;最终写入仍由对应 API 二次校验。 */
function canRunFreightNoticeAction(group: ShippingFreightNoticeGroup, actionCode: string): boolean {
return (group.available_actions || []).includes(actionCode);
@@ -2837,6 +2984,19 @@ function freightUploadStatusDisplay(group: ShippingFreightNoticeGroup): {
};
}
/**
* 通知完成面:解析上传成功证据的来源方式(人工确认 / RPA),用于徽标展示。
* 核心逻辑:upload_mode 为后端从 ShippingUploadAttempt 权威事实解析的 rpa|manual;
* 仅该两值可映射,未知/空一律返回 null,避免把历史遗留或未知模式伪装成人话。
* @param mode - 后端解析出的上传方式(rpa / manual / 空)。
*/
function freightUploadModeLabel(mode: string | null | undefined): string | null {
const value = String(mode || '').trim().toLowerCase();
if (value === 'rpa') return t('chat.shippingOrderReview.lifecycle.uploadComplete.uploadModeRpa');
if (value === 'manual') return t('chat.shippingOrderReview.lifecycle.uploadComplete.uploadModeManual');
return null;
}
async function confirmPreparationWave() {
const caseNo = String(activeCase.value?.case_no || '').trim();
const draftVersion = activeCase.value?.draft?.draft_version;
@@ -3919,7 +4079,7 @@ watch(
<main
class="flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-slate-50 text-slate-900 dark:bg-slate-950 dark:text-slate-100"
data-testid="shipping-order-review-view"
:data-readonly="isReadOnly ? 'true' : 'false'"
:data-readonly="isReviewContentReadOnly ? 'true' : 'false'"
:data-workbench-mode="workbenchMode"
>
<ReviewWorkbenchHeader
@@ -3930,7 +4090,7 @@ watch(
:saving="saving"
:save-failed="saveFailed"
:draft-conflict="Boolean(draftConflict)"
:is-read-only="isReadOnly"
:is-read-only="isReviewContentReadOnly"
:show-version-history="Boolean(activeCase)"
:show-audit-trail="Boolean(activeCase)"
@back="back"
@@ -4281,16 +4441,20 @@ watch(
<div v-else-if="freightNoticeGroups.length" class="mt-3 space-y-3" data-testid="review-freight-upload-groups">
<div class="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-default bg-surface-muted/30 px-3 py-2 text-xs" data-testid="review-freight-upload-batch-toolbar">
<span class="text-secondary">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.selected', { count: selectedFreightBusinessNos.length }) }}</span>
<div class="flex flex-wrap gap-2"><button type="button" class="rounded border border-default px-2 py-1 disabled:opacity-50" :disabled="!selectedFreightBusinessNos.length || freightBatchBusy !== null" @click="void runFreightBatchAction('download')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchDownload') }}</button><button type="button" class="rounded border border-default px-2 py-1 disabled:opacity-50" :disabled="!selectedFreightBusinessNos.length || freightBatchBusy !== null" @click="void runFreightBatchAction('rpa')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchRpa') }}</button><button type="button" class="rounded border border-default px-2 py-1 disabled:opacity-50" :disabled="!selectedFreightBusinessNos.length || freightBatchBusy !== null" @click="void runFreightBatchAction('confirm')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchConfirm') }}</button></div>
<div class="flex flex-wrap gap-2">
<button type="button" class="rounded border border-default px-2 py-1 disabled:opacity-50" :disabled="!selectedFreightBusinessNos.length || freightBatchBusy !== null" @click="void runFreightBatchAction('download')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchDownload') }}</button>
<button type="button" class="rounded border border-default px-2 py-1 disabled:opacity-50" data-testid="review-freight-upload-batch-rpa" :disabled="!selectedFreightBusinessNos.length || selectedFreightNoticesContainUploaded || freightBatchBusy !== null" @click="void runFreightBatchAction('rpa')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchRpa') }}</button>
<button type="button" class="rounded border border-default px-2 py-1 disabled:opacity-50" data-testid="review-freight-upload-batch-confirm" :disabled="!selectedFreightBusinessNos.length || selectedFreightNoticesContainUploaded || freightBatchBusy !== null" @click="void runFreightBatchAction('confirm')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchConfirm') }}</button>
</div>
</div>
<div v-for="group in freightNoticeGroups" :key="group.business_no" class="rounded-lg border border-default" data-testid="review-freight-upload-notice">
<div class="flex flex-wrap items-center justify-between gap-3 border-b border-default bg-surface-muted/40 px-3 py-2 text-xs">
<label class="flex items-center gap-2 font-semibold text-primary"><input type="checkbox" :checked="selectedFreightBusinessNos.includes(group.business_no)" :aria-label="group.business_no" @change="toggleFreightNoticeSelection(group.business_no, ($event.target as HTMLInputElement).checked)"><span>{{ group.business_no }}</span></label>
<span class="text-secondary">PO: {{ group.po_number || '—' }} · {{ group.export_file_name || '—' }}</span>
<div class="flex items-center gap-2">
<span :class="freightUploadStatusDisplay(group).chipClass" class="rounded-full px-2 py-0.5 font-medium">{{ freightUploadStatusDisplay(group).label }}</span>
<span :class="freightUploadStatusDisplay(group).chipClass" :title="freightUploadStatusDisplay(group).reason || undefined" class="rounded-full px-2 py-0.5 font-medium cursor-help" tabindex="0">{{ freightUploadStatusDisplay(group).label }}</span>
<button type="button" class="rounded border border-brand-200 px-2 py-1 font-medium text-brand-700 hover:bg-brand-50" data-testid="review-freight-upload-download" :disabled="saving" @click="void downloadFreightNotice(group.business_no)">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.download') }}</button>
<details class="relative">
<details v-if="hasFreightNoticeMoreActions(group)" class="relative" data-testid="review-freight-upload-more">
<summary class="list-none rounded border border-default p-1 text-secondary hover:bg-surface" :aria-label="t('chat.shippingProcessing.action.more')"><MoreHorizontal class="h-3.5 w-3.5" aria-hidden="true" /></summary>
<div class="absolute right-0 top-7 z-10 flex min-w-40 flex-col gap-1 rounded border border-default bg-surface p-1 shadow-lg">
<button v-if="canRunFreightNoticeAction(group, 'retry_freight_upload_rpa')" type="button" class="rounded px-2 py-1 text-left text-[11px] text-primary hover:bg-surface-muted disabled:opacity-50" :disabled="freightBatchBusy !== null" @click="void runFreightNoticeAction(group, 'rpa')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchRpa') }}</button>
@@ -4300,7 +4464,6 @@ watch(
</details>
</div>
</div>
<div v-if="freightUploadStatusDisplay(group).reason" class="border-b border-default bg-rose-50/50 px-3 py-2 text-xs text-rose-700 dark:bg-rose-950/10 dark:text-rose-300" data-testid="review-freight-upload-error">{{ freightUploadStatusDisplay(group).reason }}</div>
<table class="min-w-full text-left text-xs"><thead class="border-b border-default bg-surface-muted/30"><tr><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.lineNo') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.requiredQty') }}</th></tr></thead><tbody><tr v-for="line in group.lines" :key="`${group.business_no}-${line.line_no}-${line.part_number}`" class="border-b border-default last:border-0" data-testid="review-freight-upload-line"><td class="px-3 py-2"><span :class="freightLineNoDisplay(line).muted ? 'text-muted' : ''" :title="freightLineNoDisplay(line).title">{{ freightLineNoDisplay(line).text }}</span></td><td class="px-3 py-2">{{ line.part_number || '—' }}</td><td class="px-3 py-2">{{ line.reservation_id || '—' }}</td><td class="px-3 py-2">{{ line.shipment_qty || '—' }}</td></tr></tbody></table>
</div>
</div>
@@ -4346,6 +4509,13 @@ watch(
<Check class="h-3.5 w-3.5" aria-hidden="true" />
{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.uploaded') }}
</span>
<span
v-if="freightUploadModeLabel(group.upload_mode)"
class="inline-flex items-center gap-1 rounded-full border border-emerald-300/60 bg-emerald-100/60 px-2 py-0.5 font-medium text-emerald-700 dark:border-emerald-700/60 dark:bg-emerald-950/40 dark:text-emerald-300"
data-testid="review-upload-complete-mode"
>
{{ freightUploadModeLabel(group.upload_mode) }}
</span>
<span class="text-secondary">{{ group.po_number ? `PO: ${group.po_number}` : '' }}</span>
</div>
<div class="flex items-center gap-2">
@@ -4452,7 +4622,7 @@ watch(
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.orderFields') }}</h2>
<p class="mt-1 text-xs text-slate-500">{{ t('chat.shippingOrderReview.schemaVersion', { version: displayCase?.schema.schema_version_id || '-' }) }}</p>
</div>
<span v-if="isReadOnly" class="rounded-full bg-slate-100 px-2 py-0.5 text-xs text-slate-600 dark:bg-slate-800 dark:text-slate-300">
<span v-if="isReviewContentReadOnly" class="rounded-full bg-slate-100 px-2 py-0.5 text-xs text-slate-600 dark:bg-slate-800 dark:text-slate-300">
{{ t('chat.shippingOrderReview.readOnly') }}
</span>
</div>
@@ -4476,7 +4646,7 @@ watch(
</div>
<input
:value="draftValue(displayHeaderValues, field.field_id)"
:disabled="caseContentSkeleton || !isFieldEditable(field.field_id) || saving"
:disabled="caseContentSkeleton || !canEditReviewField(field.field_id) || saving"
class="mt-1 w-full rounded-md border border-slate-300 bg-white px-2.5 py-2 text-sm dark:border-slate-600 dark:bg-slate-950"
:class="{
'border-sky-400 ring-2 ring-sky-300 dark:border-sky-500 dark:ring-sky-700': isEvidenceLinkedField(field.field_id),
@@ -4490,7 +4660,7 @@ watch(
>
<div class="mt-1 flex items-center justify-between gap-2 text-[11px] text-slate-500">
<span>{{ valueSourceLabel(draftFieldMeta(displayHeaderValues as Record<string, unknown> | undefined, field.field_id).value_source) }}</span>
<button v-if="!caseContentSkeleton && isFieldEditable(field.field_id)" type="button" class="hover:text-sky-600" @click="reportSave(() => patchHeader(field.field_id, null, true))">
<button v-if="!caseContentSkeleton && canEditReviewField(field.field_id)" type="button" class="hover:text-sky-600" @click="reportSave(() => patchHeader(field.field_id, null, true))">
<Undo2 class="mr-1 inline h-3 w-3" />{{ t('chat.shippingOrderReview.restoreMachine') }}
</button>
</div>
@@ -4599,7 +4769,7 @@ watch(
<div class="relative flex min-w-0 items-center gap-1">
<input
:value="lineFieldDisplayValue(line, field)"
:disabled="!isFieldEditable(field.field_id) || saving || (field.field_code === 'line_no' && Boolean(draftFieldMeta(line, field.field_id).locked))"
:disabled="!canEditReviewField(field.field_id) || saving || (field.field_code === 'line_no' && Boolean(draftFieldMeta(line, field.field_id).locked))"
class="min-w-0 flex-1 rounded border border-slate-300 bg-white px-1.5 py-1 text-xs dark:border-slate-600 dark:bg-slate-950"
:class="{
'border-amber-400 ring-1 ring-amber-300 dark:border-amber-500': field.field_code === 'line_no'
@@ -5030,7 +5200,7 @@ watch(
:show-stp-retry="showObjectRetryOnFooter"
:auto-gate-hint="t(autoGateHintKey)"
:saving="saving"
:is-read-only="isReadOnly"
:is-read-only="isReviewContentReadOnly"
:has-draft="Boolean(displayCase?.draft) || isLifecycleIntakeParse"
:unsaved-count="unsavedEditCount"
:flow-presentation="flowPresentation"