feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-06 10:18:37 +08:00
1 parent 3a9fbac2fc
commit d2b3d74def
571 files changed
+78064 -24681

No files matched your search

@@ -60,6 +60,7 @@ const reviewRun = ref({
},
],
});
const workItem = ref<Record<string, any> | null>(null);
const activeCase = ref({
case_no: 'CASE-1',
@@ -78,6 +79,15 @@ const activeCase = ref({
required: true,
options: [],
},
{
field_id: 'fld-inventory-source-hint',
field_code: 'inventory_source_hint',
display_name: '库存源线索',
scope: 'line',
value_type: 'string',
required: false,
options: [],
},
],
},
draft: {
@@ -86,7 +96,11 @@ const activeCase = ref({
values: { 'fld-po': { value: 'PO-1', source: 'machine' } },
machine_fields: [{ field_id: 'fld-po', observations: [{ value: 'PO-1' }] }],
},
lines: [],
lines: [{
line_key: 'LINE-1',
values: {},
machine_fields: [],
}],
issues: [],
},
process_gate: null,
@@ -107,7 +121,7 @@ vi.mock('@/features/chat/shipping-review/useShippingOrderReview', () => ({
useShippingOrderReview: () => ({
reviewRun,
activeCase,
workItem: ref(null),
workItem,
versions: ref([]),
statusMessage: ref(null),
draftConflict: ref(null),
@@ -168,10 +182,20 @@ vi.mock('@/features/chat/shipping-review/useShippingOrderReview', () => ({
editable: computed(() => true),
showWorkflowProgress: computed(() => false),
workflowProgressPolling: computed(() => false),
shippingProcessingProjection: ref(null),
shippingProcessingLoading: ref(false),
shippingProcessingError: ref(null),
refreshShippingProcessing: vi.fn(),
reparseProgressActive: computed(() => false),
reparseProgressPolling: computed(() => false),
reparseProgressRefreshFailed: computed(() => false),
reparseProgressStage: computed(() => 'submitted'),
reparseLastStableStage: computed(() => 'submitted'),
reparseRunStatus: computed(() => 'queued'),
reparseLastActivityAt: computed(() => null),
reparseLastRefreshedAt: computed(() => null),
reparseStalePolls: computed(() => 0),
refreshReparseProgress: vi.fn(),
}),
}));
@@ -196,10 +220,15 @@ vi.mock('@/features/chat/components/shipping-review/ReviewDocumentEvidenceDrawer
vi.mock('../components/shipping-review/ReviewBuildEligibilitySummary.vue', () => ({
default: {
name: 'ReviewBuildEligibilitySummary',
emits: ['open-details'],
props: ['eligibility', 'exceptionCount', 'exceptionOrdinal'],
emits: ['open-details', 'navigate-exception'],
template:
'<div data-testid="mock-eligibility-summary">'
+ '<button data-testid="review-open-eligibility-details" @click="$emit(\'open-details\')">详情</button>'
+ '<div v-if="exceptionCount" data-testid="review-exception-nav">'
+ '<button data-testid="review-exception-prev" @click="$emit(\'navigate-exception\', -1)">上一</button>'
+ '<button data-testid="review-exception-next" @click="$emit(\'navigate-exception\', 1)">下一</button>'
+ '</div>'
+ '</div>',
},
}));
@@ -314,6 +343,8 @@ async function mountView() {
confirmCreate: '确认并建单',
restoreMachine: '恢复',
moreFields: '更多 {count}',
moreLineFields: '更多列 {count}',
collapseFields: '收起',
addLine: '新增行',
emptyValue: '空',
valueSources: { machine: '系统' },
@@ -360,6 +391,11 @@ async function mountView() {
saveFailed: '失败',
versionConflict: { badge: '冲突' },
statusBanner: { unknown: '未知' },
reparseFailedVersion: {
notice: 'V{failedVersion} 重新识别失败,失败阶段:{stage}。当前展示并可继续复核:V{displayedVersion}。',
unknownStage: '未知阶段',
stages: { layout_parsing: '解析 PDF 页面与表格' },
},
reparseProgress: {
title: '重识别',
subtitle: '',
@@ -451,6 +487,40 @@ describe('ShippingOrderReviewView layout phase 1', () => {
beforeEach(() => {
vi.clearAllMocks();
resetActiveCaseFixture();
workItem.value = null;
});
it('shows restored version as current and latest version only as failed attempt', async () => {
workItem.value = {
item_no: 'WFI-1',
current_version_no: 4,
lifecycle_status: 'reparse_failed',
displayed_version: { version_no: 3, run_no: 'RUN-3', case_no: 'CASE-1', status: 'restored' },
latest_attempt: {
version_no: 4,
run_no: 'RUN-4',
status: 'failed',
failure_stage: 'layout_parsing',
error_code: 'SHIPPING_NOTICE.ORDER_EXTRACTION_LAYOUT_FAILED',
},
};
const wrapper = await mountView();
const notice = wrapper.find('[data-testid="review-reparse-failed-version-notice"]');
expect(notice.text()).toContain('V4 重新识别失败');
expect(notice.text()).toContain('解析 PDF 页面与表格');
expect(notice.text()).toContain('V3');
// 关键断言:顶栏当前版本跟随旧成功结果 V3,禁止把旧字段标成失败尝试 V4。
expect(wrapper.text()).toContain('WFI-1');
expect(wrapper.text()).toContain('V3');
});
it('does not show reparse-failure version notice for normal review', async () => {
workItem.value = {
item_no: 'WFI-1', current_version_no: 3, lifecycle_status: 'pending_review',
};
const wrapper = await mountView();
expect(wrapper.find('[data-testid="review-reparse-failed-version-notice"]').exists()).toBe(false);
});
it('renders main editor + summary rail without chat context toggle', async () => {
@@ -459,7 +529,8 @@ describe('ShippingOrderReviewView layout phase 1', () => {
expect(wrapper.find('[data-testid="review-main-editor"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="review-build-gate-rail"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="review-document-navigation"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="review-workbench-mode"]').exists()).toBe(true);
// 标准复核不展示仅含标题的空模式条,避免占用主编辑区高度。
expect(wrapper.find('[data-testid="review-workbench-mode"]').exists()).toBe(false);
expect(wrapper.text()).not.toContain('对话上下文');
expect(wrapper.html()).not.toContain('showContext');
expect(wrapper.html()).not.toContain('hideContext');
@@ -476,6 +547,15 @@ describe('ShippingOrderReviewView layout phase 1', () => {
expect(wrapper.find('[data-testid="review-confirm-create"]').exists()).toBe(true);
});
it('renders empty optional schema fields as editable line columns', async () => {
const wrapper = await mountView();
const inputs = wrapper.findAll('[data-testid="review-line-field-input"]');
// 关键断言:库存源线索即使非必填且尚无机器值,也必须作为 Schema 列显示并可编辑。
expect(wrapper.text()).toContain('库存源线索');
expect(inputs).toHaveLength(1);
expect(inputs[0].attributes('disabled')).toBeUndefined();
});
it('does not render resident AI card without focused field', async () => {
const wrapper = await mountView();
expect(wrapper.find('[data-testid="review-llm-field-entry"]').exists()).toBe(false);
@@ -512,7 +592,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
expect(wrapper.find('[data-testid="review-document-evidence-drawer"]').exists()).toBe(true);
});
it('navigates exception fields from draft issues banner', async () => {
it('navigates exception fields from the summary rail', async () => {
activeCase.value = {
...activeCase.value,
draft: {
File diff suppressed because it is too large. Load diff