Files
syops/frontend/src/features/shipping-progress/components/ReviewProcessDetailDrawer.vue
T
hugoandCursor 84a881b554 feat(shipping-notice): 落地 XFA 统一视觉拆分确认门禁与处理投影收敛
闭合拆分预览令牌单次消费、样本 checksum 绑定与确认审计;正式提取改为 bindings-only。
同步统一标注工作台交互,并补齐进度投影/任务中心与迁移文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 10:21:25 +08:00

218 lines
7.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
features/shipping-progress/components/ReviewProcessDetailDrawer.vue
用途:订单处理工作台「流程详情」只读抽屉——完整 15 阶按五域分组。
依赖:vue-i18n、ShippingProcessingProjection、progressWindow、shippingProcessingLabels。
逻辑:由 ShippingOrderReviewView 挂载;缺时间/主体显示「—」;禁止抽屉内写操作按钮。
-->
<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { X } from 'lucide-vue-next';
import type { ShippingProcessingProjection } from '@/features/chat/types/shipping.api.types';
import {
resolveShippingProcessingStatusLabel,
shippingProcessingStageKey,
} from '@/features/chat/shipping/shippingProcessingLabels';
import {
REVIEW_PROGRESS_DOMAIN_RANGES,
buildFullProgressNodes,
buildProgressRangeHint,
stageAbsoluteIndex,
} from '../progressWindow';
import type { ProgressWindowNode } from '../types';
const props = defineProps<{
open: boolean;
projection: ShippingProcessingProjection | null;
/** 标题副文案:PO */
poNumber?: string | null;
/** 标题副文案:OT */
orderTaskNo?: string | null;
/** 有审计入口时展示只读链接 */
auditAvailable?: boolean;
}>();
const emit = defineEmits<{
close: [];
'open-audit': [];
}>();
const { t, te } = useI18n();
const nodes = computed(() => buildFullProgressNodes(props.projection));
const rangeHint = computed(() => buildProgressRangeHint(props.projection, 'workbench'));
const statusLabel = computed(() => {
if (!props.projection) return '';
return resolveShippingProcessingStatusLabel(props.projection.status, te, t);
});
const positionLabel = computed(() => {
if (!props.projection) return '';
const index = stageAbsoluteIndex(props.projection.stage) + 1;
return t('chat.shippingProcessing.progress.positionOfTotal', { current: index, total: 15 });
});
/**
* 按五域分组的完整节点。
*/
const domainGroups = computed(() => (
REVIEW_PROGRESS_DOMAIN_RANGES.map((domain) => ({
key: domain.key,
labelKey: domain.labelKey,
nodes: nodes.value.filter((node) => (
node.absoluteIndex >= domain.start && node.absoluteIndex <= domain.end
)),
}))
));
/**
* 阶段名。
*/
function nodeLabel(node: ProgressWindowNode): string {
const key = shippingProcessingStageKey(node.stage);
return te(key) ? t(key) : node.stage;
}
/**
* 节点态文案。
*/
function nodeStatusLabel(status: ProgressWindowNode['status']): string {
const key = `chat.shippingProcessing.stageNode.${status}`;
return te(key) ? t(key) : status;
}
/**
* 圆点样式。
*/
function dotClass(status: ProgressWindowNode['status']): string {
if (status === 'passed') return 'bg-emerald-500';
if (status === 'running') return 'bg-brand-500';
if (status === 'blocked') return 'bg-amber-500';
if (status === 'failed') return 'bg-rose-500';
if (status === 'skipped') return 'bg-slate-200 opacity-50';
return 'bg-slate-300';
}
</script>
<template>
<Teleport to="body">
<div
v-if="open"
class="fixed inset-0 z-50 flex justify-end"
data-testid="review-process-detail-drawer"
>
<button
type="button"
class="absolute inset-0 bg-slate-900/40"
:aria-label="t('chat.shippingProcessing.progress.closeProcessDetails')"
data-testid="review-process-detail-backdrop"
@click="emit('close')"
/>
<aside
class="relative z-10 flex h-full w-full max-w-md flex-col border-l border-default bg-surface shadow-xl"
role="dialog"
aria-modal="true"
:aria-label="t('chat.shippingProcessing.progress.processDetailsTitle')"
>
<header class="flex items-start justify-between gap-3 border-b border-default px-4 py-3">
<div class="min-w-0">
<h2 class="text-sm font-semibold text-primary">
{{ t('chat.shippingProcessing.progress.processDetailsTitle') }}
</h2>
<p class="mt-0.5 truncate text-[11px] text-secondary">
<span v-if="poNumber">PO {{ poNumber }}</span>
<span v-if="poNumber && orderTaskNo"> · </span>
<span v-if="orderTaskNo">{{ orderTaskNo }}</span>
</p>
<p
v-if="statusLabel || positionLabel"
class="mt-1 text-[11px] text-muted"
data-testid="review-process-detail-summary"
>
<span v-if="statusLabel">{{ statusLabel }}</span>
<span v-if="statusLabel && positionLabel"> · </span>
<span v-if="positionLabel">{{ positionLabel }}</span>
<span v-if="rangeHint">
· {{ t('chat.shippingProcessing.progress.completedOfTotal', {
done: rangeHint.done,
total: rangeHint.total,
}) }}
</span>
</p>
</div>
<button
type="button"
class="rounded-lg p-1.5 text-muted hover:bg-surface-muted hover:text-primary"
data-testid="review-process-detail-close"
@click="emit('close')"
>
<X class="h-4 w-4" />
</button>
</header>
<div class="min-h-0 flex-1 overflow-y-auto px-4 py-3">
<section
v-for="group in domainGroups"
:key="group.key"
class="mb-4"
:data-domain-group="group.key"
>
<h3 class="mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted">
{{ t(group.labelKey) }}
</h3>
<ol class="space-y-2">
<li
v-for="node in group.nodes"
:key="node.stage"
class="rounded-lg border border-default bg-surface-soft/50 px-2.5 py-2"
:data-stage="node.stage"
:data-state="node.status"
:data-current="node.isCurrent ? 'true' : 'false'"
data-testid="review-process-detail-node"
>
<div class="flex items-center gap-2 text-xs">
<span
class="inline-block h-2 w-2 shrink-0 rounded-full"
:class="dotClass(node.status)"
/>
<span :class="node.isCurrent ? 'font-semibold text-primary' : 'text-secondary'">
{{ nodeLabel(node) }}
</span>
<span class="ml-auto shrink-0 text-[10px] text-muted">
{{ nodeStatusLabel(node.status) }}
</span>
</div>
<dl class="mt-1.5 grid grid-cols-2 gap-x-2 gap-y-0.5 text-[10px] text-muted">
<div>
<dt class="inline">{{ t('chat.shippingProcessing.progress.nodeTime') }}</dt>
<dd class="ml-1 inline">{{ t('chat.shippingProcessing.progress.placeholderDash') }}</dd>
</div>
<div>
<dt class="inline">{{ t('chat.shippingProcessing.progress.nodeActor') }}</dt>
<dd class="ml-1 inline">{{ t('chat.shippingProcessing.progress.placeholderDash') }}</dd>
</div>
</dl>
</li>
</ol>
</section>
</div>
<footer
v-if="auditAvailable"
class="border-t border-default px-4 py-3"
>
<button
type="button"
class="text-[11px] font-medium text-brand-700 underline-offset-2 hover:underline dark:text-brand-300"
data-testid="review-process-detail-open-audit"
@click="emit('open-audit')"
>
{{ t('chat.shippingProcessing.progress.viewFullAudit') }}
</button>
</footer>
</aside>
</div>
</Teleport>
</template>