feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a9fbac2fc
commit
d2b3d74def
571 files changed
+78064
-24681
No files matched your search
+76
-7
@@ -2,7 +2,8 @@
|
||||
features/chat/components/shipping-review/ReviewCustomerResolutionPanel.vue
|
||||
用途:复核工作台固定「建单前客户确认」区域(与重新识别 PDF 分层)。
|
||||
依赖:vue-i18n、ShippingCustomerConfirmDialog、shipping.api 客户确认/重识别接口。
|
||||
逻辑:始终展示客户识别状态;选择标准客户 / 重新识别客户;成功后 emit refreshed 刷新建单资格。
|
||||
逻辑:未解决时完整展开置顶;已解决且 compact 时缩为一行摘要;
|
||||
选择标准客户 / 重新识别客户;成功后 emit refreshed 刷新建单资格。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
@@ -24,6 +25,8 @@ const props = defineProps<{
|
||||
caseNo: string;
|
||||
resolution: ShippingOrderReviewCustomerResolution | null | undefined;
|
||||
editable: boolean;
|
||||
/** 已解决时缩为一行摘要(放入「更多状态」) */
|
||||
compact?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -56,6 +59,27 @@ const displayName = computed(() => {
|
||||
return name || code || String(props.resolution?.raw_name || '').trim() || '—';
|
||||
});
|
||||
|
||||
const inputValues = computed(() => props.resolution?.input_values || []);
|
||||
const candidateRows = computed(() => props.resolution?.candidates || []);
|
||||
|
||||
function inputLabel(definitionCode: string | null | undefined): string {
|
||||
const code = String(definitionCode || '').trim().toLowerCase();
|
||||
if (code.includes('customer') && code.includes('code')) return t('chat.shippingOrderReview.customerResolution.inputLabels.customerCode');
|
||||
if (code.includes('customer') && code.includes('name')) return t('chat.shippingOrderReview.customerResolution.inputLabels.customerName');
|
||||
if (code.includes('address')) return t('chat.shippingOrderReview.customerResolution.inputLabels.address');
|
||||
if (code.endsWith('customer_code')) return t('chat.shippingOrderReview.customerResolution.inputLabels.customerCode');
|
||||
if (code.endsWith('customer_name')) return t('chat.shippingOrderReview.customerResolution.inputLabels.customerName');
|
||||
if (code.endsWith('address')) return t('chat.shippingOrderReview.customerResolution.inputLabels.address');
|
||||
if (code.includes('email')) return t('chat.shippingOrderReview.customerResolution.inputLabels.email');
|
||||
if (code.includes('domain')) return t('chat.shippingOrderReview.customerResolution.inputLabels.domain');
|
||||
return t('chat.shippingOrderReview.customerResolution.inputLabels.other');
|
||||
}
|
||||
|
||||
function candidateValue(candidate: unknown, key: string): string {
|
||||
const row = candidate && typeof candidate === 'object' ? candidate as Record<string, unknown> : {};
|
||||
return String(row[key] ?? '').trim() || '—';
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开标准客户选择弹窗并加载选项。
|
||||
*/
|
||||
@@ -94,12 +118,21 @@ async function onConfirm(customerId: number) {
|
||||
if (!props.caseNo || busy.value) return;
|
||||
busy.value = true;
|
||||
try {
|
||||
await confirmWorkspaceShippingOrderReviewCustomer(props.caseNo, {
|
||||
const result = await confirmWorkspaceShippingOrderReviewCustomer(props.caseNo, {
|
||||
customer_id: customerId,
|
||||
reason: t('chat.shippingOrderReview.customerResolution.confirmReason'),
|
||||
});
|
||||
dialogOpen.value = false;
|
||||
msg.success(t('chat.shippingOrderReview.customerResolution.confirmed'));
|
||||
const resume = result.resume_outcome;
|
||||
if (resume?.outcome === 'auto_created' || resume?.outcome === 'idempotent_replay') {
|
||||
msg.success(t('chat.shippingOrderReview.resume.autoCreated', {
|
||||
taskNo: resume.task_no || '',
|
||||
}));
|
||||
} else if (resume?.outcome === 'waiting_manual_confirm') {
|
||||
msg.success(t('chat.shippingOrderReview.resume.waitingManualConfirm'));
|
||||
} else {
|
||||
msg.success(t('chat.shippingOrderReview.customerResolution.confirmed'));
|
||||
}
|
||||
emit('refreshed');
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof BusinessError
|
||||
@@ -136,7 +169,28 @@ async function onRetry() {
|
||||
<section
|
||||
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
|
||||
data-testid="review-customer-resolution-panel"
|
||||
:data-compact="compact && resolved ? 'true' : 'false'"
|
||||
>
|
||||
<!-- 已解决摘要:一行展示客户与状态,避免占满侧栏首位 -->
|
||||
<div
|
||||
v-if="compact && resolved"
|
||||
class="flex flex-wrap items-center justify-between gap-2"
|
||||
data-testid="review-customer-resolution-compact"
|
||||
>
|
||||
<p class="text-xs text-secondary">
|
||||
<span class="font-medium text-primary">{{ t('chat.shippingOrderReview.customerResolution.title') }}</span>
|
||||
<span class="mx-1 text-muted">·</span>
|
||||
<span>{{ displayName }}</span>
|
||||
</p>
|
||||
<span
|
||||
class="rounded-full bg-emerald-100 px-2 py-0.5 text-[11px] font-medium text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100"
|
||||
data-testid="review-customer-resolution-badge"
|
||||
>
|
||||
{{ statusLabel }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<header class="flex flex-wrap items-start justify-between gap-2">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.customerResolution.title') }}</h2>
|
||||
@@ -155,12 +209,26 @@ async function onRetry() {
|
||||
|
||||
<dl class="mt-2 space-y-1 text-xs text-secondary">
|
||||
<div class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.recognizedAs') }}</dt>
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.standardCustomer') }}</dt>
|
||||
<dd class="font-medium text-primary">{{ displayName }}</dd>
|
||||
</div>
|
||||
<div v-if="resolution?.raw_name && resolution.raw_name !== displayName" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.rawName') }}</dt>
|
||||
<dd>{{ resolution.raw_name }}</dd>
|
||||
<div v-if="resolution?.short_code" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.customerCode') }}</dt>
|
||||
<dd class="font-mono font-medium text-primary">{{ resolution.short_code }}</dd>
|
||||
</div>
|
||||
<div v-if="inputValues.length" class="mt-2 border-t border-default pt-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.matchedInputs') }}</dt>
|
||||
<dd v-for="item in inputValues" :key="`${item.definition_code}:${item.normalized_value}`" class="mt-1 flex flex-wrap gap-x-2">
|
||||
<span class="text-muted">{{ inputLabel(item.definition_label || item.definition_code) }}</span>
|
||||
<span class="font-mono text-primary">{{ item.raw_value || item.normalized_value || '—' }}</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="candidateRows.length > 1" class="mt-2 border-t border-default pt-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.candidates') }}</dt>
|
||||
<dd v-for="candidate in candidateRows" :key="String(candidate.customer_id)" class="mt-1 flex flex-wrap gap-x-2">
|
||||
<span class="text-primary">{{ candidateValue(candidate, 'standard_name') }}</span>
|
||||
<span class="font-mono text-muted">{{ candidateValue(candidate, 'short_code') }}</span>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
@@ -196,5 +264,6 @@ async function onRetry() {
|
||||
@search="searchCustomers"
|
||||
@confirm="onConfirm"
|
||||
/>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user