feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a9fbac2fc
commit
d2b3d74def
571 files changed
+78064
-24681
No files matched your search
+686
@@ -0,0 +1,686 @@
|
||||
/**
|
||||
* features/chat/components/shipping/ShippingConversationProcessingCard.vue
|
||||
* 用途:右侧「本次处理中」顶层任务卡——按 needs_action / processing / completed 展示。
|
||||
* 依赖:vue-i18n、ConversationProcessingProjection、conversationProcessingState、
|
||||
* shippingProcessingLabels。
|
||||
* 逻辑:由 ShippingWorkflowTimeline 嵌入;只消费统一 projection / workItems,禁止 Workflow fallback;
|
||||
* 单 PDF 主标题用文件名,多 PDF 用「订单识别任务」;右侧不渲染 history;
|
||||
* 任务级操作只消费后端 available_actions;另渲染尚未建 OT 的 order_intake 材料卡。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ChevronDown, ChevronRight } from 'lucide-vue-next';
|
||||
import type {
|
||||
ConversationProcessingProjection,
|
||||
ConversationProcessingUserTask,
|
||||
ShippingProcessingProjection,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
import {
|
||||
createConversationProcessingUiState,
|
||||
focusTaskManually,
|
||||
markTaskViewed,
|
||||
resetConversationProcessingUiState,
|
||||
resolveFocusedTask,
|
||||
shouldExpandTaskDetails,
|
||||
toggleTaskDetails,
|
||||
} from '@/features/chat/shipping/conversationProcessingState';
|
||||
import {
|
||||
resolveShippingProcessingMessage,
|
||||
resolveShippingProcessingStatusLabel,
|
||||
shippingProcessingSourceTypeKey,
|
||||
shippingProcessingStageKey,
|
||||
} from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
|
||||
const props = defineProps<{
|
||||
projection: ConversationProcessingProjection | null;
|
||||
/** 统一 ShippingProcessing work_items(含 order_intake) */
|
||||
workItems?: ShippingProcessingProjection[] | null;
|
||||
/** 当前会话 ID;切换时重置本地焦点/展开状态 */
|
||||
conversationId?: string | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
focus: [taskNo: string];
|
||||
viewed: [taskNo: string];
|
||||
/** 请求展开某任务下的文件列表(由 Timeline 按 OT objects 合成) */
|
||||
expandFiles: [task: ConversationProcessingUserTask];
|
||||
/** 收起文件详情:父级应清空过滤并隐藏文件列表 */
|
||||
collapseFiles: [];
|
||||
/** 任务级权威操作(后端 available_actions) */
|
||||
taskAction: [payload: { task: ConversationProcessingUserTask; action: string }];
|
||||
/** Intake 级统一投影动作(如 retry_parse) */
|
||||
intakeAction: [payload: { item: ShippingProcessingProjection; action: string }];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const uiState = createConversationProcessingUiState();
|
||||
|
||||
/** 唯一进度源:统一 conversation_processing / work_items 合成投影。 */
|
||||
const activeProjection = computed((): ConversationProcessingProjection | null => (
|
||||
props.projection || null
|
||||
));
|
||||
|
||||
/** 尚未建 OT、仍应展示在「待处理材料」的 Intake 工作项。 */
|
||||
const pendingIntakeItems = computed((): ShippingProcessingProjection[] => {
|
||||
const items = Array.isArray(props.workItems) ? props.workItems : [];
|
||||
return items.filter((item) => {
|
||||
if (item.workItemType !== 'order_intake') return false;
|
||||
return !['completed', 'cancelled'].includes(String(item.status || ''));
|
||||
});
|
||||
});
|
||||
|
||||
const hasContent = computed(() => Boolean(
|
||||
activeProjection.value
|
||||
|| pendingIntakeItems.value.length,
|
||||
));
|
||||
|
||||
const completedTasks = computed(() => activeProjection.value?.completed || []);
|
||||
|
||||
const focusedTaskNo = computed(() => resolveFocusedTask(uiState, {
|
||||
serverFocusedTaskNo: activeProjection.value?.focused_task_no,
|
||||
recentTaskNo: activeProjection.value?.recent_task_no,
|
||||
}));
|
||||
|
||||
/**
|
||||
* 切会话时重置本地焦点/展开,避免跨会话残留。
|
||||
*/
|
||||
watch(
|
||||
() => String(props.conversationId || '').trim(),
|
||||
(next, prev) => {
|
||||
if (next === prev) return;
|
||||
resetConversationProcessingUiState(uiState);
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* 点击任务卡:只聚焦,不标记正式 viewed、不强制展开文件。
|
||||
* 非权威任务号仅更新本地 UI 焦点,不向后端 focus 写接口。
|
||||
*/
|
||||
function onSelectTask(task: ConversationProcessingUserTask) {
|
||||
const taskNo = String(task.user_task_no || '').trim();
|
||||
if (!taskNo) return;
|
||||
focusTaskManually(uiState, taskNo, { expandDetails: false });
|
||||
if (task.user_task_authoritative === false) return;
|
||||
emit('focus', taskNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换文件详情展开;展开时通知父级过滤,收起时清空过滤。
|
||||
*/
|
||||
function onToggleDetails(task: ConversationProcessingUserTask) {
|
||||
const taskNo = String(task.user_task_no || '').trim();
|
||||
if (!taskNo) return;
|
||||
toggleTaskDetails(uiState, taskNo);
|
||||
if (uiState.expandedDetailTaskNo === taskNo) {
|
||||
markTaskViewed(uiState, taskNo);
|
||||
emit('expandFiles', task);
|
||||
} else {
|
||||
emit('collapseFiles');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为多 PDF 任务卡(禁止用首个文件名伪装单文件任务)。
|
||||
*/
|
||||
function isMultiDocumentTask(task: ConversationProcessingUserTask): boolean {
|
||||
if (String(task.display_kind || '').trim() === 'multi_document_task') return true;
|
||||
if (Number(task.file_count || 0) > 1) return true;
|
||||
return Array.isArray(task.document_names) && task.document_names.length > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务主标题:单 PDF 用文件名;多 PDF 用 i18n「订单识别任务」;禁止 OT/Run 编号。
|
||||
*/
|
||||
function taskLabel(task: ConversationProcessingUserTask): string {
|
||||
if (isMultiDocumentTask(task)) {
|
||||
return t('chat.shippingProcessing.multiPdfTaskTitle');
|
||||
}
|
||||
const title = String(task.title || '').trim();
|
||||
if (title) return title;
|
||||
return t('chat.shippingProcessing.unnamedPdf');
|
||||
}
|
||||
|
||||
/**
|
||||
* 多 PDF 副标题:前两个文件名;超过两个时追加「等 N 个 PDF」。
|
||||
*/
|
||||
function documentNamesPreview(task: ConversationProcessingUserTask): string {
|
||||
const names = (Array.isArray(task.document_names) ? task.document_names : [])
|
||||
.map((name) => String(name || '').trim())
|
||||
.filter(Boolean);
|
||||
if (names.length <= 1) return '';
|
||||
const head = names.slice(0, 2).join(t('chat.shippingProcessing.multiPdfNameSeparator'));
|
||||
if (names.length === 2) return head;
|
||||
return t('chat.shippingProcessing.multiPdfNamesMore', {
|
||||
names: head,
|
||||
count: names.length,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件数量文案:多 PDF 用「N 个 PDF」,单文件仍用「N 个文件」。
|
||||
*/
|
||||
function fileCountLabel(task: ConversationProcessingUserTask): string {
|
||||
const count = Number(task.file_count || 0);
|
||||
if (count <= 0) return '';
|
||||
if (isMultiDocumentTask(task)) {
|
||||
return t('chat.shippingProcessing.taskPdfCount', { count });
|
||||
}
|
||||
return t('chat.shippingProcessing.taskFiles', { count });
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务状态文案:优先统一 shippingProcessing,回退 shippingWorkflow。
|
||||
*/
|
||||
function statusLabel(task: ConversationProcessingUserTask): string {
|
||||
return resolveShippingProcessingStatusLabel(String(task.status_label || ''), te, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* 最近活动时间:当天仅时分;昨天带「昨天」;更早带月日。
|
||||
*/
|
||||
function activityLabel(task: ConversationProcessingUserTask): string {
|
||||
const raw = String(task.last_activity_at || '').trim();
|
||||
if (!raw) return '';
|
||||
const date = new Date(raw);
|
||||
if (Number.isNaN(date.getTime())) return '';
|
||||
const hh = String(date.getHours()).padStart(2, '0');
|
||||
const mm = String(date.getMinutes()).padStart(2, '0');
|
||||
const time = `${hh}:${mm}`;
|
||||
const now = new Date();
|
||||
const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
const startOfTarget = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
const dayDiff = Math.round((startOfToday.getTime() - startOfTarget.getTime()) / 86400000);
|
||||
if (dayDiff === 0) {
|
||||
return t('chat.shippingProcessing.updatedAt', { time });
|
||||
}
|
||||
if (dayDiff === 1) {
|
||||
return t('chat.shippingProcessing.updatedYesterday', { time });
|
||||
}
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return t('chat.shippingProcessing.updatedOnDate', { date: `${month}-${day}`, time });
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否高亮 needs_action 任务。
|
||||
*/
|
||||
function isNeedsActionHighlight(task: ConversationProcessingUserTask): boolean {
|
||||
return task.group === 'needs_action';
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否展开该任务的文件详情区。
|
||||
*/
|
||||
function isDetailsExpanded(task: ConversationProcessingUserTask): boolean {
|
||||
return shouldExpandTaskDetails(uiState, task.user_task_no, {
|
||||
focusedTaskNo: focusedTaskNo.value,
|
||||
forceExpand: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务级可见操作:只展示后端权威动作中的业务入口。
|
||||
*/
|
||||
function visibleTaskActions(task: ConversationProcessingUserTask): string[] {
|
||||
const actions = Array.isArray(task.available_actions) ? task.available_actions : [];
|
||||
const preferred = [
|
||||
'view_details',
|
||||
'open_review',
|
||||
'enter_manual_review',
|
||||
'retry_failed_documents',
|
||||
'retry_failed_attachments',
|
||||
'cancel_task',
|
||||
'cancel_run',
|
||||
];
|
||||
const seen = new Set<string>();
|
||||
const result: string[] = [];
|
||||
for (const code of preferred) {
|
||||
if (!actions.includes(code) || seen.has(code)) continue;
|
||||
// 别名去重:只保留一套展示
|
||||
if (code === 'open_review' && seen.has('enter_manual_review')) continue;
|
||||
if (code === 'enter_manual_review' && seen.has('open_review')) continue;
|
||||
if (code === 'retry_failed_documents' && seen.has('retry_failed_attachments')) continue;
|
||||
if (code === 'retry_failed_attachments' && seen.has('retry_failed_documents')) continue;
|
||||
if (code === 'cancel_task' && seen.has('cancel_run')) continue;
|
||||
if (code === 'cancel_run' && seen.has('cancel_task')) continue;
|
||||
seen.add(code);
|
||||
result.push(code);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 动作按钮文案:任务级取消在多 PDF 时明确为「取消整个任务」。
|
||||
*/
|
||||
function actionLabel(task: ConversationProcessingUserTask, action: string): string {
|
||||
const code = String(action || '').trim();
|
||||
if (
|
||||
(code === 'cancel_task' || code === 'cancel_run')
|
||||
&& isMultiDocumentTask(task)
|
||||
) {
|
||||
return t('chat.shippingProcessing.cancelEntireTask');
|
||||
}
|
||||
if (code === 'cancel_task' || code === 'cancel_run') {
|
||||
return t('chat.shippingProcessing.cancelEntireTaskSingle');
|
||||
}
|
||||
const extractionKey = `chat.shippingOrderExtractionAction.${code}`;
|
||||
if (te(extractionKey)) return t(extractionKey);
|
||||
const aliases: Record<string, string> = {
|
||||
open_review: 'chat.shippingOrderExtractionAction.enter_manual_review',
|
||||
retry_failed_documents: 'chat.shippingOrderExtractionAction.retry_failed_attachments',
|
||||
};
|
||||
const alias = aliases[code];
|
||||
if (alias && te(alias)) return t(alias);
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行任务级动作:view_details 展开文件;其余交给父级。
|
||||
* 非权威任务号禁止向后端 focus/viewed 写接口。
|
||||
*/
|
||||
function onTaskAction(task: ConversationProcessingUserTask, action: string) {
|
||||
const code = String(action || '').trim();
|
||||
if (!code) return;
|
||||
if (code === 'view_details') {
|
||||
focusTaskManually(uiState, task.user_task_no, { expandDetails: true });
|
||||
markTaskViewed(uiState, task.user_task_no);
|
||||
emit('expandFiles', task);
|
||||
if (task.user_task_authoritative !== false) {
|
||||
emit('focus', task.user_task_no);
|
||||
emit('viewed', task.user_task_no);
|
||||
}
|
||||
return;
|
||||
}
|
||||
emit('taskAction', { task, action: code });
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake 材料标题:文件名 / 邮件主题 / Intake 编号。
|
||||
*/
|
||||
function intakeTitle(item: ShippingProcessingProjection): string {
|
||||
return String(
|
||||
item.sourceSummary?.filename
|
||||
|| item.sourceSummary?.emailSubject
|
||||
|| item.workItemNo
|
||||
|| '',
|
||||
).trim() || item.workItemNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake 状态文案。
|
||||
*/
|
||||
function intakeStatusLabel(item: ShippingProcessingProjection): string {
|
||||
return resolveShippingProcessingStatusLabel(item.status, te, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake 阶段文案。
|
||||
*/
|
||||
function intakeStageLabel(item: ShippingProcessingProjection): string {
|
||||
const key = shippingProcessingStageKey(item.stage);
|
||||
return te(key) ? t(key) : String(item.stage || '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake 来源类型文案。
|
||||
*/
|
||||
function intakeSourceLabel(item: ShippingProcessingProjection): string {
|
||||
const key = shippingProcessingSourceTypeKey(item.sourceType);
|
||||
return te(key) ? t(key) : String(item.sourceType || '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake / OT 门禁与失败恢复元信息(Gate / Attempt / 资产状态)。
|
||||
*/
|
||||
function intakeRecoveryMeta(item: ShippingProcessingProjection): string[] {
|
||||
const parts: string[] = [];
|
||||
const gate = item.currentGate;
|
||||
const reason = String(
|
||||
gate?.blockingReasonCode
|
||||
|| item.sourceSummary?.failureReasonCode
|
||||
|| '',
|
||||
).trim();
|
||||
if (reason) {
|
||||
parts.push(t('chat.shippingProcessing.failureReason', { code: reason }));
|
||||
}
|
||||
const attempt = gate?.attemptNo ?? item.sourceSummary?.parseAttemptCount;
|
||||
if (attempt != null && Number(attempt) > 0) {
|
||||
parts.push(t('chat.shippingProcessing.parseAttempt', { count: Number(attempt) }));
|
||||
}
|
||||
const assetStatus = String(item.sourceSummary?.assetStatus || '').trim();
|
||||
if (assetStatus) {
|
||||
const key = `chat.shippingProcessing.assetStatus.${assetStatus}`;
|
||||
parts.push(te(key) ? t(key) : t('chat.shippingProcessing.assetStatusLabel', { status: assetStatus }));
|
||||
}
|
||||
if (gate?.gateCode) {
|
||||
parts.push(t('chat.shippingProcessing.gateCode', { code: gate.gateCode }));
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake 可见动作(仅展示 retry_parse)。
|
||||
*/
|
||||
function visibleIntakeActions(item: ShippingProcessingProjection): string[] {
|
||||
const actions = Array.isArray(item.availableActions) ? item.availableActions : [];
|
||||
return actions.filter((code) => code === 'retry_parse');
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake 动作文案。
|
||||
*/
|
||||
function intakeActionLabel(action: string): string {
|
||||
if (action === 'retry_parse') return t('chat.shippingProcessing.retryFromFailure');
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发 Intake 级动作。
|
||||
*/
|
||||
function onIntakeAction(item: ShippingProcessingProjection, action: string) {
|
||||
const code = String(action || '').trim();
|
||||
if (!code) return;
|
||||
emit('intakeAction', { item, action: code });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="hasContent"
|
||||
class="space-y-3"
|
||||
data-testid="shipping-conversation-processing-card"
|
||||
>
|
||||
<section
|
||||
v-if="pendingIntakeItems.length"
|
||||
data-testid="shipping-processing-group-order-intake"
|
||||
>
|
||||
<div class="mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-violet-700 dark:text-violet-300">
|
||||
{{ t('chat.shippingProcessing.pendingMaterials') }}
|
||||
· {{ pendingIntakeItems.length }}
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<article
|
||||
v-for="item in pendingIntakeItems"
|
||||
:key="item.workItemNo"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-2"
|
||||
:data-testid="`shipping-processing-intake-${item.workItemNo}`"
|
||||
:data-source-type="item.sourceType"
|
||||
:data-status="item.status"
|
||||
>
|
||||
<div class="text-sm font-semibold text-primary">
|
||||
{{ intakeTitle(item) }}
|
||||
</div>
|
||||
<div class="mt-0.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-secondary">
|
||||
<span>{{ intakeSourceLabel(item) }}</span>
|
||||
<span>{{ intakeStatusLabel(item) }}</span>
|
||||
<span v-if="intakeStageLabel(item)">{{ intakeStageLabel(item) }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="intakeRecoveryMeta(item).length"
|
||||
class="mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-rose-700 dark:text-rose-300"
|
||||
data-testid="shipping-processing-intake-recovery"
|
||||
>
|
||||
<span
|
||||
v-for="(meta, idx) in intakeRecoveryMeta(item)"
|
||||
:key="`${item.workItemNo}-meta-${idx}`"
|
||||
>{{ meta }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="visibleIntakeActions(item).length"
|
||||
class="mt-1.5 flex flex-wrap gap-1.5"
|
||||
data-testid="shipping-processing-intake-actions"
|
||||
>
|
||||
<button
|
||||
v-for="action in visibleIntakeActions(item)"
|
||||
:key="`${item.workItemNo}-${action}`"
|
||||
type="button"
|
||||
class="rounded-md border border-default bg-surface px-2 py-0.5 text-[11px] text-secondary hover:text-primary"
|
||||
:data-testid="`shipping-processing-intake-action-${action}`"
|
||||
@click="onIntakeAction(item, action)"
|
||||
>
|
||||
{{ intakeActionLabel(action) }}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="activeProjection?.needs_action.length"
|
||||
data-testid="shipping-processing-group-needs_action"
|
||||
>
|
||||
<div class="mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-amber-700 dark:text-amber-300">
|
||||
{{ resolveShippingProcessingMessage('groupNeedsAction', te, t, { count: activeProjection.needs_action.length }) }}
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<article
|
||||
v-for="task in activeProjection.needs_action"
|
||||
:key="task.user_task_no"
|
||||
class="rounded-lg border px-2.5 py-2 transition"
|
||||
:class="[
|
||||
isNeedsActionHighlight(task)
|
||||
? 'border-amber-400 bg-amber-50/80 dark:border-amber-700 dark:bg-amber-950/30'
|
||||
: 'border-default bg-surface',
|
||||
focusedTaskNo === task.user_task_no ? 'ring-1 ring-brand-400' : '',
|
||||
]"
|
||||
:data-testid="`shipping-processing-task-${task.user_task_no}`"
|
||||
:data-focused="focusedTaskNo === task.user_task_no ? '1' : '0'"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="w-full text-left"
|
||||
@click="onSelectTask(task)"
|
||||
>
|
||||
<div class="text-sm font-semibold text-primary">
|
||||
{{ resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
|
||||
</div>
|
||||
<div 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>
|
||||
<span>{{ statusLabel(task) }}</span>
|
||||
<span v-if="activityLabel(task)">{{ activityLabel(task) }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="documentNamesPreview(task)"
|
||||
class="mt-0.5 truncate text-[11px] text-muted"
|
||||
data-testid="shipping-processing-task-document-names"
|
||||
>
|
||||
{{ documentNamesPreview(task) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="task.recent_append_count"
|
||||
class="mt-1 text-[11px] font-medium text-brand-700 dark:text-brand-300"
|
||||
>
|
||||
{{ resolveShippingProcessingMessage('justAppended', te, t, { count: task.recent_append_count }) }}
|
||||
</div>
|
||||
<div
|
||||
v-else-if="task.recently_created"
|
||||
class="mt-1 text-[11px] font-medium text-brand-700 dark:text-brand-300"
|
||||
>
|
||||
{{ resolveShippingProcessingMessage('justCreated', te, t) }}
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
v-if="visibleTaskActions(task).length"
|
||||
class="mt-1.5 flex flex-wrap gap-1.5"
|
||||
data-testid="shipping-processing-task-actions"
|
||||
>
|
||||
<button
|
||||
v-for="action in visibleTaskActions(task)"
|
||||
:key="`${task.user_task_no}-${action}`"
|
||||
type="button"
|
||||
class="rounded-md border border-default bg-surface px-2 py-0.5 text-[11px] text-secondary hover:text-primary"
|
||||
:data-testid="`shipping-processing-action-${action}`"
|
||||
@click="onTaskAction(task, action)"
|
||||
>
|
||||
{{ actionLabel(task, action) }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-1.5 flex items-center gap-1 text-[11px] text-secondary hover:text-primary"
|
||||
@click="onToggleDetails(task)"
|
||||
>
|
||||
<ChevronDown v-if="isDetailsExpanded(task)" class="h-3 w-3" />
|
||||
<ChevronRight v-else class="h-3 w-3" />
|
||||
{{ isDetailsExpanded(task)
|
||||
? t('chat.shippingProcessing.collapseFileDetails')
|
||||
: t('chat.shippingProcessing.expandFileDetails') }}
|
||||
</button>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="activeProjection?.processing.length"
|
||||
data-testid="shipping-processing-group-processing"
|
||||
>
|
||||
<div class="mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-sky-700 dark:text-sky-300">
|
||||
{{ resolveShippingProcessingMessage('groupProcessing', te, t, { count: activeProjection.processing.length }) }}
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<article
|
||||
v-for="task in activeProjection.processing"
|
||||
:key="task.user_task_no"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-2"
|
||||
:class="focusedTaskNo === task.user_task_no
|
||||
? 'ring-1 ring-brand-400'
|
||||
: ''"
|
||||
:data-testid="`shipping-processing-task-${task.user_task_no}`"
|
||||
:data-focused="focusedTaskNo === task.user_task_no ? '1' : '0'"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="w-full text-left"
|
||||
@click="onSelectTask(task)"
|
||||
>
|
||||
<div class="text-sm font-semibold text-primary">
|
||||
{{ resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
|
||||
</div>
|
||||
<div 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>
|
||||
<span>{{ statusLabel(task) }}</span>
|
||||
<span v-if="activityLabel(task)">{{ activityLabel(task) }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="documentNamesPreview(task)"
|
||||
class="mt-0.5 truncate text-[11px] text-muted"
|
||||
data-testid="shipping-processing-task-document-names"
|
||||
>
|
||||
{{ documentNamesPreview(task) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="task.recent_append_count"
|
||||
class="mt-1 text-[11px] font-medium text-brand-700 dark:text-brand-300"
|
||||
>
|
||||
{{ resolveShippingProcessingMessage('justAppended', te, t, { count: task.recent_append_count }) }}
|
||||
</div>
|
||||
<div
|
||||
v-else-if="task.recently_created"
|
||||
class="mt-1 text-[11px] font-medium text-brand-700 dark:text-brand-300"
|
||||
>
|
||||
{{ resolveShippingProcessingMessage('justCreated', te, t) }}
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
v-if="visibleTaskActions(task).length"
|
||||
class="mt-1.5 flex flex-wrap gap-1.5"
|
||||
data-testid="shipping-processing-task-actions"
|
||||
>
|
||||
<button
|
||||
v-for="action in visibleTaskActions(task)"
|
||||
:key="`${task.user_task_no}-${action}`"
|
||||
type="button"
|
||||
class="rounded-md border border-default bg-surface px-2 py-0.5 text-[11px] text-secondary hover:text-primary"
|
||||
:data-testid="`shipping-processing-action-${action}`"
|
||||
@click="onTaskAction(task, action)"
|
||||
>
|
||||
{{ actionLabel(task, action) }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-1.5 flex items-center gap-1 text-[11px] text-secondary hover:text-primary"
|
||||
@click="onToggleDetails(task)"
|
||||
>
|
||||
<ChevronDown v-if="isDetailsExpanded(task)" class="h-3 w-3" />
|
||||
<ChevronRight v-else class="h-3 w-3" />
|
||||
{{ isDetailsExpanded(task)
|
||||
? t('chat.shippingProcessing.collapseFileDetails')
|
||||
: t('chat.shippingProcessing.expandFileDetails') }}
|
||||
</button>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="completedTasks.length"
|
||||
data-testid="shipping-processing-group-completed"
|
||||
>
|
||||
<div class="mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-emerald-700 dark:text-emerald-300">
|
||||
{{ resolveShippingProcessingMessage('groupCompleted', te, t, { count: completedTasks.length }) }}
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<article
|
||||
v-for="task in completedTasks"
|
||||
:key="task.user_task_no"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-2"
|
||||
:class="focusedTaskNo === task.user_task_no
|
||||
? 'ring-1 ring-brand-400'
|
||||
: ''"
|
||||
:data-testid="`shipping-processing-task-${task.user_task_no}`"
|
||||
:data-focused="focusedTaskNo === task.user_task_no ? '1' : '0'"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="w-full text-left"
|
||||
@click="onSelectTask(task)"
|
||||
>
|
||||
<div class="text-sm font-semibold text-primary">
|
||||
{{ resolveShippingProcessingMessage('taskTitle', te, t, { label: taskLabel(task) }) }}
|
||||
</div>
|
||||
<div 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>
|
||||
<span>{{ statusLabel(task) }}</span>
|
||||
<span v-if="activityLabel(task)">{{ activityLabel(task) }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="documentNamesPreview(task)"
|
||||
class="mt-0.5 truncate text-[11px] text-muted"
|
||||
data-testid="shipping-processing-task-document-names"
|
||||
>
|
||||
{{ documentNamesPreview(task) }}
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
v-if="visibleTaskActions(task).length"
|
||||
class="mt-1.5 flex flex-wrap gap-1.5"
|
||||
data-testid="shipping-processing-task-actions"
|
||||
>
|
||||
<button
|
||||
v-for="action in visibleTaskActions(task)"
|
||||
:key="`${task.user_task_no}-${action}`"
|
||||
type="button"
|
||||
class="rounded-md border border-default bg-surface px-2 py-0.5 text-[11px] text-secondary hover:text-primary"
|
||||
:data-testid="`shipping-processing-action-${action}`"
|
||||
@click="onTaskAction(task, action)"
|
||||
>
|
||||
{{ actionLabel(task, action) }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-1.5 flex items-center gap-1 text-[11px] text-secondary hover:text-primary"
|
||||
@click="onToggleDetails(task)"
|
||||
>
|
||||
<ChevronDown v-if="isDetailsExpanded(task)" class="h-3 w-3" />
|
||||
<ChevronRight v-else class="h-3 w-3" />
|
||||
{{ isDetailsExpanded(task)
|
||||
? t('chat.shippingProcessing.collapseFileDetails')
|
||||
: t('chat.shippingProcessing.expandFileDetails') }}
|
||||
</button>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user