Merge branch 'hugo-shipping-notice' into dev

# Conflicts:
#	frontend/src/features/chat/components/ChatViewContent.vue
This commit is contained in:
hugo committed 2026-09-17 16:29:10 +08:00
commit 80d78130f8
121 files changed
+9621 -1263

No files matched your search

@@ -54,7 +54,6 @@ const {
pinMessagesToBottom?: boolean;
/** 供父级滚动逻辑绑定 main 元素 */
scrollContainerHolder: { el: Ref<HTMLElement | null> };
compactShippingProgress?: boolean;
}>();
const emit = defineEmits<{
@@ -68,7 +67,6 @@ const emit = defineEmits<{
'maintenance-edit-record': [record: MaintenanceRecord];
'maintenance-view-record-history': [device: MaintenanceDevice];
'maintenance-create-record-for-device': [device: MaintenanceDevice];
'open-batch-workbench': [];
/** 在途仓自动调拨:业务流激活时向上冒泡,父级据此隐藏聊天输入框。 */
'transfer-flow-active': [active: boolean];
}>();
@@ -207,7 +205,6 @@ const hasFollowingShippingProgressCard = (items: ChatMessage[], index: number):
:leave-handlers="leaveHandlers"
:shipping-handlers="shippingHandlers"
:training-handlers="trainingHandlers"
:compact-shipping-progress="compactShippingProgress"
:attachment-summary-only="hasFollowingShippingProgressCard(messages, index)"
@copy="emit('copy', { message: msg, index })"
@edit="emit('edit', $event)"
@@ -217,7 +214,6 @@ const hasFollowingShippingProgressCard = (items: ChatMessage[], index: number):
@maintenance-edit-record="emit('maintenance-edit-record', $event)"
@maintenance-view-record-history="emit('maintenance-view-record-history', $event)"
@maintenance-create-record-for-device="emit('maintenance-create-record-for-device', $event)"
@open-batch-workbench="emit('open-batch-workbench')"
/>
<ToolRunProgressCard
v-if="shouldRenderMessage(msg) && shouldShowToolRunProgressAfterMessage(msg, index)"
@@ -8,7 +8,8 @@
* 逻辑:本文件只做页面结构编排;货代 Chat 仅上传/进度通知,履约写操作不在本页;
* 右侧「本次处理」由 conversationId 驱动 Workflow projection,extractionRunNo 仅作进度装饰;
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js;合同付款预警、立账凭证 Agent 用 Tab 作业面替换消息列表与输入框。
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js;合同付款预警、立账凭证 Agent 用 Tab 作业面替换消息列表与输入框;
* 货代会话主区域:有会话即全屏批次进度中心(常驻),无会话为欢迎页+输入框,会话标题取自侧栏历史并传给中心。
*/
@@ -34,6 +35,8 @@ import ChatBrowserPanel from '@/features/chat/components/ChatBrowserPanel.vue';
import ShippingWorkflowTimeline from '@/features/chat/components/shipping/ShippingWorkflowTimeline.vue';
import { shouldShowShippingWorkbench } from '@/features/chat/shipping/shippingWorkbenchLayout';
import TrainingWorkspacePanel from '@/features/chat/components/TrainingWorkspacePanel.vue';
import LedgerConfigPanel from '@/features/maintenance/components/LedgerConfigPanel.vue';
@@ -135,38 +138,19 @@ const hideTaskChatSessionUi = computed(() => isContractPaymentAgentPage.value ||
const transferFlowActive = ref(false);
watch(isInTransitTransferAgent, (isTransfer) => { if (!isTransfer) transferFlowActive.value = false; });
/** 批次进度工作台按需打开;关闭时不占用对话区右侧布局。 */
const batchWorkbenchOpen = ref(false);
const showShippingWorkflowTimeline = computed(() => (
page.isShippingNoticeAgent
&& batchWorkbenchOpen.value
&& Boolean(activeShippingConversationId.value)
));
const compactShippingProgress = computed(() => batchWorkbenchOpen.value);
function openBatchWorkbench() {
batchWorkbenchOpen.value = true;
}
function closeBatchWorkbench() {
batchWorkbenchOpen.value = false;
}
/**
* 批次中心只服务于用户主动打开时所在的会话。切换历史会话或 Agent 后必须关闭,
* 否则旧会话的右侧投影会短暂占用新会话的对话区并造成“本次处理”串批错觉。
* 货代发货会话主区域规则(方案 A):
* 有会话 ID → 全屏批次进度中心(常驻不可关闭);无会话 → 欢迎页 + 输入框(唯一提交入口)。
*/
watch(
() => [activeShippingConversationId.value, Number(page.currentAgentId || 0)] as const,
(next, previous) => {
if (!previous || next[0] === previous[0] && next[1] === previous[1]) return;
batchWorkbenchOpen.value = false;
},
);
const showShippingWorkflowTimeline = computed(() => shouldShowShippingWorkbench({
isShippingNoticeAgent: page.isShippingNoticeAgent,
conversationId: activeShippingConversationId.value,
}));
/** 侧栏历史项中的会话标题;批次中心头部直接复用,保持侧栏与中心一致。 */
const activeShippingConversationTitle = computed(() => (
page.displayHistory.find((item) => item.conversation_id === activeShippingConversationId.value)?.title || ''
));
const embeddedIframeSrc = computed(() => {
@@ -498,9 +482,10 @@ watch(() => page.currentAgentId, () => {
<VoucherCheckChatPanel v-else-if="isVoucherCheckAgentPage" />
<div v-else class="flex min-h-0 min-w-0 flex-1" :class="showShippingWorkflowTimeline ? 'shipping-workbench-layout' : ''">
<div v-else class="flex min-h-0 min-w-0 flex-1">
<div class="flex min-h-0 min-w-0 flex-1 flex-col" :class="showShippingWorkflowTimeline ? 'shipping-chat-column' : ''">
<!-- 中心展示时对话列整体隐藏(含输入框),新文件提交走新建对话(spec 方案 A 硬性决策)。 -->
<div v-show="!showShippingWorkflowTimeline" class="flex min-h-0 min-w-0 flex-1 flex-col">
<TrainingWorkspacePanel
@@ -580,8 +565,6 @@ watch(() => page.currentAgentId, () => {
:scroll-container-holder="page.scrollContainerHolder"
:compact-shipping-progress="compactShippingProgress"
@copy="page.copyToClipboard($event.message, $event.index)"
@edit="page.input = $event"
@@ -602,8 +585,6 @@ watch(() => page.currentAgentId, () => {
@maintenance-create-record-for-device="openMaintenanceRecordCreate"
@open-batch-workbench="openBatchWorkbench"
@transfer-flow-active="transferFlowActive = $event"
/>
@@ -692,10 +673,9 @@ watch(() => page.currentAgentId, () => {
<ShippingWorkflowTimeline
v-if="showShippingWorkflowTimeline"
:conversation-id="activeShippingConversationId"
:conversation-title="activeShippingConversationTitle"
:refresh-trigger="page.workflowRefreshTrigger"
:controller="shippingProcessing"
@close="closeBatchWorkbench"
/>
@@ -846,16 +826,3 @@ watch(() => page.currentAgentId, () => {
</template>
<style scoped>
/** 打开批次工作台后,左侧对话保留为压缩入口,右侧取得主工作区宽度。 */
@media (min-width: 1024px) {
.shipping-workbench-layout {
min-width: 0;
}
.shipping-chat-column {
flex: 0 0 clamp(360px, 32vw, 520px);
}
}
</style>
@@ -75,7 +75,6 @@ const {
leaveHandlers: LeaveMessageHandlers;
shippingHandlers: ShippingMessageHandlers;
trainingHandlers: TrainingHandlers;
compactShippingProgress?: boolean;
/** 下方已有货代进度卡时,用户气泡附件只显示摘要。 */
attachmentSummaryOnly?: boolean;
}>();
@@ -89,7 +88,6 @@ const emit = defineEmits<{
'maintenance-edit-record': [record: MaintenanceRecord];
'maintenance-view-record-history': [device: MaintenanceDevice];
'maintenance-create-record-for-device': [device: MaintenanceDevice];
'open-batch-workbench': [];
}>();
const authStore = useAuthStore();
@@ -747,11 +745,9 @@ function handleInlineDownload(file: InlineDownloadFile): void {
:retrying="retryingOrderExtraction"
:refreshing="refreshingOrderExtraction"
:cancelling="cancellingOrderExtraction"
:compact-progress="compactShippingProgress"
@retry="retryShippingOrderExtraction"
@refresh="refreshShippingOrderExtraction"
@cancel="cancelShippingOrderExtraction"
@open-batch-workbench="emit('open-batch-workbench')"
/>
<LeaveMessageBlock
v-if="isLeaveMessage"
@@ -22,6 +22,7 @@ const i18n = createI18n({
actionCodes: {
reload_inventory_result: '重新读取库存结果',
retry_inventory_preparation: '重新获取库存',
confirm_customer: '确认客户',
},
inventoryActions: {
reloadInventoryResult: '重新读取库存结果',
@@ -337,4 +338,57 @@ describe('ReviewCurrentProcessingCard', () => {
// 关键断言:无 statusDetail 时说明行完全不渲染,不留空壳。
expect(wrapper.find('[data-testid="review-current-task-status-detail"]').exists()).toBe(false);
});
it('renders the suggested next action instead of the reason text when next_action is present', () => {
// v4 语义分离:「下一步」给建议动作(确认客户),原因文案(客户尚未确认)
// 属于阻塞原因位,不得再挤进下一步槽位。
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'order_review',
userStatus: 'waiting_human',
blockingReason: {
code: 'customer_unresolved',
message: '客户尚未确认',
nextAction: 'confirm_customer',
} as any,
},
global: { plugins: [i18n] },
});
expect(wrapper.get('[data-testid="review-current-task-next-step-text"]').text()).toBe('确认客户');
});
it('hides the generic run-level status detail when a specific blocking reason is shown', () => {
// v4 去重:具体阻断原因已由「下一步」承载时,泛化的「当前步骤需要人工处理」属纯重复。
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'order_review',
userStatus: 'waiting_human',
blockingReason: {
code: 'customer_unresolved',
message: '客户尚未确认',
nextAction: 'confirm_customer',
} as any,
statusDetail: { text: '当前步骤需要人工处理' },
},
global: { plugins: [i18n] },
});
expect(wrapper.find('[data-testid="review-current-task-status-detail"]').exists()).toBe(false);
});
it('keeps the run-level status detail when the blocking reason is generic', () => {
// 无具体原因(未知码、无契约文案)时,Run 级等待说明仍是唯一信息,必须保留。
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'order_review',
userStatus: 'waiting_human',
blockingReason: { code: 'internal_gate_reason' } as any,
statusDetail: { text: '当前步骤需要人工处理' },
},
global: { plugins: [i18n] },
});
expect(wrapper.get('[data-testid="review-current-task-status-detail"]').text()).toBe('当前步骤需要人工处理');
});
});
@@ -10,7 +10,9 @@
禁止把读取占位误述为「系统处理中」,也不做骨架→真值的二次刷新;
loading 仅在挂载期抑制可执行动作,等权威投影到达后再放行(fail-closed);
由 ShippingOrderReviewView 在 mountCurrentProcessingCard 时挂载;
v2 新增 statusDetail:状态块内嵌动态说明(隐藏裁决在视图侧,见 spec §5.2)。
v2 新增 statusDetail:状态块内嵌动态说明(隐藏裁决在视图侧,见 spec §5.2);
v4 语义分离:下一步优先消费 blocking_reason.next_action 的建议动作文案,
且具体阻断原因在场时隐藏泛化 statusDetail(防同卡三行「待人工」空话)。
-->
<script setup lang="ts">
import { computed } from 'vue';
@@ -20,7 +22,10 @@ import type {
ShippingProcessingBlockingReason,
ShippingProcessingPrimaryAction,
} from '@/features/chat/types/shipping.api.types';
import { resolveShippingProcessingStageLabel } from '@/features/chat/shipping/shippingProcessingLabels';
import {
isGenericBlockingReason,
resolveShippingProcessingStageLabel,
} from '@/features/chat/shipping/shippingProcessingLabels';
import { resolveGateReasonLabel } from '@/features/shipping-progress/gateReasonLabel';
import { lookupWorkbenchAction, shouldRenderWorkbenchAction } from '@/features/shipping-progress/workbenchActionRegistry';
import { inventoryActionLabelKey, isInternalInventoryAction } from '@/features/shipping-progress/actionPresentation';
@@ -147,9 +152,15 @@ const nextStepText = computed(() => {
// 其余按 user_status/blocking_reason 照常渲染,空态自然落在「状态待确认」,不做骨架二次刷新。
const automationMessage = props.loading ? safeMessage(props.automation?.message) : '';
if (automationMessage) return automationMessage;
// 1) blocking_reason → 用后端给的 i18n_key 渲染具体阻断
// 1) blocking_reason → 先给契约注册的「建议动作」(下一步=做什么),
// 再回退原因文案(i18n_key / Gate 命名空间);禁止裸露内部原因码。
const br = props.blockingReason;
if (br) {
const nextAction = String(br.nextAction || br.next_action || '').trim();
const actionKey = nextAction
? `workspace.shippingNotice.processGate.actionCodes.${nextAction}`
: '';
if (actionKey && te(actionKey)) return t(actionKey);
const i18nKey = String(br.i18nKey || '').trim();
if (i18nKey && te(i18nKey)) {
return t(i18nKey);
@@ -205,6 +216,15 @@ const showNextStep = computed(() => {
return !['completed', 'cancelled'].includes(status);
});
/**
* 状态块内嵌动态说明的显隐:具体阻断原因已由「下一步」承载时,
* Run 级泛化等待说明(如「当前步骤需要人工处理」)属纯重复,隐藏。
*/
const showStatusDetail = computed(() => {
if (!props.statusDetail?.text) return false;
return isGenericBlockingReason(props.blockingReason, te);
});
/**
* 判断当前工作台是否应隐藏后端下发的纯导航动作。
* 批次中心可用它打开工作台;进入工作台后必须复用注册表规则,避免当前阶段再次显示
@@ -382,13 +402,14 @@ type ReviewCurrentUserStatus =
/>
{{ statusLabel }}
</dd>
<!-- v2:状态块内嵌动态说明(弱文本一行,不加标题/图标/区块;显隐裁决在视图侧)。 -->
<!-- v2:状态块内嵌动态说明(弱文本一行,不加标题/图标/区块;
v4:blocking_reason 已含具体原因时隐藏,避免与「下一步」重复)。 -->
<p
v-if="statusDetail?.text"
v-if="showStatusDetail"
class="w-full text-[11px] leading-4 text-muted"
data-testid="review-current-task-status-detail"
aria-live="polite"
>{{ statusDetail.text }}</p>
>{{ statusDetail?.text }}</p>
</div>
</dl>
@@ -173,3 +173,64 @@ describe('ReviewDocumentNavigation', () => {
narrow.unmount();
});
});
describe('ReviewDocumentNavigation queue row status icons', () => {
/**
* 以指定字段挂载单行侧栏队列,返回该行按钮包装器。
*/
function mountRow(item: Partial<ReviewDocumentNavItem>) {
return mount(ReviewDocumentNavigation, {
props: {
items: [{ case_no: 'C-1', file_name: 'f1.pdf', status: 'draft', ...item }],
activeCaseNo: 'C-1',
navAriaLabel: 'nav',
forceMode: 'sidebar',
},
global: { plugins: [i18n] },
}).get('[data-testid="review-doc-nav-C-1"]');
}
it('renders confirmed cases as in-progress spinner instead of done check', () => {
const row = mountRow({ status: 'confirmed' });
// 关键断言:已创建任务是系统在办中间态,必须转圈而非绿勾。
expect(row.find('svg.animate-spin').exists()).toBe(true);
expect(row.find('svg.text-emerald-500').exists()).toBe(false);
});
it('renders ready-to-confirm cases as amber attention icon', () => {
const row = mountRow({ status: 'ready' });
// 关键断言:可确认是等人操作,属于待办而非完成。
expect(row.find('svg.text-amber-500').exists()).toBe(true);
});
it('renders backend gate-blocked cases as amber attention icon', () => {
const row = mountRow({ status: 'confirmed', needs_attention: true });
// 关键断言:needs_attention 是后端门禁裁决,优先于中间态转圈。
expect(row.find('svg.text-amber-500').exists()).toBe(true);
expect(row.find('svg.animate-spin').exists()).toBe(false);
});
it('reserves the green check for terminal upload_complete', () => {
const row = mountRow({ status: 'confirmed', lifecycle_stage: 'upload_complete' });
expect(row.find('svg.text-emerald-500').exists()).toBe(true);
expect(row.find('svg.animate-spin').exists()).toBe(false);
});
it('renders failed and neutral states as before', () => {
expect(mountRow({ status: 'failed' }).find('svg.text-rose-500').exists()).toBe(true);
const idle = mountRow({ status: 'non_order' });
expect(idle.find('svg.text-muted').exists()).toBe(true);
expect(idle.find('svg.animate-spin').exists()).toBe(false);
});
it('keeps the truthful state icon on the selected row', () => {
const row = mountRow({ status: 'draft' });
// 关键断言:选中态由行高亮表达,图标不再被 active 覆盖成灰圈。
expect(row.find('svg.text-amber-500').exists()).toBe(true);
});
it('treats missing needs_attention as false for old queue payloads', () => {
const row = mountRow({ status: 'confirmed', needs_attention: undefined });
expect(row.find('svg.animate-spin').exists()).toBe(true);
});
});
@@ -11,6 +11,7 @@ import {
ChevronLeft,
ChevronRight,
Circle,
LoaderCircle,
Search,
TriangleAlert,
X,
@@ -23,10 +24,12 @@ export type ReviewDocumentNavItem = {
file_name?: string | null;
status: string;
issue_count?: number;
/** 队列接口按当前门禁裁决的"需人工"标志(blocked_manual/blocked_retryable/failed_terminal);前端禁止自行推断阻塞。 */
needs_attention?: boolean | null;
po_number?: string | null;
customer_name?: string | null;
stage_label?: string | null;
/** 队列接口下发的生命周期码;仅用于本地化展示,不参与阶段裁决。 */
/** 队列接口下发的生命周期码;用于阶段文字展示与终态(upload_complete)绿勾判定,不参与阶段裁决。 */
lifecycle_stage?: ReviewLifecycleStageCode | null;
};
@@ -118,17 +121,20 @@ function lifecycleStageLabel(item: ReviewDocumentNavItem): string | null {
}
/**
* 导航状态图标语义。
* 队列状态图标语义,按优先级命中即停:
* 失败 → 需人工(草稿问题数 / needs_attention 门禁阻塞)→ 终态绿勾
* → 等人状态 ⚠ → 系统在办转圈 → 中性灰圈 → 兜底转圈。
* 绿勾只属于终态(upload_complete / closed / completed);选中态由行高亮表达,
* 本函数不感知选中,图标永远如实反映状态。
*/
function navIconKind(item: ReviewDocumentNavItem): 'active' | 'alert' | 'processing' | 'done' | 'failed' | 'idle' {
if (props.activeCaseNo === item.case_no) return 'active';
function navIconKind(item: ReviewDocumentNavItem): 'alert' | 'done' | 'failed' | 'processing' | 'idle' {
const status = String(item.status || '').toLowerCase();
if (item.issue_count && item.issue_count > 0) return 'alert';
if (status === 'failed' || status === 'error') return 'failed';
if (status === 'confirmed' || status === 'completed' || status === 'ready' || status === 'closed') return 'done';
if (status === 'processing' || status === 'reparse_pending' || status === 'queued') return 'processing';
if (status === 'non_order' || status === 'cancelled' || status === 'superseded') return 'idle';
if (status === 'draft' || status === 'pending_review' || status === 'waiting_review') return 'alert';
if ((item.issue_count && item.issue_count > 0) || item.needs_attention === true) return 'alert';
if (item.lifecycle_stage === 'upload_complete' || status === 'completed' || status === 'closed') return 'done';
if (['draft', 'ready', 'unreviewed', 'quality_issue', 'pending_review', 'waiting_review'].includes(status)) return 'alert';
if (['confirmed', 'confirming', 'processing', 'reparse_pending', 'queued'].includes(status)) return 'processing';
if (['non_order', 'cancelled', 'superseded'].includes(status)) return 'idle';
return 'processing';
}
@@ -139,7 +145,7 @@ function matchesStatusFilter(item: ReviewDocumentNavItem): boolean {
if (statusFilter.value === 'all') return true;
const kind = navIconKind(item);
if (statusFilter.value === 'needs_action') return kind === 'alert';
if (statusFilter.value === 'processing') return kind === 'processing' || kind === 'active';
if (statusFilter.value === 'processing') return kind === 'processing';
if (statusFilter.value === 'done') return kind === 'done';
if (statusFilter.value === 'failed') return kind === 'failed';
return true;
@@ -218,6 +224,11 @@ function onSelect(caseNo: string) {
class="h-3.5 w-3.5 shrink-0 text-rose-500"
aria-hidden="true"
/>
<LoaderCircle
v-else-if="navIconKind(item) === 'processing'"
class="h-3.5 w-3.5 shrink-0 animate-spin text-brand-600"
aria-hidden="true"
/>
<Circle
v-else
class="h-3 w-3 shrink-0 text-muted"
@@ -329,6 +340,10 @@ function onSelect(caseNo: string) {
v-else-if="navIconKind(item) === 'failed'"
class="mt-0.5 h-3.5 w-3.5 shrink-0 text-rose-500"
/>
<LoaderCircle
v-else-if="navIconKind(item) === 'processing'"
class="mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-brand-600"
/>
<Circle
v-else
class="mt-0.5 h-3 w-3 shrink-0 text-muted"
@@ -1184,4 +1184,86 @@ describe('ShippingConversationProcessingCard', () => {
const row = wrapper.find('[data-testid="shipping-processing-file-DOC-10"]');
expect(row.findAll('button')).toHaveLength(0);
});
it('shows a specific blocking reason once per waiting-human card without header duplication', async () => {
// v4 去重:具体原因由文件行页脚独家承载;任务卡头不再重复同一句。
// ui_state 挂在任务条目上(与后端 EML 聚合下发形态一致:任务级为代表子项原因)。
const projection = buildProjection();
setStatusGroup(projection, 'waiting_human', [{
user_task_no: 'OT-REASON-ONCE', group: 'waiting_human', status_label: 'pending_review',
file_count: 1, run_no: 'RUN-REASON-ONCE', can_append: false,
uiState: {
status: 'waiting_human',
stage: 'order_review',
blocking_reason: { code: 'customer_unresolved', message: '客户尚未确认' },
primary_action: null,
secondary_actions: [],
},
objects: [{
kind: 'document', object_key: 'DOC-REASON', label: 'reason.pdf', filename: 'reason.pdf',
document_id: 91, root_document_id: 91, status_label: 'pending_review',
}],
}]);
const workItem = buildWorkItem('OT-REASON-ONCE', {
sourceSummary: {
emailSubject: null, filename: 'reason.pdf', documentId: 91,
documentCount: 1, parsedDocumentCount: 1, candidateCount: 1,
customerName: null, poNumber: 'PO-REASON',
},
status: 'waiting_human',
uiState: {
status: 'waiting_human',
stage: 'order_review',
blocking_reason: { code: 'customer_unresolved', message: '客户尚未确认' },
primary_action: null,
secondary_actions: [],
},
});
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection, workItems: [workItem], workbenchMode: true },
global: { plugins: [i18n] },
});
await flushPromises();
// 关键断言:具体原因全文只出现一次,且带「阻塞原因:」前缀落在文件行页脚。
const matches = wrapper.text().match(/客户尚未确认/g) || [];
expect(matches.length).toBe(1);
expect(wrapper.text()).toContain('阻塞原因:客户尚未确认');
});
it('hides the blocker line when the backend only provides a generic fallback reason', async () => {
// v4:未知原因码不得渲染成「当前步骤需要人工处理」空话;状态芯片已表达待人工。
const projection = buildProjection();
setStatusGroup(projection, 'waiting_human', [{
user_task_no: 'OT-REASON-GENERIC', group: 'waiting_human', status_label: 'pending_review',
file_count: 1, run_no: 'RUN-REASON-GENERIC', can_append: false,
objects: [{
kind: 'document', object_key: 'DOC-GENERIC', label: 'generic.pdf', filename: 'generic.pdf',
document_id: 92, root_document_id: 92, status_label: 'pending_review',
}],
}]);
const workItem = buildWorkItem('OT-REASON-GENERIC', {
sourceSummary: {
emailSubject: null, filename: 'generic.pdf', documentId: 92,
documentCount: 1, parsedDocumentCount: 1, candidateCount: 1,
customerName: null, poNumber: 'PO-GENERIC',
},
status: 'waiting_human',
uiState: {
status: 'waiting_human',
stage: 'order_review',
blocking_reason: { code: 'mystery_internal_code' },
primary_action: null,
secondary_actions: [],
},
});
const wrapper = mount(ShippingConversationProcessingCard, {
props: { projection, workItems: [workItem], workbenchMode: true },
global: { plugins: [i18n] },
});
await flushPromises();
expect(wrapper.text()).not.toContain('阻塞原因');
expect(wrapper.text()).not.toContain('当前步骤需要人工处理');
});
});
@@ -30,8 +30,8 @@ import {
toggleTaskDetails,
} from '@/features/chat/shipping/conversationProcessingState';
import {
resolveBlockingReasonText,
resolveShippingProcessingMessage,
resolveShippingProcessingReasonLabel,
resolveShippingProcessingStageLabel,
resolveShippingProcessingStatusLabel,
} from '@/features/chat/shipping/shippingProcessingLabels';
@@ -593,7 +593,8 @@ function workbenchFileReason(file: WorkbenchFileRow, task: ConversationProcessin
const reason = file.projection.uiState
? file.projection.uiState.blocking_reason
: file.projection.blockingReason;
return resolveShippingProcessingReasonLabel(reason, te, t);
// v4:具体原因才展示(Gate 命名空间/契约 message 可解析),通用兜底返回空串隐藏。
return resolveBlockingReasonText(reason, te, t);
}
return taskReasonLabel(task);
}
@@ -686,12 +687,20 @@ function stageLabel(task: ConversationProcessingUserTask): string {
return intakeStageLabel(projection);
}
/** 展示后端 ui_state 已裁决的阻断原因;i18n 仅负责翻译,不映射或猜测业务原因。 */
/** 展示后端 ui_state 已裁决的阻断原因;v4:具体原因才展示,通用兜底返回空串。 */
function taskReasonLabel(task: ConversationProcessingUserTask): string {
const reason = task.uiState
? task.uiState.blocking_reason
: task.blockingReason;
return resolveShippingProcessingReasonLabel(reason, te, t);
return resolveBlockingReasonText(reason, te, t);
}
/**
* 任务卡头原因行显隐:workbench 模式下文件行页脚已逐文件承载原因,
* 卡头不再重复同一句;非 workbench(折叠聚合卡)仍由卡头独家展示。
*/
function taskHeaderReasonVisible(task: ConversationProcessingUserTask): boolean {
return !props.workbenchMode || visibleWorkbenchFileRows(task).length === 0;
}
/** 同一 EML 聚合卡状态计数;仅用后端下发的 aggregateSummary,不从 UI 状态推导。 */
@@ -960,7 +969,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
>
{{ primaryFileLabel(task) }}
</div>
<div v-if="taskReasonLabel(task)" class="mt-1 text-[11px] text-rose-600 dark:text-rose-300">
<div v-if="taskHeaderReasonVisible(task) && taskReasonLabel(task)" class="mt-1 text-[11px] text-rose-600 dark:text-rose-300">
{{ taskReasonLabel(task) }}
</div>
<div v-if="aggregateStatusLabel(task)" class="mt-1 text-[11px] text-secondary">
@@ -1056,7 +1065,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
<div v-if="!workbenchMode" class="mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-secondary">
<span v-if="fileCountLabel(task)">{{ fileCountLabel(task) }}</span>
</div>
<div v-if="taskReasonLabel(task)" class="mt-1 text-[11px] text-rose-600 dark:text-rose-300">{{ taskReasonLabel(task) }}</div>
<div v-if="taskHeaderReasonVisible(task) && taskReasonLabel(task)" class="mt-1 text-[11px] text-rose-600 dark:text-rose-300">{{ taskReasonLabel(task) }}</div>
<div v-if="aggregateStatusLabel(task)" class="mt-1 text-[11px] text-secondary">{{ aggregateStatusLabel(task) }}</div>
</button>
<div v-if="workbenchMode" class="mt-3 space-y-2 border-t border-amber-200/70 pt-2">
@@ -1323,7 +1332,7 @@ function intakeStageLabel(item: ShippingProcessingProjection): string {
>
{{ primaryFileLabel(task) }}
</div>
<div v-if="taskReasonLabel(task)" class="mt-1 text-[11px] text-rose-600 dark:text-rose-300">
<div v-if="taskHeaderReasonVisible(task) && taskReasonLabel(task)" class="mt-1 text-[11px] text-rose-600 dark:text-rose-300">
{{ taskReasonLabel(task) }}
</div>
<div v-if="workbenchMode" class="mt-3 space-y-2 border-t border-emerald-200/70 pt-2">
@@ -74,7 +74,8 @@ describe('ShippingOrderExtractionCard', () => {
},
});
expect(wrapper.get('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(true);
// 方案 A:中心常驻后,对话流不再提供「打开批次进度中心」入口(回归保护:按钮不得复活)。
expect(wrapper.find('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(false);
});
it('does not present historical handling items or CTA as current work when the live projection exists', () => {
@@ -115,16 +116,6 @@ describe('ShippingOrderExtractionCard', () => {
expect(wrapper.find('[data-testid="shipping-order-extraction-primary-action"]').exists()).toBe(false);
});
it('collapses file-level progress when the batch workbench is open', () => {
const wrapper = mount(ShippingOrderExtractionCard, {
props: { state: buildState(), runNo: 'SNER-COMPACT', compactProgress: true },
global: { plugins: [i18n], provide: { [SHIPPING_WORKFLOW_KEY as symbol]: { processingWorkItems: ref([]) } } },
});
expect(wrapper.find('[data-testid="shipping-order-extraction-status-groups"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(false);
});
it('uses unified EML aggregation and keeps candidate creation out of completed', async () => {
const aggregate = {
workItemType: 'order_task', workItemNo: 'INTAKE:SNI-1', sourceType: 'eml', rootOrderTaskNo: 'OT-1',
@@ -643,7 +634,8 @@ describe('ShippingOrderExtractionCard', () => {
expect(wrapper.text()).toContain('3 个文件');
expect(wrapper.text()).toContain('系统处理中');
expect(wrapper.text()).toContain('处理时间偏长');
expect(wrapper.text()).toContain('打开批次进度中心');
// 方案 A:中心常驻后,对话流不再提供「打开批次进度中心」入口(回归保护:按钮不得复活)。
expect(wrapper.text()).not.toContain('打开批次进度中心');
expect(wrapper.text()).not.toContain('刷新状态');
expect(wrapper.text()).not.toContain('取消本次识别');
expect(wrapper.text()).not.toContain('PO-450003.pdf');
@@ -731,7 +723,8 @@ describe('ShippingOrderExtractionCard', () => {
});
expect(wrapper.text()).toContain('订单候选已生成');
expect(wrapper.text()).toContain('候选待人工确认 · 2 项');
expect(wrapper.text()).toContain('打开批次进度中心');
// 方案 A:中心常驻后,对话流不再提供「打开批次进度中心」入口(回归保护:按钮不得复活)。
expect(wrapper.text()).not.toContain('打开批次进度中心');
expect(wrapper.text()).not.toContain('部分附件需人工处理');
expect(wrapper.findAll('[data-testid="shipping-order-extraction-handling-item"]').length).toBe(0);
});
@@ -826,7 +819,8 @@ describe('ShippingOrderExtractionCard', () => {
});
expect(wrapper.find('[data-testid="shipping-order-extraction-primary-action"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="shipping-order-extraction-view-details"]').exists()).toBe(false);
expect(wrapper.get('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(true);
// 方案 A:中心常驻后,对话流不再提供「打开批次进度中心」入口(回归保护:按钮不得复活)。
expect(wrapper.find('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(false);
});
it('does not render multi-OT ChatProgressSummary list', () => {
@@ -914,7 +908,8 @@ describe('ShippingOrderExtractionCard', () => {
global: { plugins: [i18n] },
});
expect(wrapper.find('[data-testid="shipping-order-extraction-primary-action"]').exists()).toBe(false);
expect(wrapper.get('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(true);
// 方案 A:中心常驻后,对话流不再提供「打开批次进度中心」入口(回归保护:按钮不得复活)。
expect(wrapper.find('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(false);
});
it('does not render the removed view details link', () => {
@@ -956,7 +951,8 @@ describe('ShippingOrderExtractionCard', () => {
},
},
});
expect(wrapper.get('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(true);
// 方案 A:中心常驻后,对话流不再提供「打开批次进度中心」入口(回归保护:按钮不得复活)。
expect(wrapper.find('[data-testid="shipping-order-extraction-open-batch-workbench"]').exists()).toBe(false);
expect(wrapper.text()).toContain('共 1 个文件');
});
@@ -1,14 +1,14 @@
/**
* features/chat/components/shipping/ShippingOrderExtractionCard.vue
* 用途:聊天主区「本次订单文件处理」摘要卡——标题、文件数+状态、一行 handling 摘要、唯一主 CTA、查看详情。
* 用途:聊天主区「本次订单文件处理」摘要卡——标题、文件数+状态、一行 handling 摘要、无对话流 CTA(批次中心常驻,方案 A)。
* 依赖:订单抽取 Run 状态卡 DTO、shipping.api 文档/进度接口、ShippingOrderExtractionDetailsDrawer、vue-router、vue-i18n。
* 逻辑:对话区默认展示状态-EML 聚合;批次工作台打开后切换为紧凑摘要,长进度/Gate/刷新取消由工作台承接。
* 逻辑:对话区默认展示状态-EML 聚合;无对话流 CTA(批次中心常驻,方案 A),长进度/Gate/刷新取消由工作台承接。
*/
<script setup lang="ts">
import { computed, inject, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { AlertCircle, ArrowRight, CheckCircle2, ChevronDown, CircleX, FileText, LoaderCircle, Mail, RefreshCw, TriangleAlert } from 'lucide-vue-next';
import { AlertCircle, CheckCircle2, ChevronDown, CircleX, FileText, LoaderCircle, Mail, RefreshCw, TriangleAlert } from 'lucide-vue-next';
import type {
ShippingOrderExtractionHandlingItemState,
ShippingOrderExtractionFileState,
@@ -44,15 +44,12 @@ const props = defineProps<{
readonlyReason?: string | null;
/** 可选统一投影;摘要卡不再渲染进度,仅保留 prop 兼容宿主。 */
processingProjection?: ShippingProcessingProjection | null;
/** 批次工作台打开时,左侧只保留摘要,避免与工作台重复展示文件明细。 */
compactProgress?: boolean;
}>();
const emit = defineEmits<{
retry: [];
refresh: [];
cancel: [reason?: string];
'open-batch-workbench': [];
}>();
const { t, te } = useI18n();
@@ -425,7 +422,6 @@ const hasAnyStatusGroupTask = computed(() => (
*/
const recognizingPlaceholderVisible = computed(() => (
hasConversationStatusGroups.value
&& !props.compactProgress
&& !hasAnyStatusGroupTask.value
&& (submittedFileCount.value ?? 0) > 0
));
@@ -850,7 +846,7 @@ async function onPrimaryChatAction() {
<div v-if="handlingSummaryLine && !hasConversationStatusGroups" class="mt-1 text-sm text-secondary">{{ handlingSummaryLine }}</div>
</div>
<div v-if="hasConversationStatusGroups && !compactProgress" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-status-groups">
<div v-if="hasConversationStatusGroups" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-status-groups">
<div v-if="recognizingPlaceholderVisible" class="flex items-center gap-2 rounded-lg border border-default bg-surface p-3 text-sm text-muted">
<LoaderCircle class="h-4 w-4 animate-spin text-brand-500" />
<span data-testid="shipping-order-extraction-recognizing-placeholder">{{ t('chat.shippingProcessing.recognizingAttachments') }}</span>
@@ -899,7 +895,7 @@ async function onPrimaryChatAction() {
</section>
</template>
</div>
<div v-else-if="!compactProgress && emlAggregate" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-eml-aggregate">
<div v-else-if="emlAggregate" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-eml-aggregate">
<article class="overflow-hidden rounded-lg border border-default bg-surface shadow-sm">
<div class="flex items-start gap-3 border-b border-default bg-surface-soft p-3 dark:bg-slate-950/30">
<Mail class="mt-0.5 h-5 w-5 text-brand-500" />
@@ -926,7 +922,7 @@ async function onPrimaryChatAction() {
</div>
</article>
</div>
<div v-else-if="!compactProgress" class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30">
<div v-else class="flex flex-col gap-2 bg-surface-soft p-2 dark:bg-slate-950/30">
<div v-for="row in activeEmailRows" :key="row.unitId" class="overflow-hidden rounded-lg border border-default bg-surface shadow-sm">
<div class="flex items-start gap-3 border-b border-default bg-surface-soft p-3 dark:bg-slate-950/30"><Mail class="mt-0.5 h-5 w-5 text-brand-500" /><div class="min-w-0 flex-1"><div class="flex items-center justify-between gap-3"><span class="font-medium">{{ t('chat.shippingProcessing.emailPrefix') }}{{ row.fileName }}</span><span class="rounded border px-2 py-0.5 text-xs" :class="isFailedParseRow(row) || emailHasFailedChild(row) ? 'border-rose-200 bg-rose-100/70 text-rose-600' : emailIsCompleted(row) ? 'border-emerald-200 bg-emerald-100/70 text-emerald-600' : 'border-brand-200 bg-brand-100/70 text-brand-600'">{{ isFailedParseRow(row) || emailHasFailedChild(row) ? t('chat.shippingProcessing.batchException') : emailIsCompleted(row) ? t('chat.shippingProcessing.batchExtracted') : t('chat.shippingProcessing.parsingAttachments') }}</span></div><span class="mt-1 block font-mono text-xs text-muted">{{ t('chat.shippingProcessing.emailMeta') }}</span></div></div>
<div class="mx-4 my-2 flex flex-col gap-2 border-l-2 border-default bg-surface-soft p-3 pl-4 dark:border-slate-700 dark:bg-slate-950/30"><div v-for="child in childRows(row)" :key="`child-${child.unitId}`" class="flex items-center justify-between gap-3 text-sm"><span class="flex min-w-0 items-center gap-2"><CheckCircle2 v-if="child.status === 'candidate_ready'" class="h-4 w-4 text-emerald-500" /><LoaderCircle v-else-if="!isFailedParseRow(child)" class="h-4 w-4 animate-spin text-brand-500" /><AlertCircle v-else class="h-4 w-4 text-rose-500" /><span class="truncate">{{ child.fileName }}</span></span><span :class="rowStatusClass(child)">{{ rowStatusLabel(child) }}</span></div></div>
@@ -936,20 +932,6 @@ async function onPrimaryChatAction() {
<div v-for="row in failedRows" :key="`failed-${row.unitId}`" class="rounded-lg border border-rose-200 bg-rose-50 p-3 dark:border-rose-800 dark:bg-rose-950/30"><div class="flex items-center justify-between text-rose-600"><span class="flex items-center gap-2 font-medium"><AlertCircle class="h-5 w-5" />{{ row.fileName }}</span><span class="rounded bg-rose-100 px-2 py-0.5 text-xs">{{ t('chat.shippingProcessing.batchException') }}</span></div><p class="mt-2 pl-7 text-sm">{{ row.explainability?.message || t('chat.shippingProcessing.batchManualVerify') }}</p></div>
</div>
<div class="flex justify-end border-t border-default bg-brand-50/60 p-3 dark:bg-brand-950/20">
<div class="flex items-center gap-3">
<button
v-if="!compactProgress && (hasConversationStatusGroups || String(props.runNo || '').trim())"
type="button"
class="inline-flex items-center gap-2 rounded-lg bg-brand-600 px-5 py-2.5 text-sm font-medium text-white shadow-sm hover:bg-brand-700"
data-testid="shipping-order-extraction-open-batch-workbench"
@click="emit('open-batch-workbench')"
>
{{ t('chat.shippingProcessing.openBatchWorkbench') }}
<ArrowRight class="h-4 w-4" />
</button>
</div>
</div>
<div v-if="false" class="flex items-start gap-3">
<CircleX class="mt-0.5 h-4 w-4 shrink-0" />
<div class="min-w-0 flex-1">
@@ -104,10 +104,11 @@ function buildController(
function mountTimeline(
processing = processingProjection(),
workItems: ShippingProcessingProjection[] = [],
extraProps: Record<string, unknown> = {},
) {
return mount(ShippingWorkflowTimeline, {
attachTo: document.body,
props: { conversationId: 'conv-1', controller: buildController(processing, workItems) },
props: { conversationId: 'conv-1', controller: buildController(processing, workItems), ...extraProps },
global: { plugins: [i18n], stubs: { teleport: true } },
});
}
@@ -124,6 +125,24 @@ describe('ShippingWorkflowTimeline', () => {
gateRecovery.submitPrimaryAction.mockClear();
});
it('has no close button and reuses the conversation title in the header', () => {
const wrapper = mountTimeline(processingProjection(), [], { conversationTitle: 'PO#6075309 09-15' });
// 中心常驻不可关闭(方案 A):关闭按钮必须消失。
expect(wrapper.find('[data-testid="shipping-workflow-close"]').exists()).toBe(false);
// 会话标题直接复用侧栏命名,保持两处一致。
const titleNode = wrapper.find('[data-testid="shipping-workflow-conversation-title"]');
expect(titleNode.exists()).toBe(true);
expect(titleNode.text()).toContain('PO#6075309 09-15');
});
it('omits the title node when no conversation title is provided', () => {
const wrapper = mountTimeline(processingProjection(), []);
expect(wrapper.find('[data-testid="shipping-workflow-conversation-title"]').exists()).toBe(false);
});
it('prefers backend five-stage lifecycle nodes and shows the authorized download toolbar in freight upload', async () => {
const processing = processingProjection({
lifecycle_nodes: [
@@ -205,25 +224,6 @@ describe('ShippingWorkflowTimeline', () => {
expect(wrapper.find('[data-testid="shipping-processing-file-DOC-9"]').exists()).toBe(true);
});
it('labels a manually actionable batch as action needed instead of processing', async () => {
const task = { ...processingProjection().processing[0], group: 'needs_action' };
const processing = processingProjection({
summary: { total_files: 1, processing_files: 0, completed_files: 0, waiting_human_files: 1, failed_files: 0 },
needs_action: [task], processing: [],
status_groups: { failed: [], waiting_human: [task], processing: [], completed: [], cancelled: [], archived: [] },
} as Partial<ConversationProcessingProjection>);
const wrapper = mountTimeline(processing, [fileProjection({
uiState: {
status: 'waiting_human', stage: 'order_review', lifecycleStage: 'order_review',
lifecycleEntries: [], blocking_reason: null, primary_action: null, secondary_actions: [],
},
})]);
await flushPromises();
// 关键断言:锁定表示仍有待办,不得与「处理中 0」形成视觉矛盾。
expect(wrapper.get('[data-testid="shipping-workflow-panel-pinned"]').text()).toBe('待处理');
});
it('navigates only through the backend lifecycle entry', async () => {
const file = fileProjection({
uiState: {
@@ -3,7 +3,7 @@
* 用途:聊天页右侧「批次进度中心」——后端批次投影、五阶段进度和文件行操作。
* 依赖:vue-i18n、useMessage、useShippingNoticeWorkflow、ShippingConversationProcessingCard、
* ReasonDialog、ProcessGateRecoveryCard。
* 逻辑:顶层以 OT / ShippingProcessing 为主路径;标题栏仅保留批次名称、加载与截断提示,
* 逻辑:顶层以 OT / ShippingProcessing 为主路径;标题栏保留批次名称、会话标题、加载与截断提示;中心常驻不可关闭(方案 A),
* 文件总览和进度仅消费后端批次 summary;
* 文件清单消费后端 conversation_processing.status_groups;work_items 仅用于定位同一
* 展示 DTO 的操作对象;整批操作走 Run API,单文件取消走 Unit API;
@@ -14,7 +14,7 @@
import { computed, inject, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { ChevronDown, ChevronRight, Lock, RefreshCw } from 'lucide-vue-next';
import { RefreshCw } from 'lucide-vue-next';
import {
downloadWorkspaceShippingExcelFile,
downloadWorkspaceShippingExportArchive,
@@ -59,10 +59,8 @@ const props = defineProps<{
refreshTrigger?: number;
/** 测试或父级注入时可直接传入控制器,跳过自建轮询。 */
controller?: UseShippingNoticeWorkflowReturn | null;
}>();
const emit = defineEmits<{
close: [];
/** 当前会话标题;父级从侧栏历史匹配传入,中心头部直接复用(无新增接口)。 */
conversationTitle?: string | null;
}>();
const { t, te } = useI18n();
@@ -91,11 +89,6 @@ const ctl = computed((): UseShippingNoticeWorkflowReturn => (
props.controller || injected || localController
));
/**
* 侧栏折叠态:默认展开。
* 有处理中/待处理/未查看完成任务时强制展开,仅允许收起文件详情。
*/
const collapsed = ref(false);
/** 复核返回对话时展示的聚焦提示(由 focus_notice 触发一次)。 */
const focusTaskBanner = ref<string | null>(null);
const actionBusyItemNo = ref<string | null>(null);
@@ -249,34 +242,6 @@ const initialLoading = computed(() => Boolean(ctl.value.initialLoading?.value));
const manualRefreshing = computed(() => Boolean(ctl.value.manualRefreshing?.value));
const isRefreshing = computed(() => Boolean(ctl.value.isRefreshing?.value));
const error = computed(() => ctl.value.error.value);
/**
* 右侧仍有用户必须持续可见的任务时,禁止收起整个处理面板。
* 核心逻辑:处理中 / 待处理 / 未查看完成均属活跃可见任务;无此类任务才允许收起侧栏。
*/
const hasPinnedProcessingTasks = computed(() => {
const projection = displayProcessing.value;
if (!projection) return false;
return statusGroupTasks('failed', 'waiting_human', 'processing', 'completed').length > 0;
});
/**
* 切换侧栏折叠:活跃任务存在时强制保持展开。
*/
function togglePanelCollapsed() {
if (hasPinnedProcessingTasks.value) {
collapsed.value = false;
return;
}
collapsed.value = !collapsed.value;
}
watch(
hasPinnedProcessingTasks,
(pinned) => {
if (pinned) collapsed.value = false;
},
{ immediate: true },
);
/**
* 移除右侧常驻「批次与文件列表」长列表抽屉(UI-REFACTOR 方案 7)。
@@ -839,7 +804,6 @@ watch(
return;
}
if (!focusedTaskExists.value) return;
collapsed.value = false;
focusTaskBanner.value = normalized;
// [UI-01/UI-02] 真正选中进度卡,禁止只显示提示条。
await onProcessingFocus(normalized);
@@ -856,31 +820,12 @@ watch(
<template>
<aside
class="flex min-w-0 flex-1 shrink-0 flex-col border-l border-default bg-surface shadow-[-16px_0_40px_rgba(15,23,42,0.10)] transition-[width] duration-200"
:class="collapsed ? '!w-14' : ''"
class="flex min-w-0 flex-1 shrink-0 flex-col bg-surface"
data-testid="shipping-workflow-timeline"
>
<div class="flex w-full items-center gap-1 border-b border-default px-2 py-2">
<button
type="button"
class="shrink-0 rounded-md p-1.5 text-muted hover:bg-surface-muted hover:text-primary"
data-testid="shipping-workflow-close"
:title="t('chat.shippingProcessing.closeWorkbench')"
@click="emit('close')"
>
×
</button>
<component
:is="hasPinnedProcessingTasks ? 'div' : 'button'"
:type="hasPinnedProcessingTasks ? undefined : 'button'"
class="flex min-w-0 flex-1 items-center justify-between gap-2 rounded-md px-1 py-1 text-left"
:class="hasPinnedProcessingTasks
? 'cursor-default'
: 'hover:bg-surface-muted/60'"
data-testid="shipping-workflow-panel-toggle"
@click="togglePanelCollapsed"
>
<div v-if="!collapsed" class="min-w-0">
<div class="flex min-w-0 flex-1 items-center justify-between gap-2 rounded-md px-1 py-1 text-left">
<div class="min-w-0">
<div class="flex items-center gap-1.5">
<div class="text-sm font-semibold text-primary">
{{ te('chat.shippingProcessing.panelTitle')
@@ -888,14 +833,11 @@ watch(
: t('chat.shippingProcessing.title') }}
</div>
<span
v-if="hasPinnedProcessingTasks"
class="inline-flex items-center gap-0.5 rounded bg-surface-muted px-1.5 py-0.5 text-[10px] font-medium text-secondary"
data-testid="shipping-workflow-panel-pinned"
:title="t('chat.shippingProcessing.panelPinnedHint')"
>
<Lock class="h-3 w-3 shrink-0" aria-hidden="true" />
{{ t('chat.shippingProcessing.panelPinnedLabel') }}
</span>
v-if="conversationTitle"
class="min-w-0 truncate rounded bg-surface-muted px-1.5 py-0.5 text-xs text-secondary"
data-testid="shipping-workflow-conversation-title"
:title="conversationTitle"
>{{ conversationTitle }}</span>
</div>
<div class="mt-0.5 space-y-0.5 text-xs text-secondary" data-testid="shipping-workflow-panel-summary">
<template v-if="initialLoading && !displayProcessing">
@@ -918,12 +860,7 @@ watch(
</template>
</div>
</div>
<ChevronDown
v-if="!collapsed && !hasPinnedProcessingTasks"
class="h-4 w-4 shrink-0 text-muted"
/>
<ChevronRight v-else-if="collapsed" class="h-4 w-4 shrink-0 text-muted" />
</component>
</div>
<button
type="button"
class="shrink-0 rounded-md p-1.5 text-muted hover:bg-surface-muted hover:text-primary disabled:opacity-50"
@@ -939,7 +876,7 @@ watch(
</button>
</div>
<div v-if="!collapsed" class="min-h-0 flex-1 overflow-y-auto p-5">
<div class="min-h-0 flex-1 overflow-y-auto p-5">
<div
v-if="initialLoading && !displayProcessing"
class="mb-4 space-y-3"