feat(shipping-notice): 收敛复核阶段同源投影与 OT 后履约推进
统一 Case/Progress 阶段 label_key、修复 Job 成功未推进 OT 的可重试失败投影与写路径,并落地 OT 后行级匹配/波次履约与版面诊断开关。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
74270adc22
commit
fd6a23f870
100 files changed
+12138
-1017
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewCompletedChecksPanel.vue
|
||||
用途:右侧「已完成检查」折叠列表;仅消费后端 completed_checks。
|
||||
依赖:vue-i18n。
|
||||
逻辑:默认折叠;禁止前端自行拼接 Gate/里程碑。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export interface CompletedCheckItem {
|
||||
code: string;
|
||||
status?: string;
|
||||
completed_at?: string | null;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
items?: CompletedCheckItem[] | null;
|
||||
defaultOpen?: boolean;
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
|
||||
const checks = computed(() => (props.items || []).filter((item) => String(item.status || 'passed') === 'passed'));
|
||||
const visible = computed(() => checks.value.length > 0);
|
||||
|
||||
/**
|
||||
* 检查项本地化标签。
|
||||
*/
|
||||
function checkLabel(code: string): string {
|
||||
const key = `chat.shippingOrderReview.completedChecks.codes.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<details
|
||||
v-if="visible"
|
||||
class="rounded-xl border border-slate-200 bg-white p-2 text-xs dark:border-slate-800 dark:bg-slate-900"
|
||||
:open="defaultOpen"
|
||||
data-testid="review-completed-checks"
|
||||
>
|
||||
<summary class="cursor-pointer px-1 py-1 font-medium text-muted">
|
||||
{{ t('chat.shippingOrderReview.completedChecks.title', { count: checks.length }) }}
|
||||
</summary>
|
||||
<ul class="mt-2 space-y-1 px-1 pb-1">
|
||||
<li
|
||||
v-for="item in checks"
|
||||
:key="item.code"
|
||||
class="flex items-center gap-2 text-[11px] text-secondary"
|
||||
:data-testid="`review-completed-check-${item.code}`"
|
||||
>
|
||||
<span class="text-emerald-600 dark:text-emerald-400" aria-hidden="true">✓</span>
|
||||
<span>{{ checkLabel(item.code) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
</template>
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewCurrentProcessingCard.vue
|
||||
用途:正式 OT 创建后的右侧「当前处理状态」主卡(阶段 + 自动推进合并)。
|
||||
依赖:vue-i18n、ShippingOrderReviewAutomation、resolveShippingProcessingStageLabel。
|
||||
逻辑:优先消费 Progress 同源的 stageCode + stageLabelKey;Case current_stage 仅降级;
|
||||
禁止把阶段码直接当用户文案;Job 明细与 task_missing 诊断仅管理员区;
|
||||
由 ShippingOrderReviewView 在 has_formal_ot / task_missing 时置顶渲染。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { RefreshCw } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewAutomation } from '@/features/chat/types/shipping.api.types';
|
||||
import { resolveShippingProcessingStageLabel } from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
|
||||
const props = defineProps<{
|
||||
stageCode?: string | null;
|
||||
stageLabelKey?: string | null;
|
||||
stageInconsistent?: boolean;
|
||||
taskMissing?: boolean;
|
||||
taskNo?: string | null;
|
||||
confirmedTaskId?: number | null;
|
||||
showAdminDiagnosis?: boolean;
|
||||
automation?: ShippingOrderReviewAutomation | null;
|
||||
showRetry?: boolean;
|
||||
retrying?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
retry: [];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
|
||||
/**
|
||||
* 当前处理阶段展示文案:消费 label_key,禁止直接展示阶段码。
|
||||
*/
|
||||
const stageLabel = computed(() => {
|
||||
if (props.taskMissing) {
|
||||
return t('chat.shippingOrderReview.currentProcessing.taskMissing');
|
||||
}
|
||||
if (props.stageInconsistent) {
|
||||
return t('chat.shippingOrderReview.currentProcessing.stateInconsistent');
|
||||
}
|
||||
return resolveShippingProcessingStageLabel(
|
||||
String(props.stageCode || ''),
|
||||
te,
|
||||
t,
|
||||
props.stageLabelKey,
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* 自动推进用户态文案(消费 phase,禁止前端猜建单/推进)。
|
||||
*/
|
||||
const statusLabel = computed(() => {
|
||||
const automation = props.automation;
|
||||
const status = String(automation?.status || '').trim().toLowerCase();
|
||||
const phase = String(automation?.phase || '').trim();
|
||||
if (props.taskMissing) {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusTaskMissing');
|
||||
}
|
||||
if (status === 'waiting_to_start') {
|
||||
return phase === 'pre_ot_stp'
|
||||
? t('chat.shippingOrderReview.automation.waitingPreOt')
|
||||
: t('chat.shippingOrderReview.automation.waitingPostOt');
|
||||
}
|
||||
if (status === 'queued' || status === 'running') {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusRunning');
|
||||
}
|
||||
if (status === 'failed' || status === 'manual_fallback') {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusFailedRetryable');
|
||||
}
|
||||
if (status === 'completed') {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusCompleted');
|
||||
}
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusIdle');
|
||||
});
|
||||
|
||||
/**
|
||||
* 主卡重试:仅在有 task_no 且非 task_missing 时由父组件控制 showRetry。
|
||||
*/
|
||||
const canShowRetry = computed(() => (
|
||||
Boolean(props.showRetry)
|
||||
&& !props.taskMissing
|
||||
&& Boolean(String(props.taskNo || '').trim())
|
||||
));
|
||||
</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-task-missing="taskMissing ? '1' : '0'"
|
||||
:data-automation-status="String(automation?.status || '')"
|
||||
:data-automation-phase="String(automation?.phase || '')"
|
||||
>
|
||||
<header class="mb-2">
|
||||
<h2 class="text-sm font-semibold text-sky-950 dark:text-sky-100">
|
||||
{{ t('chat.shippingOrderReview.currentProcessing.title') }}
|
||||
</h2>
|
||||
<p class="mt-0.5 text-xs text-sky-900/80 dark:text-sky-200/80">
|
||||
{{ stageLabel }}
|
||||
</p>
|
||||
</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.currentProcessing.status') }}</dt>
|
||||
<dd data-testid="review-current-processing-status">{{ statusLabel }}</dd>
|
||||
</div>
|
||||
<div v-if="taskNo" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentProcessing.formalOt') }}</dt>
|
||||
<dd class="font-mono" data-testid="review-current-processing-ot">{{ taskNo }}</dd>
|
||||
</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>
|
||||
|
||||
<button
|
||||
v-if="canShowRetry"
|
||||
type="button"
|
||||
class="mt-3 inline-flex items-center gap-1 rounded border border-amber-400 bg-amber-50 px-2.5 py-1.5 text-xs text-amber-950 disabled:opacity-50 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
data-testid="review-current-processing-retry"
|
||||
:disabled="retrying"
|
||||
@click="emit('retry')"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
{{ t('chat.shippingOrderReview.autoProgress.retryStp') }}
|
||||
</button>
|
||||
</section>
|
||||
</template>
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewFieldCompletenessPanel.vue
|
||||
用途:字段完整性用户态卡片;与模板匹配分离,消费 Case.field_completeness。
|
||||
依赖:vue-i18n。
|
||||
逻辑:仅展示 blocked/ready 与缺失字段;required_field_missing 不进入模板匹配区。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export interface FieldCompletenessIssue {
|
||||
code?: string;
|
||||
field_id?: string | null;
|
||||
field_code?: string | null;
|
||||
line_index?: number | null;
|
||||
message?: string | null;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
completeness?: {
|
||||
status?: string;
|
||||
issues?: FieldCompletenessIssue[];
|
||||
} | null;
|
||||
fieldLabels?: Record<string, string>;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const status = computed(() => String(props.completeness?.status || '').trim().toLowerCase());
|
||||
const blocked = computed(() => status.value === 'blocked');
|
||||
const issues = computed(() => props.completeness?.issues || []);
|
||||
const visible = computed(() => Boolean(status.value));
|
||||
|
||||
/**
|
||||
* 字段展示名。
|
||||
*/
|
||||
function fieldLabel(issue: FieldCompletenessIssue): string {
|
||||
const code = String(issue.field_code || issue.field_id || '').trim();
|
||||
if (!code) return t('chat.shippingOrderReview.fieldCompleteness.unknownField');
|
||||
return props.fieldLabels?.[code] || code;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
v-if="visible"
|
||||
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
|
||||
data-testid="review-field-completeness-panel"
|
||||
:data-status="status"
|
||||
>
|
||||
<header class="flex flex-wrap items-start justify-between gap-2">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.fieldCompleteness.title') }}</h2>
|
||||
<p class="mt-0.5 text-xs text-muted">{{ t('chat.shippingOrderReview.fieldCompleteness.subtitle') }}</p>
|
||||
</div>
|
||||
<span
|
||||
class="rounded-full px-2.5 py-1 text-xs font-medium"
|
||||
:class="blocked
|
||||
? 'bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100'
|
||||
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100'"
|
||||
>
|
||||
{{ blocked
|
||||
? t('chat.shippingOrderReview.fieldCompleteness.blocked')
|
||||
: t('chat.shippingOrderReview.fieldCompleteness.ready') }}
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<ul v-if="blocked && issues.length" class="mt-2 space-y-1 text-[11px] text-secondary">
|
||||
<li
|
||||
v-for="(issue, idx) in issues"
|
||||
:key="`${issue.field_id || issue.field_code || idx}`"
|
||||
class="rounded-lg border border-default bg-surface-soft px-2.5 py-1.5"
|
||||
>
|
||||
<span class="font-medium">{{ fieldLabel(issue) }}</span>
|
||||
<span v-if="issue.code" class="ml-2 font-mono text-muted">{{ issue.code }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</template>
|
||||
+10
-10
@@ -2,7 +2,8 @@
|
||||
features/chat/components/shipping-review/ReviewFulfillmentDecisionPanel.vue
|
||||
用途:复核工作台行级履约决定(等待补货 / 完整行先行 / 关闭)。
|
||||
依赖:vue-i18n、decide/wave line-fulfillment API、showReviewResumeOutcome。
|
||||
逻辑:展示 qty/shortage;逐行决定;选中 fulfill 行可确认波次;关闭 emit open-close-dialog。
|
||||
逻辑:分列展示料号/需求数量/可用数量/预约单号/状态;禁止 part_number 回退预约单号;
|
||||
逐行决定;选中 fulfill 行可确认波次;关闭 emit open-close-dialog。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
@@ -181,8 +182,9 @@ function onCloseRemaining() {
|
||||
<th v-if="editable" class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.waveSelect') }}</th>
|
||||
<th class="px-1 py-1 font-medium">#</th>
|
||||
<th class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.partNumber') }}</th>
|
||||
<th class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.qty') }}</th>
|
||||
<th class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.shortage') }}</th>
|
||||
<th class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.requiredQty') }}</th>
|
||||
<th class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.availableQty') }}</th>
|
||||
<th class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.reservationId') }}</th>
|
||||
<th class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.status') }}</th>
|
||||
<th v-if="editable" class="px-1 py-1 font-medium">{{ t('chat.shippingOrderReview.fulfillmentDecision.actions') }}</th>
|
||||
</tr>
|
||||
@@ -204,14 +206,12 @@ function onCloseRemaining() {
|
||||
>
|
||||
</td>
|
||||
<td class="px-1 py-1">{{ (line.line_index ?? 0) + 1 }}</td>
|
||||
<td class="px-1 py-1 font-mono">{{ line.part_number || line.reservation_id || '—' }}</td>
|
||||
<td class="px-1 py-1">
|
||||
{{ line.required_qty ?? '—' }}
|
||||
<span v-if="line.available_qty" class="text-muted"> / {{ line.available_qty }}</span>
|
||||
</td>
|
||||
<td class="px-1 py-1" :class="line.shortage_qty ? 'font-medium text-rose-700 dark:text-rose-300' : ''">
|
||||
{{ line.shortage_qty || '—' }}
|
||||
<td class="px-1 py-1 font-mono" data-testid="review-fulfill-part-number">
|
||||
{{ line.part_number || t('chat.shippingOrderReview.fulfillmentDecision.partUnrecognized') }}
|
||||
</td>
|
||||
<td class="px-1 py-1">{{ line.required_qty ?? '—' }}</td>
|
||||
<td class="px-1 py-1">{{ line.available_qty ?? '—' }}</td>
|
||||
<td class="px-1 py-1 font-mono">{{ line.reservation_id || '—' }}</td>
|
||||
<td class="px-1 py-1">{{ lineStatusLabel(line.line_status) }}</td>
|
||||
<td v-if="editable && !TERMINAL_STATUSES.has(String(line.line_status || ''))" class="px-1 py-1">
|
||||
<div class="flex flex-wrap gap-1">
|
||||
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewFulfillmentSummaryCard.vue
|
||||
用途:复核侧栏紧凑展示行级履约缺口摘要,完整表格在库存模式主区处理。
|
||||
依赖:vue-i18n、ShippingOrderReviewLineFulfillment。
|
||||
逻辑:仅显示开放行/缺口计数与进入库存处理入口;不渲染 7 列表格。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewLineFulfillment } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
lineFulfillment: ShippingOrderReviewLineFulfillment | null | undefined;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'enter-inventory': [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const visible = computed(() => Boolean(
|
||||
props.lineFulfillment?.has_open_lines
|
||||
|| props.lineFulfillment?.has_shortage
|
||||
|| (props.lineFulfillment?.open_count || 0) > 0,
|
||||
));
|
||||
|
||||
const openCount = computed(() => Number(props.lineFulfillment?.open_count || 0));
|
||||
const readyCount = computed(() => Number(props.lineFulfillment?.ready_count || 0));
|
||||
const shortageCount = computed(() => (
|
||||
props.lineFulfillment?.lines || []
|
||||
).filter((line) => Boolean(line.shortage_qty)).length);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
v-if="visible"
|
||||
class="rounded-xl border border-sky-200 bg-sky-50/70 p-3 shadow-sm dark:border-sky-900 dark:bg-sky-950/40"
|
||||
data-testid="review-fulfillment-summary-card"
|
||||
>
|
||||
<header class="mb-2">
|
||||
<h2 class="text-sm font-semibold text-sky-950 dark:text-sky-50">
|
||||
{{ t('chat.shippingOrderReview.fulfillmentDecision.title') }}
|
||||
</h2>
|
||||
<p class="mt-0.5 text-xs text-sky-900 dark:text-sky-200">
|
||||
{{ t('chat.shippingOrderReview.fulfillmentDecision.railHint') }}
|
||||
</p>
|
||||
</header>
|
||||
<ul class="space-y-1 text-xs text-secondary">
|
||||
<li>{{ t('chat.shippingOrderReview.fulfillmentDecision.openCount', { count: openCount }) }}</li>
|
||||
<li>{{ t('chat.shippingOrderReview.fulfillmentDecision.readyCount', { count: readyCount }) }}</li>
|
||||
<li v-if="shortageCount">
|
||||
{{ t('chat.shippingOrderReview.fulfillmentDecision.shortageCount', { count: shortageCount }) }}
|
||||
</li>
|
||||
</ul>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-3 w-full rounded-xl border border-sky-300 bg-white px-3 py-1.5 text-sm text-sky-950 hover:bg-sky-100 dark:border-sky-800 dark:bg-slate-900 dark:text-sky-50 dark:hover:bg-sky-950"
|
||||
data-testid="review-fulfillment-enter-inventory"
|
||||
@click="emit('enter-inventory')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.fulfillmentDecision.enterInventory') }}
|
||||
</button>
|
||||
</section>
|
||||
</template>
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewInventoryIssueFallbackCard.vue
|
||||
用途:无行投影且库存系统失败时的 Case 级兜底卡;仅重试获取库存。
|
||||
依赖:vue-i18n。
|
||||
逻辑:由 ShippingOrderReviewView 在 inventory_issue_fallback 或行级库存问题聚合时挂载;
|
||||
禁止进库存工作台、禁止匹配/关闭/换源。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export interface InventoryIssueFallback {
|
||||
kind?: string | null;
|
||||
reason_label_key?: string | null;
|
||||
affected_line_count?: number | null;
|
||||
file_count?: number | null;
|
||||
allowed_actions?: string[] | null;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
fallback: InventoryIssueFallback | null | undefined;
|
||||
busy?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'retry-preparation': [];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
|
||||
const visible = computed(() => {
|
||||
const actions = props.fallback?.allowed_actions || [];
|
||||
return Boolean(props.fallback && actions.includes('retry_inventory_preparation'));
|
||||
});
|
||||
|
||||
/**
|
||||
* 失败原因文案。
|
||||
*/
|
||||
const reasonLabel = computed(() => {
|
||||
const keyCode = String(props.fallback?.reason_label_key || props.fallback?.kind || '').trim();
|
||||
const key = `chat.shippingOrderReview.inventoryFallback.kinds.${keyCode}`;
|
||||
return te(key) ? t(key) : t('chat.shippingOrderReview.inventoryFallback.kinds.inventory_file_missing');
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
v-if="visible"
|
||||
class="rounded-xl border border-amber-200 bg-amber-50/70 p-3 shadow-sm dark:border-amber-900 dark:bg-amber-950/30"
|
||||
data-testid="review-inventory-issue-fallback"
|
||||
>
|
||||
<h2 class="text-sm font-semibold text-amber-950 dark:text-amber-50">
|
||||
{{ t('chat.shippingOrderReview.inventoryFallback.title') }}
|
||||
</h2>
|
||||
<p class="mt-1 text-xs text-amber-900 dark:text-amber-100" data-testid="review-inventory-fallback-reason">
|
||||
{{ reasonLabel }}
|
||||
</p>
|
||||
<p
|
||||
v-if="(fallback?.affected_line_count || 0) > 0"
|
||||
class="mt-1 text-[11px] text-amber-800/90 dark:text-amber-200/90"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.inventoryFallback.affectedLines', {
|
||||
count: fallback?.affected_line_count || 0,
|
||||
}) }}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-3 w-full rounded-xl border border-amber-300 bg-white px-3 py-1.5 text-sm text-amber-950 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-800 dark:bg-slate-900 dark:text-amber-50"
|
||||
data-testid="review-inventory-fallback-retry"
|
||||
:disabled="busy"
|
||||
@click="emit('retry-preparation')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineOps.retryPreparation') }}
|
||||
</button>
|
||||
</section>
|
||||
</template>
|
||||
@@ -3,7 +3,7 @@
|
||||
用途:标准复核侧栏中的异常库存行摘要列表(只显示需处理行)。
|
||||
依赖:vue-i18n、ShippingOrderReviewBuildEligibilityLineProjection。
|
||||
逻辑:行列表由后端 recovery/suggestion 投影提供,前端不自行发明异常规则;
|
||||
点击行可定位明细或进入库存处理模式。
|
||||
点击行可定位明细;正式 OT 后 showEnterAction=false,禁止切库存工作台。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -12,9 +12,11 @@ import type { ShippingOrderReviewBuildEligibilityLineProjection } from '@/featur
|
||||
defineProps<{
|
||||
lines: ShippingOrderReviewBuildEligibilityLineProjection[];
|
||||
/**
|
||||
* 仅展示「进入库存」入口,不列出行明细(Gate/履约摘要已表达缺口时使用)。
|
||||
* 仅展示摘要标题,不列出行明细(Gate/履约摘要已表达缺口时使用)。
|
||||
*/
|
||||
summaryOnly?: boolean;
|
||||
/** 是否展示「进入库存」按钮;正式 OT 后应关闭。 */
|
||||
showEnterAction?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -44,6 +46,7 @@ function blockReasonLabel(reason?: string | null): string {
|
||||
<header class="mb-2 flex items-center justify-between gap-2">
|
||||
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.workbench.inventoryIssues') }}</h2>
|
||||
<button
|
||||
v-if="showEnterAction"
|
||||
type="button"
|
||||
class="rounded border border-amber-300 px-2 py-1 text-xs text-amber-900 hover:bg-amber-50 dark:border-amber-800 dark:text-amber-100 dark:hover:bg-amber-950/40"
|
||||
data-testid="review-inventory-issues-enter"
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewLineFulfillmentAggregateCard.spec.ts
|
||||
* 用途:锁定 UI-3 订单级聚合卡——同时展示系统进度与人工待办,无逐行摘要。
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import ReviewLineFulfillmentAggregateCard from './ReviewLineFulfillmentAggregateCard.vue';
|
||||
import type { ShippingOrderReviewLineFulfillment } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
lineFulfillmentAggregate: {
|
||||
title: '履约进度摘要',
|
||||
hint: '同时展示系统进度与人工待办',
|
||||
autoProgress: '系统处理中 {count} 行',
|
||||
manualPending: '待人工处理 {count} 行',
|
||||
inventoryPending: '库存处理中 {count} 行',
|
||||
systemFailed: '自动履约失败 {count} 行',
|
||||
enterInventory: '进入库存/履约处理',
|
||||
viewLines: '查看订单明细',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
describe('ReviewLineFulfillmentAggregateCard', () => {
|
||||
it('shows system progress and manual pending together with inventory entry', async () => {
|
||||
const lineFulfillment: ShippingOrderReviewLineFulfillment = {
|
||||
lines: [],
|
||||
auto_progress_count: 2,
|
||||
manual_pending_count: 1,
|
||||
system_failed_count: 0,
|
||||
inventory_pending_count: 0,
|
||||
};
|
||||
const wrapper = mount(ReviewLineFulfillmentAggregateCard, {
|
||||
props: { lineFulfillment },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-aggregate-card"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-aggregate-auto-progress"]').text())
|
||||
.toContain('2');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-aggregate-manual-pending"]').text())
|
||||
.toContain('1');
|
||||
// 断言:不得只有系统进度而无短缺入口
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-aggregate-enter-inventory"]').exists())
|
||||
.toBe(true);
|
||||
await wrapper.get('[data-testid="review-line-fulfillment-aggregate-enter-inventory"]').trigger('click');
|
||||
expect(wrapper.emitted('enter-inventory')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('hides when all aggregate counts are zero', () => {
|
||||
const wrapper = mount(ReviewLineFulfillmentAggregateCard, {
|
||||
props: {
|
||||
lineFulfillment: {
|
||||
lines: [],
|
||||
auto_progress_count: 0,
|
||||
manual_pending_count: 0,
|
||||
system_failed_count: 0,
|
||||
inventory_pending_count: 0,
|
||||
},
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-aggregate-card"]').exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewLineFulfillmentAggregateCard.vue
|
||||
用途:正式 OT 后右侧订单级履约聚合卡(系统进度 / 人工待办 / 失败),无逐行摘要。
|
||||
依赖:vue-i18n、ShippingOrderReviewLineFulfillment。
|
||||
逻辑:由 ShippingOrderReviewView 在 hasFormalOt 时挂载于侧栏主卡区;
|
||||
同时展示系统进度与短缺入口,禁止只显示「系统处理中」。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewLineFulfillment } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
lineFulfillment: ShippingOrderReviewLineFulfillment | null | undefined;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'enter-inventory': [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
/**
|
||||
* 聚合计数(后端投影;缺省按 0)。
|
||||
*/
|
||||
const autoProgressCount = computed(() => Number(props.lineFulfillment?.auto_progress_count || 0));
|
||||
const manualPendingCount = computed(() => Number(props.lineFulfillment?.manual_pending_count || 0));
|
||||
const systemFailedCount = computed(() => Number(props.lineFulfillment?.system_failed_count || 0));
|
||||
const inventoryPendingCount = computed(() => Number(
|
||||
props.lineFulfillment?.inventory_pending_count || 0,
|
||||
));
|
||||
|
||||
/**
|
||||
* 有任一非零计数才展示;避免空卡占位。
|
||||
*/
|
||||
const visible = computed(() => (
|
||||
autoProgressCount.value > 0
|
||||
|| manualPendingCount.value > 0
|
||||
|| systemFailedCount.value > 0
|
||||
|| inventoryPendingCount.value > 0
|
||||
));
|
||||
|
||||
/**
|
||||
* 人工/库存/失败需进入明细处理;纯系统进度可不强调入口。
|
||||
* 本轮禁止切换库存工作台,入口改为由父级滚到明细。
|
||||
*/
|
||||
const showEnterInventory = computed(() => (
|
||||
manualPendingCount.value > 0
|
||||
|| systemFailedCount.value > 0
|
||||
|| inventoryPendingCount.value > 0
|
||||
));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
v-if="visible"
|
||||
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
|
||||
data-testid="review-line-fulfillment-aggregate-card"
|
||||
>
|
||||
<header class="mb-2">
|
||||
<h2 class="text-sm font-semibold text-slate-900 dark:text-slate-50">
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.title') }}
|
||||
</h2>
|
||||
<p class="mt-0.5 text-xs text-muted">
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.hint') }}
|
||||
</p>
|
||||
</header>
|
||||
<ul class="space-y-1 text-xs text-secondary">
|
||||
<li
|
||||
v-if="autoProgressCount > 0"
|
||||
data-testid="review-line-fulfillment-aggregate-auto-progress"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.autoProgress', {
|
||||
count: autoProgressCount,
|
||||
}) }}
|
||||
</li>
|
||||
<li
|
||||
v-if="manualPendingCount > 0"
|
||||
class="font-medium text-amber-800 dark:text-amber-200"
|
||||
data-testid="review-line-fulfillment-aggregate-manual-pending"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.manualPending', {
|
||||
count: manualPendingCount,
|
||||
}) }}
|
||||
</li>
|
||||
<li
|
||||
v-if="inventoryPendingCount > 0"
|
||||
data-testid="review-line-fulfillment-aggregate-inventory-pending"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.inventoryPending', {
|
||||
count: inventoryPendingCount,
|
||||
}) }}
|
||||
</li>
|
||||
<li
|
||||
v-if="systemFailedCount > 0"
|
||||
class="font-medium text-rose-700 dark:text-rose-300"
|
||||
data-testid="review-line-fulfillment-aggregate-system-failed"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.systemFailed', {
|
||||
count: systemFailedCount,
|
||||
}) }}
|
||||
</li>
|
||||
</ul>
|
||||
<button
|
||||
v-if="showEnterInventory"
|
||||
type="button"
|
||||
class="mt-3 w-full rounded-xl border border-slate-300 bg-slate-50 px-3 py-1.5 text-sm text-slate-900 hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-50 dark:hover:bg-slate-800"
|
||||
data-testid="review-line-fulfillment-aggregate-enter-inventory"
|
||||
@click="emit('enter-inventory')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentAggregate.viewLines') }}
|
||||
</button>
|
||||
</section>
|
||||
</template>
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewLineFulfillmentDetail.spec.ts
|
||||
* 用途:锁定 UI-2 行内履约摘要字段与审计入口。
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import ReviewLineFulfillmentDetail from './ReviewLineFulfillmentDetail.vue';
|
||||
import type { ShippingOrderReviewLineFulfillmentLine } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
lineFulfillmentDetail: {
|
||||
title: '行履约摘要',
|
||||
wave: '履约波次',
|
||||
task: '正式任务',
|
||||
snapshotId: '库存快照 ID',
|
||||
matchedAt: '匹配校验时间',
|
||||
decisionSource: '决定来源',
|
||||
decisionSourceValue: {
|
||||
system: '系统自动',
|
||||
user: '人工',
|
||||
unknown: '未知',
|
||||
},
|
||||
failureReason: '自动履约失败原因',
|
||||
noFailure: '无',
|
||||
openAudit: '打开审计',
|
||||
close: '收起',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
describe('ReviewLineFulfillmentDetail', () => {
|
||||
it('renders wave/task/snapshot/source/failure and emits audit', async () => {
|
||||
const line: ShippingOrderReviewLineFulfillmentLine = {
|
||||
line_key: 'L1',
|
||||
inventory_snapshot_id: 42,
|
||||
inventory_checked_at: '2026-08-07T01:00:00Z',
|
||||
decision_source: 'system',
|
||||
auto_fulfill_error_message: 'wave_explode',
|
||||
decision: {
|
||||
wave_no: 3,
|
||||
task_id: 9,
|
||||
decision_source: 'system',
|
||||
},
|
||||
};
|
||||
const wrapper = mount(ReviewLineFulfillmentDetail, {
|
||||
props: { line, taskNo: 'SN-100' },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-summary"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-wave"]').text()).toContain('3');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-task"]').text()).toContain('SN-100');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-snapshot"]').text()).toContain('42');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-decisionSource"]').text()).toContain('系统自动');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-failure"]').text()).toContain('wave_explode');
|
||||
|
||||
await wrapper.get('[data-testid="review-line-fulfillment-open-audit"]').trigger('click');
|
||||
expect(wrapper.emitted('open-audit')).toBeTruthy();
|
||||
await wrapper.get('[data-testid="review-line-fulfillment-summary-close"]').trigger('click');
|
||||
expect(wrapper.emitted('close')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewLineFulfillmentDetail.vue
|
||||
用途:订单明细行内履约摘要(查看履约详情);不进入库存工作台。
|
||||
依赖:vue-i18n、ShippingOrderReviewLineFulfillmentLine。
|
||||
逻辑:由 ShippingOrderReviewView 在展开行下方挂载;展示 wave/task/快照/匹配时间/
|
||||
决定来源/失败原因,并提供审计入口。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewLineFulfillmentLine } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
line: ShippingOrderReviewLineFulfillmentLine | null | undefined;
|
||||
taskNo?: string | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'open-audit': [];
|
||||
close: [];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
|
||||
/**
|
||||
* 展示用字段行。
|
||||
*/
|
||||
const rows = computed(() => {
|
||||
const line = props.line;
|
||||
const decision = line?.decision;
|
||||
const waveNo = decision?.wave_no ?? null;
|
||||
const taskNo = String(props.taskNo || '').trim()
|
||||
|| (decision?.task_id != null ? String(decision.task_id) : '');
|
||||
const source = String(line?.decision_source || decision?.decision_source || '').trim();
|
||||
const sourceKey = `chat.shippingOrderReview.lineFulfillmentDetail.decisionSourceValue.${source}`;
|
||||
const sourceLabel = source
|
||||
? (te(sourceKey) ? t(sourceKey) : source)
|
||||
: '—';
|
||||
const failure = String(line?.auto_fulfill_error_message || '').trim();
|
||||
|
||||
return [
|
||||
{
|
||||
key: 'wave',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.wave'),
|
||||
value: waveNo != null ? String(waveNo) : '—',
|
||||
},
|
||||
{
|
||||
key: 'task',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.task'),
|
||||
value: taskNo || '—',
|
||||
},
|
||||
{
|
||||
key: 'snapshot',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.snapshotId'),
|
||||
value: line?.inventory_snapshot_id != null ? String(line.inventory_snapshot_id) : '—',
|
||||
},
|
||||
{
|
||||
key: 'matchedAt',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.matchedAt'),
|
||||
value: formatTime(line?.inventory_checked_at),
|
||||
},
|
||||
{
|
||||
key: 'decisionSource',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.decisionSource'),
|
||||
value: sourceLabel,
|
||||
},
|
||||
{
|
||||
key: 'failure',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.failureReason'),
|
||||
value: failure || t('chat.shippingOrderReview.lineFulfillmentDetail.noFailure'),
|
||||
emphasize: Boolean(failure),
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
/**
|
||||
* 格式化匹配/校验时间。
|
||||
*/
|
||||
function formatTime(value: string | null | undefined): string {
|
||||
if (!value) return '—';
|
||||
const date = new Date(value);
|
||||
return Number.isNaN(date.getTime()) ? String(value) : date.toLocaleString();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="rounded-md border border-slate-200 bg-slate-50/80 px-3 py-2 text-xs dark:border-slate-700 dark:bg-slate-950/50"
|
||||
data-testid="review-line-fulfillment-summary"
|
||||
role="region"
|
||||
:aria-label="t('chat.shippingOrderReview.lineFulfillmentDetail.title')"
|
||||
>
|
||||
<div class="mb-2 flex items-center justify-between gap-2">
|
||||
<p class="font-medium text-slate-700 dark:text-slate-200">
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentDetail.title') }}
|
||||
</p>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-slate-300 px-2 py-0.5 text-[11px] text-sky-700 hover:bg-white dark:border-slate-600 dark:text-sky-300 dark:hover:bg-slate-900"
|
||||
data-testid="review-line-fulfillment-open-audit"
|
||||
@click="emit('open-audit')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentDetail.openAudit') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded px-2 py-0.5 text-[11px] text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
data-testid="review-line-fulfillment-summary-close"
|
||||
@click="emit('close')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineFulfillmentDetail.close') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<dl class="grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<div
|
||||
v-for="row in rows"
|
||||
:key="row.key"
|
||||
class="min-w-0 rounded bg-white/70 px-2 py-1.5 dark:bg-slate-900/60"
|
||||
:data-testid="`review-line-fulfillment-field-${row.key}`"
|
||||
>
|
||||
<dt class="text-[10px] font-medium text-slate-500 dark:text-slate-400">{{ row.label }}</dt>
|
||||
<dd
|
||||
class="mt-0.5 break-words text-[11px] text-slate-800 dark:text-slate-100"
|
||||
:class="row.emphasize ? 'font-medium text-rose-700 dark:text-rose-300' : ''"
|
||||
>
|
||||
{{ row.value }}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewLineInventoryOps.spec.ts
|
||||
* 用途:锁定库存浮层仅渲染 inventory_allowed_actions;关闭在更多操作;Teleport 菜单可见。
|
||||
*/
|
||||
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import ReviewLineInventoryOps from './ReviewLineInventoryOps.vue';
|
||||
import type { ShippingOrderReviewLineFulfillmentLine } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
lineOps: {
|
||||
inventoryProcessing: '库存处理',
|
||||
retryPreparation: '重试获取库存',
|
||||
retryMatching: '重新匹配库存',
|
||||
moreActions: '更多操作',
|
||||
viewFulfillment: '查看履约详情',
|
||||
},
|
||||
fulfillmentDecision: {
|
||||
closeLine: '关闭该明细',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
function mountOps(line: Partial<ShippingOrderReviewLineFulfillmentLine>) {
|
||||
return mount(ReviewLineInventoryOps, {
|
||||
props: {
|
||||
line: line as ShippingOrderReviewLineFulfillmentLine,
|
||||
editable: true,
|
||||
},
|
||||
attachTo: document.body,
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = '';
|
||||
});
|
||||
|
||||
describe('ReviewLineInventoryOps', () => {
|
||||
it('shows only preparation when matching not allowed', async () => {
|
||||
const wrapper = mountOps({
|
||||
inventory_allowed_actions: ['retry_inventory_preparation'],
|
||||
line_allowed_actions: [],
|
||||
});
|
||||
await wrapper.get('[data-testid="review-line-view-inventory"]').trigger('click');
|
||||
expect(document.querySelector('[data-testid="review-line-retry-preparation"]')).toBeTruthy();
|
||||
expect(document.querySelector('[data-testid="review-line-retry-matching"]')).toBeFalsy();
|
||||
expect(document.querySelector('[data-testid="review-line-decide-close"]')).toBeFalsy();
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('puts close under more actions, not inventory panel', async () => {
|
||||
const wrapper = mountOps({
|
||||
inventory_allowed_actions: ['retry_inventory_preparation'],
|
||||
line_allowed_actions: ['close_unfulfillable'],
|
||||
});
|
||||
await wrapper.get('[data-testid="review-line-view-inventory"]').trigger('click');
|
||||
expect(document.querySelector('[data-testid="review-line-decide-close"]')).toBeFalsy();
|
||||
await wrapper.get('[data-testid="review-line-more-actions"]').trigger('click');
|
||||
expect(document.querySelector('[data-testid="review-line-decide-close"]')).toBeTruthy();
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('hides inventory icon when no inventory actions and no problem status', () => {
|
||||
const wrapper = mountOps({
|
||||
inventory_allowed_actions: [],
|
||||
line_allowed_actions: ['close_unfulfillable'],
|
||||
user_line_status: 'inventory_matched',
|
||||
inventory_status: 'ready',
|
||||
display_available: '50',
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-line-view-inventory"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-line-more-actions"]').exists()).toBe(true);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('shows inventory icon from problem status even when backend actions empty', async () => {
|
||||
const wrapper = mountOps({
|
||||
inventory_allowed_actions: [],
|
||||
line_allowed_actions: [],
|
||||
user_line_status: 'inventory_pending',
|
||||
inventory_status: 'preparing',
|
||||
display_available: 'pending',
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-line-view-inventory"]').exists()).toBe(true);
|
||||
await wrapper.get('[data-testid="review-line-view-inventory"]').trigger('click');
|
||||
expect(document.querySelector('[data-testid="review-line-retry-preparation"]')).toBeTruthy();
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('emits retry-inventory for both floating actions', async () => {
|
||||
const wrapper = mountOps({
|
||||
inventory_allowed_actions: ['retry_inventory_preparation', 'retry_inventory_matching'],
|
||||
line_allowed_actions: [],
|
||||
});
|
||||
await wrapper.get('[data-testid="review-line-view-inventory"]').trigger('click');
|
||||
expect(document.querySelector('[data-testid="review-line-retry-preparation"]')).toBeTruthy();
|
||||
expect(document.querySelector('[data-testid="review-line-retry-matching"]')).toBeTruthy();
|
||||
(document.querySelector('[data-testid="review-line-retry-matching"]') as HTMLButtonElement).click();
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.emitted('retry-inventory')?.[0]).toEqual(['retry_inventory_matching']);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,297 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewLineInventoryOps.vue
|
||||
用途:明细行库存处理浮层 + 行级更多操作(关闭);不进库存工作台、不在右侧挂动作。
|
||||
依赖:vue-i18n、lucide、line.inventory_allowed_actions / line_allowed_actions。
|
||||
逻辑:优先后端动作;库存问题态后端漏下发时前端兜底 preparation(+匹配失败时 matching);
|
||||
菜单 Teleport 到 body,避免表格 overflow 裁切。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { MoreHorizontal, Warehouse } from 'lucide-vue-next';
|
||||
import type { ShippingOrderReviewLineFulfillmentLine } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
line: ShippingOrderReviewLineFulfillmentLine | null | undefined;
|
||||
editable: boolean;
|
||||
busy?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'retry-inventory': [actionCode: 'retry_inventory_preparation' | 'retry_inventory_matching'];
|
||||
'close-line': [];
|
||||
'view-fulfillment': [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const inventoryMenuOpen = ref(false);
|
||||
const moreMenuOpen = ref(false);
|
||||
const inventoryBtnRef = ref<HTMLElement | null>(null);
|
||||
const moreBtnRef = ref<HTMLElement | null>(null);
|
||||
const inventoryMenuStyle = ref<Record<string, string>>({});
|
||||
const moreMenuStyle = ref<Record<string, string>>({});
|
||||
|
||||
const PROBLEM_USER_STATUSES = new Set([
|
||||
'inventory_file_missing',
|
||||
'inventory_file_expired',
|
||||
'inventory_match_failed',
|
||||
'inventory_source_unrecognized',
|
||||
'source_conflict',
|
||||
'shortage',
|
||||
'inventory_pending',
|
||||
'acquiring_inventory',
|
||||
'auto_fulfill_failed',
|
||||
]);
|
||||
const PROBLEM_INVENTORY_STATUSES = new Set([
|
||||
'preparing',
|
||||
'unavailable',
|
||||
'mapping_failed',
|
||||
'source_conflict',
|
||||
'invalid_key',
|
||||
]);
|
||||
|
||||
/**
|
||||
* 库存动作集合:后端优先;问题态漏下发时兜底 preparation / matching。
|
||||
*/
|
||||
const inventoryActions = computed(() => {
|
||||
const fromBe = [...(props.line?.inventory_allowed_actions || [])].filter(Boolean);
|
||||
if (fromBe.length) return new Set(fromBe);
|
||||
if (!props.line) return new Set<string>();
|
||||
|
||||
const userStatus = String(props.line.user_line_status || '').trim();
|
||||
const invStatus = String(props.line.inventory_status || '').trim();
|
||||
const matchResult = String(props.line.match_result || '').trim();
|
||||
const isProblem = (
|
||||
PROBLEM_USER_STATUSES.has(userStatus)
|
||||
|| PROBLEM_INVENTORY_STATUSES.has(invStatus)
|
||||
|| props.line.display_available === 'pending'
|
||||
|| Boolean(props.line.is_shortage)
|
||||
);
|
||||
if (!isProblem) return new Set<string>();
|
||||
|
||||
const actions = new Set<string>(['retry_inventory_preparation']);
|
||||
if (
|
||||
userStatus === 'inventory_match_failed'
|
||||
|| invStatus === 'mapping_failed'
|
||||
|| matchResult === 'mapping_failed'
|
||||
) {
|
||||
actions.add('retry_inventory_matching');
|
||||
}
|
||||
return actions;
|
||||
});
|
||||
|
||||
const lineActions = computed(() => {
|
||||
const fromBe = [...(props.line?.line_allowed_actions || [])].filter(Boolean);
|
||||
if (fromBe.length) return new Set(fromBe);
|
||||
const userStatus = String(props.line?.user_line_status || '').trim();
|
||||
if (!props.line) return new Set<string>();
|
||||
if (['wave_created', 'fulfilled', 'closed'].includes(userStatus)) {
|
||||
return userStatus === 'closed' ? new Set<string>() : new Set(['view_fulfillment_detail']);
|
||||
}
|
||||
if (PROBLEM_USER_STATUSES.has(userStatus) || Boolean(props.line.is_shortage)) {
|
||||
return new Set(['close_unfulfillable']);
|
||||
}
|
||||
return new Set<string>();
|
||||
});
|
||||
|
||||
const showInventoryOps = computed(() => (
|
||||
inventoryActions.value.has('retry_inventory_preparation')
|
||||
|| inventoryActions.value.has('retry_inventory_matching')
|
||||
));
|
||||
const canRetryPreparation = computed(() => inventoryActions.value.has('retry_inventory_preparation'));
|
||||
const canRetryMatching = computed(() => inventoryActions.value.has('retry_inventory_matching'));
|
||||
const canClose = computed(() => lineActions.value.has('close_unfulfillable'));
|
||||
const canViewFulfillment = computed(() => lineActions.value.has('view_fulfillment_detail'));
|
||||
const showMore = computed(() => canClose.value || canViewFulfillment.value);
|
||||
|
||||
/**
|
||||
* 按触发按钮定位浮动菜单(fixed,避免被表格 overflow 裁切)。
|
||||
*/
|
||||
function placeMenu(anchor: HTMLElement | null, target: typeof inventoryMenuStyle) {
|
||||
if (!anchor || typeof window === 'undefined') return;
|
||||
const rect = anchor.getBoundingClientRect();
|
||||
const width = 168;
|
||||
const left = Math.max(8, Math.min(rect.right - width, window.innerWidth - width - 8));
|
||||
target.value = {
|
||||
position: 'fixed',
|
||||
top: `${Math.round(rect.bottom + 4)}px`,
|
||||
left: `${Math.round(left)}px`,
|
||||
width: `${width}px`,
|
||||
zIndex: '80',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭所有浮层。
|
||||
*/
|
||||
function closeMenus() {
|
||||
inventoryMenuOpen.value = false;
|
||||
moreMenuOpen.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档点击/滚动时关闭浮层,避免残留遮挡。
|
||||
*/
|
||||
function onDocPointerDown(event: Event) {
|
||||
const target = event.target as Node | null;
|
||||
if (!target) return;
|
||||
const el = target as HTMLElement;
|
||||
if (el.closest?.('[data-testid="review-line-inventory-panel"]')) return;
|
||||
if (el.closest?.('[data-testid="review-line-more-menu"]')) return;
|
||||
if (el.closest?.('[data-testid="review-line-view-inventory"]')) return;
|
||||
if (el.closest?.('[data-testid="review-line-more-actions"]')) return;
|
||||
closeMenus();
|
||||
}
|
||||
|
||||
function onViewportChange() {
|
||||
if (inventoryMenuOpen.value) placeMenu(inventoryBtnRef.value, inventoryMenuStyle);
|
||||
if (moreMenuOpen.value) placeMenu(moreBtnRef.value, moreMenuStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换库存处理浮层。
|
||||
*/
|
||||
async function toggleInventoryMenu() {
|
||||
moreMenuOpen.value = false;
|
||||
inventoryMenuOpen.value = !inventoryMenuOpen.value;
|
||||
if (inventoryMenuOpen.value) {
|
||||
await nextTick();
|
||||
placeMenu(inventoryBtnRef.value, inventoryMenuStyle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换更多操作浮层。
|
||||
*/
|
||||
async function toggleMoreMenu() {
|
||||
inventoryMenuOpen.value = false;
|
||||
moreMenuOpen.value = !moreMenuOpen.value;
|
||||
if (moreMenuOpen.value) {
|
||||
await nextTick();
|
||||
placeMenu(moreBtnRef.value, moreMenuStyle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发库存动作并关闭浮层。
|
||||
*/
|
||||
function onRetry(actionCode: 'retry_inventory_preparation' | 'retry_inventory_matching') {
|
||||
closeMenus();
|
||||
emit('retry-inventory', actionCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭明细(由父级弹确认框)。
|
||||
*/
|
||||
function onCloseLine() {
|
||||
closeMenus();
|
||||
emit('close-line');
|
||||
}
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
document.addEventListener('pointerdown', onDocPointerDown, true);
|
||||
window.addEventListener('scroll', onViewportChange, true);
|
||||
window.addEventListener('resize', onViewportChange);
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (typeof document === 'undefined') return;
|
||||
document.removeEventListener('pointerdown', onDocPointerDown, true);
|
||||
window.removeEventListener('scroll', onViewportChange, true);
|
||||
window.removeEventListener('resize', onViewportChange);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative inline-flex items-center gap-0.5">
|
||||
<button
|
||||
v-if="showInventoryOps"
|
||||
ref="inventoryBtnRef"
|
||||
type="button"
|
||||
class="rounded p-1.5 hover:bg-slate-100 disabled:opacity-50 dark:hover:bg-slate-800"
|
||||
data-testid="review-line-view-inventory"
|
||||
:disabled="busy"
|
||||
:aria-label="t('chat.shippingOrderReview.lineOps.inventoryProcessing')"
|
||||
:title="t('chat.shippingOrderReview.lineOps.inventoryProcessing')"
|
||||
:aria-expanded="inventoryMenuOpen"
|
||||
@click="toggleInventoryMenu"
|
||||
>
|
||||
<Warehouse class="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="showMore"
|
||||
ref="moreBtnRef"
|
||||
type="button"
|
||||
class="rounded p-1.5 hover:bg-slate-100 disabled:opacity-50 dark:hover:bg-slate-800"
|
||||
data-testid="review-line-more-actions"
|
||||
:disabled="!editable || busy"
|
||||
:aria-label="t('chat.shippingOrderReview.lineOps.moreActions')"
|
||||
:title="t('chat.shippingOrderReview.lineOps.moreActions')"
|
||||
:aria-expanded="moreMenuOpen"
|
||||
@click="toggleMoreMenu"
|
||||
>
|
||||
<MoreHorizontal class="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</button>
|
||||
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="inventoryMenuOpen && showInventoryOps"
|
||||
class="rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-slate-700 dark:bg-slate-900"
|
||||
role="menu"
|
||||
data-testid="review-line-inventory-panel"
|
||||
:style="inventoryMenuStyle"
|
||||
>
|
||||
<button
|
||||
v-if="canRetryPreparation"
|
||||
type="button"
|
||||
class="block w-full px-3 py-2 text-left text-xs hover:bg-slate-50 dark:hover:bg-slate-800"
|
||||
role="menuitem"
|
||||
data-testid="review-line-retry-preparation"
|
||||
@click="onRetry('retry_inventory_preparation')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineOps.retryPreparation') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="canRetryMatching"
|
||||
type="button"
|
||||
class="block w-full px-3 py-2 text-left text-xs hover:bg-slate-50 dark:hover:bg-slate-800"
|
||||
role="menuitem"
|
||||
data-testid="review-line-retry-matching"
|
||||
@click="onRetry('retry_inventory_matching')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineOps.retryMatching') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="moreMenuOpen && showMore"
|
||||
class="rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-slate-700 dark:bg-slate-900"
|
||||
role="menu"
|
||||
data-testid="review-line-more-menu"
|
||||
:style="moreMenuStyle"
|
||||
>
|
||||
<button
|
||||
v-if="canViewFulfillment"
|
||||
type="button"
|
||||
class="block w-full px-3 py-2 text-left text-xs hover:bg-slate-50 dark:hover:bg-slate-800"
|
||||
role="menuitem"
|
||||
data-testid="review-line-fulfillment-detail"
|
||||
@click="closeMenus(); emit('view-fulfillment')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.lineOps.viewFulfillment') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="canClose"
|
||||
type="button"
|
||||
class="block w-full px-3 py-2 text-left text-xs text-rose-700 hover:bg-rose-50 dark:text-rose-300 dark:hover:bg-rose-950/40"
|
||||
role="menuitem"
|
||||
data-testid="review-line-decide-close"
|
||||
@click="onCloseLine"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.fulfillmentDecision.closeLine') }}
|
||||
</button>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,8 +1,9 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewProfileMatchPanel.vue
|
||||
用途:复核工作台文档模板匹配只读区(选中模板 / 候选分 / 回退原因)。
|
||||
用途:复核工作台文档模板匹配只读区(用户四态;管理员详细在技术诊断)。
|
||||
依赖:vue-i18n、ShippingOrderReviewProfileMatch。
|
||||
逻辑:A3 只展示;换模板/重抽取仍走 Process Gate 或重新识别 PDF。
|
||||
逻辑:普通用户只显示 matched/unmatched/ambiguous/unknown;
|
||||
required_field_missing 不在此展示;分数/Profile ID 仅 admin visibility。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
@@ -15,11 +16,18 @@ const props = defineProps<{
|
||||
|
||||
const { t, te } = useI18n();
|
||||
|
||||
const visible = computed(() => Boolean(props.profileMatch?.available));
|
||||
const visible = computed(() => {
|
||||
const match = props.profileMatch;
|
||||
if (!match) return false;
|
||||
if (match.visibility === 'admin_only' && match.available === false) return false;
|
||||
return Boolean(match.available !== false);
|
||||
});
|
||||
|
||||
const isAdminView = computed(() => String(props.profileMatch?.visibility || '') === 'admin');
|
||||
const needsReview = computed(() => Boolean(props.profileMatch?.needs_review));
|
||||
|
||||
/**
|
||||
* 匹配状态本地化。
|
||||
* 匹配状态本地化(用户四态)。
|
||||
*/
|
||||
const statusLabel = computed(() => {
|
||||
const status = String(props.profileMatch?.status || '').trim();
|
||||
@@ -28,27 +36,19 @@ const statusLabel = computed(() => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 选中模板展示名。
|
||||
* 选中模板展示名(用户仅 display_name)。
|
||||
*/
|
||||
const selectedLabel = computed(() => {
|
||||
const selected = props.profileMatch?.selected_profile;
|
||||
if (!selected?.profile_code) {
|
||||
if (!selected) {
|
||||
return t('chat.shippingOrderReview.profileMatch.noSelected');
|
||||
}
|
||||
const name = String(selected.display_name || selected.profile_code).trim();
|
||||
const name = String(selected.display_name || selected.profile_code || '').trim();
|
||||
if (!name) return t('chat.shippingOrderReview.profileMatch.noSelected');
|
||||
if (!isAdminView.value) return name;
|
||||
const version = selected.version != null ? ` v${selected.version}` : '';
|
||||
return `${name}${version}`;
|
||||
});
|
||||
|
||||
/**
|
||||
* 回退原因本地化列表。
|
||||
*/
|
||||
const fallbackLabels = computed(() =>
|
||||
(props.profileMatch?.fallback_reason_codes || []).map((code) => {
|
||||
const key = `chat.shippingOrderReview.profileMatch.reasons.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
}),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -56,6 +56,7 @@ const fallbackLabels = computed(() =>
|
||||
v-if="visible"
|
||||
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
|
||||
data-testid="review-profile-match-panel"
|
||||
:data-status="String(profileMatch?.status || '')"
|
||||
>
|
||||
<header class="flex flex-wrap items-start justify-between gap-2">
|
||||
<div>
|
||||
@@ -78,47 +79,33 @@ const fallbackLabels = computed(() =>
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.selected') }}</dt>
|
||||
<dd class="font-medium text-primary" data-testid="review-profile-match-selected">{{ selectedLabel }}</dd>
|
||||
</div>
|
||||
<div v-if="profileMatch?.route_type" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.routeType') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.route_type }}</dd>
|
||||
</div>
|
||||
<div v-if="profileMatch?.execution_mode" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.executionMode') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.execution_mode }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<ul
|
||||
v-if="(profileMatch?.candidates || []).length"
|
||||
class="mt-2 space-y-1.5"
|
||||
data-testid="review-profile-match-candidates"
|
||||
>
|
||||
<li
|
||||
v-for="(item, idx) in profileMatch?.candidates || []"
|
||||
:key="`${item.profile_code}-${item.version}-${idx}`"
|
||||
class="rounded-lg border border-default bg-surface-soft px-2.5 py-1.5 text-[11px] text-secondary"
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<span class="font-medium text-primary">
|
||||
{{ item.display_name || item.profile_code }}
|
||||
<span v-if="item.version != null" class="text-muted">v{{ item.version }}</span>
|
||||
</span>
|
||||
<span v-if="item.score != null" class="font-mono text-muted">
|
||||
{{ t('chat.shippingOrderReview.profileMatch.score', { score: Number(item.score).toFixed(2) }) }}
|
||||
</span>
|
||||
<template v-if="isAdminView">
|
||||
<dl class="mt-2 space-y-1 text-xs text-secondary">
|
||||
<div v-if="profileMatch?.route_type" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.routeType') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.route_type }}</dd>
|
||||
</div>
|
||||
<p v-if="item.reason_codes?.length" class="mt-0.5 text-muted">
|
||||
{{ item.reason_codes.join(', ') }}
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul v-if="fallbackLabels.length" class="mt-2 list-disc space-y-0.5 pl-4 text-[11px] text-amber-900 dark:text-amber-100">
|
||||
<li v-for="label in fallbackLabels" :key="label">{{ label }}</li>
|
||||
</ul>
|
||||
|
||||
<p class="mt-2 text-[11px] text-muted">
|
||||
{{ t('chat.shippingOrderReview.profileMatch.reselectHint') }}
|
||||
</p>
|
||||
<div v-if="profileMatch?.execution_mode" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.executionMode') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.execution_mode }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<ul
|
||||
v-if="(profileMatch?.candidates || []).length"
|
||||
class="mt-2 space-y-1.5"
|
||||
data-testid="review-profile-match-candidates"
|
||||
>
|
||||
<li
|
||||
v-for="(item, idx) in profileMatch?.candidates || []"
|
||||
:key="`${item.profile_code}-${item.version}-${idx}`"
|
||||
class="rounded-lg border border-default bg-surface-soft px-2.5 py-1.5 text-[11px] text-secondary"
|
||||
>
|
||||
<span class="font-mono">{{ item.profile_code }}</span>
|
||||
<span v-if="item.score != null" class="ml-2 text-muted">{{ item.score }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
+5
-1
@@ -3,6 +3,7 @@
|
||||
用途:订单处理工作台只读进度区外壳——挂载压缩版 ReviewProgressStrip + 人工上传入口。
|
||||
依赖:vue-i18n、ShippingProcessingProjection、ReviewProgressStrip、shippingProcessingFulfillment。
|
||||
逻辑:标题与「当前需要」由 Strip 统一渲染;surface=review 永不渲染 review-generic-next-steps;
|
||||
正式 OT 已创建时传 hasFormalOt 抑制「请确认建单」;
|
||||
仅人工上传保留任务台跳转;其他 Gate 只靠 Strip + Footer;写操作不在本面板。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
@@ -24,6 +25,8 @@ const props = defineProps<{
|
||||
polling?: boolean;
|
||||
/** 统一进度投影:节点与文案的权威来源。 */
|
||||
processingProjection?: ShippingProcessingProjection | null;
|
||||
/** 正式 OT 已创建;抑制确认建单类「当前需要」。 */
|
||||
hasFormalOt?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -47,7 +50,7 @@ const showTaskWorkbenchLink = computed(() => {
|
||||
|
||||
<template>
|
||||
<section
|
||||
class="rounded-xl border border-default bg-surface-soft/60 p-3"
|
||||
class="rounded-xl border border-default bg-surface-soft/60 p-2.5"
|
||||
data-testid="review-workflow-progress-panel"
|
||||
>
|
||||
<div
|
||||
@@ -62,6 +65,7 @@ const showTaskWorkbenchLink = computed(() => {
|
||||
v-else-if="processingProjection"
|
||||
:projection="processingProjection"
|
||||
:polling="polling"
|
||||
:has-formal-ot="hasFormalOt || Boolean(String(taskNo || '').trim())"
|
||||
@open-process-details="emit('open-process-details')"
|
||||
@refresh="emit('refresh')"
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user