feat(shipping-notice): 落地 XFA 统一视觉拆分确认门禁与处理投影收敛

闭合拆分预览令牌单次消费、样本 checksum 绑定与确认审计;正式提取改为 bindings-only。
同步统一标注工作台交互,并补齐进度投影/任务中心与迁移文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-06 10:21:25 +08:00
1 parent d2b3d74def
commit 84a881b554
195 files changed
+20269 -3463

No files matched your search

@@ -8,7 +8,10 @@ import { mount, flushPromises } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';
import { createI18n } from 'vue-i18n';
import chatZhCn from '@/locales/zh-CN/chat.json';
import type { ConversationProcessingProjection } from '@/features/chat/types/shipping.api.types';
import type {
ConversationProcessingProjection,
ShippingProcessingProjection,
} from '@/features/chat/types/shipping.api.types';
import ShippingConversationProcessingCard from './ShippingConversationProcessingCard.vue';
const i18n = createI18n({
@@ -64,6 +67,41 @@ function buildProjection(): ConversationProcessingProjection {
};
}
/** 构造任务卡使用的权威统一进度。 */
function buildWorkItem(
taskNo: string,
patch: Partial<ShippingProcessingProjection> = {},
): ShippingProcessingProjection {
return {
workItemType: 'order_task',
workItemNo: taskNo,
sourceType: 'direct_pdf',
rootOrderTaskNo: taskNo,
shippingNoticeNo: null,
conversationId: 'conv-1',
submissionNo: 'SUB-1',
intakeNo: 'INT-1',
status: 'processing',
stage: 'document_parsing',
progressVersion: 1,
lastActivityAt: '2026-08-06T00:00:00Z',
currentGate: null,
availableActions: ['view_details'],
sourceSummary: {
emailSubject: null,
filename: `${taskNo}.pdf`,
documentId: taskNo === 'OT-NEED' ? 1 : 2,
documentCount: 1,
parsedDocumentCount: 1,
candidateCount: 1,
customerName: null,
poNumber: null,
},
childOrderTasks: [],
...patch,
};
}
describe('ShippingConversationProcessingCard', () => {
it('renders needs_action / processing / completed groups, hides history on the right panel', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
@@ -315,4 +353,52 @@ describe('ShippingConversationProcessingCard', () => {
item: { workItemNo: 'SNI-1' },
});
});
it('renders each PDF task with its own compact projection, including completed tasks', async () => {
const projection = buildProjection();
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection,
workItems: [
buildWorkItem('OT-NEED', {
status: 'waiting_review',
stage: 'waiting_review',
}),
buildWorkItem('OT-PROC', {
stage: 'inventory_matching',
}),
buildWorkItem('OT-DONE', {
status: 'completed',
stage: 'completed',
}),
],
},
global: { plugins: [i18n] },
});
await flushPromises();
// 未聚焦时:needs_action/processing 显示紧凑进度;已完成默认收起(UI-05)。
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(2);
expect(wrapper.find('[data-testid="shipping-processing-task-OT-DONE"] [data-testid="sidebar-progress-inline"]').exists()).toBe(false);
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.find('[data-testid="shipping-processing-task-OT-DONE"]').text()).toContain('已完成');
expect(wrapper.findAll('[data-testid="shipping-processing-task-actions"]')).toHaveLength(0);
});
it('maps internal review_case_draft status to a user-facing review label', async () => {
const projection = buildProjection();
projection.needs_action = [{
...projection.needs_action[0],
status_label: 'review_case_draft',
}];
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection },
global: { plugins: [i18n] },
});
await flushPromises();
expect(wrapper.text()).toContain('待复核');
expect(wrapper.text()).not.toContain('review_case_draft');
});
});