feat(shipping-freight-auto-upload): 新增货代发货Excel连接级自动上传全链路功能
为提升货代上传的自动化程度,减少人工操作,本提交实现完整的连接级自动上传功能,包含以下变更: - 新增数据库迁移与ShippingRpaProfile模型字段,存储连接级上传配置 - 完善RPA自动上传触发、回调与状态管理逻辑,支持三态结果与人工兜底 - 优化聊天界面任务卡片加载与按钮渲染,修复无文案幽灵按钮问题
This commit is contained in:
1 parent
06c18b3c7c
commit
434c04ed2d
30 files changed
+1574
-185
No files matched your search
+77
-1
@@ -2,7 +2,8 @@
|
||||
* features/chat/components/shipping-review/ReviewCurrentProcessingCard.spec.ts
|
||||
* 用途:验证工作台右侧当前任务卡只在需要人工处理时渲染业务动作。
|
||||
* 依赖:Vitest、Vue Test Utils、Vue I18n、ReviewCurrentProcessingCard。
|
||||
* 逻辑:库存自动处理中即使遗留 primary_action,也不得显示编辑正式任务;可重试状态仍保留重试入口。
|
||||
* 逻辑:库存自动处理中即使遗留 primary_action,也不得显示编辑正式任务;可重试状态仍保留重试入口;
|
||||
* loading 是「权威投影读取中」占位:已知阶段照常展示,状态/下一步给中性加载文案(非系统处理中)。
|
||||
*/
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
@@ -38,9 +39,25 @@ const i18n = createI18n({
|
||||
saveOrderAndValidate: '提交订单',
|
||||
currentProcessing: {
|
||||
waitingStart: '等待系统启动',
|
||||
stageLoading: '正在获取最新状态…',
|
||||
statusIdle: '待机',
|
||||
status: '状态',
|
||||
stages: {
|
||||
excel_generating: 'Excel 生成',
|
||||
},
|
||||
},
|
||||
currentTask: {
|
||||
title: '当前任务',
|
||||
labelStage: '当前门禁',
|
||||
statusRunning: '系统处理中',
|
||||
statusWaitingHuman: '待人工处理',
|
||||
statusRetryable: '可重试',
|
||||
statusFailed: '自动处理失败',
|
||||
statusCompleted: '已完成',
|
||||
statusCancelled: '已取消',
|
||||
nextStepTitle: '下一步',
|
||||
nextStepRunning: '系统正在处理,暂不需要人工操作',
|
||||
nextStepUnknown: '状态待确认',
|
||||
nextStepWaitingExternal: '等待外部系统回执,暂不需要人工操作',
|
||||
},
|
||||
},
|
||||
@@ -180,6 +197,23 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
expect(wrapper.text()).not.toContain('edit_draft');
|
||||
});
|
||||
|
||||
it('hides an unlabeled primary action instead of rendering an icon-only ghost button', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'fulfillment_prep',
|
||||
userStatus: 'waiting_human',
|
||||
// 后端下发了动作码,但前端无受控文案(缺失 i18n 映射 / 未登记),
|
||||
// 必须整体隐藏按钮,不能渲染成只有 Bot/RefreshCw 图标的“幽灵按钮”。
|
||||
primaryAction: { code: 'unknown_system_action', i18nKey: 'workspace.shippingNotice.processGate.actionCodes.unknown_system_action' },
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.find('[data-testid="review-current-task-actions"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(false);
|
||||
expect(wrapper.text()).not.toContain('unknown_system_action');
|
||||
});
|
||||
|
||||
it('renders a localized reason instead of an internal blocking code in the next step', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
@@ -233,4 +267,46 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
['retry_inventory_preparation', {}],
|
||||
]);
|
||||
});
|
||||
|
||||
it('keeps the known stage and status while the authoritative projection is still loading', () => {
|
||||
// Case 先到、Projection 后到的过渡窗口:阶段与投影同源(project_stage_for_task),
|
||||
// status 也来自后端 automation 运行态,必须照常展示,不能退回骨架/「正在更新状态」占位。
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
loading: true,
|
||||
stageCode: 'excel_generating',
|
||||
stageLabelKey: 'excel_generating',
|
||||
userStatus: 'running',
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.get('[data-testid="review-current-task-stage"]').text()).toBe('Excel 生成');
|
||||
// loading 只抑制动作,不掩盖真值:运行态照常显示「系统处理中」。
|
||||
expect(wrapper.get('[data-testid="review-current-task-status"]').text()).toBe('系统处理中');
|
||||
expect(wrapper.get('[data-testid="review-current-task-next-step-text"]').text())
|
||||
.toBe('系统正在处理,暂不需要人工操作');
|
||||
});
|
||||
|
||||
it('shows the neutral idle value instead of a skeleton when nothing is actionable yet', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: { loading: true, stageCode: 'excel_generating', stageLabelKey: 'excel_generating' },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
// 空用户态自然落到「待机 / 状态待确认」,与投影稳态一致——不做骨架→真值的二次刷新。
|
||||
expect(wrapper.get('[data-testid="review-current-task-stage"]').text()).toBe('Excel 生成');
|
||||
expect(wrapper.get('[data-testid="review-current-task-status"]').text()).toBe('待机');
|
||||
expect(wrapper.get('[data-testid="review-current-task-next-step-text"]').text()).toBe('状态待确认');
|
||||
});
|
||||
|
||||
it('falls back to a neutral stage placeholder only when no stage is known', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: { loading: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.get('[data-testid="review-current-task-stage"]').text()).toBe('正在获取最新状态…');
|
||||
expect(wrapper.get('[data-testid="review-current-task-status"]').text()).toBe('待机');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user