feat(shipping-notice): 完成货代发货通知全门禁恢复MVP收口

完成全门禁恢复MVP版本交付:调整自动上传与重试配置,重构正式执行链路;修复多处代码bug,新增测试与审计工具;更新全流程文档与契约规范。
This commit is contained in:
hugo committed 2026-08-11 14:04:39 +08:00
1 parent 8e0bbf7a81
commit c94d173f92
181 files changed
+12947 -1724

No files matched your search

@@ -3,7 +3,7 @@
* 用途:验收右侧任务分组卡——needs_action / processing / 处理记录三子段与动作层级。
* 依赖:Vitest、Vue Test Utils、vue-i18n、ShippingConversationProcessingCard。
* 逻辑:构造 ConversationProcessingProjection;断言分组文案、处理记录折叠与三类子段、
* UI-02 单一详情入口、UI-03 history 截断角标、有 workItem 时无任务级主/次按钮。
* UI-02 单一详情入口、UI-03 history 截断角标、人工 Gate 按钮常驻且不依赖任务焦点。
*/
import { mount, flushPromises } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';
@@ -336,18 +336,50 @@ describe('ShippingConversationProcessingCard', () => {
expect(wrapper.text()).not.toContain('20260803-A13F95D2');
});
it('emits focus only when selecting a task (not viewed)', async () => {
it('selects a task locally without writing focus or viewed events', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection: buildProjection() },
global: { plugins: [i18n] },
});
await flushPromises();
await wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] button').trigger('click');
expect(wrapper.emitted('focus')?.[0]).toEqual(['OT-NEED']);
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').attributes('data-focused')).toBe('1');
expect(wrapper.emitted('focus')).toBeUndefined();
expect(wrapper.emitted('viewed')).toBeUndefined();
expect(wrapper.emitted('expandFiles')).toBeUndefined();
});
it('opens local task details without emitting a viewed write event', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
projection: {
summary: { total_tasks: 1, processing: 0, needs_action: 0, completed: 1, history: 0 },
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] },
});
await flushPromises();
await wrapper.find('[data-testid="shipping-processing-history-toggle"]').trigger('click');
await wrapper.find('[data-testid="shipping-processing-action-view_result"]').trigger('click');
expect(wrapper.emitted('taskAction')?.[0]?.[0]).toMatchObject({
task: { user_task_no: 'OT-DETAIL' },
action: 'view_result',
});
expect(wrapper.emitted('viewed')).toBeUndefined();
});
it('applies visible focus ring on needs_action card when focused', async () => {
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
@@ -464,7 +496,7 @@ describe('ShippingConversationProcessingCard', () => {
});
});
it('hides task-level primary/secondary when workItem exists but keeps expand-files entry', async () => {
it('keeps a human Gate action visible before and after selecting its task', async () => {
const projection = buildProjection();
const wrapper = mount(ShippingConversationProcessingCard, {
props: {
@@ -473,6 +505,12 @@ describe('ShippingConversationProcessingCard', () => {
buildWorkItem('OT-NEED', {
status: 'waiting_review',
stage: 'waiting_review',
currentGate: {
gateCode: 'inventory_matching',
nextActionCode: 'open_inventory_match_review',
blockingReasonCode: 'inventory_match_not_ready',
},
availableActions: ['open_inventory_match_review'],
}),
buildWorkItem('OT-PROC', {
stage: 'inventory_matching',
@@ -483,13 +521,20 @@ describe('ShippingConversationProcessingCard', () => {
});
await flushPromises();
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(1);
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-PROC"]').text()).toContain('库存匹配');
expect(wrapper.findAll('[data-testid="shipping-processing-task-actions"]')).toHaveLength(0);
// UI-02:有 workItem 时仍保留展开文件详情(OT-NEED 为多文件)。
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] [data-testid="shipping-processing-expand-files"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] [data-testid="shipping-processing-action-view_details"]').exists()).toBe(false);
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('库存');
await task.find('button').trigger('click');
await flushPromises();
// 点击仅改变焦点;同一 Gate 的恢复入口必须继续可见。
expect(task.attributes('data-focused')).toBe('1');
expect(task.find('[data-testid="unified-action-primary"]').exists()).toBe(true);
});
it('maps internal review_case_draft status to a user-facing review label', async () => {