feat(shipping-process-gates): 落地全门禁中断恢复并消除双真相
纳入 Execution/Gate/Attempt 模型与迁移、Worker/API/前端恢复卡片与 Admin 诊断, Gate 阻断时清零旧 action_buttons,异常摘要统一脱敏,并为运维筛选与 Attempt Diff 补齐入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b352c281d5
commit
323928626b
92 files changed
+11930
-458
No files matched your search
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/TaskTodoPanel.vue
|
||||
* 用途:仅渲染后端 ui_state.action_buttons / summary.allowed_actions 对应的当前待办动作。
|
||||
* 依赖:shipping.api 履约写接口、shipping-tasks.api 下载/人工上传、ManualUploadEvidenceDialog、各确认对话框。
|
||||
* 逻辑:禁止按 process_status 二次推导按钮;管理员 can_handle=false 时只读;
|
||||
* wait_manual_upload 允许下载 Excel + 登记人工上传凭据(禁 RPA);
|
||||
* 多源阻断时对话框候选强制取 stp_facts.recovery_source_codes,禁止展示冻结全集。
|
||||
* 用途:渲染统一 Gate 恢复卡片与 STP 履约待办动作(ui_state.action_buttons)。
|
||||
* 依赖:ProcessGateRecoveryCard、shipping.api、shipping-tasks.api、ManualUploadEvidenceDialog。
|
||||
* 逻辑:优先展示 ui_state.process_gate 阻断信息与 next_action_code;禁止按 process_status
|
||||
* 二次推导门禁动作;存在 current_blocking_gate 时不渲染旧 action_buttons(Gate 唯一真相);
|
||||
* 管理员 can_handle=false 时只读;无 Gate 阻断时 wait_manual_upload 允许下载 Excel + 人工上传凭据。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
@@ -32,6 +32,8 @@ import { downloadWorkspaceShippingExcelFile } from '@/features/workspace/api/shi
|
||||
import { refreshShippingTodoBadge } from '@/features/workspace/composables/useShippingTodoBadge';
|
||||
import InventorySourceSelectDialog from './InventorySourceSelectDialog.vue';
|
||||
import ManualUploadEvidenceDialog from './ManualUploadEvidenceDialog.vue';
|
||||
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
|
||||
import type { ShippingProcessGateUserSummary } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
detail: ShippingTaskDetail;
|
||||
@@ -56,9 +58,34 @@ const inventorySourceCandidates = ref<ShippingInventorySourceCandidate[]>([]);
|
||||
const inventorySourceInitialCode = ref('');
|
||||
|
||||
const summary = computed(() => props.detail.ui_state?.summary || {});
|
||||
const processGateSummary = computed((): ShippingProcessGateUserSummary | null =>
|
||||
props.detail.ui_state?.process_gate
|
||||
|| (summary.value.process_gate as ShippingProcessGateUserSummary | null | undefined)
|
||||
|| null,
|
||||
);
|
||||
const actionButtons = computed(() => props.detail.ui_state?.action_buttons || []);
|
||||
const checkpointKind = computed(() => String(props.detail.ui_state?.checkpoint_kind || ''));
|
||||
const checkpoint = computed(() => String(props.detail.ui_state?.checkpoint || ''));
|
||||
/** 统一 Gate 投影中的主要恢复动作;用于去重旧 action_buttons。 */
|
||||
const processGateNextAction = computed(() =>
|
||||
String(
|
||||
processGateSummary.value?.next_action_code
|
||||
|| processGateSummary.value?.current_blocking_gate?.next_action_code
|
||||
|| '',
|
||||
).trim(),
|
||||
);
|
||||
/** 有 Gate 阻断时优先展示统一投影文案。 */
|
||||
const displayTodoTitle = computed(() =>
|
||||
processGateSummary.value?.current_blocking_gate?.label
|
||||
|| summary.value.current_todo
|
||||
|| summary.value.title
|
||||
|| t('workspace.shippingNotice.todo.noActionTitle'),
|
||||
);
|
||||
const displayTodoMessage = computed(() =>
|
||||
processGateSummary.value?.blocking_message
|
||||
|| summary.value.message
|
||||
|| t('workspace.shippingNotice.todo.noActionMessage'),
|
||||
);
|
||||
|
||||
/**
|
||||
* 是否展示「待人工上传登记」提示。
|
||||
@@ -117,12 +144,22 @@ const allowedIds = computed(() => {
|
||||
if (Array.isArray(fromSummary) && fromSummary.length) return new Set(fromSummary.map(String));
|
||||
return new Set(actionButtons.value.map((item) => item.id));
|
||||
});
|
||||
const visibleActions = computed(() =>
|
||||
actionButtons.value.filter((action) => {
|
||||
const hasBlockingGate = computed(() => Boolean(processGateSummary.value?.current_blocking_gate));
|
||||
|
||||
const visibleActions = computed(() => {
|
||||
// [STEP] Gate 阻断时后端已清零 action_buttons;前端再兜底隐藏,避免双真相。
|
||||
if (hasBlockingGate.value) return [];
|
||||
return actionButtons.value.filter((action) => {
|
||||
const id = String(action.id || '');
|
||||
return allowedIds.value.has(id) && isActionAllowedForCheckpoint(id, checkpointKind.value);
|
||||
}),
|
||||
);
|
||||
if (!allowedIds.value.has(id) || !isActionAllowedForCheckpoint(id, checkpointKind.value)) {
|
||||
return false;
|
||||
}
|
||||
if (processGateNextAction.value && id === processGateNextAction.value) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
/**
|
||||
* 动作成功后刷新详情并更新导航徽标。
|
||||
*/
|
||||
@@ -327,15 +364,29 @@ async function runAction(action: ShippingChatAction) {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<section class="rounded-2xl border border-brand-200/80 bg-brand-50/40 px-4 py-3">
|
||||
<div class="space-y-3">
|
||||
<ProcessGateRecoveryCard
|
||||
:summary="processGateSummary"
|
||||
:can-handle="canHandle"
|
||||
:navigation-context="{
|
||||
agentId: detail.owner_agent_id != null ? String(detail.owner_agent_id) : undefined,
|
||||
conversationId: detail.conversation_id || undefined,
|
||||
}"
|
||||
@refreshed="afterSuccess"
|
||||
@refresh-needed="afterSuccess"
|
||||
/>
|
||||
<section
|
||||
v-if="!hasBlockingGate"
|
||||
class="rounded-2xl border border-brand-200/80 bg-brand-50/40 px-4 py-3"
|
||||
>
|
||||
<div class="mb-1 text-xs font-semibold uppercase tracking-wide text-brand-700">
|
||||
{{ $t('workspace.shippingNotice.todo.currentTodo') }}
|
||||
</div>
|
||||
<h3 class="text-sm font-semibold text-primary">
|
||||
{{ summary.current_todo || summary.title || $t('workspace.shippingNotice.todo.noActionTitle') }}
|
||||
{{ displayTodoTitle }}
|
||||
</h3>
|
||||
<p class="mt-1 text-sm text-secondary">
|
||||
{{ summary.message || $t('workspace.shippingNotice.todo.noActionMessage') }}
|
||||
{{ displayTodoMessage }}
|
||||
</p>
|
||||
<p v-if="summary.pause_reason" class="mt-1 text-xs text-amber-700">
|
||||
{{ summary.pause_reason }}
|
||||
@@ -398,5 +449,6 @@ async function runAction(action: ShippingChatAction) {
|
||||
@confirm="onFreezeConfirm"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in new issue
Block a user