- 后端进度写入 step_key 全量切换为 15 阶契约 stage 码 - 投影层清除 CheckPoint stepN_* 遗留别名与子串/前缀启发式,阶段信号按契约码精确匹配 - 建单前 Case 摘要透传草稿首要阻断原因 - 前端标签/归一化/处理卡片同步契约码,阻断原因按 i18n 优先展示 - 修复正式下游回看时 activeCase 刻意为空导致队列定位与接收解析上下文静默跳过 - 同步更新投影/门禁/工作台/RPA 流程测试
506 lines
22 KiB
Vue
506 lines
22 KiB
Vue
<!--
|
||
features/chat/components/shipping-review/ReviewCurrentProcessingCard.vue
|
||
用途:发货通知工作台右侧唯一的「当前任务」主卡(阶段 + 用户状态 + 阻断 + 动作)。
|
||
依赖:vue-i18n、ShippingProcessingBlockingReason/PrimaryAction 类型、resolveShippingProcessingStageLabel。
|
||
逻辑:主卡内部 section = 「当前阶段/状态/正式OT → 下一步 → 动作区」;
|
||
状态文案严格绑定 user_status;blocking_reason 只作下一步问题说明;按钮显隐由后端 retryable + primary_action.parameters 决定;
|
||
主动作按钮文案 fail-closed:后端下发动作码但无受控 i18n 文案时整体隐藏该按钮(含图标),禁止渲染无文字裸按钮;
|
||
loading 仅代表「权威投影读取中」而非系统运行态:已知阶段/状态/阻断仍照常展示
|
||
(与投影同源或后端 automation 运行态),空态自然落到「待机/状态待确认」,
|
||
禁止把读取占位误述为「系统处理中」,也不做骨架→真值的二次刷新;
|
||
loading 仅在挂载期抑制可执行动作,等权威投影到达后再放行(fail-closed);
|
||
由 ShippingOrderReviewView 在 mountCurrentProcessingCard 时挂载;
|
||
v2 新增 statusDetail:状态块内嵌动态说明(隐藏裁决在视图侧,见 spec §5.2);
|
||
v4 语义分离:下一步优先消费 blocking_reason.next_action 的建议动作文案,
|
||
且具体阻断原因在场时隐藏泛化 statusDetail(防同卡三行「待人工」空话)。
|
||
-->
|
||
<script setup lang="ts">
|
||
import { computed } from 'vue';
|
||
import { Bot, RefreshCw, Crosshair } from 'lucide-vue-next';
|
||
import { useI18n } from 'vue-i18n';
|
||
import type {
|
||
ShippingProcessingBlockingReason,
|
||
ShippingProcessingPrimaryAction,
|
||
} from '@/features/chat/types/shipping.api.types';
|
||
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';
|
||
|
||
const props = defineProps<{
|
||
stageCode?: string | null;
|
||
stageLabelKey?: string | null;
|
||
stageInconsistent?: boolean;
|
||
|
||
userStatus?:
|
||
| 'running'
|
||
| 'waiting_human'
|
||
| 'retryable'
|
||
| 'failed'
|
||
| 'completed'
|
||
| 'cancelled'
|
||
| null;
|
||
retryable?: boolean;
|
||
blockingReason?: ShippingProcessingBlockingReason | null;
|
||
primaryAction?: ShippingProcessingPrimaryAction | null;
|
||
recoveryActions?: Array<{
|
||
code: string;
|
||
i18nKey?: string | null;
|
||
label_key?: string | null;
|
||
parameters?: Record<string, unknown>;
|
||
}>;
|
||
/** 正式 Gate 原始状态仅用于区分未入队、运行中与外部回执等待;不参与按钮裁决。 */
|
||
gateStatus?: string | null;
|
||
|
||
taskMissing?: boolean;
|
||
confirmedTaskId?: number | null;
|
||
showAdminDiagnosis?: boolean;
|
||
retrying?: boolean;
|
||
locating?: boolean;
|
||
/** 仅 UI 展示的 running 文案(如 inventory_preparation 正在跑时主卡按钮 loading 附加信息)。 */
|
||
automation?: {
|
||
status?: string | null;
|
||
message?: string | null;
|
||
} | null;
|
||
showRetry?: boolean;
|
||
loading?: boolean;
|
||
/** 状态块内嵌动态说明(Run 级 lifecycle_progress 解析结果);null/空文本不渲染,显隐裁决在视图侧。 */
|
||
statusDetail?: { text: string } | null;
|
||
}>();
|
||
|
||
const emit = defineEmits<{
|
||
locate: [draftLineId?: string | null, fieldId?: string | null];
|
||
action: [code: string, parameters?: Record<string, unknown>];
|
||
}>();
|
||
|
||
const { t, te } = useI18n();
|
||
|
||
/**
|
||
* 当前阶段展示文案:优先消费 stage_label_key,禁止直接展示 stage 码。
|
||
* 核心逻辑:loading 是「权威投影读取中」占位,不是业务运行态——只要已有可展示的
|
||
* 阶段(Case 快照 current_stage 与投影同源,见 currentProcessingStageDisplay),
|
||
* 照常展示真实阶段;仅在连降级阶段都没有时才回退 stageLoading 占位文案。
|
||
*/
|
||
const stageLabel = computed(() => {
|
||
const hasKnownStage = Boolean(
|
||
String(props.stageCode || '').trim() || String(props.stageLabelKey || '').trim(),
|
||
);
|
||
if (props.loading && !hasKnownStage) {
|
||
return t('chat.shippingOrderReview.currentProcessing.stageLoading');
|
||
}
|
||
if (props.stageInconsistent) {
|
||
return t('chat.shippingOrderReview.currentProcessing.stateInconsistent');
|
||
}
|
||
return resolveShippingProcessingStageLabel(
|
||
String(props.stageCode || ''),
|
||
te,
|
||
t,
|
||
props.stageLabelKey,
|
||
);
|
||
});
|
||
|
||
/**
|
||
* 「状态」行用户态文案:严格绑定 user_status,不再由前端推断。
|
||
* loading 只是「权威投影读取中」:只要已有后端下发的 user_status(如 Case automation
|
||
* 运行态)就照常展示真实/待机文案,禁止再退回「正在获取最新状态」骨架造成二次刷新
|
||
* (状态空时 statusIdle 即中性「待机」,与投影稳态一致)。
|
||
*/
|
||
const statusLabel = computed(() => {
|
||
const s = String(props.userStatus || '').trim() as ReviewCurrentUserStatus | '';
|
||
const map: Record<ReviewCurrentUserStatus, string> = {
|
||
running: t('chat.shippingOrderReview.currentTask.statusRunning'),
|
||
waiting_human: t('chat.shippingOrderReview.currentTask.statusWaitingHuman'),
|
||
retryable: t('chat.shippingOrderReview.currentTask.statusRetryable'),
|
||
failed: t('chat.shippingOrderReview.currentTask.statusFailed'),
|
||
completed: t('chat.shippingOrderReview.currentTask.statusCompleted'),
|
||
cancelled: t('chat.shippingOrderReview.currentTask.statusCancelled'),
|
||
};
|
||
if (props.taskMissing) {
|
||
return t('chat.shippingOrderReview.currentProcessing.taskMissing');
|
||
}
|
||
if (s === 'running' && String(props.gateStatus || '').trim().toLowerCase() === 'pending') {
|
||
return t('chat.shippingOrderReview.currentProcessing.waitingStart');
|
||
}
|
||
if (!s) return t('chat.shippingOrderReview.currentProcessing.statusIdle');
|
||
return map[s] ?? t('chat.shippingOrderReview.currentProcessing.statusIdle');
|
||
});
|
||
|
||
/**
|
||
* 下一步(「下一步」section 的问题/说明文案):优先展示 blocking_reason 的统一 i18n 映射,
|
||
* 否则按 user_status 给系统态文案;禁止将后端内部原因码直接展示给用户。
|
||
*/
|
||
const nextStepText = computed(() => {
|
||
const safeMessage = (value: unknown): string => {
|
||
const raw = String(value || '').trim();
|
||
const lowered = raw.toLowerCase();
|
||
if (!raw) return '';
|
||
if (
|
||
lowered.includes('cannot import name')
|
||
|| lowered.includes('traceback')
|
||
|| lowered.includes('site-packages')
|
||
|| lowered.includes('\\app\\')
|
||
|| lowered.includes('/app/')
|
||
) {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepFailedNoRetry');
|
||
}
|
||
return raw;
|
||
};
|
||
// 加载占位不等于系统运行态:只透传后端 automation.message(若有);
|
||
// 其余按 user_status/blocking_reason 照常渲染,空态自然落在「状态待确认」,不做骨架二次刷新。
|
||
const automationMessage = props.loading ? safeMessage(props.automation?.message) : '';
|
||
if (automationMessage) return automationMessage;
|
||
// 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);
|
||
}
|
||
return resolveGateReasonLabel(br.code, { t, te })
|
||
|| t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||
}
|
||
// 建单前订单冻结校验尚未提交时,明确告诉用户下一步是保存并校验。
|
||
// 保存是底栏唯一的表单提交入口,不升级为右栏 CTA;该分支也兼容历史响应
|
||
// 仍携带 validate 的情形,避免「待人工」与「无需操作」产生语义矛盾。
|
||
if (
|
||
String(props.stageCode || '').trim() === 'order_review'
|
||
&& !props.blockingReason
|
||
&& (
|
||
String(props.primaryAction?.code || '').trim() === 'validate'
|
||
|| String(props.userStatus || '').trim() === 'waiting_human'
|
||
)
|
||
) {
|
||
return t('chat.shippingOrderReview.saveOrderAndValidate');
|
||
}
|
||
if (
|
||
String(props.userStatus || '').trim() === 'running'
|
||
&& String(props.gateStatus || '').trim().toLowerCase() === 'waiting_external'
|
||
) {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepWaitingExternal');
|
||
}
|
||
// 2) 无阻断时,按 user_status 给系统说明文案
|
||
const s = String(props.userStatus || '').trim() as ReviewCurrentUserStatus | '';
|
||
if (s === 'running') {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepRunning');
|
||
}
|
||
if (s === 'completed') {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepCompleted');
|
||
}
|
||
if (s === 'cancelled') {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepCancelled');
|
||
}
|
||
if (s === 'failed' && !props.retryable) {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepFailedNoRetry');
|
||
}
|
||
if (s === 'waiting_human') {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepWaitingHumanDefault');
|
||
}
|
||
if (s === 'retryable') {
|
||
return t('chat.shippingOrderReview.currentTask.nextStepRetryableDefault');
|
||
}
|
||
return t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||
});
|
||
|
||
/** 已完成/已取消时没有后续业务动作,不渲染“下一步”区,避免制造未完成错觉。 */
|
||
const showNextStep = computed(() => {
|
||
const status = String(props.userStatus || '').trim().toLowerCase();
|
||
return !['completed', 'cancelled'].includes(status);
|
||
});
|
||
|
||
/**
|
||
* 状态块内嵌动态说明的显隐:具体阻断原因已由「下一步」承载时,
|
||
* Run 级泛化等待说明(如「当前步骤需要人工处理」)属纯重复,隐藏。
|
||
*/
|
||
const showStatusDetail = computed(() => {
|
||
if (!props.statusDetail?.text) return false;
|
||
return isGenericBlockingReason(props.blockingReason, te);
|
||
});
|
||
|
||
/**
|
||
* 判断当前工作台是否应隐藏后端下发的纯导航动作。
|
||
* 批次中心可用它打开工作台;进入工作台后必须复用注册表规则,避免当前阶段再次显示
|
||
* 「进入订单复核」或「编辑正式任务」等自跳转入口。
|
||
*/
|
||
function isHiddenWorkbenchNavigationAction(code: string): boolean {
|
||
const entry = lookupWorkbenchAction(code);
|
||
return Boolean(entry && !shouldRenderWorkbenchAction(entry, {
|
||
actionsExecutable: true,
|
||
surface: 'review',
|
||
actionCode: code,
|
||
}));
|
||
}
|
||
|
||
/**
|
||
* 当前任务卡只承载正式 Gate 的可执行业务动作。
|
||
*
|
||
* 草稿编辑/建草稿是页面能力,保存校验是底栏唯一提交;它们即使出现在历史响应中,
|
||
* 也不能升级为右栏 CTA,更不能因缺失文案泄漏内部动作码。
|
||
*/
|
||
function isNonTaskCapabilityAction(code: string): boolean {
|
||
return new Set(['edit_draft', 'create_draft', 'validate']).has(code.trim().toLowerCase());
|
||
}
|
||
|
||
/**
|
||
* 业务动作按钮只消费 primary_action;retryable 是状态,不是授权。
|
||
*
|
||
* 核心逻辑:除既有授权过滤外,文案必须是后端下发且经受控映射解析出的非空文案
|
||
* (businessActionLabel 已 fail-closed 为 '');无文案时整体隐藏按钮,防止
|
||
* 渲染成只有图标/空壳的“幽灵按钮”误导用户以为是开关或其他控件。
|
||
*/
|
||
const showBusinessAction = computed(() => {
|
||
if (props.loading) return false;
|
||
if (props.taskMissing) return false;
|
||
// [STEP] 自动处理期间没有人工业务动作;只保留外层的刷新进度入口。
|
||
// 防止正式任务编辑等历史 primary_action 穿透到库存获取运行态。
|
||
if (props.userStatus === 'running') return false;
|
||
const code = String(props.primaryAction?.code || '').trim();
|
||
if (isInternalInventoryAction(code)) return false;
|
||
if (!code) return false;
|
||
if (isNonTaskCapabilityAction(code)) return false;
|
||
if (isHiddenWorkbenchNavigationAction(code)) return false;
|
||
// 无对象边界的泛化 retry 永不展示。
|
||
if (code === 'retry') return false;
|
||
// [AUTHORITY] 无受控文案的动作码 fail-closed:连图标一起隐藏,不渲染空壳按钮。
|
||
if (!businessActionLabel.value) return false;
|
||
return true;
|
||
});
|
||
|
||
const businessActionLabel = computed(() => {
|
||
const code = String(props.primaryAction?.code || '').trim();
|
||
const inventoryKey = inventoryActionLabelKey(code);
|
||
if (inventoryKey && te(inventoryKey)) return t(inventoryKey);
|
||
const pa = props.primaryAction;
|
||
if (!pa) return '';
|
||
if (isNonTaskCapabilityAction(String(pa.code || ''))) return '';
|
||
// Gate action presentation uses label_key; normalize it at the shared card boundary
|
||
// so every gate renders its business label instead of exposing the action code.
|
||
const i18nKey = String(
|
||
pa.i18nKey
|
||
|| (pa as ShippingProcessingPrimaryAction & { label_key?: string | null }).label_key
|
||
|| '',
|
||
).trim();
|
||
if (i18nKey && te(i18nKey)) {
|
||
return t(i18nKey);
|
||
}
|
||
// 当前任务按钮没有受控文案时 fail-closed,禁止泄漏内部 action code。
|
||
return '';
|
||
});
|
||
|
||
const businessActionTitle = computed(() => {
|
||
const retryingFlag = Boolean(props.retrying);
|
||
if (retryingFlag) {
|
||
return t('chat.shippingOrderReview.currentTask.actionRetryRunningTooltip');
|
||
}
|
||
return '';
|
||
});
|
||
|
||
const actionIsRetry = computed(() => String(props.primaryAction?.code || '').trim().startsWith('retry_'));
|
||
const actionIsInventoryRpa = computed(() => String(props.primaryAction?.code || '').trim() === 'retry_inventory_preparation');
|
||
const recoveryActions = computed(() => (props.recoveryActions || []).filter((action) => {
|
||
const code = String(action.code || '').trim();
|
||
if (!code || isNonTaskCapabilityAction(code) || isInternalInventoryAction(code)) return false;
|
||
if (code === String(props.primaryAction?.code || '').trim()) return false;
|
||
const key = String(
|
||
action.i18nKey
|
||
|| action.label_key
|
||
|| `workspace.shippingNotice.processGate.actionCodes.${code}`,
|
||
).trim();
|
||
return Boolean(key && te(key));
|
||
}));
|
||
|
||
function recoveryActionLabel(action: (typeof recoveryActions.value)[number]): string {
|
||
const inventoryKey = inventoryActionLabelKey(action.code);
|
||
if (inventoryKey && te(inventoryKey)) return t(inventoryKey);
|
||
const key = String(
|
||
action.i18nKey
|
||
|| action.label_key
|
||
|| `workspace.shippingNotice.processGate.actionCodes.${action.code}`,
|
||
).trim();
|
||
return key && te(key) ? t(key) : '';
|
||
}
|
||
|
||
function handleBusinessActionClick() {
|
||
const primaryActionCode = String(props.primaryAction?.code || '').trim();
|
||
if (!primaryActionCode || primaryActionCode === 'retry') return;
|
||
emit('action', primaryActionCode, props.primaryAction?.parameters ?? {});
|
||
}
|
||
|
||
/**
|
||
* 辅助导航「定位明细」:仅当后端在 primary_action.parameters 里提供 draft_line_id 或 field_id 才显示。
|
||
*/
|
||
const showLocateAction = computed(() => {
|
||
if (props.loading) return false;
|
||
if (props.taskMissing) return false;
|
||
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
|
||
const hasDraftLineId = typeof params.draft_line_id === 'string' && params.draft_line_id.length > 0;
|
||
const hasFieldId = typeof params.field_id === 'string' && params.field_id.length > 0;
|
||
return hasDraftLineId || hasFieldId;
|
||
});
|
||
|
||
const locateTargetDraftLineId = computed(() => {
|
||
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
|
||
return typeof params.draft_line_id === 'string' ? params.draft_line_id : null;
|
||
});
|
||
|
||
const locateTargetFieldId = computed(() => {
|
||
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
|
||
return typeof params.field_id === 'string' ? params.field_id : null;
|
||
});
|
||
|
||
function handleLocateClick() {
|
||
emit('locate', locateTargetDraftLineId.value, locateTargetFieldId.value);
|
||
}
|
||
|
||
type ReviewCurrentUserStatus =
|
||
| 'running'
|
||
| 'waiting_human'
|
||
| 'retryable'
|
||
| 'failed'
|
||
| 'completed'
|
||
| 'cancelled';
|
||
</script>
|
||
|
||
<template>
|
||
<section
|
||
class="rounded-xl border border-sky-200 bg-sky-50/80 p-3 shadow-sm dark:border-sky-900 dark:bg-sky-950/30"
|
||
data-testid="review-current-processing-card"
|
||
:data-user-status="String(userStatus || '')"
|
||
:data-task-missing="taskMissing ? '1' : '0'"
|
||
:data-loading="loading ? '1' : '0'"
|
||
>
|
||
<header class="mb-3">
|
||
<h2 class="text-sm font-semibold text-sky-950 dark:text-sky-100">
|
||
{{ t('chat.shippingOrderReview.currentTask.title') }}
|
||
</h2>
|
||
</header>
|
||
|
||
<dl class="space-y-1 text-xs text-sky-950 dark:text-sky-100">
|
||
<div class="flex flex-wrap gap-x-2">
|
||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentTask.labelStage') }}</dt>
|
||
<dd data-testid="review-current-task-stage" :class="loading ? 'animate-pulse' : ''">{{ stageLabel }}</dd>
|
||
</div>
|
||
<div class="flex flex-wrap gap-x-2">
|
||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentProcessing.status') }}</dt>
|
||
<dd
|
||
class="inline-flex items-center gap-1"
|
||
data-testid="review-current-task-status"
|
||
:class="loading ? 'animate-pulse' : ''"
|
||
>
|
||
<RefreshCw
|
||
v-if="userStatus === 'running' && !loading"
|
||
class="h-3 w-3 animate-spin"
|
||
aria-hidden="true"
|
||
/>
|
||
{{ statusLabel }}
|
||
</dd>
|
||
<!-- v2:状态块内嵌动态说明(弱文本一行,不加标题/图标/区块;
|
||
v4:blocking_reason 已含具体原因时隐藏,避免与「下一步」重复)。 -->
|
||
<p
|
||
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>
|
||
</div>
|
||
</dl>
|
||
|
||
<p
|
||
v-if="taskMissing"
|
||
class="mt-2 text-[11px] text-rose-800 dark:text-rose-200"
|
||
data-testid="review-current-processing-task-missing"
|
||
>
|
||
{{ t('chat.shippingOrderReview.currentProcessing.taskMissingHint') }}
|
||
</p>
|
||
|
||
<aside
|
||
v-if="taskMissing && showAdminDiagnosis"
|
||
class="mt-2 rounded border border-rose-300 bg-rose-50/80 p-2 text-[11px] text-rose-950 dark:border-rose-800 dark:bg-rose-950/40 dark:text-rose-100"
|
||
data-testid="review-current-processing-admin-diagnosis"
|
||
>
|
||
<p class="font-medium">{{ t('chat.shippingOrderReview.currentProcessing.adminDiagnosisTitle') }}</p>
|
||
<p
|
||
v-if="confirmedTaskId != null"
|
||
class="mt-1 font-mono"
|
||
>
|
||
{{ t('chat.shippingOrderReview.currentProcessing.confirmedTaskId', { id: confirmedTaskId }) }}
|
||
</p>
|
||
<p class="mt-1">
|
||
{{ t('chat.shippingOrderReview.currentProcessing.adminDiagnosisStatus') }}
|
||
</p>
|
||
<p class="mt-1 text-muted">
|
||
{{ t('chat.shippingOrderReview.currentProcessing.adminDiagnosisHint') }}
|
||
</p>
|
||
</aside>
|
||
|
||
<div
|
||
v-if="showNextStep"
|
||
class="mt-3 border-t border-sky-200/70 pt-3 dark:border-sky-800/60"
|
||
data-testid="review-current-task-next-step-section"
|
||
>
|
||
<p class="text-[11px] font-medium uppercase tracking-wide text-sky-900/70 dark:text-sky-200/70">
|
||
{{ t('chat.shippingOrderReview.currentTask.nextStepTitle') }}
|
||
</p>
|
||
<p
|
||
class="mt-1 text-xs text-sky-950 dark:text-sky-100"
|
||
data-testid="review-current-task-next-step-text"
|
||
:class="loading ? 'animate-pulse' : ''"
|
||
>{{ nextStepText }}</p>
|
||
</div>
|
||
|
||
<div
|
||
v-if="showBusinessAction || showLocateAction"
|
||
class="mt-3 flex flex-wrap items-center gap-2"
|
||
data-testid="review-current-task-actions"
|
||
>
|
||
<button
|
||
v-if="showBusinessAction"
|
||
type="button"
|
||
class="inline-flex items-center gap-1 rounded-md bg-sky-700 px-3 py-1.5 text-xs font-medium text-white shadow-sm transition hover:bg-sky-800 disabled:opacity-50 dark:bg-sky-600 dark:hover:bg-sky-500"
|
||
:data-testid="actionIsRetry ? 'review-current-processing-retry' : 'review-current-task-primary-action'"
|
||
:disabled="retrying || locating"
|
||
:title="businessActionTitle"
|
||
@click="handleBusinessActionClick"
|
||
>
|
||
<Bot v-if="actionIsInventoryRpa" class="h-3.5 w-3.5" />
|
||
<RefreshCw
|
||
v-else-if="actionIsRetry"
|
||
class="h-3.5 w-3.5"
|
||
:class="{ 'animate-spin': Boolean(retrying) }"
|
||
/>
|
||
{{ businessActionLabel }}
|
||
</button>
|
||
<button
|
||
v-for="action in recoveryActions"
|
||
:key="action.code"
|
||
type="button"
|
||
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-surface px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
|
||
:data-testid="`review-current-task-recovery-${action.code}`"
|
||
:disabled="retrying || locating"
|
||
@click="$emit('action', action.code, action.parameters || {})"
|
||
>
|
||
{{ recoveryActionLabel(action) }}
|
||
</button>
|
||
<button
|
||
v-if="showLocateAction"
|
||
type="button"
|
||
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-surface px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
|
||
data-testid="review-current-task-locate-action"
|
||
:disabled="locating"
|
||
@click="handleLocateClick"
|
||
>
|
||
<Crosshair class="h-3.5 w-3.5" />
|
||
{{ t('chat.shippingOrderReview.currentTask.actionLocateLine') }}
|
||
</button>
|
||
</div>
|
||
</section>
|
||
</template>
|