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
@@ -3,7 +3,7 @@
|
||||
* 用途:展示任务事件 + Workflow Event 统一时间线(只读),不发明进度百分比。
|
||||
* 依赖:ShippingTaskEvent、ShippingWorkflowEvent、dateTime、vue-i18n。
|
||||
* 逻辑:由 ShippingTaskWorkbench 传入 task events 与 workflow events;按时间合并排序;
|
||||
* Workflow 事件操作人展示为 actor_type/actor_id。
|
||||
* 未知事件与操作者内部标识统一使用通用业务文案。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
@@ -23,18 +23,17 @@ type TimelineRow = {
|
||||
label: string;
|
||||
createdAt?: string | null;
|
||||
actor?: string | null;
|
||||
detail?: Record<string, unknown> | null;
|
||||
source: 'task' | 'workflow';
|
||||
};
|
||||
|
||||
/**
|
||||
* 将任务事件类型映射为可读文案;契约外码原样展示。
|
||||
* 将任务事件类型映射为可读文案;契约外码使用通用说明。
|
||||
*/
|
||||
function taskEventLabel(eventType: string | null | undefined): string {
|
||||
const code = String(eventType || '').trim();
|
||||
if (!code) return t('workspace.shippingNotice.eventTypes.system');
|
||||
const key = `workspace.shippingNotice.eventTypes.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
return te(key) ? t(key) : t('workspace.shippingNotice.timeline.updated');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,20 +43,20 @@ function workflowEventLabel(event: ShippingWorkflowEvent): string {
|
||||
const code = String(event.event_code || event.message_code || event.stage_code || '').trim();
|
||||
if (!code) return t('workspace.shippingNotice.timeline.workflowEvent');
|
||||
const key = `workspace.shippingNotice.workflowEvents.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
return te(key) ? t(key) : t('workspace.shippingNotice.timeline.updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化操作人展示:优先 type/id,便于审计追溯。
|
||||
* 格式化操作人展示:普通工作台只显示业务角色,不展示内部 ID。
|
||||
* @param actorType - 角色(user/system/admin…)
|
||||
* @param actorId - 操作者 ID 或系统标识
|
||||
*/
|
||||
function formatActorLabel(actorType?: string | null, actorId?: string | number | null): string | null {
|
||||
const type = String(actorType || '').trim();
|
||||
const id = actorId == null ? '' : String(actorId).trim();
|
||||
if (type && id) return `${type}/${id}`;
|
||||
if (id) return id;
|
||||
if (type) return type;
|
||||
const roleKey = `workspace.shippingNotice.timeline.actors.${type}`;
|
||||
if (type && te(roleKey)) return t(roleKey);
|
||||
if (type || id) return t('workspace.shippingNotice.timeline.actors.user');
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -67,7 +66,6 @@ const rows = computed<TimelineRow[]>(() => {
|
||||
label: taskEventLabel(event.event_type),
|
||||
createdAt: event.created_at,
|
||||
actor: formatActorLabel(null, event.actor_id),
|
||||
detail: event.detail_json || null,
|
||||
source: 'task',
|
||||
}));
|
||||
const workflowRows: TimelineRow[] = (props.workflowEvents || []).map((event, index) => ({
|
||||
@@ -75,11 +73,6 @@ const rows = computed<TimelineRow[]>(() => {
|
||||
label: workflowEventLabel(event),
|
||||
createdAt: event.occurred_at,
|
||||
actor: formatActorLabel(event.actor_type, event.actor_id),
|
||||
detail: {
|
||||
...(event.payload || {}),
|
||||
...(event.reason ? { reason: event.reason } : {}),
|
||||
...(event.stage_code ? { stage_code: event.stage_code } : {}),
|
||||
},
|
||||
source: 'workflow',
|
||||
}));
|
||||
return [...taskRows, ...workflowRows].sort((a, b) => {
|
||||
@@ -116,13 +109,6 @@ const rows = computed<TimelineRow[]>(() => {
|
||||
<span class="text-muted">{{ formatLocalDateTime(row.createdAt) }}</span>
|
||||
<span v-if="row.actor" class="text-muted">{{ $t('workspace.shippingNotice.operator', { id: row.actor }) }}</span>
|
||||
</div>
|
||||
<details
|
||||
v-if="row.detail && Object.keys(row.detail).length"
|
||||
class="mt-1 text-xs text-muted"
|
||||
>
|
||||
<summary class="cursor-pointer select-none">{{ $t('workspace.shippingNotice.timeline.detail') }}</summary>
|
||||
<pre class="mt-1 whitespace-pre-wrap break-words">{{ JSON.stringify(row.detail, null, 2) }}</pre>
|
||||
</details>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user