feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
84a881b554
commit
74270adc22
149 files changed
+20111
-3871
No files matched your search
@@ -31,6 +31,7 @@ import {
|
||||
attemptWorkspaceShippingOrderReviewFieldLocate,
|
||||
getWorkspaceShippingOrderReviewEvidenceItem,
|
||||
getWorkspaceShippingTask,
|
||||
retryWorkspaceShippingOrderStpAutoCreate,
|
||||
viewWorkspaceShippingOrderReviewHighlightDiagnostic,
|
||||
} from '../api/shipping.api';
|
||||
import ReviewActionConfirmDialog, {
|
||||
@@ -42,6 +43,7 @@ import ReviewBuildEligibilitySummary from '../components/shipping-review/ReviewB
|
||||
import ReviewCustomerResolutionPanel from '../components/shipping-review/ReviewCustomerResolutionPanel.vue';
|
||||
import ReviewFieldConflictPanel from '../components/shipping-review/ReviewFieldConflictPanel.vue';
|
||||
import ReviewDuplicatePanel from '../components/shipping-review/ReviewDuplicatePanel.vue';
|
||||
import ReviewProfileMatchPanel from '../components/shipping-review/ReviewProfileMatchPanel.vue';
|
||||
import ReviewReservationPanel from '../components/shipping-review/ReviewReservationPanel.vue';
|
||||
import ReviewFulfillmentDecisionPanel from '../components/shipping-review/ReviewFulfillmentDecisionPanel.vue';
|
||||
import ReviewFulfillmentSummaryCard from '../components/shipping-review/ReviewFulfillmentSummaryCard.vue';
|
||||
@@ -68,6 +70,10 @@ import ReviewLlmSuggestionDrawer from '../components/shipping-review/ReviewLlmSu
|
||||
import ReviewVersionHistoryDrawer from '../components/shipping-review/ReviewVersionHistoryDrawer.vue';
|
||||
import ReviewProcessDetailDrawer from '@/features/shipping-progress/components/ReviewProcessDetailDrawer.vue';
|
||||
import { useProcessingActionPresentation } from '@/features/shipping-progress/composables/useProcessingActionPresentation';
|
||||
import {
|
||||
resolveWorkbenchActionItem,
|
||||
type WorkbenchPanelAvailability,
|
||||
} from '@/features/shipping-progress/workbenchActionRegistry';
|
||||
import { parseOrderReviewConfirmResponse } from '../shipping-review/parseOrderReviewConfirmResponse';
|
||||
import { REVIEW_BUILD_ELIGIBILITY_BLOCKED, useShippingOrderReview } from '../shipping-review/useShippingOrderReview';
|
||||
import type { ActionPresentationItem } from '@/features/shipping-progress/types';
|
||||
@@ -108,6 +114,8 @@ const {
|
||||
isReadOnly,
|
||||
loading,
|
||||
loadFailed,
|
||||
caseSwitchLoading,
|
||||
caseSwitchFailed,
|
||||
saving,
|
||||
saveFailed,
|
||||
versionsLoading,
|
||||
@@ -122,6 +130,7 @@ const {
|
||||
ensurePreviewLoaded,
|
||||
load,
|
||||
selectCase,
|
||||
requestedCaseNo,
|
||||
refreshWorkItemContext,
|
||||
openCurrentVersion,
|
||||
reloadLatestDraft,
|
||||
@@ -212,11 +221,61 @@ const pendingSwitchCaseNo = ref<string | null>(null);
|
||||
const otNavMode = ref<ReviewDocumentNavMode>('hidden');
|
||||
const closeFulfillmentOpen = ref(false);
|
||||
const closeFulfillmentLineKeys = ref<string[]>([]);
|
||||
/** focus=evidence 深链只消费一次,切换 PDF 后不得再次自动打开。 */
|
||||
const evidenceFocusConsumed = ref(false);
|
||||
|
||||
/** can_build && can_auto_create 时底栏隐藏「确认建单」并提示自动推进。 */
|
||||
const hideConfirmBecauseAutoGate = computed(() => Boolean(
|
||||
buildEligibility.value?.can_build && buildEligibility.value?.can_auto_create,
|
||||
));
|
||||
/** can_build && can_auto_create 时底栏隐藏「确认建单」;文案仅表示资格达标等待入队,不等于正在推进。 */
|
||||
/** queued|running 时隐藏「确认并创建任务」;waiting_to_start / failed / manual_fallback 保留人工兜底。 */
|
||||
const hideConfirmBecauseAutoGate = computed(() => {
|
||||
const automationStatus = String(activeCase.value?.automation?.status || '').trim().toLowerCase();
|
||||
if (['queued', 'running'].includes(automationStatus)) return true;
|
||||
if (String(activeCase.value?.status || '') === 'confirmed') return true;
|
||||
if (String(activeCase.value?.confirmed_task_no || '').trim()) return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
/** 底栏是否展示自动建单提示(等待 / 推进中)。 */
|
||||
const showAutoGateHint = computed(() => {
|
||||
const automationStatus = String(activeCase.value?.automation?.status || '').trim().toLowerCase();
|
||||
return ['waiting_to_start', 'queued', 'running'].includes(automationStatus);
|
||||
});
|
||||
|
||||
/** failed / manual_fallback 时展示「重试自动推进」。 */
|
||||
const showStpRetry = computed(() => {
|
||||
const automation = activeCase.value?.automation;
|
||||
const status = String(automation?.status || '').trim().toLowerCase();
|
||||
if (!['failed', 'manual_fallback'].includes(status)) return false;
|
||||
if (String(activeCase.value?.status || '') === 'confirmed') return false;
|
||||
if (String(activeCase.value?.confirmed_task_no || '').trim()) return false;
|
||||
return Boolean(automation?.retryable) || (activeCase.value?.available_actions || []).includes('retry_stp_auto_create');
|
||||
});
|
||||
|
||||
/**
|
||||
* 是否存在已确认的自动建单/推进 Job(queued|running)。
|
||||
* 核心逻辑:仅 post_confirm 或投影 status 明确入队/运行时为 true;资格达标不算。
|
||||
*/
|
||||
const hasConfirmedAutomationJob = computed(() => {
|
||||
const automationStatus = String(activeCase.value?.automation?.status || '').trim().toLowerCase();
|
||||
if (['queued', 'running', 'completed'].includes(automationStatus)) return true;
|
||||
const progress = activeCase.value?.post_confirm_auto_progress;
|
||||
const progressStatus = String(progress?.status || '').trim().toLowerCase();
|
||||
if (['queued', 'running', 'started', 'in_progress'].includes(progressStatus)) return true;
|
||||
const projStatus = String(shippingProcessingProjection.value?.status || '').trim().toLowerCase();
|
||||
const hasTask = Boolean(
|
||||
String(activeCase.value?.confirmed_task_no || '').trim()
|
||||
|| String(authoritativeOrderTaskNo.value || '').trim(),
|
||||
);
|
||||
return hasTask && ['processing', 'automating', 'queued'].includes(projStatus);
|
||||
});
|
||||
|
||||
/**
|
||||
* 底栏自动资格提示:无真实 Job 时降级为「等待系统启动」,禁止「正在推进」。
|
||||
*/
|
||||
const autoGateHintKey = computed(() => (
|
||||
hasConfirmedAutomationJob.value
|
||||
? 'chat.shippingOrderReview.buildEligibility.autoGateRunningHint'
|
||||
: 'chat.shippingOrderReview.buildEligibility.autoGateWaitingHint'
|
||||
));
|
||||
|
||||
/** 证据浮窗是否以浮动方式展示(打开且未固定为侧栏)。 */
|
||||
const evidenceFloating = computed(
|
||||
@@ -279,12 +338,17 @@ function hydrateConfirmProgressFromCase() {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 深链 focus=evidence:仅首次进入且尚未消费时打开证据模式;消费后立即从 URL 清除 focus。
|
||||
* 切换 PDF/Case 不得因残留 query 或新 evidence 加载再次自动打开。
|
||||
*/
|
||||
watch(
|
||||
() => [evidence.value, reviewFocus.value] as const,
|
||||
() => [evidence.value, reviewFocus.value, activeCase.value?.case_no] as const,
|
||||
([items, focus]) => {
|
||||
if (focus !== 'evidence' || !items?.length) return;
|
||||
if (focus !== 'evidence' || evidenceFocusConsumed.value || !items?.length) return;
|
||||
const first = items.find((item) => item.bbox) || items[0];
|
||||
if (!first) return;
|
||||
evidenceFocusConsumed.value = true;
|
||||
focusedEvidenceRef.value = {
|
||||
fieldId: String(first.field_id || '').trim(),
|
||||
lineIndex: first.line_index == null ? undefined : Number(first.line_index),
|
||||
@@ -292,6 +356,9 @@ watch(
|
||||
workbenchMode.value = 'evidence';
|
||||
panelState.value = { ...panelState.value, pdfOpen: true };
|
||||
void ensurePreviewLoaded();
|
||||
const nextQuery = { ...route.query };
|
||||
delete nextQuery.focus;
|
||||
void router.replace({ query: nextQuery });
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
@@ -882,12 +949,44 @@ const canEnterInventory = computed(() => (
|
||||
));
|
||||
const availableActions = computed(() => activeCase.value?.available_actions || []);
|
||||
|
||||
/** 订单处理工作台写权限(只读查看为 false)。 */
|
||||
const workbenchActionsExecutable = computed(() => !isReadOnly.value);
|
||||
|
||||
/** 当前 Case 面板可用性,供注册表 requiresPanel 守卫。 */
|
||||
const workbenchPanelAvailability = computed((): WorkbenchPanelAvailability => {
|
||||
const c = activeCase.value;
|
||||
return {
|
||||
customerUnresolved: Boolean(c && !c.customer_resolution?.resolved),
|
||||
hasFieldConflicts: Boolean((c?.field_conflicts || []).length),
|
||||
hasDuplicateAdjudication: Boolean(c?.duplicate?.needs_adjudication),
|
||||
hasProfileMatch: Boolean(c?.profile_match?.available),
|
||||
hasInventoryCandidates: Boolean((routingRecoveryLines.value || []).length),
|
||||
hasInventoryIssues: Boolean(
|
||||
(routingRecoveryLines.value || []).length
|
||||
|| c?.line_fulfillment?.has_shortage,
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
/** 底栏流程写操作:与原进度条 ActionBar 同源,surface=review。 */
|
||||
const flowProjectionRef = computed(() => shippingProcessingProjection.value);
|
||||
const flowPresentation = useProcessingActionPresentation(flowProjectionRef, { surface: 'review' });
|
||||
const flowPresentationOptions = computed(() => ({
|
||||
surface: 'review' as const,
|
||||
actionsExecutable: workbenchActionsExecutable.value,
|
||||
panels: workbenchPanelAvailability.value,
|
||||
}));
|
||||
const flowPresentation = useProcessingActionPresentation(flowProjectionRef, flowPresentationOptions);
|
||||
const flowActionBusy = ref(false);
|
||||
const viewResultLoading = ref(false);
|
||||
|
||||
/** 系统自动推进中:底栏隐藏无效主写按钮。 */
|
||||
const customerResolutionPanelRef = ref<{ openSelectDialog: () => Promise<void> } | null>(null);
|
||||
const customerResolutionWideRef = ref<{ openSelectDialog: () => Promise<void> } | null>(null);
|
||||
const fieldConflictPanelRef = ref<{ focusFirstConflict: () => void } | null>(null);
|
||||
const duplicatePanelRef = ref<{ focusAdjudication: () => void } | null>(null);
|
||||
|
||||
/** 系统自动推进中:仅当存在确认 Job 时隐藏主写按钮;资格达标不算 automating。 */
|
||||
const isProcessingAutomating = computed(() => {
|
||||
if (!hasConfirmedAutomationJob.value) return false;
|
||||
const status = String(shippingProcessingProjection.value?.status || '').trim().toLowerCase();
|
||||
return ['processing', 'automating', 'queued'].includes(status)
|
||||
&& !shippingProcessingProjection.value?.currentGate?.nextActionCode;
|
||||
@@ -1350,57 +1449,226 @@ const retryAutoProgressAfterConfirm = async () => {
|
||||
};
|
||||
|
||||
/**
|
||||
* 统一动作栏点击:优先复用已有写路径;履约业务动作委托 TaskTodoPanel。
|
||||
* STP 自动建单失败 / manual_fallback:调用专用 retry API 重新入队。
|
||||
* 核心逻辑:与确认后 auto_progress 重试分离;成功后刷新 Case 投影。
|
||||
*/
|
||||
const onUnifiedProcessingAction = (item: ActionPresentationItem) => {
|
||||
const intent = item.intent;
|
||||
if (intent === 'retry') {
|
||||
void retryAutoProgressAfterConfirm();
|
||||
return;
|
||||
}
|
||||
if (intent === 'refresh') {
|
||||
void refreshShippingProcessing();
|
||||
void loadFormalTaskDetail();
|
||||
return;
|
||||
}
|
||||
if (intent === 'download_excel' && confirmedNoticeTaskNo.value) {
|
||||
void (async () => {
|
||||
try {
|
||||
await downloadWorkspaceShippingExcelFile(confirmedNoticeTaskNo.value);
|
||||
await loadFormalTaskDetail();
|
||||
} catch (error: unknown) {
|
||||
msg.warning(error instanceof Error ? error.message : t('errors.generic'));
|
||||
}
|
||||
})();
|
||||
return;
|
||||
}
|
||||
if (
|
||||
intent === 'open_manual_upload'
|
||||
|| intent === 'open_inventory_source_review'
|
||||
|| intent === 'open_inventory_match_review'
|
||||
|| intent === 'open_shortage_review'
|
||||
|| intent === 'upload_inventory_file'
|
||||
|| intent === 'regenerate_excel'
|
||||
) {
|
||||
// [UI-01] 履约动作统一由 ActionBar 触发,表单/弹窗仍由 TaskTodoPanel 承接。
|
||||
if (!formalTaskDetail.value && confirmedNoticeTaskNo.value) {
|
||||
void loadFormalTaskDetail().then(() => {
|
||||
void formalTodoPanelRef.value?.invokeActionByCode(item.actionCode);
|
||||
});
|
||||
const retryStpAutoCreate = async () => {
|
||||
const caseNo = String(activeCase.value?.case_no || '').trim();
|
||||
if (!caseNo || progressRetrying.value) return;
|
||||
progressRetrying.value = true;
|
||||
try {
|
||||
const result = await retryWorkspaceShippingOrderStpAutoCreate(caseNo);
|
||||
if (result.case) {
|
||||
activeCase.value = result.case;
|
||||
} else {
|
||||
void formalTodoPanelRef.value?.invokeActionByCode(item.actionCode);
|
||||
await reloadLatestDraft();
|
||||
}
|
||||
void nextTick(() => {
|
||||
document
|
||||
.querySelector('[data-testid="review-formal-task-todo-panel"]')
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
});
|
||||
msg.success(t('chat.shippingOrderReview.autoProgress.retryStpSuccess'));
|
||||
} catch (error) {
|
||||
msg.error(resolveReviewErrorMessage(error));
|
||||
} finally {
|
||||
progressRetrying.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 滚动到工作台锚点(data-testid)。
|
||||
*/
|
||||
function scrollWorkbenchAnchor(testId: string | null | undefined) {
|
||||
const id = String(testId || '').trim();
|
||||
if (!id) return;
|
||||
void nextTick(() => {
|
||||
document
|
||||
.querySelector(`[data-testid="${id}"]`)
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确保正式任务详情已加载且身份一致,再委托 TaskTodoPanel。
|
||||
*
|
||||
* @returns 是否可继续 invoke
|
||||
*/
|
||||
async function ensureFormalTaskDetailReady(): Promise<boolean> {
|
||||
const taskNo = confirmedNoticeTaskNo.value;
|
||||
if (!taskNo) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return false;
|
||||
}
|
||||
if (!formalTaskDetail.value || formalTaskDetail.value.task_no !== taskNo) {
|
||||
await loadFormalTaskDetail();
|
||||
}
|
||||
if (!formalTaskDetail.value || formalTaskDetail.value.task_no !== taskNo) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一动作栏点击:经注册表派发到显式执行器(禁止散落 if / Gate POST / 盲调 API)。
|
||||
*/
|
||||
const onUnifiedProcessingAction = async (item: ActionPresentationItem) => {
|
||||
if (flowActionBusy.value) return;
|
||||
// 建单后库存源别名须解析为 todo_panel,禁止再走候选面板。
|
||||
const entry = resolveWorkbenchActionItem(item, {
|
||||
postCreate: hasCreatedShippingTask.value,
|
||||
});
|
||||
if (!entry) {
|
||||
return;
|
||||
}
|
||||
if (intent === 'open_order_review' || intent === 'edit_formal_task') {
|
||||
// 已在订单处理工作台,无需跳转。
|
||||
if (entry.isWrite && !workbenchActionsExecutable.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
flowActionBusy.value = true;
|
||||
try {
|
||||
const behavior = entry.reviewBehavior;
|
||||
|
||||
if (behavior === 'hidden_on_review' || behavior === 'refresh_strip_only') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'open_customer_dialog') {
|
||||
// [A1] 先滚动客户面板,再打开既有确认弹窗;禁止直调确认 API。
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-customer-resolution-panel');
|
||||
const taskNo = String(
|
||||
confirmedNoticeTaskNo.value
|
||||
|| activeCase.value?.confirmed_task_no
|
||||
|| activeCase.value?.order_task_no
|
||||
|| authoritativeOrderTaskNo.value
|
||||
|| '',
|
||||
).trim();
|
||||
if (taskNo && typeof page.openShippingCustomerDialog === 'function') {
|
||||
await page.openShippingCustomerDialog(taskNo);
|
||||
return;
|
||||
}
|
||||
const panel = customerResolutionWideRef.value || customerResolutionPanelRef.value;
|
||||
if (panel?.openSelectDialog) {
|
||||
await panel.openSelectDialog();
|
||||
return;
|
||||
}
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'focus_field_conflicts') {
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-field-conflict-panel');
|
||||
if (fieldConflictPanelRef.value?.focusFirstConflict) {
|
||||
fieldConflictPanelRef.value.focusFirstConflict();
|
||||
} else {
|
||||
const first = activeCase.value?.field_conflicts?.[0];
|
||||
if (first) {
|
||||
focusFieldConflict({
|
||||
fieldCode: first.field_code,
|
||||
lineIndex: first.line_index ?? null,
|
||||
lineKey: first.line_key ?? null,
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'focus_duplicate_panel') {
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-duplicate-panel');
|
||||
duplicatePanelRef.value?.focusAdjudication?.();
|
||||
void nextTick(() => {
|
||||
document
|
||||
.querySelector('[data-testid="review-duplicate-actions"]')
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'focus_profile_panel') {
|
||||
void router.replace({ query: { ...route.query, focus: 'profile' } });
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-profile-match-panel');
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'open_inventory_candidates') {
|
||||
// [B1] 仅建单前:进入库存模式并定位候选面板;禁止 TaskTodoPanel / 正式 OT API。
|
||||
// 建单后由 resolveWorkbenchActionItem(postCreate) 改写为 todo_panel。
|
||||
if (hasCreatedShippingTask.value) {
|
||||
if (!(await ensureFormalTaskDetailReady())) return;
|
||||
scrollWorkbenchAnchor('review-formal-task-todo-panel');
|
||||
await formalTodoPanelRef.value?.invokeActionByCode('confirm_inventory_source');
|
||||
return;
|
||||
}
|
||||
workbenchMode.value = 'inventory';
|
||||
await nextTick();
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-inventory-candidates-panel');
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'focus_inventory_issues') {
|
||||
workbenchMode.value = 'inventory';
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-inventory-issue-list');
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'view_result') {
|
||||
// [C1] 详情未返回时先 loading + loadFormalTaskDetail,身份匹配后再定位结果区。
|
||||
viewResultLoading.value = true;
|
||||
try {
|
||||
const expectedTaskNo = String(confirmedNoticeTaskNo.value || '').trim();
|
||||
if (expectedTaskNo) {
|
||||
const ready = await ensureFormalTaskDetailReady();
|
||||
if (!ready) return;
|
||||
if (String(formalTaskDetail.value?.task_no || '').trim() !== expectedTaskNo) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
await nextTick();
|
||||
const resultEl = document.querySelector('[data-testid="review-formal-task-result-region"]');
|
||||
if (resultEl) {
|
||||
resultEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
} else {
|
||||
scrollWorkbenchAnchor('review-formal-task-todo-panel');
|
||||
msg.info(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
}
|
||||
} finally {
|
||||
viewResultLoading.value = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'view_record') {
|
||||
openAuditTrail();
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'download') {
|
||||
if (!confirmedNoticeTaskNo.value) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return;
|
||||
}
|
||||
await downloadWorkspaceShippingExcelFile(confirmedNoticeTaskNo.value);
|
||||
await loadFormalTaskDetail();
|
||||
await refreshShippingProcessing();
|
||||
msg.success(t('chat.shippingOrderReview.workbench.actionSuccess'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'retry') {
|
||||
await retryAutoProgressAfterConfirm();
|
||||
await refreshShippingProcessing();
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior === 'todo_panel') {
|
||||
if (!(await ensureFormalTaskDetailReady())) return;
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-formal-task-todo-panel');
|
||||
const todoCode = entry.todoActionCode || item.actionCode;
|
||||
await formalTodoPanelRef.value?.invokeActionByCode(todoCode);
|
||||
return;
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
msg.warning(error instanceof Error ? error.message : t('errors.generic'));
|
||||
} finally {
|
||||
flowActionBusy.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const reportSave = async (action: () => Promise<unknown> | null) => {
|
||||
@@ -1636,11 +1904,47 @@ const selectReplacement = (event: Event) => {
|
||||
|
||||
/**
|
||||
* 实际切换 Case(无未保存拦截)。
|
||||
* 核心逻辑:清理证据焦点与确认成功条;非 dock 关闭证据模式;只更新 URL,
|
||||
* 由 run/case watch 在同 Run 内走轻量 selectCase,避免整页 load 误报历史版与加载中。
|
||||
*/
|
||||
const select = async (caseNo: string) => {
|
||||
const wasDocked = panelState.value.pdfDocked && panelState.value.pdfOpen;
|
||||
const switchingToCurrent = Boolean(
|
||||
reviewProgressContext.value?.current_case_no
|
||||
&& caseNo === reviewProgressContext.value.current_case_no
|
||||
&& isViewingHistoricalVersion.value,
|
||||
);
|
||||
|
||||
focusedEvidenceRef.value = null;
|
||||
confirmSuccess.value = null;
|
||||
|
||||
// [STEP 1] 浮窗模式关闭;dock 保留布局。切到当前版本强制关浮窗(G19)。
|
||||
if (!wasDocked || switchingToCurrent) {
|
||||
if (workbenchMode.value === 'evidence') {
|
||||
workbenchMode.value = 'standard';
|
||||
}
|
||||
panelState.value = {
|
||||
...panelState.value,
|
||||
pdfOpen: wasDocked && !switchingToCurrent,
|
||||
pdfExpanded: false,
|
||||
pdfDocked: wasDocked && !switchingToCurrent ? panelState.value.pdfDocked : false,
|
||||
eligibilityDetailsOpen: false,
|
||||
};
|
||||
}
|
||||
|
||||
// [STEP 2] 先轻量加载目标 Case,再同步 URL;watch 见已是当前 Case 则跳过二次 load。
|
||||
await selectCase(caseNo);
|
||||
await router.replace({ query: { ...route.query, case: caseNo } });
|
||||
const docId = activeCase.value?.document?.id;
|
||||
const nextQuery: Record<string, unknown> = { ...route.query, case: caseNo };
|
||||
delete nextQuery.focus;
|
||||
delete nextQuery.candidate;
|
||||
if (docId != null) nextQuery.document_id = String(docId);
|
||||
else delete nextQuery.document_id;
|
||||
await router.replace({ query: nextQuery as typeof route.query });
|
||||
|
||||
if (wasDocked && !switchingToCurrent && panelState.value.pdfOpen) {
|
||||
void ensurePreviewLoaded(caseNo);
|
||||
}
|
||||
};
|
||||
|
||||
/** 未保存本地修改数(与底栏提示、切换拦截同源)。 */
|
||||
@@ -1802,13 +2106,25 @@ watch(
|
||||
|
||||
watch(
|
||||
[runNo, () => String(route.query.case || route.query.case_no || ''), conversationId, itemNoFromQuery],
|
||||
([nextRun, nextCase, nextConversationId, nextItemNo]) => {
|
||||
if (nextRun) {
|
||||
void load(nextRun, nextCase || undefined, {
|
||||
conversationId: nextConversationId || undefined,
|
||||
itemNo: nextItemNo || undefined,
|
||||
});
|
||||
([nextRun, nextCase, nextConversationId, nextItemNo], previous) => {
|
||||
if (!nextRun) return;
|
||||
const prevRun = previous?.[0] ? String(previous[0]) : '';
|
||||
const activeNo = String(activeCase.value?.case_no || '').trim();
|
||||
const sameRunLoaded = Boolean(
|
||||
reviewRun.value?.run_no
|
||||
&& String(reviewRun.value.run_no) === String(nextRun)
|
||||
&& prevRun === String(nextRun),
|
||||
);
|
||||
// [STEP] 同 Run 仅切换 PDF/Case:走轻量 selectCase,禁止整页 load 清空进度与闪「正在加载」。
|
||||
if (sameRunLoaded && nextCase) {
|
||||
if (nextCase === activeNo) return;
|
||||
void selectCase(nextCase);
|
||||
return;
|
||||
}
|
||||
void load(nextRun, nextCase || undefined, {
|
||||
conversationId: nextConversationId || undefined,
|
||||
itemNo: nextItemNo || undefined,
|
||||
});
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
@@ -2039,17 +2355,31 @@ watch(
|
||||
class="rounded-xl border border-default bg-surface p-3"
|
||||
data-testid="review-formal-task-todo-panel"
|
||||
>
|
||||
<div v-if="formalTaskDetailLoading" class="py-4 text-center text-xs text-muted">
|
||||
{{ t('workspace.shippingNotice.loading') }}
|
||||
<div
|
||||
data-testid="review-formal-task-result-region"
|
||||
:data-view-result-loading="viewResultLoading ? '1' : '0'"
|
||||
>
|
||||
<div v-if="formalTaskDetailLoading" class="py-4 text-center text-xs text-muted">
|
||||
{{ t('workspace.shippingNotice.loading') }}
|
||||
</div>
|
||||
<TaskTodoPanel
|
||||
v-else-if="formalTaskDetail"
|
||||
ref="formalTodoPanelRef"
|
||||
:detail="formalTaskDetail"
|
||||
:gate-can-handle="false"
|
||||
:actions-executable="workbenchActionsExecutable"
|
||||
:hide-primary-actions="true"
|
||||
:expected-notice-task-no="confirmedNoticeTaskNo"
|
||||
:expected-order-task-no="authoritativeOrderTaskNo"
|
||||
:expected-review-case-no="activeCase?.case_no || null"
|
||||
:expected-run-no="runNo || null"
|
||||
@refreshed="() => {
|
||||
void loadFormalTaskDetail();
|
||||
void refreshShippingProcessing();
|
||||
msg.success(t('chat.shippingOrderReview.workbench.actionSuccess'));
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
<TaskTodoPanel
|
||||
v-else-if="formalTaskDetail"
|
||||
ref="formalTodoPanelRef"
|
||||
:detail="formalTaskDetail"
|
||||
:can-handle="!isReadOnly"
|
||||
:hide-primary-actions="true"
|
||||
@refreshed="() => { void loadFormalTaskDetail(); void refreshShippingProcessing(); }"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section
|
||||
@@ -2205,6 +2535,48 @@ watch(
|
||||
:class="otNavUsesSidebar ? '' : 'contents'"
|
||||
>
|
||||
<template v-if="showWorkbenchGrid">
|
||||
<div
|
||||
v-if="caseSwitchFailed"
|
||||
class="rounded-xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-900 dark:border-rose-900 dark:bg-rose-950/40 dark:text-rose-100"
|
||||
data-testid="review-case-switch-failed"
|
||||
>
|
||||
<p>{{ t('chat.shippingOrderReview.caseSwitchFailed') }}</p>
|
||||
<div
|
||||
class="mt-3 space-y-2"
|
||||
aria-hidden="true"
|
||||
data-testid="review-case-switch-failed-skeleton"
|
||||
>
|
||||
<div class="h-4 w-2/5 animate-pulse rounded bg-rose-200/70 dark:bg-rose-900/50" />
|
||||
<div class="h-10 w-full animate-pulse rounded bg-rose-200/70 dark:bg-rose-900/50" />
|
||||
<div class="h-24 w-full animate-pulse rounded bg-rose-200/70 dark:bg-rose-900/50" />
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-3 rounded border border-rose-300 px-2 py-1 text-xs hover:bg-rose-100 dark:border-rose-800 dark:hover:bg-rose-950"
|
||||
data-testid="review-case-switch-retry"
|
||||
@click="() => { const target = requestedCaseNo; if (target) void selectCase(target); }"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.caseSwitchRetry') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="caseSwitchLoading"
|
||||
class="space-y-3 rounded-xl border border-dashed border-slate-300 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/40"
|
||||
data-testid="review-case-switch-loading"
|
||||
>
|
||||
<p class="text-sm text-slate-600 dark:text-slate-300">{{ t('chat.shippingOrderReview.caseSwitchLoading') }}</p>
|
||||
<div class="space-y-2" aria-hidden="true">
|
||||
<div class="h-4 w-2/5 animate-pulse rounded bg-slate-200 dark:bg-slate-700" />
|
||||
<div class="h-10 w-full animate-pulse rounded bg-slate-200 dark:bg-slate-700" />
|
||||
<div class="h-10 w-full animate-pulse rounded bg-slate-200 dark:bg-slate-700" />
|
||||
<div class="h-24 w-full animate-pulse rounded bg-slate-200 dark:bg-slate-700" />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="activeCase"
|
||||
class="relative space-y-4"
|
||||
data-testid="review-case-workbench-shell"
|
||||
>
|
||||
<ReviewWorkbenchModeToggle
|
||||
v-if="workbenchMode !== 'standard' && workbenchMode !== 'reparse'"
|
||||
:mode="workbenchMode"
|
||||
@@ -2220,7 +2592,7 @@ watch(
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!reparseProgressActive && activeCase?.process_gate?.current_blocking_gate && !activeCase.process_gate.technical_auto_only"
|
||||
:summary="activeCase.process_gate"
|
||||
:can-handle="editable"
|
||||
:can-handle="false"
|
||||
:navigation-context="reviewGateNavigationContext"
|
||||
:field-labels="reviewFieldLabels"
|
||||
@refreshed="reloadLatestDraft"
|
||||
@@ -2229,6 +2601,7 @@ watch(
|
||||
/>
|
||||
<ReviewCustomerResolutionPanel
|
||||
v-if="activeCase && !activeCase.customer_resolution?.resolved"
|
||||
ref="customerResolutionPanelRef"
|
||||
:case-no="activeCase.case_no"
|
||||
:resolution="activeCase.customer_resolution"
|
||||
:editable="editable"
|
||||
@@ -2604,6 +2977,7 @@ watch(
|
||||
<div class="hidden space-y-3 xl:block" data-testid="review-primary-blockers-wide">
|
||||
<ReviewCustomerResolutionPanel
|
||||
v-if="activeCase && !activeCase.customer_resolution?.resolved"
|
||||
ref="customerResolutionWideRef"
|
||||
:case-no="activeCase.case_no"
|
||||
:resolution="activeCase.customer_resolution"
|
||||
:editable="editable"
|
||||
@@ -2612,7 +2986,7 @@ watch(
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!reparseProgressActive && activeCase?.process_gate?.current_blocking_gate && !activeCase.process_gate.technical_auto_only"
|
||||
:summary="activeCase.process_gate"
|
||||
:can-handle="editable"
|
||||
:can-handle="false"
|
||||
:navigation-context="reviewGateNavigationContext"
|
||||
:field-labels="reviewFieldLabels"
|
||||
@refreshed="reloadLatestDraft"
|
||||
@@ -2631,8 +3005,13 @@ watch(
|
||||
@navigate-exception="navigateExceptionField"
|
||||
/>
|
||||
</div>
|
||||
<ReviewProfileMatchPanel
|
||||
v-if="activeCase?.profile_match?.available"
|
||||
:profile-match="activeCase.profile_match"
|
||||
/>
|
||||
<ReviewFieldConflictPanel
|
||||
v-if="activeCase"
|
||||
ref="fieldConflictPanelRef"
|
||||
:case-no="activeCase.case_no"
|
||||
:draft-version="activeCase.draft?.draft_version"
|
||||
:conflicts="activeCase.field_conflicts"
|
||||
@@ -2642,6 +3021,7 @@ watch(
|
||||
/>
|
||||
<ReviewDuplicatePanel
|
||||
v-if="activeCase"
|
||||
ref="duplicatePanelRef"
|
||||
:case-no="activeCase.case_no"
|
||||
:duplicate="activeCase.duplicate"
|
||||
:editable="editable"
|
||||
@@ -2703,6 +3083,7 @@ watch(
|
||||
</details>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2791,19 +3172,25 @@ watch(
|
||||
:available-actions="availableActions"
|
||||
:can-confirm-build="canConfirmBuild"
|
||||
:hide-confirm-because-auto-gate="hideConfirmBecauseAutoGate"
|
||||
:show-auto-gate-hint="showAutoGateHint"
|
||||
:show-stp-retry="showStpRetry"
|
||||
:auto-gate-hint="t(autoGateHintKey)"
|
||||
:saving="saving"
|
||||
:is-read-only="isReadOnly"
|
||||
:has-draft="Boolean(activeCase?.draft)"
|
||||
:unsaved-count="unsavedEditCount"
|
||||
:flow-presentation="flowPresentation"
|
||||
:automating="isProcessingAutomating"
|
||||
:actions-executable="workbenchActionsExecutable"
|
||||
:flow-busy="flowActionBusy"
|
||||
@mark-non-order="openActionDialog('non_order')"
|
||||
@mark-quality-issue="openActionDialog('quality_issue')"
|
||||
@reparse="openActionDialog('reparse')"
|
||||
@upload-replacement="selectReplacement"
|
||||
@validate="reportSave(() => validate())"
|
||||
@confirm="openActionDialog('confirm')"
|
||||
@flow-action="onUnifiedProcessingAction"
|
||||
@retry-stp="() => void retryStpAutoCreate()"
|
||||
@flow-action="(item) => { void onUnifiedProcessingAction(item); }"
|
||||
/>
|
||||
|
||||
<ReviewProcessDetailDrawer
|
||||
|
||||
Reference in new issue
Block a user