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

@@ -1,8 +1,8 @@
/**
* features/workspace/shipping-task-center/TaskProgressTimeline.spec.ts
* 用途:锁定任务中心时间线同时消费 Task Event 与 Workflow Event。
* 用途:锁定任务中心时间线仅消费统一 ShippingAuditEvent 条目。
* 依赖:Vitest、@vue/test-utils、TaskProgressTimeline。
* 逻辑:合并排序后两类事件均可见;未知内部码、操作人 ID 与 JSON 详情不展示。
* 逻辑:渲染 auditItems;未知内部码与敏感字段不直出;空态与 loading 态可区分。
*/
import { describe, expect, it } from 'vitest';
import { mount } from '@vue/test-utils';
@@ -15,14 +15,14 @@ const messages = {
shippingNotice: {
events: '事件时间线',
operator: '操作者 {id}',
eventTypes: { system: '系统', task_created: '任务已创建' },
workflowEvents: { stage_changed: '阶段变更', upload_manual_confirmed: '人工上传已登记' },
auditTimeline: {
events: { task_created: '任务已创建' },
},
eventTypes: { system: '系统' },
timeline: {
empty: '暂无事件记录',
detail: '查看详情',
sourceTask: '任务事件',
sourceWorkflow: '文件处理记录',
workflowEvent: '文件处理记录',
loading: '加载中…',
sourceAudit: '审计记录',
updated: '处理状态已更新',
actors: { user: '业务人员', system: '系统' },
},
@@ -32,61 +32,54 @@ const messages = {
};
describe('TaskProgressTimeline', () => {
it('merges task and workflow events and shows workflow actor type/id', () => {
it('renders unified audit items with actor display and source badge', () => {
const i18n = createI18n({ legacy: false, locale: 'zh-CN', messages });
const wrapper = mount(TaskProgressTimeline, {
props: {
events: [
{ event_type: 'task_created', created_at: '2026-07-31T01:00:00Z', actor_id: 1 },
],
workflowEvents: [
items: [
{
seq_no: 1,
event_code: 'upload_manual_confirmed',
actor_type: 'user',
actor_id: '42',
occurred_at: '2026-07-31T01:01:00Z',
id: 1,
event_type: 'task_created',
actor_display: '业务人员',
created_at: '2026-07-31T01:00:00Z',
reason: '任务创建成功',
},
{
id: 2,
event_type: 'upload_rpa_triggered',
actor_type: 'system',
created_at: '2026-07-31T01:01:00Z',
},
],
},
global: { plugins: [i18n] },
});
// 关键断言:时间线同时展示 Task 与 Workflow 事件来源标签,且 Workflow 显示操作人。
expect(wrapper.text()).toContain('任务事件');
expect(wrapper.text()).toContain('文件处理记录');
// 关键断言:统一审计来源标签与本地化事件文案可见。
expect(wrapper.text()).toContain('审计记录');
expect(wrapper.text()).toContain('任务已创建');
expect(wrapper.text()).toContain('人工上传已登记');
expect(wrapper.text()).toContain('处理状态已更新');
expect(wrapper.text()).toContain('操作者 业务人员');
expect(wrapper.text()).not.toContain('user/42');
expect(wrapper.text()).not.toContain('操作者 1');
expect(wrapper.text()).toContain('操作者 系统');
expect(wrapper.text()).toContain('任务创建成功');
expect(wrapper.text()).not.toContain('upload_rpa_triggered');
});
it('does not expose unknown event codes or raw detail JSON', () => {
it('shows empty state when no audit items', () => {
const i18n = createI18n({ legacy: false, locale: 'zh-CN', messages });
const wrapper = mount(TaskProgressTimeline, {
props: {
events: [{
event_type: 'internal_task_event',
actor_id: 99,
detail_json: { node_id: 'node-1', error: 'HTTP 500' },
}],
workflowEvents: [{
seq_no: 2,
event_code: 'internal_workflow_event',
actor_type: 'worker',
actor_id: 'worker-7',
payload: { gate_code: 'quality_gate_internal' },
}],
},
props: { items: [] },
global: { plugins: [i18n] },
});
const text = wrapper.text();
expect(text).toContain('处理状态已更新');
for (const technicalText of [
'internal_task_event', 'internal_workflow_event', 'node_id', 'HTTP 500',
'gate_code', 'quality_gate_internal', 'worker-7',
]) {
expect(text).not.toContain(technicalText);
}
expect(wrapper.text()).toContain('暂无事件记录');
});
it('shows loading placeholder before items arrive', () => {
const i18n = createI18n({ legacy: false, locale: 'zh-CN', messages });
const wrapper = mount(TaskProgressTimeline, {
props: { items: [], loading: true },
global: { plugins: [i18n] },
});
expect(wrapper.text()).toContain('加载中…');
expect(wrapper.text()).not.toContain('暂无事件记录');
});
});