feat(shipping-notice): 优化货运订单履约流程与用户体验
- 优化聊天附件列表为横向可滚动布局并新增配套测试用例 - 移除自动填充默认用户消息逻辑,空备注时不再伪造默认正文 - 修复流程Gate动作展示逻辑,隐藏历史遗留操作与自动阶段无效按钮 - 完善库存匹配重试与订单快照冻结校验流程 - 优化进度展示优先级,优先显示人工待处理状态 - 移除Excel导出自动推导金额逻辑,强制使用Schema配置字段 - 新增货代通用报表RPA详细设计文档 - 更新相关测试用例与断言逻辑
This commit is contained in:
1 parent
dc282f3b1d
commit
11cef575b4
51 files changed
+2197
-112
No files matched your search
@@ -103,6 +103,46 @@ const attachmentUrlInputRef = ref<HTMLInputElement | null>(null);
|
||||
const showAttachmentMenu = ref(false);
|
||||
const showAttachmentUrlPanel = ref(false);
|
||||
const attachmentUrlInput = ref('');
|
||||
const attachmentScrollerRef = ref<HTMLElement | null>(null);
|
||||
const attachmentCanScrollLeft = ref(false);
|
||||
const attachmentCanScrollRight = ref(false);
|
||||
let attachmentDragStartX = 0;
|
||||
let attachmentDragScrollLeft = 0;
|
||||
let attachmentDragging = false;
|
||||
|
||||
/** 同步附件横向带的左右可滚动状态,供箭头按钮和无障碍状态使用。 */
|
||||
function updateAttachmentScrollState() {
|
||||
const element = attachmentScrollerRef.value;
|
||||
if (!element) return;
|
||||
attachmentCanScrollLeft.value = element.scrollLeft > 1;
|
||||
attachmentCanScrollRight.value = element.scrollLeft + element.clientWidth < element.scrollWidth - 1;
|
||||
}
|
||||
|
||||
/** 按固定步长移动附件横向带,避免大量附件撑高输入区。 */
|
||||
function scrollAttachments(direction: 'left' | 'right') {
|
||||
attachmentScrollerRef.value?.scrollBy({ left: direction === 'left' ? -320 : 320, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
/** 开始桌面端指针拖拽;触摸端交给原生横向滚动,避免手势冲突。 */
|
||||
function startAttachmentDrag(event: PointerEvent) {
|
||||
const element = attachmentScrollerRef.value;
|
||||
if (!element || event.pointerType === 'touch') return;
|
||||
attachmentDragging = true;
|
||||
attachmentDragStartX = event.clientX;
|
||||
attachmentDragScrollLeft = element.scrollLeft;
|
||||
element.setPointerCapture?.(event.pointerId);
|
||||
}
|
||||
|
||||
/** 根据指针位移更新附件横向滚动位置。 */
|
||||
function moveAttachmentDrag(event: PointerEvent) {
|
||||
if (!attachmentDragging || !attachmentScrollerRef.value) return;
|
||||
attachmentScrollerRef.value.scrollLeft = attachmentDragScrollLeft - (event.clientX - attachmentDragStartX);
|
||||
}
|
||||
|
||||
/** 结束附件横向拖拽并恢复普通指针状态。 */
|
||||
function stopAttachmentDrag() {
|
||||
attachmentDragging = false;
|
||||
}
|
||||
|
||||
/** 当前发货通知是否仍在上传或预解析,决定输入框下方的操作提示。 */
|
||||
const hasShippingNoticeInProgress = computed(() => props.attachments.some(
|
||||
@@ -321,11 +361,14 @@ const handleDocumentPointerDown = (event: MouseEvent | TouchEvent) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(updateAttachmentScrollState);
|
||||
window.addEventListener('resize', updateAttachmentScrollState);
|
||||
document.addEventListener('mousedown', handleDocumentPointerDown);
|
||||
document.addEventListener('touchstart', handleDocumentPointerDown, { passive: true });
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', updateAttachmentScrollState);
|
||||
document.removeEventListener('mousedown', handleDocumentPointerDown);
|
||||
document.removeEventListener('touchstart', handleDocumentPointerDown);
|
||||
});
|
||||
@@ -416,12 +459,24 @@ watch(
|
||||
<div
|
||||
v-if="attachments.length > 0"
|
||||
data-testid="chat-attachment-list"
|
||||
class="flex flex-wrap gap-2 px-2.5 pb-2 pt-1"
|
||||
class="relative flex items-center gap-1 px-2.5 pb-2 pt-1"
|
||||
>
|
||||
<button v-if="attachmentCanScrollLeft" type="button" class="z-10 shrink-0 rounded-full border border-default bg-surface p-1 text-muted shadow-sm" aria-label="向左查看附件" @click="scrollAttachments('left')">‹</button>
|
||||
<div
|
||||
ref="attachmentScrollerRef"
|
||||
class="flex min-w-0 flex-1 flex-nowrap gap-2 overflow-x-auto pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
||||
:class="attachmentDragging ? 'cursor-grabbing select-none' : 'cursor-grab'"
|
||||
@scroll="updateAttachmentScrollState"
|
||||
@pointerdown="startAttachmentDrag"
|
||||
@pointermove="moveAttachmentDrag"
|
||||
@pointerup="stopAttachmentDrag"
|
||||
@pointercancel="stopAttachmentDrag"
|
||||
@pointerleave="stopAttachmentDrag"
|
||||
>
|
||||
<article
|
||||
v-for="a in attachments"
|
||||
:key="a.id"
|
||||
class="group relative flex min-w-0 basis-full items-center gap-3 rounded-xl px-3 py-2.5 transition-colors sm:basis-[calc(50%-0.25rem)] lg:max-w-[310px]"
|
||||
class="group relative flex h-[68px] w-[250px] shrink-0 items-center gap-3 rounded-xl px-3 py-2.5 transition-colors"
|
||||
:class="isProcurementContractAgent && a.kind === 'local'
|
||||
? 'border border-[#9cc7f2] bg-[#eef6ff]'
|
||||
: 'border border-default bg-surface-soft'"
|
||||
@@ -522,6 +577,8 @@ watch(
|
||||
<X class="h-3.5 w-3.5" />
|
||||
</button>
|
||||
</article>
|
||||
</div>
|
||||
<button v-if="attachmentCanScrollRight" type="button" class="z-10 shrink-0 rounded-full border border-default bg-surface p-1 text-muted shadow-sm" aria-label="向右查看附件" @click="scrollAttachments('right')">›</button>
|
||||
</div>
|
||||
|
||||
<input
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import ChatMessageAttachmentList from './ChatMessageAttachmentList.vue';
|
||||
|
||||
describe('ChatMessageAttachmentList', () => {
|
||||
it('keeps many sent attachments in a single horizontally scrollable row', () => {
|
||||
const wrapper = mount(ChatMessageAttachmentList, {
|
||||
props: {
|
||||
attachments: [
|
||||
{ name: 'one.eml', type: 'document', source: 'local', size: 1024, extension: 'eml' },
|
||||
{ name: 'two.eml', type: 'document', source: 'local', size: 2048, extension: 'eml' },
|
||||
{ name: 'three.eml', type: 'document', source: 'local', size: 3072, extension: 'eml' },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const list = wrapper.get('[data-testid="chat-message-attachment-list"]');
|
||||
expect(list.classes()).toContain('overflow-x-auto');
|
||||
expect(list.classes()).toContain('flex-nowrap');
|
||||
expect(wrapper.findAll('article')).toHaveLength(3);
|
||||
});
|
||||
});
|
||||
@@ -35,12 +35,12 @@ function attachmentBadge(attachment: ChatMessageAttachment): string {
|
||||
<div
|
||||
v-if="attachments.length > 0"
|
||||
data-testid="chat-message-attachment-list"
|
||||
class="mb-2 flex w-full flex-wrap justify-end gap-2"
|
||||
class="mb-2 flex w-full flex-nowrap justify-end gap-2 overflow-x-auto pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
<article
|
||||
v-for="(attachment, attachmentIndex) in attachments"
|
||||
:key="`${attachment.name}-${attachment.size ?? 'unknown'}-${attachmentIndex}`"
|
||||
class="flex min-w-0 basis-full items-center gap-2.5 rounded-xl border border-default bg-surface px-3 py-2.5 shadow-sm dark:bg-slate-900 sm:basis-[calc(50%-0.25rem)] sm:min-w-[220px] sm:max-w-[290px]"
|
||||
class="flex h-[68px] w-[250px] shrink-0 items-center gap-2.5 rounded-xl border border-default bg-surface px-3 py-2.5 shadow-sm dark:bg-slate-900"
|
||||
:title="attachment.name"
|
||||
>
|
||||
<div
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewCurrentProcessingCard.spec.ts
|
||||
* 用途:验证工作台右侧当前任务卡只在需要人工处理时渲染业务动作。
|
||||
* 依赖:Vitest、Vue Test Utils、Vue I18n、ReviewCurrentProcessingCard。
|
||||
* 逻辑:库存自动处理中即使遗留 primary_action,也不得显示编辑正式任务;可重试状态仍保留重试入口。
|
||||
*/
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import ReviewCurrentProcessingCard from './ReviewCurrentProcessingCard.vue';
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching': '重新库存匹配',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
describe('ReviewCurrentProcessingCard', () => {
|
||||
it('hides a legacy primary action while inventory preparation is running', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_preparation',
|
||||
userStatus: 'running',
|
||||
primaryAction: { code: 'edit_formal_task', i18nKey: 'edit_formal_task' },
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
// 自动处理只显示状态,不能让历史的正式任务编辑动作干扰当前库存阶段。
|
||||
expect(wrapper.find('[data-testid="review-current-task-actions"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('keeps the retry action for retryable states', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: { stageCode: 'inventory_preparation', userStatus: 'retryable', retryable: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
// 失败后的人工恢复路径不能被运行态过滤误伤。
|
||||
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('renders Gate label_key for every primary action presentation', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_matching',
|
||||
userStatus: 'waiting_human',
|
||||
primaryAction: {
|
||||
code: 'retry_inventory_matching',
|
||||
label_key: 'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching',
|
||||
} as any,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').text()).toBe('重新库存匹配');
|
||||
});
|
||||
|
||||
it('renders server-provided recovery actions without duplicating the primary action', async () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_matching',
|
||||
userStatus: 'waiting_human',
|
||||
primaryAction: { code: 'retry_inventory_matching', i18nKey: 'retry_inventory_matching' },
|
||||
recoveryActions: [{ code: 'retry_inventory_from_preparation' }],
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.find('[data-testid="review-current-task-recovery-retry_inventory_from_preparation"]').exists()).toBe(true);
|
||||
expect(wrapper.findAll('button').length).toBe(2);
|
||||
});
|
||||
});
|
||||
+46
-2
@@ -35,6 +35,12 @@ const props = defineProps<{
|
||||
retryable?: boolean;
|
||||
blockingReason?: ShippingProcessingBlockingReason | null;
|
||||
primaryAction?: ShippingProcessingPrimaryAction | null;
|
||||
recoveryActions?: Array<{
|
||||
code: string;
|
||||
i18nKey?: string | null;
|
||||
label_key?: string | null;
|
||||
parameters?: Record<string, unknown>;
|
||||
}>;
|
||||
|
||||
taskMissing?: boolean;
|
||||
confirmedTaskId?: number | null;
|
||||
@@ -169,6 +175,9 @@ const showNextStep = computed(() => {
|
||||
const showBusinessAction = computed(() => {
|
||||
if (props.loading) return false;
|
||||
if (props.taskMissing) return false;
|
||||
// [STEP] 自动处理期间没有人工业务动作;只保留外层的刷新进度入口。
|
||||
// 防止正式任务编辑等历史 primary_action 穿透到库存获取运行态。
|
||||
if (props.userStatus === 'running') return false;
|
||||
if (props.retryable) return true;
|
||||
const code = String(props.primaryAction?.code || '').trim();
|
||||
if (!code) return false;
|
||||
@@ -186,7 +195,13 @@ const businessActionLabel = computed(() => {
|
||||
}
|
||||
const pa = props.primaryAction;
|
||||
if (!pa) return '';
|
||||
const i18nKey = String(pa.i18nKey || '').trim();
|
||||
// Gate action presentation uses label_key; normalize it at the shared card boundary
|
||||
// so every gate renders its business label instead of exposing the action code.
|
||||
const i18nKey = String(
|
||||
pa.i18nKey
|
||||
|| (pa as ShippingProcessingPrimaryAction & { label_key?: string | null }).label_key
|
||||
|| '',
|
||||
).trim();
|
||||
if (i18nKey && te(i18nKey)) {
|
||||
return t(i18nKey);
|
||||
}
|
||||
@@ -214,13 +229,31 @@ const businessActionTitle = computed(() => {
|
||||
});
|
||||
|
||||
const actionIsRetry = computed(() => Boolean(props.retryable) || String(props.primaryAction?.code || '') === 'retry');
|
||||
const recoveryActions = computed(() => (props.recoveryActions || []).filter((action) => {
|
||||
const code = String(action.code || '').trim();
|
||||
return code && code !== String(props.primaryAction?.code || '').trim();
|
||||
}));
|
||||
|
||||
function recoveryActionLabel(action: (typeof recoveryActions.value)[number]): string {
|
||||
const key = String(
|
||||
action.i18nKey
|
||||
|| action.label_key
|
||||
|| `workspace.shippingNotice.processGate.actionCodes.${action.code}`,
|
||||
).trim();
|
||||
return key && te(key) ? t(key) : action.code;
|
||||
}
|
||||
|
||||
function handleBusinessActionClick() {
|
||||
const primaryActionCode = String(props.primaryAction?.code || '').trim();
|
||||
if (props.retryable && primaryActionCode && primaryActionCode !== 'retry') {
|
||||
emit('action', primaryActionCode, props.primaryAction?.parameters ?? {});
|
||||
return;
|
||||
}
|
||||
if (actionIsRetry.value) {
|
||||
emit('retry');
|
||||
return;
|
||||
}
|
||||
emit('action', String(props.primaryAction?.code || ''), props.primaryAction?.parameters ?? {});
|
||||
emit('action', primaryActionCode, props.primaryAction?.parameters ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,6 +390,17 @@ type ReviewCurrentUserStatus =
|
||||
/>
|
||||
{{ businessActionLabel }}
|
||||
</button>
|
||||
<button
|
||||
v-for="action in recoveryActions"
|
||||
:key="action.code"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-white px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
|
||||
:data-testid="`review-current-task-recovery-${action.code}`"
|
||||
:disabled="retrying || locating"
|
||||
@click="$emit('action', action.code, action.parameters || {})"
|
||||
>
|
||||
{{ recoveryActionLabel(action) }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showLocateAction"
|
||||
type="button"
|
||||
|
||||
@@ -1017,12 +1017,6 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
t,
|
||||
});
|
||||
|
||||
// 快览完成后补充可见的用户请求;用户已输入备注时绝不覆盖。
|
||||
watch([isShippingNoticeAgent, shippingIntakes.allParsedReady], ([isShippingAgent, allParsedReady]) => {
|
||||
if (!isShippingAgent || !allParsedReady || input.value.trim()) return;
|
||||
input.value = t('chat.shippingOrderExtractionDefaultUserMessage');
|
||||
});
|
||||
|
||||
const { handleShippingMenuAction, handleShippingActionClick } = createShippingMenuHandlers({
|
||||
isThinking,
|
||||
currentAgentId,
|
||||
|
||||
@@ -619,12 +619,16 @@ export function useShippingOrderReview(options: { onWorkflowRefresh?: () => void
|
||||
try {
|
||||
if (authoritativeOrderTaskNo.value) {
|
||||
await refreshShippingProcessing();
|
||||
const unifiedStatus = String(shippingProcessingProjection.value?.status || '').trim().toLowerCase();
|
||||
const unifiedStatus = String(
|
||||
shippingProcessingProjection.value?.userStatus
|
||||
|| shippingProcessingProjection.value?.status
|
||||
|| '',
|
||||
).trim().toLowerCase();
|
||||
if (unifiedStatus !== lastUnifiedStatus) {
|
||||
lastUnifiedStatus = unifiedStatus;
|
||||
options.onWorkflowRefresh?.();
|
||||
}
|
||||
if (UNIFIED_TERMINAL.has(unifiedStatus)) {
|
||||
if (UNIFIED_TERMINAL.has(unifiedStatus) || unifiedStatus === 'waiting_review') {
|
||||
stopWorkflowProgressPolling();
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -174,7 +174,7 @@ describe('useChatShippingSendHandler', () => {
|
||||
|
||||
expect(consumed).toBe(true);
|
||||
expect(startOrderExtractionRun).toHaveBeenCalledWith(
|
||||
'chat.shippingOrderExtractionDefaultUserMessage',
|
||||
'',
|
||||
['SNI-EMPTY-NOTE'],
|
||||
[{
|
||||
name: 'orders.eml',
|
||||
@@ -214,7 +214,7 @@ describe('useChatShippingSendHandler', () => {
|
||||
|
||||
expect(consumed).toBe(true);
|
||||
expect(startOrderExtractionRun).toHaveBeenCalledWith(
|
||||
'chat.shippingOrderExtractionDefaultUserMessage',
|
||||
'',
|
||||
['SNI-FIRST', 'SNI-SECOND'],
|
||||
[
|
||||
{ name: 'first.eml', size: 100, extension: 'eml', type: 'document', source: 'shipping_notice' },
|
||||
|
||||
@@ -189,8 +189,8 @@ export function createShippingSendHandlers(ctx: ShippingSendHandlerContext) {
|
||||
&& submittedIntakes.has(item.intakeNo.trim().toUpperCase()),
|
||||
),
|
||||
);
|
||||
// 阶段 2:空备注补充用户可见的默认请求,便于会话记录与审计;不改变 Worker 的确定性识别流程。
|
||||
const query = trimmed || ctx.t('chat.shippingOrderExtractionDefaultUserMessage');
|
||||
// 空备注不伪造用户正文;订单抽取动作由结构化 Run 提交承载,用户消息只保留附件快照。
|
||||
const query = trimmed;
|
||||
ctx.shippingAutoFlowRequested.value = false;
|
||||
if (typeof textOrEvent !== 'string') ctx.input.value = '';
|
||||
try {
|
||||
|
||||
@@ -179,7 +179,7 @@ describe('useChatShippingUploadHandler', () => {
|
||||
await handleShippingAutoUploadNoticeBatch([]);
|
||||
|
||||
expect(startOrderExtractionRun).toHaveBeenCalledWith(
|
||||
'chat.shippingOrderExtractionDefaultUserMessage',
|
||||
'',
|
||||
['SNI-1'],
|
||||
[],
|
||||
);
|
||||
|
||||
@@ -231,7 +231,7 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
ctx.msg.warning(ctx.t('chat.shippingNoticeUploadFailed'));
|
||||
return false;
|
||||
}
|
||||
const query = ctx.input.value.trim() || ctx.t('chat.shippingOrderExtractionDefaultUserMessage');
|
||||
const query = ctx.input.value.trim();
|
||||
const ok = await ctx.startOrderExtractionRun(query, intakeNos, []);
|
||||
if (ok) {
|
||||
ctx.clearConsumedNoticeAttachments?.();
|
||||
|
||||
@@ -430,7 +430,7 @@ export function useShippingOrderExtractionRuns(options: UseShippingOrderExtracti
|
||||
|
||||
/**
|
||||
* 启动订单抽取统一提交:后端裁决 append/create,并只持久化用户操作与唯一 Run 状态卡。
|
||||
* @param query - 用户本次备注;允许为空,不发送给 Dify Chatflow。
|
||||
* @param query - 用户本次备注;为空时用户消息仅展示附件,不伪造默认正文。
|
||||
* @param intakeNos - 本次冻结的 Intake 编号。
|
||||
* @param attachments - 用户消息中的安全附件快照。
|
||||
* @param uploadBatchId - 上传批次隔离键;禁止当作 user_task_no。
|
||||
|
||||
@@ -310,7 +310,8 @@ vi.mock('../components/shipping-review/ReviewInventoryCandidatesPanel.vue', () =
|
||||
vi.mock('@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue', () => ({
|
||||
default: {
|
||||
name: 'ProcessGateRecoveryCard',
|
||||
template: '<div data-testid="mock-process-gate" />',
|
||||
props: ['showActions'],
|
||||
template: '<div data-testid="mock-process-gate" :data-actions="showActions === false ? \'hidden\' : \'shown\'" />',
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -642,6 +643,7 @@ function resetActiveCaseFixture() {
|
||||
task_missing: false,
|
||||
recovery_available: null,
|
||||
post_confirm_auto_progress: null,
|
||||
process_gate: null,
|
||||
current_stage: null,
|
||||
technical_progress: null,
|
||||
automation: { status: 'idle', can_auto_create: false, can_build: true },
|
||||
@@ -659,6 +661,38 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
reviewProgressContext.value = null;
|
||||
});
|
||||
|
||||
it('uses the current-task card as the only Gate action entry for every formal-OT Gate', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
status: 'confirmed',
|
||||
has_formal_ot: true,
|
||||
task_missing: false,
|
||||
confirmed_task_id: 88,
|
||||
confirmed_task_no: 'SN-GATE-1',
|
||||
process_gate: {
|
||||
execution_no: 'EXEC-GATE-1',
|
||||
status: 'blocked',
|
||||
owner_type: 'human',
|
||||
technical_auto_only: false,
|
||||
current_blocking_gate: { gate_code: 'customer_confirmation', status: 'blocked' },
|
||||
primary_action: {
|
||||
code: 'confirm_customer',
|
||||
label_key: 'chat.shippingNotice.processGate.actionCodes.confirm_customer',
|
||||
kind: 'current_gate',
|
||||
dispatch: 'mutation',
|
||||
},
|
||||
},
|
||||
automation: { status: 'manual_fallback', can_auto_create: false, can_build: true },
|
||||
};
|
||||
|
||||
const wrapper = await mountView();
|
||||
await flushPromises();
|
||||
|
||||
// 任意正式 OT Gate 的可执行入口只保留在“当前任务”;待处理事项只读说明仍保留。
|
||||
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="mock-process-gate"]').attributes('data-actions')).toBe('hidden');
|
||||
});
|
||||
|
||||
it('shows restored version as current and latest version only as failed attempt', async () => {
|
||||
reviewProgressContext.value = {
|
||||
item_no: 'WFI-1',
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
ReviewCustomerResolutionPanel / ReviewCurrentProcessingCard / ReviewCompletedChecksPanel /
|
||||
ReviewBuildEligibilitySummary、ReviewInventory*、
|
||||
ReviewLineInventoryOps(履约操作并入明细右侧列)、ReviewLineFulfillmentDetail(行内履约摘要)、
|
||||
ProcessGateRecoveryCard;formal_task 仅显式动作挂载 TaskTodoPanel(主写在 Footer);
|
||||
formal_task 仅显式动作挂载 TaskTodoPanel(主写在 Footer);
|
||||
shipping.api.retryWorkspaceConversationAutoProgress(对话级重试)。
|
||||
逻辑:建单前订单检查为主卡;正式 OT 后保持 standard,不自动切 formal_task 空壳;
|
||||
对话级「重试自动推进」在顶栏;当前 Case 对象级重试优先右栏 CurrentProcessingCard,
|
||||
@@ -65,6 +65,7 @@ import ReviewWorkbenchHeader from '../components/shipping-review/ReviewWorkbench
|
||||
import ReviewWorkbenchModeToggle from '../components/shipping-review/ReviewWorkbenchModeToggle.vue';
|
||||
import ReviewUnsavedSwitchDialog from '../components/shipping-review/ReviewUnsavedSwitchDialog.vue';
|
||||
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
|
||||
import { useShippingProcessGateRecovery } from '@/features/shipping-process-gates/composables/useShippingProcessGateRecovery';
|
||||
import TaskTodoPanel from '@/features/workspace/shipping-task-center/TaskTodoPanel.vue';
|
||||
import ManualUploadEvidenceDialog from '@/features/workspace/shipping-task-center/ManualUploadEvidenceDialog.vue';
|
||||
import { downloadWorkspaceShippingExcelFile } from '@/features/workspace/api/shipping-tasks.api';
|
||||
@@ -103,6 +104,7 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const page = useChatPageContext();
|
||||
const { t, te } = useI18n();
|
||||
const { submitPrimaryAction: submitProcessGatePrimaryAction } = useShippingProcessGateRecovery();
|
||||
const {
|
||||
reviewRun,
|
||||
activeCase,
|
||||
@@ -233,11 +235,6 @@ const agentId = computed(() => String(route.params.agentId || ''));
|
||||
const conversationId = computed(() => String(page.conversationId || route.query.conversation_id || ''));
|
||||
const itemNoFromQuery = computed(() => String(route.query.item_no || ''));
|
||||
const reviewFocus = computed(() => String(route.query.focus || '').trim());
|
||||
/** Gate 恢复卡片导航上下文(复核台深链)。 */
|
||||
const reviewGateNavigationContext = computed(() => ({
|
||||
agentId: agentId.value,
|
||||
conversationId: conversationId.value,
|
||||
}));
|
||||
const focusedEvidenceRef = ref<{ fieldId: string; lineIndex?: number } | null>(null);
|
||||
|
||||
const workbenchMode = ref<ReviewWorkbenchMode>('standard');
|
||||
@@ -355,21 +352,47 @@ const caseContentSkeleton = computed(() => caseSwitchFailed.value && !activeCase
|
||||
));
|
||||
|
||||
/**
|
||||
* 是否挂载右侧/窄屏「当前处理」卡:task_missing、正式 OT、或自动化进行中/失败态。
|
||||
* 核心逻辑:对象级重试优先挂在此卡上,未挂载时才回落底栏。
|
||||
* 是否挂载右侧/窄屏「当前处理」卡:task_missing、正式 OT、自动化进行中/失败态,或人工 Gate。
|
||||
* 核心逻辑:当前任务是本页唯一 Gate 写入口,对象级重试优先挂在此卡上,未挂载时才回落底栏。
|
||||
*/
|
||||
const mountCurrentProcessingCard = computed(() => {
|
||||
if (!displayCase.value) return false;
|
||||
if (caseContentSkeleton.value) return true;
|
||||
if (Boolean(displayCase.value.task_missing)) return true;
|
||||
if (hasFormalOt.value) return true;
|
||||
const gate = displayCase.value.process_gate;
|
||||
if (
|
||||
gate?.current_blocking_gate
|
||||
&& !gate.technical_auto_only
|
||||
&& String(gate.owner_type || '') !== 'system'
|
||||
) return true;
|
||||
const status = String(displayCase.value.automation?.status || '').trim().toLowerCase();
|
||||
return ['waiting_to_start', 'queued', 'running', 'failed', 'manual_fallback'].includes(status);
|
||||
});
|
||||
|
||||
/** 对象级重试:有当前处理卡时放右栏/窄屏主卡;否则回落底栏。 */
|
||||
const showObjectRetryOnRail = computed(() => showStpRetry.value && mountCurrentProcessingCard.value);
|
||||
const showObjectRetryOnFooter = computed(() => showStpRetry.value && !mountCurrentProcessingCard.value);
|
||||
const showObjectRetryOnRail = computed(() => showStpRetry.value && mountCurrentProcessingCard.value);
|
||||
const showObjectRetryOnFooter = computed(() => showStpRetry.value && !mountCurrentProcessingCard.value);
|
||||
|
||||
/** 当前任务卡是复核页唯一 Gate 写入口;Gate 主动作优先于泛化自动重试。 */
|
||||
const currentTaskPrimaryAction = computed(() => (
|
||||
displayCase.value?.process_gate?.primary_action
|
||||
?? shippingProcessingProjection.value?.primaryAction
|
||||
?? displayCase.value?.primary_action
|
||||
?? null
|
||||
));
|
||||
const currentTaskRetryable = computed(() => (
|
||||
showObjectRetryOnRail.value
|
||||
|| (
|
||||
Boolean(shippingProcessingProjection.value?.retryable)
|
||||
&& !String(currentTaskPrimaryAction.value?.code || '').trim()
|
||||
)
|
||||
));
|
||||
const currentTaskRecoveryActions = computed(() => (
|
||||
(displayCase.value?.process_gate?.recovery_targets || []).map((target) => ({
|
||||
code: String(target.action_code || '').trim(),
|
||||
})).filter((action) => action.code)
|
||||
));
|
||||
|
||||
/** 管理员诊断:后端 technical_progress / automation.technical 仅 admin 投影。 */
|
||||
const showAdminTaskMissingDiagnosis = computed(() => (
|
||||
@@ -1289,10 +1312,30 @@ async function handleCurrentTaskAction(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'retry_inventory_matching': {
|
||||
const summary = displayCase.value?.process_gate;
|
||||
if (!summary) return;
|
||||
const result = await submitProcessGatePrimaryAction(summary, { actionCode: code });
|
||||
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
|
||||
await reloadLatestDraft();
|
||||
await refreshShippingProcessing();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'mark_manual_uploaded':
|
||||
await formalTodoPanelRef.value?.invokeActionByCode('mark_manual_uploaded');
|
||||
break;
|
||||
default:
|
||||
if (code.startsWith('retry_') || code.startsWith('recheck_') || code.startsWith('regenerate_')) {
|
||||
const summary = displayCase.value?.process_gate;
|
||||
if (!summary) return;
|
||||
const result = await submitProcessGatePrimaryAction(summary, { actionCode: code });
|
||||
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
|
||||
await reloadLatestDraft();
|
||||
await refreshShippingProcessing();
|
||||
}
|
||||
break;
|
||||
}
|
||||
msg.info(t('chat.shippingOrderReview.currentTask.actionUnknown', { code }));
|
||||
}
|
||||
}
|
||||
@@ -3272,15 +3315,17 @@ watch(
|
||||
:automation="displayCase?.automation"
|
||||
:show-retry="showObjectRetryOnRail"
|
||||
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
|
||||
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
|
||||
:retryable="currentTaskRetryable"
|
||||
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
|
||||
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
|
||||
:primary-action="currentTaskPrimaryAction"
|
||||
:recovery-actions="currentTaskRecoveryActions"
|
||||
:retrying="displayCase?.process_gate?.current_blocking_gate
|
||||
? (progressRetrying || caseSwitchLoading)
|
||||
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
|
||||
:retry-exhausted-sources="taskInventoryExhaustedSources"
|
||||
:loading="caseContentSkeleton"
|
||||
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
|
||||
@action="(code, params) => void handleCurrentTaskAction(code, params)"
|
||||
/>
|
||||
<ReviewCustomerResolutionPanel
|
||||
v-if="activeCase && !activeCase.customer_resolution?.resolved && showEligibilityAsPrimary"
|
||||
@@ -3753,9 +3798,10 @@ watch(
|
||||
:has-formal-ot="shippingProcessingProjection?.hasFormalOt ?? hasFormalOt"
|
||||
:shipping-notice-no="shippingProcessingProjection?.shippingNoticeNo ?? confirmedNoticeTaskNo"
|
||||
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
|
||||
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
|
||||
:retryable="currentTaskRetryable"
|
||||
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
|
||||
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
|
||||
:primary-action="currentTaskPrimaryAction"
|
||||
:recovery-actions="currentTaskRecoveryActions"
|
||||
:retrying="displayCase?.process_gate?.current_blocking_gate
|
||||
? (progressRetrying || caseSwitchLoading)
|
||||
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
|
||||
@@ -3772,16 +3818,10 @@ watch(
|
||||
@retry-preparation="() => void retryCaseInventoryFallback()"
|
||||
/>
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!reparseProgressActive && showHumanBlockingGate && displayCase?.process_gate && hasCreatedShippingTask"
|
||||
v-if="showHumanBlockingGate && displayCase?.process_gate"
|
||||
:summary="displayCase.process_gate"
|
||||
:can-handle="workbenchActionsExecutable"
|
||||
:navigation-context="reviewGateNavigationContext"
|
||||
inventory-upload-mode="local"
|
||||
:field-labels="reviewFieldLabels"
|
||||
@refreshed="reloadLatestDraft"
|
||||
@refresh-needed="reloadLatestDraft"
|
||||
@confirm-customer="(taskNo) => void page.openShippingCustomerDialog?.(taskNo)"
|
||||
@manual-upload="() => void openManualUploadRegistration()"
|
||||
:can-handle="false"
|
||||
:show-actions="false"
|
||||
/>
|
||||
<ReviewProfileMatchPanel
|
||||
:profile-match="displayCase?.profile_match"
|
||||
|
||||
Reference in new issue
Block a user