feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
84a881b554
commit
74270adc22
149 files changed
+20111
-3871
No files matched your search
@@ -1,19 +1,14 @@
|
||||
/**
|
||||
* features/chat/components/shipping/ShippingOrderExtractionCard.vue
|
||||
* 用途:聊天主区批次进度卡——摘要计数、Run 级诊断事项、当前文件阶段、健康提醒与动作。
|
||||
* 依赖:订单抽取 Run 状态卡 DTO、shipping.api 文档/进度接口、ShippingOrderExtractionDetailsDrawer、
|
||||
* orderExtractionProgressDisplay、vue-router、vue-i18n、ChatProgressSummary;
|
||||
* ProcessGateRecoveryCard 仅兼容保留(runLevelProcessGate 当前恒为空)。
|
||||
* 逻辑:有统一投影时按当前 Run 根 OT 展示全部 PDF/OT 紧凑进度,主操作仅来自投影;
|
||||
* handlingItems 保留诊断信息,不再渲染与投影平级的 primaryAction 主按钮;
|
||||
* Run 失败优先展示 errorExplainability.message;详情抽屉证据入口携带 focus+document_id。
|
||||
* 用途:聊天主区「订单识别任务」摘要卡——标题、文件数+状态、一行 handling 摘要、唯一主 CTA、查看详情。
|
||||
* 依赖:订单抽取 Run 状态卡 DTO、shipping.api 文档/进度接口、ShippingOrderExtractionDetailsDrawer、vue-router、vue-i18n。
|
||||
* 逻辑:对话区只做任务摘要;长进度/Gate/刷新取消由右侧栏承接;详情抽屉仅由次要「查看详情」打开。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { CircleCheck, CircleX, LoaderCircle, TriangleAlert } from 'lucide-vue-next';
|
||||
import { CHAT_PAGE_KEY } from '@/features/chat/composables/chat.context';
|
||||
import type {
|
||||
ShippingOrderExtractionHandlingItemState,
|
||||
ShippingOrderExtractionState,
|
||||
@@ -21,28 +16,12 @@ import type {
|
||||
import type {
|
||||
ShippingOrderExtractionDocumentResult,
|
||||
ShippingOrderExtractionProgressEvent,
|
||||
ShippingProcessGateUserSummary,
|
||||
} from '../../types/shipping.api.types';
|
||||
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
|
||||
import ChatProgressSummary from '@/features/shipping-progress/components/ChatProgressSummary.vue';
|
||||
import {
|
||||
SHIPPING_WORKFLOW_KEY,
|
||||
} from '@/features/chat/shipping/useShippingNoticeWorkflow';
|
||||
import type { ShippingProcessingProjection } from '../../types/shipping.api.types';
|
||||
import type { ActionPresentationItem } from '@/features/shipping-progress/types';
|
||||
import {
|
||||
listWorkspaceShippingOrderExtractionDocuments,
|
||||
listWorkspaceShippingOrderExtractionProgressEvents,
|
||||
} from '../../api/shipping.api';
|
||||
import {
|
||||
formatOrderExtractionElapsed,
|
||||
resolveOrderExtractionUserStageKey,
|
||||
} from '../../shipping/orderExtractionProgressDisplay';
|
||||
import {
|
||||
listDisplayableHandlingAffectedRefs,
|
||||
type ShippingHandlingAffectedRef,
|
||||
type ShippingHandlingRefTarget,
|
||||
} from '../../shipping/orderExtractionHandlingRefs';
|
||||
import ShippingOrderExtractionDetailsDrawer from './ShippingOrderExtractionDetailsDrawer.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -54,7 +33,7 @@ const props = defineProps<{
|
||||
/** 新版 Run 已替代旧版时,历史卡仅允许查看详情。 */
|
||||
readonly?: boolean;
|
||||
readonlyReason?: string | null;
|
||||
/** 可选统一投影;缺省时从 SHIPPING_WORKFLOW_KEY 解析。 */
|
||||
/** 可选统一投影;摘要卡不再渲染进度,仅保留 prop 兼容宿主。 */
|
||||
processingProjection?: ShippingProcessingProjection | null;
|
||||
}>();
|
||||
|
||||
@@ -67,74 +46,6 @@ const emit = defineEmits<{
|
||||
const { t, te } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const chatPage = inject(CHAT_PAGE_KEY, null);
|
||||
const shippingWorkflow = inject(SHIPPING_WORKFLOW_KEY, null);
|
||||
|
||||
/**
|
||||
* 解析当前 Run/任务对应的全部统一 ShippingProcessing 投影。
|
||||
* 核心逻辑:显式 prop 优先;根 OT 同时匹配自身与 rootOrderTaskNo 相同的兄弟 OT;
|
||||
* Candidate 前回退本会话 order_intake,禁止用 find() 丢失同 Run 的其他 PDF。
|
||||
*/
|
||||
const resolvedProcessingProjections = computed((): ShippingProcessingProjection[] => {
|
||||
if (props.processingProjection) return [props.processingProjection];
|
||||
const items = shippingWorkflow?.processingWorkItems?.value || [];
|
||||
if (!items.length) return [];
|
||||
const taskNo = String(props.state.userTaskNo || '').trim();
|
||||
if (taskNo) {
|
||||
const matched = items.filter((item) => (
|
||||
item.workItemType === 'order_task'
|
||||
&& (
|
||||
String(item.workItemNo || '').trim() === taskNo
|
||||
|| String(item.rootOrderTaskNo || '').trim() === taskNo
|
||||
)
|
||||
));
|
||||
if (matched.length) return matched;
|
||||
}
|
||||
return items.filter((item) => item.workItemType === 'order_intake');
|
||||
});
|
||||
|
||||
const hasProcessingProjection = computed(() => resolvedProcessingProjections.value.length > 0);
|
||||
|
||||
/** 进度行标题优先使用 PDF 文件名,其次使用 PO,最后使用工作项号。 */
|
||||
function processingProjectionTitle(item: ShippingProcessingProjection): string {
|
||||
return String(
|
||||
item.sourceSummary?.filename
|
||||
|| item.sourceSummary?.poNumber
|
||||
|| item.workItemNo,
|
||||
).trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一进度摘要动作:刷新 / 进入复核等由宿主路由承接。
|
||||
*/
|
||||
function onChatProgressAction(item: ActionPresentationItem) {
|
||||
if (item.intent === 'refresh') {
|
||||
emit('refresh');
|
||||
return;
|
||||
}
|
||||
if (item.intent === 'open_order_review') {
|
||||
void openOrderReview();
|
||||
}
|
||||
}
|
||||
const confirmCancelOpen = ref(false);
|
||||
const cancelReason = ref('');
|
||||
|
||||
/**
|
||||
* Gate 恢复卡「确认客户」:打开对话叠层客户选择弹窗。
|
||||
*/
|
||||
async function onGateConfirmCustomer(taskNo: string) {
|
||||
await chatPage?.openShippingCustomerDialog?.(taskNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run 级阻断 Gate:co8 后不再从 Workflow items 读取;由复核/Gate 主路径承接。
|
||||
*/
|
||||
const runLevelProcessGate = computed((): ShippingProcessGateUserSummary | null => null);
|
||||
|
||||
const gateNavigationContext = computed(() => ({
|
||||
agentId: String(route.params.agentId || ''),
|
||||
conversationId: String(route.query.conversation_id || ''),
|
||||
}));
|
||||
|
||||
const detailsOpen = ref(false);
|
||||
const detailsLoading = ref(false);
|
||||
@@ -146,24 +57,7 @@ const progressEvents = ref<ShippingOrderExtractionProgressEvent[]>([]);
|
||||
|
||||
const displaySummary = computed(() => props.state.summary);
|
||||
|
||||
const workflowStageLabel = computed(() => '');
|
||||
const workflowLastActivityLabel = computed(() => '');
|
||||
|
||||
const handlingItems = computed(() => {
|
||||
const items = props.state.handlingItems || [];
|
||||
// [UI-04] 有 OT 统一投影时,隐藏已被 Gate/进度表达的复核类事项,仅保留未归属异常。
|
||||
if (!hasProcessingProjection.value) return items;
|
||||
const covered = new Set([
|
||||
'manual_review',
|
||||
'field_conflict',
|
||||
'customer_confirmation',
|
||||
'candidate_confirmation',
|
||||
'duplicate_check',
|
||||
'inventory_source',
|
||||
'review_required',
|
||||
]);
|
||||
return items.filter((item) => !covered.has(String(item.category || '').trim()));
|
||||
});
|
||||
const handlingItems = computed(() => props.state.handlingItems || []);
|
||||
|
||||
/**
|
||||
* 是否为「仅重复关联已有任务、无需人工复核」终态通知。
|
||||
@@ -178,7 +72,7 @@ const isDuplicateOnlyNotice = computed(() => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 是否为纯候选确认场景;优先信任后端 primary_notice,避免用摘要计数掩盖混合原因。
|
||||
* 是否为纯候选确认场景;优先信任后端 primary_notice。
|
||||
*/
|
||||
const isCandidateConfirmationNotice = computed(() => (
|
||||
props.state.primaryNotice === 'candidate_confirmation'
|
||||
@@ -210,18 +104,6 @@ const toneClass = computed(() => {
|
||||
}
|
||||
});
|
||||
|
||||
const stageLabel = computed(() => {
|
||||
const key = resolveOrderExtractionUserStageKey(
|
||||
props.state.currentActivity?.userVisibleStage || props.state.userVisibleStage,
|
||||
props.state.currentActivity?.eventCode || props.state.status,
|
||||
);
|
||||
return te(key) ? t(key) : '';
|
||||
});
|
||||
|
||||
const elapsedLabel = computed(() =>
|
||||
formatOrderExtractionElapsed(props.state.currentActivity?.elapsedSeconds),
|
||||
);
|
||||
|
||||
/**
|
||||
* 将处理事项类别映射为一句过程通知文案。
|
||||
* @param category - 后端 primary_notice / handling item category
|
||||
@@ -232,12 +114,24 @@ function noticeForCategory(category: string): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 一句过程通知;有 handling_items 时以后端类别为准,不再笼统写「需人工处理」。
|
||||
* 解析处理事项标题。
|
||||
* @param item - 后端 handling item
|
||||
*/
|
||||
const compactLine = computed(() => {
|
||||
function handlingTitle(item: ShippingOrderExtractionHandlingItemState): string {
|
||||
const key = `chat.shippingOrderExtractionHandling.category.${item.category}`;
|
||||
return te(key) ? t(key) : item.category;
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态短句:排队/处理中仅「系统处理中」;其余用过程通知,不含文件阶段耗时。
|
||||
*/
|
||||
const statusNotice = computed(() => {
|
||||
if (props.state.cancellation?.requested && !props.state.cancellation?.completedAt && !props.state.terminal) {
|
||||
return t('chat.shippingOrderExtractionUserStage.cancellation_requested');
|
||||
}
|
||||
if (props.state.status === 'queued' || props.state.status === 'processing') {
|
||||
return t('chat.shippingProcessing.systemProcessing');
|
||||
}
|
||||
if (isDuplicateOnlyNotice.value) {
|
||||
return t('chat.shippingSessionSummary.processNoticeDuplicateLinked');
|
||||
}
|
||||
@@ -258,78 +152,78 @@ const compactLine = computed(() => {
|
||||
if (explained) return explained;
|
||||
return t('chat.shippingSessionSummary.processNoticeFailed');
|
||||
}
|
||||
default: {
|
||||
if (props.state.status === 'queued' || props.state.status === 'processing') {
|
||||
const parts: string[] = [];
|
||||
const fileName = String(props.state.currentActivity?.fileName || '').trim();
|
||||
if (fileName) {
|
||||
parts.push(t('chat.shippingOrderExtractionCurrentFile', {
|
||||
fileName: fileName || t('chat.shippingOrderExtractionUnknownDocument'),
|
||||
}));
|
||||
}
|
||||
const stage = stageLabel.value;
|
||||
if (stage) parts.push(stage);
|
||||
const elapsed = elapsedLabel.value;
|
||||
if (elapsed) parts.push(t('chat.shippingOrderExtractionElapsed', { elapsed }));
|
||||
if (parts.length) return parts.join(' · ');
|
||||
}
|
||||
default:
|
||||
return t('chat.shippingSessionSummary.processNoticeProcessing');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const activityKey = computed(() => {
|
||||
const code = String(props.state.currentActivity?.eventCode || '').trim();
|
||||
const key = `chat.shippingOrderExtractionActivity.${code}`;
|
||||
return code && te(key) ? key : '';
|
||||
/**
|
||||
* 文件数 + 状态一行:`N 个文件 · 系统处理中`(或终态通知)。
|
||||
*/
|
||||
const statusLine = computed(() => {
|
||||
const count = Math.max(0, Number(displaySummary.value.totalDocuments || 0));
|
||||
const status = statusNotice.value;
|
||||
if (count <= 0) return status;
|
||||
return `${t('chat.shippingProcessing.taskFiles', { count })} · ${status}`;
|
||||
});
|
||||
|
||||
/**
|
||||
* 一行 handling 摘要(无操作按钮);无事项时为空。
|
||||
*/
|
||||
const handlingSummaryLine = computed(() => {
|
||||
const items = handlingItems.value;
|
||||
if (!items.length) return '';
|
||||
const first = items[0];
|
||||
if (!first) return '';
|
||||
const totalCount = items.reduce((sum, item) => sum + Math.max(0, Number(item.count || 0)), 0);
|
||||
const count = totalCount > 0 ? totalCount : items.length;
|
||||
return t('chat.shippingOrderExtractionHandling.summaryLine', {
|
||||
title: handlingTitle(first),
|
||||
count,
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 唯一主 CTA:失败→重试解析;需处理→继续处理;否则不展示。
|
||||
*/
|
||||
const primaryChatAction = computed((): { kind: 'retry' | 'continue'; label: string } | null => {
|
||||
if (props.readonly) return null;
|
||||
const actions = props.state.availableActions || [];
|
||||
const canRetry = actions.includes('retry_failed_attachments')
|
||||
|| actions.includes('retry_failed_documents')
|
||||
|| displaySummary.value.failedDocuments > 0
|
||||
|| props.state.status === 'failed';
|
||||
if (canRetry) {
|
||||
return {
|
||||
kind: 'retry',
|
||||
label: t('chat.shippingNoticeRetryParse'),
|
||||
};
|
||||
}
|
||||
const needsContinue = actions.includes('enter_manual_review')
|
||||
|| actions.includes('review_candidate')
|
||||
|| actions.includes('open_order_review')
|
||||
|| actions.includes('open_order_processing')
|
||||
|| props.state.status === 'review_required'
|
||||
|| props.state.status === 'partially_completed'
|
||||
|| isCandidateConfirmationNotice.value;
|
||||
if (needsContinue) {
|
||||
return {
|
||||
kind: 'continue',
|
||||
label: t('chat.shippingProcessing.continueProcessing'),
|
||||
};
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
const showRetry = computed(() => (
|
||||
!props.readonly && (
|
||||
props.state.availableActions.includes('retry_failed_attachments')
|
||||
|| displaySummary.value.failedDocuments > 0
|
||||
)
|
||||
));
|
||||
const showRefresh = computed(() => !props.readonly && props.state.availableActions.includes('refresh_status'));
|
||||
const showCancel = computed(() => (
|
||||
!props.readonly
|
||||
&&
|
||||
props.state.availableActions.includes('cancel_run')
|
||||
&& !(props.state.cancellation?.requested && !props.state.cancellation?.completedAt)
|
||||
));
|
||||
const healthTips = computed(() => props.state.healthTips || []);
|
||||
|
||||
/**
|
||||
* 解析处理事项标题。
|
||||
* @param item - 后端 handling item
|
||||
*/
|
||||
function handlingTitle(item: ShippingOrderExtractionHandlingItemState): string {
|
||||
const key = `chat.shippingOrderExtractionHandling.category.${item.category}`;
|
||||
return te(key) ? t(key) : item.category;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析原因码文案;未知或内部技术码统一回退为可执行的业务提示。
|
||||
* @param code - 原因码
|
||||
*/
|
||||
function reasonLabel(code: string): string {
|
||||
const normalized = String(code || '').trim();
|
||||
if (!normalized) return '';
|
||||
const key = `chat.shippingOrderExtractionReason.${normalized}`;
|
||||
if (te(key)) return t(key);
|
||||
const freezeKey = `chat.shippingOrderExtractionHandling.reason.${normalized}`;
|
||||
return te(freezeKey) ? t(freezeKey) : t('chat.shippingOrderExtractionReasonUnknown');
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开订单复核工作台(Chat order-review 模式)。
|
||||
* @param options.documentId - 可选,定位到具体 PDF
|
||||
* @param options.candidateNo - 可选,写入 query 供复核页筛选
|
||||
* @param options.focus - evidence=证据区;draft=草稿复核(默认)
|
||||
*/
|
||||
async function openOrderReview(options?: {
|
||||
documentId?: number;
|
||||
candidateNo?: string;
|
||||
focus?: 'evidence' | 'draft';
|
||||
}) {
|
||||
const runNo = String(props.runNo || '').trim();
|
||||
@@ -341,8 +235,6 @@ async function openOrderReview(options?: {
|
||||
mode: 'order-review',
|
||||
run_no: runNo,
|
||||
};
|
||||
const candidateNo = String(options?.candidateNo || '').trim();
|
||||
if (candidateNo) query.candidate = candidateNo;
|
||||
const documentId = Number(options?.documentId || 0);
|
||||
if (documentId > 0) query.document_id = String(documentId);
|
||||
const focus = options?.focus === 'evidence' || options?.focus === 'draft'
|
||||
@@ -441,87 +333,15 @@ async function enterReviewFromDetails(payload?: { focus?: 'evidence' | 'draft';
|
||||
}
|
||||
|
||||
/**
|
||||
* 在对话侧聚焦 Task(双工作台主路径);Task 工作台仅作备用深链。
|
||||
* 执行唯一主 CTA:重试解析或进入订单处理。
|
||||
*/
|
||||
async function focusTaskInChat(taskNo: string) {
|
||||
const normalized = String(taskNo || '').trim();
|
||||
if (!normalized) return;
|
||||
const conversationId = String(route.query.conversation_id || '').trim();
|
||||
await router.replace({
|
||||
name: 'Chat',
|
||||
params: { agentId: String(route.params.agentId || '') },
|
||||
query: {
|
||||
...route.query,
|
||||
conversation_id: conversationId || undefined,
|
||||
focus_task_no: normalized,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 按受影响对象引用跳转到对话聚焦或复核入口。
|
||||
*/
|
||||
async function openAffectedRef(target: ShippingHandlingRefTarget) {
|
||||
if (target.kind === 'chat_focus_task') {
|
||||
await focusTaskInChat(target.taskNo);
|
||||
return;
|
||||
}
|
||||
if (target.kind === 'review') {
|
||||
await openOrderReview({
|
||||
documentId: target.documentId,
|
||||
candidateNo: target.candidateNo,
|
||||
focus: 'draft',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出事项下可展示的受影响对象。
|
||||
*/
|
||||
function affectedRows(item: ShippingOrderExtractionHandlingItemState) {
|
||||
return listDisplayableHandlingAffectedRefs(item.affectedRefs as ShippingHandlingAffectedRef[]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按处理事项主动作跳转或触发重试;优先跳到首个受影响对象。
|
||||
* @param item - 处理事项
|
||||
*/
|
||||
async function handleHandlingAction(item: ShippingOrderExtractionHandlingItemState) {
|
||||
if (props.readonly) return;
|
||||
const action = String(item.primaryAction || '').trim();
|
||||
if (action === 'retry_failed_attachments') {
|
||||
async function onPrimaryChatAction() {
|
||||
if (!primaryChatAction.value || props.readonly) return;
|
||||
if (primaryChatAction.value.kind === 'retry') {
|
||||
emit('retry');
|
||||
return;
|
||||
}
|
||||
const first = affectedRows(item)[0];
|
||||
if (first && first.target.kind !== 'none') {
|
||||
await openAffectedRef(first.target);
|
||||
return;
|
||||
}
|
||||
if (action === 'view_details') {
|
||||
await openDetailsDrawer();
|
||||
return;
|
||||
}
|
||||
if (action === 'enter_manual_review' || action === 'review_candidate') {
|
||||
await openOrderReview({ focus: 'draft' });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认后发出取消事件;取消是请求语义,由后端检查点生效。
|
||||
*/
|
||||
function confirmCancel() {
|
||||
confirmCancelOpen.value = false;
|
||||
const reason = String(cancelReason.value || '').trim();
|
||||
cancelReason.value = '';
|
||||
emit('cancel', reason || undefined);
|
||||
}
|
||||
|
||||
/** 打开取消确认并清空上次填写的原因。 */
|
||||
function openCancelConfirm() {
|
||||
if (props.readonly) return;
|
||||
cancelReason.value = '';
|
||||
confirmCancelOpen.value = true;
|
||||
await openOrderReview({ focus: 'draft' });
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -554,7 +374,21 @@ function openCancelConfirm() {
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionHistory.superseded') }}
|
||||
</div>
|
||||
<div class="text-sm font-medium">{{ compactLine }}</div>
|
||||
|
||||
<div
|
||||
class="text-sm font-medium"
|
||||
data-testid="shipping-order-extraction-title"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.multiPdfTaskTitle') }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-0.5 text-xs opacity-90"
|
||||
data-testid="shipping-order-extraction-status-line"
|
||||
>
|
||||
{{ statusLine }}
|
||||
</div>
|
||||
|
||||
<p
|
||||
v-if="state.errorExplainability?.request_id"
|
||||
class="mt-1 text-[11px] opacity-80"
|
||||
@@ -564,134 +398,11 @@ function openCancelConfirm() {
|
||||
</p>
|
||||
|
||||
<div
|
||||
v-if="displaySummary.totalDocuments > 0"
|
||||
class="mt-1.5 flex flex-wrap gap-1.5 text-[11px] opacity-90"
|
||||
data-testid="shipping-order-extraction-summary"
|
||||
v-if="handlingSummaryLine"
|
||||
class="mt-1.5 text-xs opacity-90"
|
||||
data-testid="shipping-order-extraction-handling-summary"
|
||||
>
|
||||
<span>{{ t('chat.shippingOrderExtractionSummary.total', { count: displaySummary.totalDocuments }) }}</span>
|
||||
<span v-if="displaySummary.processingDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.processing', { count: displaySummary.processingDocuments }) }}
|
||||
</span>
|
||||
<span v-if="displaySummary.pendingDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.pending', { count: displaySummary.pendingDocuments }) }}
|
||||
</span>
|
||||
<span v-if="displaySummary.completedDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.completed', { count: displaySummary.completedDocuments }) }}
|
||||
</span>
|
||||
<span v-if="displaySummary.reviewRequiredDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.reviewRequired', { count: displaySummary.reviewRequiredDocuments }) }}
|
||||
</span>
|
||||
<span v-if="displaySummary.failedDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.failed', { count: displaySummary.failedDocuments }) }}
|
||||
</span>
|
||||
<span v-if="(displaySummary.cancelledDocuments || 0) > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.cancelled', { count: displaySummary.cancelledDocuments }) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="workflowStageLabel || workflowLastActivityLabel"
|
||||
class="mt-1 text-[11px] opacity-80"
|
||||
data-testid="shipping-order-extraction-workflow-meta"
|
||||
>
|
||||
<span v-if="workflowStageLabel">{{ workflowStageLabel }}</span>
|
||||
<span v-if="workflowLastActivityLabel" class="ml-1">· {{ workflowLastActivityLabel }}</span>
|
||||
</div>
|
||||
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="runLevelProcessGate?.current_blocking_gate && !hasProcessingProjection"
|
||||
class="mt-2"
|
||||
:summary="runLevelProcessGate"
|
||||
:can-handle="!readonly"
|
||||
:navigation-context="gateNavigationContext"
|
||||
@refreshed="emit('refresh')"
|
||||
@refresh-needed="emit('refresh')"
|
||||
@confirm-customer="(taskNo) => void onGateConfirmCustomer(taskNo)"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="hasProcessingProjection"
|
||||
class="mt-2 space-y-2"
|
||||
data-testid="chat-progress-summary-list"
|
||||
>
|
||||
<div
|
||||
v-for="projection in resolvedProcessingProjections"
|
||||
:key="projection.workItemNo"
|
||||
>
|
||||
<div class="truncate text-[11px] font-semibold opacity-90">
|
||||
{{ processingProjectionTitle(projection) }}
|
||||
</div>
|
||||
<ChatProgressSummary
|
||||
:projection="projection"
|
||||
@action="onChatProgressAction"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="handlingItems.length"
|
||||
class="mt-2 space-y-1.5"
|
||||
data-testid="shipping-order-extraction-handling-items"
|
||||
>
|
||||
<div class="text-[11px] font-medium opacity-90">
|
||||
{{ t('chat.shippingOrderExtractionHandling.title') }}
|
||||
</div>
|
||||
<div
|
||||
v-for="item in handlingItems"
|
||||
:key="item.category"
|
||||
class="rounded-md border border-current/15 bg-black/5 px-2 py-1.5 text-xs dark:bg-white/5"
|
||||
data-testid="shipping-order-extraction-handling-item"
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<div class="min-w-0 font-medium">
|
||||
{{ handlingTitle(item) }}
|
||||
<span class="ml-1 opacity-80">{{ t('chat.shippingOrderExtractionHandling.count', { count: item.count }) }}</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="item.primaryAction && !readonly && !hasProcessingProjection && (item.primaryAction !== 'review_candidate' || !handlingItems.some((other) => other.primaryAction === 'enter_manual_review'))"
|
||||
type="button"
|
||||
class="shrink-0 rounded-md border border-current/20 px-2 py-0.5 text-[11px] font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
data-testid="shipping-order-extraction-handling-primary-action"
|
||||
@click="handleHandlingAction(item)"
|
||||
>
|
||||
{{ (item.primaryAction === 'review_candidate' || item.primaryAction === 'enter_manual_review')
|
||||
? t('chat.shippingOrderExtractionAction.enter_manual_review')
|
||||
: te(`chat.shippingOrderExtractionAction.${item.primaryAction}`)
|
||||
? t(`chat.shippingOrderExtractionAction.${item.primaryAction}`)
|
||||
: t('chat.shippingOrderExtractionAction.view_details') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="item.reasonCodes.length" class="mt-1 opacity-80">
|
||||
{{ t('chat.shippingOrderExtractionHandling.reasonPrefix') }}
|
||||
{{ item.reasonCodes.slice(0, 4).map(reasonLabel).join(';') }}
|
||||
</div>
|
||||
<div
|
||||
v-if="affectedRows(item).length"
|
||||
class="mt-1.5 flex flex-wrap gap-1"
|
||||
data-testid="shipping-order-extraction-affected-refs"
|
||||
>
|
||||
<span class="opacity-80">{{ t('chat.shippingOrderExtractionHandling.affectedPrefix') }}</span>
|
||||
<button
|
||||
v-for="row in affectedRows(item)"
|
||||
:key="row.key"
|
||||
type="button"
|
||||
class="rounded border border-current/20 px-1.5 py-0.5 text-[11px] font-medium underline-offset-2 hover:underline"
|
||||
:disabled="readonly"
|
||||
@click="openAffectedRef(row.target)"
|
||||
>
|
||||
{{ row.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="state.currentActivity?.fileName" class="mt-1 text-xs opacity-80">
|
||||
{{ t('chat.shippingOrderExtractionCurrentFile', {
|
||||
fileName: state.currentActivity.fileName || t('chat.shippingOrderExtractionUnknownDocument'),
|
||||
}) }}
|
||||
<span v-if="stageLabel"> · {{ stageLabel }}</span>
|
||||
<span v-else-if="activityKey"> · {{ t(activityKey) }}</span>
|
||||
<span v-if="elapsedLabel"> · {{ t('chat.shippingOrderExtractionElapsed', { elapsed: elapsedLabel }) }}</span>
|
||||
{{ handlingSummaryLine }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
@@ -707,80 +418,27 @@ function openCancelConfirm() {
|
||||
{{ t('chat.shippingOrderExtractionRefreshFailed') }}
|
||||
</div>
|
||||
|
||||
<div v-if="confirmCancelOpen" class="mt-2 rounded-md border border-current/20 bg-black/5 p-2 text-xs dark:bg-white/5">
|
||||
<div class="font-medium">{{ t('chat.shippingOrderExtractionCancel.confirmTitle') }}</div>
|
||||
<div class="mt-1 opacity-80">{{ t('chat.shippingOrderExtractionCancel.confirmImpact') }}</div>
|
||||
<label class="mt-2 block opacity-90">
|
||||
{{ t('chat.shippingOrderExtractionCancel.reasonOptional') }}
|
||||
<textarea
|
||||
v-model="cancelReason"
|
||||
rows="2"
|
||||
class="input-field mt-1 w-full py-1 text-xs"
|
||||
:placeholder="t('chat.shippingOrderExtractionCancel.reasonOptional')"
|
||||
/>
|
||||
</label>
|
||||
<div class="mt-2 flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
:disabled="cancelling"
|
||||
@click="confirmCancel"
|
||||
>
|
||||
{{ cancelling
|
||||
? t('chat.shippingOrderExtractionCancel.submitting')
|
||||
: t('chat.shippingOrderExtractionAction.cancel_run') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium opacity-80 hover:underline"
|
||||
:disabled="cancelling"
|
||||
@click="confirmCancelOpen = false; cancelReason = ''"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionCancel.dismiss') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="mt-2 flex flex-wrap gap-2">
|
||||
<div class="mt-2 flex flex-wrap items-center gap-3">
|
||||
<button
|
||||
v-if="primaryChatAction"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
data-testid="shipping-order-extraction-primary-action"
|
||||
:disabled="primaryChatAction.kind === 'retry' && retrying"
|
||||
@click="onPrimaryChatAction"
|
||||
>
|
||||
{{ primaryChatAction.kind === 'retry' && retrying
|
||||
? t('chat.shippingOrderExtractionRetrying')
|
||||
: primaryChatAction.label }}
|
||||
</button>
|
||||
<button
|
||||
v-if="String(props.runNo || '').trim()"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
class="text-xs font-medium underline-offset-2 opacity-80 hover:underline"
|
||||
data-testid="shipping-order-extraction-view-details"
|
||||
@click="openDetailsDrawer"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionAction.view_details') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showRefresh"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
:disabled="refreshing"
|
||||
@click="emit('refresh')"
|
||||
>
|
||||
{{ refreshing
|
||||
? t('chat.shippingOrderExtractionRefreshing')
|
||||
: t('chat.shippingOrderExtractionAction.refresh_status') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showCancel"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
:disabled="cancelling"
|
||||
@click="openCancelConfirm"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionAction.cancel_run') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showRetry"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
:disabled="retrying"
|
||||
@click="emit('retry')"
|
||||
>
|
||||
{{ retrying
|
||||
? t('chat.shippingOrderExtractionRetrying')
|
||||
: t('chat.shippingOrderExtractionAction.retry_failed_attachments') }}
|
||||
{{ t('chat.shippingProcessing.viewTaskDetails') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user