feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码

This commit is contained in:
hugo committed 2026-08-23 00:27:18 +08:00
1 parent 935bf26fa6
commit 7cfd5d167e
230 files changed
+9337 -10989

No files matched your search

@@ -22,65 +22,83 @@ const i18n = createI18n({
});
function buildProjection(): ConversationProcessingProjection {
const needsAction = {
user_task_no: 'OT-NEED',
group: 'needs_action' as const,
status_label: 'pending_review',
file_count: 2,
run_no: 'RUN-NEED',
can_append: false,
recently_created: false,
};
const processing = {
user_task_no: 'OT-PROC',
submission_ordinal: 2,
group: 'processing' as const,
status_label: 'extracting',
file_count: 1,
run_no: 'RUN-PROC',
can_append: true,
recently_created: true,
focused: true,
};
const completed = {
user_task_no: 'OT-DONE',
group: 'completed' as const,
status_label: 'completed',
title: 'done.pdf',
file_count: 1,
run_no: 'RUN-DONE',
can_append: false,
available_actions: ['view_details'],
};
const archived = {
user_task_no: 'OT-HIST',
group: 'history' as const,
status_label: 'completed',
file_count: 1,
run_no: 'RUN-HIST',
can_append: false,
viewed: true,
available_actions: ['view_details'],
};
const cancelled = {
user_task_no: 'OT-CANCEL',
group: 'history' as const,
status_label: 'cancelled',
file_count: 1,
run_no: 'RUN-CANCEL',
can_append: false,
viewed: true,
available_actions: ['view_details'],
};
return {
summary: { total_tasks: 3, processing: 1, needs_action: 1, completed: 1, history: 2 },
focused_task_no: 'OT-PROC',
recent_task_no: 'OT-PROC',
needs_action: [{
user_task_no: 'OT-NEED',
group: 'needs_action',
status_label: 'pending_review',
file_count: 2,
run_no: 'RUN-NEED',
can_append: false,
recently_created: false,
}],
processing: [{
user_task_no: 'OT-PROC',
submission_ordinal: 2,
group: 'processing',
status_label: 'extracting',
file_count: 1,
run_no: 'RUN-PROC',
can_append: true,
recently_created: true,
focused: true,
}],
completed: [{
user_task_no: 'OT-DONE',
group: 'completed',
status_label: 'completed',
title: 'done.pdf',
file_count: 1,
run_no: 'RUN-DONE',
can_append: false,
available_actions: ['view_details'],
}],
history: [
{
user_task_no: 'OT-HIST',
group: 'history',
status_label: 'completed',
file_count: 1,
run_no: 'RUN-HIST',
can_append: false,
viewed: true,
available_actions: ['view_details'],
},
{
user_task_no: 'OT-CANCEL',
group: 'history',
status_label: 'cancelled',
file_count: 1,
run_no: 'RUN-CANCEL',
can_append: false,
viewed: true,
available_actions: ['view_details'],
},
],
status_groups: {
failed: [needsAction], waiting_human: [], processing: [processing], completed: [completed],
cancelled: [cancelled], archived: [archived],
},
};
}
/** 测试仅构造权威 status_groups;禁止再把旧四组作为组件输入。 */
function setStatusGroup(
projection: ConversationProcessingProjection,
key: keyof NonNullable<ConversationProcessingProjection['status_groups']>,
tasks: NonNullable<ConversationProcessingProjection['status_groups']>[keyof NonNullable<ConversationProcessingProjection['status_groups']>],
) {
projection.status_groups![key] = tasks;
}
function projectionWithGroups(
summary: ConversationProcessingProjection['summary'],
groups: NonNullable<ConversationProcessingProjection['status_groups']>,
): ConversationProcessingProjection {
return { summary, status_groups: groups };
}
/** 构造任务卡使用的权威统一进度。 */
function buildWorkItem(
taskNo: string,
@@ -119,12 +137,12 @@ function buildWorkItem(
describe('ShippingConversationProcessingCard', () => {
it('only exposes file cancellation when the backend explicitly authorizes cancel_unit', async () => {
const projection = buildProjection();
projection.processing = [{
setStatusGroup(projection, 'processing', [{
user_task_no: 'OT-CANCEL-UNIT', group: 'processing', status_label: 'extracting',
file_count: 1, run_no: 'RUN-CANCEL-UNIT', can_append: false,
objects: [{ kind: 'document', object_key: 'DOC-9', label: 'cancel.pdf', filename: 'cancel.pdf',
document_id: 9, root_document_id: 9, status_label: 'extracting' }],
}];
}]);
const workItem = buildWorkItem('OT-CANCEL-UNIT', {
availableActions: ['cancel_unit'],
sourceSummary: { ...buildWorkItem('OT-CANCEL-UNIT').sourceSummary, documentId: 9 },
@@ -151,12 +169,12 @@ describe('ShippingConversationProcessingCard', () => {
it('does not fall back to legacy cancellation when ui_state revokes it', async () => {
const projection = buildProjection();
projection.processing = [{
setStatusGroup(projection, 'processing', [{
user_task_no: 'OT-CANCEL-REVOKED', group: 'processing', status_label: 'extracting',
file_count: 1, run_no: 'RUN-CANCEL-REVOKED', can_append: false,
objects: [{ kind: 'document', object_key: 'DOC-10', label: 'revoked.pdf', filename: 'revoked.pdf',
document_id: 10, root_document_id: 10, status_label: 'extracting' }],
}];
}]);
const workItem = buildWorkItem('OT-CANCEL-REVOKED', {
availableActions: ['cancel_unit'],
sourceSummary: { ...buildWorkItem('OT-CANCEL-REVOKED').sourceSummary, documentId: 10 },
@@ -181,11 +199,11 @@ describe('ShippingConversationProcessingCard', () => {
it('does not render legacy document_names as a batch file row without a live leaf projection', async () => {
const projection = buildProjection();
projection.processing = [{
setStatusGroup(projection, 'processing', [{
user_task_no: 'OT-HISTORICAL-SNAPSHOT', group: 'processing', status_label: 'extracting',
title: 'legacy-run.pdf', document_names: ['legacy-run.pdf'], file_count: 1,
run_no: 'RUN-HISTORICAL-SNAPSHOT', can_append: false,
}];
}]);
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection, workItems: [], workbenchMode: true },
global: { plugins: [i18n] },
@@ -199,7 +217,7 @@ describe('ShippingConversationProcessingCard', () => {
it('uses the live leaf summary instead of a stale task object in batch mode', async () => {
const projection = buildProjection();
projection.processing = [{
setStatusGroup(projection, 'processing', [{
user_task_no: 'OT-LIVE-LEAF', group: 'processing', status_label: 'extracting',
title: 'snapshot-old-name.pdf', file_count: 1, run_no: 'RUN-LIVE-LEAF', can_append: false,
objects: [{
@@ -207,7 +225,7 @@ describe('ShippingConversationProcessingCard', () => {
filename: 'snapshot-old-name.pdf', document_id: 88, root_document_id: 88,
status_label: 'pending_review',
}],
}];
}]);
const live = buildWorkItem('OT-LIVE-LEAF', {
runNo: 'RUN-LIVE-LEAF',
sourceSummary: {
@@ -235,12 +253,12 @@ describe('ShippingConversationProcessingCard', () => {
it('expands EML files only from the live aggregate work item', async () => {
const projection = buildProjection();
projection.processing = [{
setStatusGroup(projection, 'processing', [{
user_task_no: 'INTAKE:EML-LIVE', group: 'processing', status_label: 'extracting',
title: 'snapshot-mail.eml', document_names: ['snapshot-attachment.pdf'],
file_count: 1, run_no: 'RUN-EML-LIVE', can_append: false,
aggregateChildren: [],
}];
}]);
const liveChild = buildWorkItem('DOCUMENT:77', {
sourceType: 'eml', rootOrderTaskNo: 'OT-EML-LIVE', runNo: 'RUN-EML-LIVE',
sourceSummary: {
@@ -275,12 +293,49 @@ describe('ShippingConversationProcessingCard', () => {
expect(wrapper.text()).not.toContain('snapshot-attachment.pdf');
});
it('counts only stage-filtered EML leaves in the batch status heading', async () => {
const projection = buildProjection();
setStatusGroup(projection, 'processing', [{
user_task_no: 'INTAKE:MIXED-STAGES', group: 'processing', status_label: 'extracting',
title: 'mixed-stages.eml', file_count: 2, run_no: 'RUN-MIXED-STAGES', can_append: false,
}]);
const orderReviewLeaf = buildWorkItem('DOCUMENT:401', {
sourceType: 'eml', rootOrderTaskNo: 'OT-MIXED-STAGES',
sourceSummary: { ...buildWorkItem('DOCUMENT:401').sourceSummary, documentId: 401, filename: 'review.pdf' },
uiState: {
status: 'waiting_human', stage: 'waiting_review', lifecycleStage: 'order_review',
lifecycleEntries: [], blocking_reason: null, primary_action: null, secondary_actions: [],
},
});
const freightLeaf = buildWorkItem('DOCUMENT:402', {
sourceType: 'eml', rootOrderTaskNo: 'OT-MIXED-STAGES',
sourceSummary: { ...buildWorkItem('DOCUMENT:402').sourceSummary, documentId: 402, filename: 'upload.xlsx' },
uiState: {
status: 'running', stage: 'freight_uploading', lifecycleStage: 'freight_upload',
lifecycleEntries: [], blocking_reason: null, primary_action: null, secondary_actions: [],
},
});
const root = buildWorkItem('INTAKE:MIXED-STAGES', {
sourceType: 'eml', rootOrderTaskNo: 'OT-MIXED-STAGES',
aggregateChildren: [orderReviewLeaf, freightLeaf],
});
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection, workItems: [root], workbenchMode: true, lifecycleFilter: 'order_review' },
global: { plugins: [i18n] },
});
await flushPromises();
// 阶段卡与列表标题必须消费同一批可见叶子,不能把同一 EML 的其它阶段附件混入。
expect(wrapper.get('[data-testid="shipping-processing-group-processing"]').text()).toContain('1 个文件');
expect(wrapper.get('[data-testid="shipping-processing-group-processing"]').text()).not.toContain('2 个文件');
});
it('keeps an EML attachment when it has a linked child order task', async () => {
const projection = buildProjection();
projection.processing = [{
setStatusGroup(projection, 'processing', [{
user_task_no: 'INTAKE:EML-WITH-CHILD-OT', group: 'processing', status_label: 'extracting',
title: 'mail.eml', file_count: 2, run_no: 'RUN-EML-WITH-CHILD-OT', can_append: false,
}];
}]);
const firstAttachment = buildWorkItem('OT-EML-WITH-CHILD-OT', {
sourceType: 'eml', rootOrderTaskNo: 'OT-EML-WITH-CHILD-OT',
sourceSummary: {
@@ -416,9 +471,9 @@ describe('ShippingConversationProcessingCard', () => {
it('uses expand-files as the only detail entry when canExpandFileDetails', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 1, processing: 0, needs_action: 1, completed: 0, history: 0 },
needs_action: [{
projection: projectionWithGroups(
{ total_tasks: 1, processing: 0, needs_action: 1, completed: 0, history: 0 }, {
failed: [{
user_task_no: 'OT-MULTI',
group: 'needs_action',
status_label: 'pending_review',
@@ -429,11 +484,8 @@ describe('ShippingConversationProcessingCard', () => {
run_no: 'RUN-MULTI',
can_append: false,
available_actions: ['view_details', 'cancel_task'],
}],
processing: [],
completed: [],
history: [],
},
}], waiting_human: [], processing: [], completed: [], cancelled: [], archived: [],
}),
},
global: { plugins: [i18n] },
});
@@ -455,9 +507,9 @@ describe('ShippingConversationProcessingCard', () => {
it('shows view_details when task cannot expand file details, and keeps cancel as overflow', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 1, processing: 0, needs_action: 1, completed: 0, history: 0 },
needs_action: [{
projection: projectionWithGroups(
{ total_tasks: 1, processing: 0, needs_action: 1, completed: 0, history: 0 }, {
failed: [{
user_task_no: 'OT-SINGLE',
group: 'needs_action',
status_label: 'pending_review',
@@ -466,11 +518,8 @@ describe('ShippingConversationProcessingCard', () => {
can_append: false,
available_actions: ['view_details', 'cancel_task'],
objects: [],
}],
processing: [],
completed: [],
history: [],
},
}], waiting_human: [], processing: [], completed: [], cancelled: [], archived: [],
}),
},
global: { plugins: [i18n] },
});
@@ -485,9 +534,9 @@ describe('ShippingConversationProcessingCard', () => {
it('shows multi-document title from authoritative projection without workflow fallback', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 1, total_files: 2, processing: 0, needs_action: 1, completed: 0, history: 0 },
needs_action: [{
projection: projectionWithGroups(
{ total_tasks: 1, total_files: 2, processing: 0, needs_action: 1, completed: 0, history: 0 }, {
failed: [{
user_task_no: 'OT-MULTI',
group: 'needs_action',
status_label: 'pending_review',
@@ -499,11 +548,8 @@ describe('ShippingConversationProcessingCard', () => {
can_append: false,
available_actions: ['view_details', 'cancel_task'],
objects: [],
}],
processing: [],
completed: [],
history: [],
},
}], waiting_human: [], processing: [], completed: [], cancelled: [], archived: [],
}),
},
global: { plugins: [i18n] },
});
@@ -518,10 +564,9 @@ describe('ShippingConversationProcessingCard', () => {
it('uses unified order recognition title instead of internal OT number', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 1, processing: 1, needs_action: 0, completed: 0, history: 0 },
needs_action: [],
processing: [{
projection: projectionWithGroups(
{ total_tasks: 1, processing: 1, needs_action: 0, completed: 0, history: 0 }, {
failed: [], waiting_human: [], processing: [{
user_task_no: 'OT-20260803-A13F95D2',
group: 'processing',
status_label: 'processing',
@@ -529,10 +574,8 @@ describe('ShippingConversationProcessingCard', () => {
file_count: 1,
run_no: 'SNER-X',
can_append: false,
}],
completed: [],
history: [],
},
}], completed: [], cancelled: [], archived: [],
}),
},
global: { plugins: [i18n] },
});
@@ -558,16 +601,17 @@ describe('ShippingConversationProcessingCard', () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 1, processing: 0, needs_action: 0, completed: 1, history: 0 },
...projectionWithGroups(
{ total_tasks: 1, processing: 0, needs_action: 0, completed: 1, history: 0 }, {
failed: [], waiting_human: [], processing: [], completed: [{
user_task_no: 'OT-DETAIL', group: 'completed', status_label: 'completed',
file_count: 1, run_no: 'RUN-DETAIL', can_append: false,
available_actions: ['view_details'],
}], cancelled: [], archived: [],
},
),
focused_task_no: null,
recent_task_no: null,
needs_action: [],
completed: [{
user_task_no: 'OT-DETAIL', group: 'completed', status_label: 'completed',
file_count: 1, run_no: 'RUN-DETAIL', can_append: false,
available_actions: ['view_details'],
}],
processing: [], history: [],
},
},
global: { plugins: [i18n] },
@@ -609,10 +653,13 @@ describe('ShippingConversationProcessingCard', () => {
props: {
projection: {
...buildProjection(),
needs_action: [{
...buildProjection().needs_action[0],
available_actions: ['view_details', 'open_review', 'cancel_task'],
}],
status_groups: {
...buildProjection().status_groups!,
failed: [{
...buildProjection().status_groups!.failed[0],
available_actions: ['view_details', 'open_review', 'cancel_task'],
}],
},
},
},
global: { plugins: [i18n] },
@@ -632,12 +679,10 @@ describe('ShippingConversationProcessingCard', () => {
}));
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 20, processing: 20, needs_action: 0, history: 0 },
needs_action: [],
processing,
history: [],
},
projection: projectionWithGroups(
{ total_tasks: 20, processing: 20, needs_action: 0, history: 0 },
{ failed: [], waiting_human: [], processing, completed: [], cancelled: [], archived: [] },
),
},
global: { plugins: [i18n] },
});
@@ -649,9 +694,9 @@ describe('ShippingConversationProcessingCard', () => {
it('renders an EML order_intake in the unified failed group rather than the removed intake side path', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 1, total_files: 1, processing: 0, needs_action: 1, completed: 0, history: 0 },
needs_action: [{
projection: projectionWithGroups(
{ total_tasks: 1, total_files: 1, processing: 0, needs_action: 1, completed: 0, history: 0 }, {
failed: [{
user_task_no: 'SNI-1',
group: 'needs_action',
userGroup: 'failed',
@@ -660,11 +705,8 @@ describe('ShippingConversationProcessingCard', () => {
file_count: 1,
run_no: null,
can_append: false,
}],
processing: [],
completed: [],
history: [],
},
}], waiting_human: [], processing: [], completed: [], cancelled: [], archived: [],
}),
workItems: [{
workItemType: 'order_intake',
workItemNo: 'SNI-1',
@@ -687,6 +729,15 @@ describe('ShippingConversationProcessingCard', () => {
attemptNo: 2,
},
availableActions: ['view_details', 'retry_parse'],
uiState: {
status: 'failed',
stage: 'document_parsing',
lifecycleStage: 'intake_parse',
lifecycleEntries: [],
blocking_reason: { code: 'SHIPPING_NOTICE.INTAKE_PARSE_FAILED' },
primary_action: { code: 'retry_parse', i18nKey: null, parameters: {}, executionMode: 'immediate' },
secondary_actions: [],
},
sourceSummary: {
emailSubject: null,
filename: 'po.pdf',
@@ -708,7 +759,9 @@ describe('ShippingConversationProcessingCard', () => {
expect(wrapper.find('[data-testid="shipping-processing-group-failed"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="shipping-processing-task-SNI-1"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="shipping-processing-group-order-intake"]').exists()).toBe(false);
expect(wrapper.text()).toContain('重试解析');
// Intake retry_parse 与 Case reparse 对用户统一展示为“重新解析”;
// 后端 action_code 仍保留不同对象边界与执行接口。
expect(wrapper.text()).toContain('重新解析');
});
it('keeps a human Gate action visible before and after selecting its task', async () => {
@@ -726,6 +779,15 @@ describe('ShippingConversationProcessingCard', () => {
blockingReasonCode: 'inventory_match_not_ready',
},
availableActions: ['open_inventory_match_review'],
uiState: {
status: 'waiting_human',
stage: 'waiting_review',
lifecycleStage: 'order_review',
lifecycleEntries: [],
blocking_reason: { code: 'inventory_match_not_ready' },
primary_action: { code: 'open_inventory_match_review', i18nKey: null, parameters: {}, executionMode: 'immediate' },
secondary_actions: [],
},
}),
buildWorkItem('OT-PROC', {
stage: 'inventory_matching',
@@ -737,12 +799,12 @@ describe('ShippingConversationProcessingCard', () => {
await flushPromises();
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(2);
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').text()).toContain('待复核');
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').text()).toContain('待人工处理');
expect(wrapper.find('[data-testid="shipping-processing-task-OT-PROC"]').text()).toContain('库存匹配');
expect(wrapper.findAll('[data-testid="shipping-processing-task-actions"]')).toHaveLength(0);
const task = wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]');
expect(task.find('[data-testid="unified-action-primary"]').exists()).toBe(true);
expect(task.find('[data-testid="unified-action-primary"]').text()).toContain('库存');
expect(task.find('[data-testid="unified-action-primary"]').text()).toContain('open_inventory_match_review');
await task.find('button').trigger('click');
await flushPromises();
@@ -754,10 +816,10 @@ describe('ShippingConversationProcessingCard', () => {
it('maps internal review_case_draft status to a user-facing review label', async () => {
const projection = buildProjection();
projection.needs_action = [{
...projection.needs_action[0],
setStatusGroup(projection, 'failed', [{
...projection.status_groups!.failed[0],
status_label: 'review_case_draft',
}];
}]);
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection },
global: { plugins: [i18n] },
@@ -771,12 +833,12 @@ describe('ShippingConversationProcessingCard', () => {
it('renders a compact V3 file row with named lifecycle entries', async () => {
const projection = buildProjection();
projection.processing = [{
...projection.processing[0],
setStatusGroup(projection, 'processing', [{
...projection.status_groups!.processing[0],
user_task_no: 'OT-LIFECYCLE',
run_no: 'RUN-LIFECYCLE',
file_count: 1,
}];
}]);
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection,
@@ -798,7 +860,7 @@ describe('ShippingConversationProcessingCard', () => {
status: 'running',
stage: 'inventory_match',
lifecycleStage: 'fulfillment_prep',
lifecycleEntries: [
lifecycle_entries: [
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
{ code: 'fulfillment_prep', state: 'current', targetSurface: 'order_lifecycle_workbench' },
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
@@ -819,20 +881,71 @@ describe('ShippingConversationProcessingCard', () => {
expect(row.text()).toContain('lifecycle.pdf');
expect(row.text()).toContain('PO:PO-LIFECYCLE');
expect(row.text()).toContain('通知准备');
expect(row.text()).toContain('订单复核 · 可进入');
expect(row.text()).toContain('通知准备 · 当前可处理');
expect(row.text()).toContain('货代上传 · 前置未完成');
expect(row.text()).toContain('通知完成 · 前置未完成');
expect(row.text()).toContain('当前阶段:通知准备');
});
it('keeps the file action slot for a real action but not for duplicate lifecycle navigation', async () => {
const projection = buildProjection();
setStatusGroup(projection, 'processing', [{
...projection.status_groups!.processing[0],
user_task_no: 'OT-FILE-ACTION', run_no: 'RUN-FILE-ACTION', file_count: 1,
}]);
const navigationOnly = buildWorkItem('OT-FILE-ACTION', {
runNo: 'RUN-FILE-ACTION',
sourceSummary: { ...buildWorkItem('OT-FILE-ACTION').sourceSummary, documentId: 31 },
uiState: {
status: 'waiting_human', stage: 'order_review', lifecycleStage: 'order_review',
lifecycleEntries: [{ code: 'order_review', state: 'current', targetSurface: 'order_lifecycle_workbench' }],
blocking_reason: null,
primary_action: {
code: 'open_order_review', i18nKey: null, parameters: {}, executionMode: 'navigate',
targetSurface: 'order_lifecycle_workbench', targetLifecycleStage: 'order_review',
},
secondary_actions: [],
},
});
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection, workItems: [navigationOnly], workbenchMode: true },
global: { plugins: [i18n] },
});
await flushPromises();
const row = wrapper.get('[data-testid="shipping-processing-file-DOC-31"]');
expect(row.text()).not.toContain('进入订单复核');
await wrapper.setProps({
workItems: [buildWorkItem('OT-FILE-ACTION', {
runNo: 'RUN-FILE-ACTION',
sourceSummary: { ...buildWorkItem('OT-FILE-ACTION').sourceSummary, documentId: 31 },
uiState: {
status: 'waiting_human', stage: 'order_review', lifecycleStage: 'order_review',
lifecycleEntries: [{ code: 'order_review', state: 'current', targetSurface: 'order_lifecycle_workbench' }],
blocking_reason: null,
primary_action: {
code: 'create_draft', i18nKey: null, parameters: {}, executionMode: 'navigate',
targetSurface: 'order_lifecycle_workbench', targetLifecycleStage: 'order_review',
},
secondary_actions: [],
},
})],
});
await flushPromises();
expect(row.text()).toContain('创建草稿');
await row.find('button').trigger('click');
expect(wrapper.emitted('projectionAction')?.[0]?.[0]).toMatchObject({
item: { actionCode: 'create_draft' },
});
});
it('fails closed when a lifecycle entry has an unknown backend state', async () => {
const projection = buildProjection();
projection.processing = [{
...projection.processing[0],
setStatusGroup(projection, 'processing', [{
...projection.status_groups!.processing[0],
user_task_no: 'OT-LIFECYCLE-UNKNOWN',
run_no: 'RUN-LIFECYCLE-UNKNOWN',
file_count: 1,
}];
}]);
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection,
@@ -853,7 +966,7 @@ describe('ShippingConversationProcessingCard', () => {
status: 'running',
stage: 'inventory_match',
lifecycleStage: 'fulfillment_prep',
lifecycleEntries: [
lifecycle_entries: [
{ code: 'order_review', state: 'paused', targetSurface: 'order_lifecycle_workbench' },
] as unknown as ShippingProcessingProjection['uiState']['lifecycleEntries'],
blocking_reason: null,
@@ -867,9 +980,6 @@ describe('ShippingConversationProcessingCard', () => {
await flushPromises();
const row = wrapper.find('[data-testid="shipping-processing-file-DOC-10"]');
const orderReview = row.findAll('button').find((button) => button.text().includes('订单复核'));
expect(orderReview?.attributes('disabled')).toBeDefined();
await orderReview?.trigger('click');
expect(wrapper.emitted('openLifecycleStage')).toBeUndefined();
expect(row.findAll('button')).toHaveLength(0);
});
});