feat(shipping-notice): 新增订单行与字段冲突管理功能,支持字段冲突查询与解决
This commit is contained in:
1 parent
4fbaed2b4c
commit
9da0481fc3
74 files changed
+4861
-375
No files matched your search
@@ -27,6 +27,7 @@ import type {
|
||||
ShippingTaskDetail,
|
||||
ShippingTaskSummary,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import ShippingTaskParsedResultCard from '@/features/chat/components/ShippingTaskParsedResultCard.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
@@ -631,6 +632,21 @@ const handleSwitchBatch = (batchNo: string) => {
|
||||
</ul>
|
||||
<div class="mt-1 font-normal text-slate-600">{{ diagnosis.advice }}</div>
|
||||
</div>
|
||||
<ShippingTaskParsedResultCard
|
||||
v-if="isCurrentTask(task.task_no) && activeTaskDetail"
|
||||
class="mb-3"
|
||||
:task-no="activeTaskDetail.task_no"
|
||||
:po-number="activeTaskDetail.po_number"
|
||||
:lines="activeTaskDetail.lines"
|
||||
:parse-validation="activeTaskDetail.parse_validation || activeTaskDetail.step_payload?.parse_validation || null"
|
||||
:process-field-gate="activeTaskDetail.process_field_gate || null"
|
||||
:source-candidate="activeTaskDetail.source_candidate || null"
|
||||
:field-conflicts="activeTaskDetail.field_conflicts || []"
|
||||
:order-data-version="activeTaskDetail.order_data_version"
|
||||
:default-expanded="isAbnormalTask(task) || isWaitingHumanTask(task)"
|
||||
compact
|
||||
@refreshed="emit('focus-task', activeTaskDetail.task_no)"
|
||||
/>
|
||||
<div v-if="!resolveWorkspaceActionButtons(task).length" class="mb-3 text-xs leading-5 text-muted">
|
||||
<span class="font-semibold text-secondary">{{ t('chat.shippingNoticeUi.suggestedAction') }}</span>
|
||||
{{ resolveSuggestedAction(task) }}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<!--
|
||||
features/chat/components/ShippingFieldEvidencePanel.vue
|
||||
用途:只读展开订单字段级原文证据(Document + quote)。
|
||||
依赖:shipping.api.types、vue-i18n。
|
||||
逻辑:由 ShippingTaskParsedResultCard / Candidate 审核区传入 evidence;本组件不推导业务结论。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingFieldEvidenceItem } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
evidence?: ShippingFieldEvidenceItem[] | null;
|
||||
compact?: boolean;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const items = computed(() =>
|
||||
(props.evidence || []).filter((item) => item && typeof item === 'object'),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="items.length" class="space-y-2">
|
||||
<div class="text-[11px] font-semibold uppercase tracking-wide text-muted">
|
||||
{{ t('chat.shippingParsedResult.evidenceTitle') }}
|
||||
</div>
|
||||
<details
|
||||
v-for="(item, index) in items"
|
||||
:key="`${item.field || 'field'}-${item.document_id || index}`"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-2 text-xs"
|
||||
:open="!compact && index === 0"
|
||||
>
|
||||
<summary class="cursor-pointer font-medium text-secondary">
|
||||
<span class="font-mono">{{ item.field || t('chat.shippingParsedResult.unknownField') }}</span>
|
||||
<span v-if="item.reservation_id" class="ml-2 text-muted">{{ item.reservation_id }}</span>
|
||||
</summary>
|
||||
<div class="mt-2 space-y-1 text-muted">
|
||||
<div v-if="item.document_id != null">
|
||||
{{ t('chat.shippingParsedResult.documentId', { id: item.document_id }) }}
|
||||
</div>
|
||||
<blockquote
|
||||
v-if="item.quote"
|
||||
class="rounded border border-slate-200 bg-slate-50 px-2 py-1.5 font-mono text-[11px] leading-5 text-slate-700"
|
||||
>
|
||||
{{ item.quote }}
|
||||
</blockquote>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</template>
|
||||
@@ -15,6 +15,7 @@ interface EditableCandidateLine {
|
||||
qty: string;
|
||||
reservation_id: string;
|
||||
source_type: string;
|
||||
hub_code: string;
|
||||
uom: string;
|
||||
}
|
||||
|
||||
@@ -46,7 +47,7 @@ watch(() => props.attachment.candidates, () => {
|
||||
|
||||
/**
|
||||
* 将 Candidate 摘要投影为可编辑的 PO 与订单行。
|
||||
* 核心逻辑:保留原始扩展字段,并显式映射 SKU、数量、Reservation ID、Source Type 与单位。
|
||||
* 核心逻辑:保留原始扩展字段,并显式映射 SKU、数量、Reservation ID、Source Type、Hub Code 与单位。
|
||||
* @param candidateNo - 待编辑的 Candidate 编号
|
||||
* @returns 无返回值;Candidate 不存在时保持当前编辑状态
|
||||
*/
|
||||
@@ -64,6 +65,7 @@ function startEdit(candidateNo: string): void {
|
||||
qty: String(line.qty ?? ''),
|
||||
reservation_id: String(line.reservation_id || ''),
|
||||
source_type: String(line.source_type || ''),
|
||||
hub_code: String(line.hub_code || ''),
|
||||
uom: String(line.uom || 'EA'),
|
||||
})));
|
||||
if (!editLines.length) addLine();
|
||||
@@ -72,16 +74,16 @@ function startEdit(candidateNo: string): void {
|
||||
|
||||
/**
|
||||
* 新增一条待修订订单行。
|
||||
* 核心逻辑:创建带可选 Source Type 路由线索的空白草稿。
|
||||
* 核心逻辑:创建带可选 Source Type / Hub Code 路由线索的空白草稿。
|
||||
* @returns 无返回值
|
||||
*/
|
||||
function addLine(): void {
|
||||
editLines.push({ source: {}, sku: '', qty: '', reservation_id: '', source_type: '', uom: 'EA' });
|
||||
editLines.push({ source: {}, sku: '', qty: '', reservation_id: '', source_type: '', hub_code: '', uom: 'EA' });
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并提交 Candidate 修订。
|
||||
* 核心逻辑:保留原始扩展字段,并将 Source Type 作为唯一可选库存路由线索提交。
|
||||
* 核心逻辑:保留原始扩展字段;Source Type 与 Hub Code 分开提交,避免编辑时静默丢失 Hub Code。
|
||||
* @returns 无返回值;校验失败时写入本地错误提示
|
||||
*/
|
||||
function saveEdit(): void {
|
||||
@@ -95,6 +97,7 @@ function saveEdit(): void {
|
||||
qty: Number(line.qty),
|
||||
reservation_id: line.reservation_id.trim() || undefined,
|
||||
source_type: line.source_type.trim() || undefined,
|
||||
hub_code: line.hub_code.trim() || undefined,
|
||||
uom: line.uom.trim() || 'EA',
|
||||
};
|
||||
});
|
||||
@@ -116,6 +119,23 @@ function saveEdit(): void {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 非编辑态展示 Candidate 订单行摘要。
|
||||
* @param candidate - 当前 Candidate
|
||||
*/
|
||||
function readonlyLines(candidate: typeof candidates.value[number]): Array<Record<string, unknown>> {
|
||||
const lines = candidate.businessSummary?.lines;
|
||||
return Array.isArray(lines)
|
||||
? lines.filter((item): item is Record<string, unknown> => !!item && typeof item === 'object')
|
||||
: [];
|
||||
}
|
||||
|
||||
/** 将未知值格式化为表格占位文本。 */
|
||||
function displayCell(value: unknown): string {
|
||||
const text = String(value ?? '').trim();
|
||||
return text || '—';
|
||||
}
|
||||
|
||||
/** 对当前首个重复目标应用决策;强制新建时要求填写原因。 */
|
||||
function resolveDuplicate(candidateNo: string, action: ShippingDuplicateAction): void {
|
||||
const candidate = candidates.value.find((item) => item.candidateNo === candidateNo);
|
||||
@@ -178,6 +198,38 @@ function submitForceCreate(candidateNo: string): void {
|
||||
<div v-if="candidate.conflicts.length" class="mt-1 text-amber-700">
|
||||
{{ t('chat.shippingCandidateConflictCount', { count: candidate.conflicts.length }) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="editingCandidateNo !== candidate.candidateNo && readonlyLines(candidate).length"
|
||||
class="mt-2 overflow-x-auto rounded-lg border border-default bg-surface"
|
||||
>
|
||||
<table class="min-w-full text-[11px]">
|
||||
<thead class="bg-surface-soft text-left text-muted">
|
||||
<tr>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingCandidateSku') }}</th>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingCandidateQty') }}</th>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingCandidateReservation') }}</th>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingCandidateSourceType') }}</th>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingCandidateHubCode') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(line, index) in readonlyLines(candidate)"
|
||||
:key="`${candidate.candidateNo}-line-${index}`"
|
||||
class="border-t border-default/60"
|
||||
>
|
||||
<td class="px-2 py-1 font-mono">{{ displayCell(line.sku) }}</td>
|
||||
<td class="px-2 py-1">{{ displayCell(line.qty) }}</td>
|
||||
<td class="px-2 py-1 font-mono">{{ displayCell(line.reservation_id) }}</td>
|
||||
<td class="px-2 py-1">{{ displayCell(line.source_type) }}</td>
|
||||
<td class="px-2 py-1 font-mono">{{ displayCell(line.hub_code) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div v-if="(candidate.missingFields || []).length" class="mt-1 text-amber-700">
|
||||
{{ t('chat.shippingCandidateMissingFields', { fields: (candidate.missingFields || []).join(', ') }) }}
|
||||
</div>
|
||||
<div v-if="candidate.duplicate?.blocking && !candidate.duplicateResolution" class="mt-2 flex flex-wrap items-center gap-2 text-amber-700">
|
||||
<span>{{ t('chat.shippingCandidateDuplicate', { task: candidate.duplicate.matches[0]?.taskNo || '-' }) }}</span>
|
||||
<button
|
||||
@@ -212,11 +264,12 @@ function submitForceCreate(candidateNo: string): void {
|
||||
<span class="text-muted">{{ t('chat.shippingCandidatePoNumber') }}</span>
|
||||
<input v-model="editPoNumber" class="mt-1 w-full rounded border border-default bg-surface px-2 py-1 text-primary" />
|
||||
</label>
|
||||
<div v-for="(line, index) in editLines" :key="index" class="grid grid-cols-2 gap-2 rounded border border-default bg-surface p-2 md:grid-cols-5">
|
||||
<div v-for="(line, index) in editLines" :key="index" class="grid grid-cols-2 gap-2 rounded border border-default bg-surface p-2 md:grid-cols-6">
|
||||
<input v-model="line.sku" :placeholder="t('chat.shippingCandidateSku')" class="rounded border border-default px-2 py-1" />
|
||||
<input v-model="line.qty" type="number" min="0.0001" step="any" :placeholder="t('chat.shippingCandidateQty')" class="rounded border border-default px-2 py-1" />
|
||||
<input v-model="line.reservation_id" :placeholder="t('chat.shippingCandidateReservation')" class="rounded border border-default px-2 py-1" />
|
||||
<input v-model="line.source_type" :placeholder="t('chat.shippingCandidateSourceType')" class="rounded border border-default px-2 py-1" />
|
||||
<input v-model="line.hub_code" :placeholder="t('chat.shippingCandidateHubCode')" class="rounded border border-default px-2 py-1" />
|
||||
<div class="flex gap-1">
|
||||
<input v-model="line.uom" :placeholder="t('chat.shippingCandidateUom')" class="min-w-0 flex-1 rounded border border-default px-2 py-1" />
|
||||
<button v-if="editLines.length > 1" type="button" class="text-red-600" @click="editLines.splice(index, 1)">×</button>
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<!--
|
||||
features/chat/components/ShippingTaskFieldConflictPanel.vue
|
||||
用途:展示并解决任务级订单字段冲突(keep / take incoming)。
|
||||
依赖:shipping.api.resolveWorkspaceShippingFieldConflict、vue-i18n、useMessage。
|
||||
逻辑:由 ShippingTaskParsedResultCard 挂载;解决成功后 emit refreshed 让父级重拉 Task Detail。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { resolveWorkspaceShippingFieldConflict } from '@/features/chat/api/shipping.api';
|
||||
import type { ShippingFieldConflict } from '@/features/chat/types/shipping.api.types';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
|
||||
const props = defineProps<{
|
||||
taskNo: string;
|
||||
conflicts?: ShippingFieldConflict[] | null;
|
||||
orderDataVersion?: number | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
refreshed: [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const resolvingId = ref<number | null>(null);
|
||||
|
||||
const openConflicts = computed(() =>
|
||||
(props.conflicts || []).filter((item) => String(item.status || '') === 'open'),
|
||||
);
|
||||
|
||||
/**
|
||||
* 解决单条冲突。
|
||||
* 核心逻辑:携带 conflict_version 与 order_data_version;409 时提示刷新。
|
||||
*/
|
||||
async function resolveConflict(
|
||||
conflict: ShippingFieldConflict,
|
||||
resolution: 'keep_existing' | 'take_incoming',
|
||||
) {
|
||||
if (!props.taskNo || resolvingId.value != null) return;
|
||||
resolvingId.value = conflict.id;
|
||||
try {
|
||||
await resolveWorkspaceShippingFieldConflict(props.taskNo, conflict.id, {
|
||||
resolution,
|
||||
expectedConflictVersion: conflict.conflict_version,
|
||||
expectedOrderDataVersion: props.orderDataVersion ?? undefined,
|
||||
idempotencyKey: `conflict-${conflict.id}-${resolution}-${conflict.conflict_version}`,
|
||||
});
|
||||
msg.success(t('chat.shippingFieldConflict.resolveSuccess'));
|
||||
emit('refreshed');
|
||||
} catch (err) {
|
||||
msg.error(err instanceof Error ? err.message : t('chat.shippingFieldConflict.resolveFailed'));
|
||||
} finally {
|
||||
resolvingId.value = null;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="openConflicts.length"
|
||||
class="space-y-2 rounded-lg border border-rose-200 bg-rose-50/80 px-2.5 py-2"
|
||||
>
|
||||
<div class="text-[11px] font-semibold text-rose-900">
|
||||
{{ t('chat.shippingFieldConflict.title', { count: openConflicts.length }) }}
|
||||
</div>
|
||||
<div class="text-[11px] leading-5 text-rose-800">
|
||||
{{ t('chat.shippingFieldConflict.hint') }}
|
||||
</div>
|
||||
<ul class="space-y-2">
|
||||
<li
|
||||
v-for="conflict in openConflicts"
|
||||
:key="conflict.id"
|
||||
class="rounded-md border border-rose-200 bg-white/90 px-2.5 py-2 text-[11px]"
|
||||
>
|
||||
<div class="font-medium text-rose-900">
|
||||
<span v-if="conflict.position != null">#{{ Number(conflict.position) + 1 }} · </span>
|
||||
<span class="font-mono">{{ conflict.field_name }}</span>
|
||||
</div>
|
||||
<div class="mt-1 grid gap-1 text-slate-700 sm:grid-cols-2">
|
||||
<div>
|
||||
<span class="text-muted">{{ t('chat.shippingFieldConflict.existing') }}:</span>
|
||||
<span class="ml-1 font-mono">{{ conflict.existing_value || '—' }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-muted">{{ t('chat.shippingFieldConflict.incoming') }}:</span>
|
||||
<span class="ml-1 font-mono">{{ conflict.incoming_value || '—' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-slate-300 bg-white px-2 py-1 text-[11px] font-medium hover:bg-slate-50 disabled:opacity-50"
|
||||
:disabled="resolvingId != null"
|
||||
@click="resolveConflict(conflict, 'keep_existing')"
|
||||
>
|
||||
{{ t('chat.shippingFieldConflict.keepExisting') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-rose-300 bg-rose-100 px-2 py-1 text-[11px] font-medium text-rose-900 hover:bg-rose-200 disabled:opacity-50"
|
||||
:disabled="resolvingId != null"
|
||||
@click="resolveConflict(conflict, 'take_incoming')"
|
||||
>
|
||||
{{ t('chat.shippingFieldConflict.takeIncoming') }}
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,210 @@
|
||||
<!--
|
||||
features/chat/components/ShippingTaskParsedResultCard.vue
|
||||
用途:任务详情持久只读展示订单解析行、流转门禁、字段冲突与来源证据。
|
||||
依赖:ShippingFieldEvidencePanel、ShippingTaskFieldConflictPanel、shipping.api.types、vue-i18n。
|
||||
逻辑:Drawer / ShippingNoticeView 共用;只解释后端 Gate,不自行推导可继续状态。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import ShippingFieldEvidencePanel from '@/features/chat/components/ShippingFieldEvidencePanel.vue';
|
||||
import ShippingTaskFieldConflictPanel from '@/features/chat/components/ShippingTaskFieldConflictPanel.vue';
|
||||
import type {
|
||||
ShippingFieldConflict,
|
||||
ShippingNoticeLine,
|
||||
ShippingParseIssue,
|
||||
ShippingParseValidation,
|
||||
ShippingProcessFieldGate,
|
||||
ShippingSourceCandidateProjection,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
taskNo?: string | null;
|
||||
poNumber?: string | null;
|
||||
lines?: ShippingNoticeLine[] | null;
|
||||
parseValidation?: ShippingParseValidation | null;
|
||||
processFieldGate?: ShippingProcessFieldGate | null;
|
||||
sourceCandidate?: ShippingSourceCandidateProjection | null;
|
||||
fieldConflicts?: ShippingFieldConflict[] | null;
|
||||
orderDataVersion?: number | null;
|
||||
/** 阻断时默认展开;非阻断可折叠。 */
|
||||
defaultExpanded?: boolean;
|
||||
compact?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
refreshed: [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const expanded = ref(true);
|
||||
|
||||
watch(
|
||||
() => props.defaultExpanded,
|
||||
(value) => {
|
||||
if (typeof value === 'boolean') expanded.value = value;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const orderLines = computed(() => (props.lines || []).filter((line) => line && typeof line === 'object'));
|
||||
|
||||
const gateIssues = computed(() => {
|
||||
const fromGate = Array.isArray(props.processFieldGate?.issues) ? props.processFieldGate?.issues : [];
|
||||
const fromValidation = Array.isArray(props.parseValidation?.issues) ? props.parseValidation?.issues : [];
|
||||
return [...fromGate, ...fromValidation] as ShippingParseIssue[];
|
||||
});
|
||||
|
||||
const missingFields = computed(() => {
|
||||
const gateMissing = Array.isArray(props.processFieldGate?.missing_fields)
|
||||
? props.processFieldGate?.missing_fields || []
|
||||
: [];
|
||||
const candidateMissing = Array.isArray(props.sourceCandidate?.missing_fields)
|
||||
? props.sourceCandidate?.missing_fields || []
|
||||
: [];
|
||||
return Array.from(new Set([...gateMissing, ...candidateMissing].map((item) => String(item)).filter(Boolean)));
|
||||
});
|
||||
|
||||
const hasBlocking = computed(() =>
|
||||
gateIssues.value.some((issue) => String(issue.severity || '') === 'blocking')
|
||||
|| missingFields.value.includes('reservation_id')
|
||||
|| String(props.processFieldGate?.status || '') === 'needs_enrichment'
|
||||
|| String(props.parseValidation?.status || '') === 'needs_review'
|
||||
|| (props.fieldConflicts || []).some((item) => String(item.status || '') === 'open'),
|
||||
);
|
||||
|
||||
const statusLabel = computed(() => {
|
||||
if (hasBlocking.value) return t('chat.shippingParsedResult.statusBlocked');
|
||||
if (orderLines.value.length) return t('chat.shippingParsedResult.statusReady');
|
||||
return t('chat.shippingParsedResult.statusEmpty');
|
||||
});
|
||||
|
||||
const displayValue = (value: unknown) => {
|
||||
const text = String(value ?? '').trim();
|
||||
return text || '—';
|
||||
};
|
||||
|
||||
/**
|
||||
* 将门禁 reason 映射为用户可读文案。
|
||||
* @param reason - 后端 issue.reason
|
||||
*/
|
||||
function issueReasonLabel(reason?: string | null): string {
|
||||
const key = String(reason || '').trim();
|
||||
if (key === 'missing') return t('chat.shippingParsedResult.issueMissing');
|
||||
if (key === 'invalid_format') return t('chat.shippingParsedResult.issueInvalid');
|
||||
if (key === 'source_conflict' || key === 'field_conflict') return t('chat.shippingParsedResult.issueConflict');
|
||||
if (key === 'value_corrected') return t('chat.shippingParsedResult.issueCorrected');
|
||||
return key || t('chat.shippingParsedResult.issueUnknown');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
class="rounded-xl border p-3 text-xs"
|
||||
:class="hasBlocking
|
||||
? 'border-amber-200 bg-amber-50/70'
|
||||
: 'border-slate-200 bg-surface-soft/80'"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full items-start justify-between gap-2 text-left"
|
||||
@click="expanded = !expanded"
|
||||
>
|
||||
<div>
|
||||
<div class="text-[11px] font-bold uppercase tracking-wider text-muted">
|
||||
{{ t('chat.shippingParsedResult.title') }}
|
||||
</div>
|
||||
<div v-if="taskNo" class="mt-0.5 font-mono text-[11px] text-secondary">{{ taskNo }}</div>
|
||||
<div v-if="poNumber" class="mt-0.5 text-muted">PO {{ poNumber }}</div>
|
||||
</div>
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 text-[10px] font-semibold"
|
||||
:class="hasBlocking ? 'bg-amber-100 text-amber-800' : 'bg-emerald-100 text-emerald-700'"
|
||||
>
|
||||
{{ statusLabel }}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div v-if="expanded" class="mt-3 space-y-3">
|
||||
<div class="rounded-lg border border-slate-200/80 bg-white/80 px-2.5 py-2 text-[11px] leading-5 text-slate-700">
|
||||
{{ t('chat.shippingParsedResult.impactHint') }}
|
||||
</div>
|
||||
|
||||
<ShippingTaskFieldConflictPanel
|
||||
v-if="taskNo"
|
||||
:task-no="taskNo"
|
||||
:conflicts="fieldConflicts || []"
|
||||
:order-data-version="orderDataVersion"
|
||||
@refreshed="emit('refreshed')"
|
||||
/>
|
||||
|
||||
<div v-if="missingFields.length" class="space-y-1">
|
||||
<div class="font-semibold text-amber-800">{{ t('chat.shippingParsedResult.missingFields') }}</div>
|
||||
<div class="flex flex-wrap gap-1">
|
||||
<span
|
||||
v-for="field in missingFields"
|
||||
:key="field"
|
||||
class="rounded border border-amber-200 bg-amber-100 px-1.5 py-0.5 font-mono text-[10px] text-amber-900"
|
||||
>
|
||||
{{ field }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul v-if="gateIssues.length" class="space-y-1.5">
|
||||
<li
|
||||
v-for="(issue, index) in gateIssues"
|
||||
:key="`${issue.field}-${issue.line_index ?? index}`"
|
||||
class="rounded-lg border px-2.5 py-2"
|
||||
:class="String(issue.severity) === 'blocking'
|
||||
? 'border-rose-200 bg-rose-50 text-rose-800'
|
||||
: String(issue.reason) === 'value_corrected'
|
||||
? 'border-sky-200 bg-sky-50 text-sky-800'
|
||||
: 'border-amber-200 bg-amber-50 text-amber-800'"
|
||||
>
|
||||
<div class="font-medium">
|
||||
<span v-if="issue.line_index != null">#{{ Number(issue.line_index) + 1 }} · </span>
|
||||
<span class="font-mono">{{ issue.field }}</span>
|
||||
<span class="ml-1">{{ issueReasonLabel(issue.reason) }}</span>
|
||||
</div>
|
||||
<div v-if="issue.sku" class="mt-0.5 text-[11px] opacity-80">SKU {{ issue.sku }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div v-if="orderLines.length" class="overflow-x-auto rounded-xl border border-default bg-white/90">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-surface text-left text-[11px] text-muted">
|
||||
<tr>
|
||||
<th class="px-2.5 py-2">#</th>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingNoticeUi.sku') }}</th>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingNoticeUi.qty') }}</th>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingNoticeUi.reservationId') }}</th>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingParsedResult.sourceType') }}</th>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingParsedResult.hubCode') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(line, index) in orderLines"
|
||||
:key="`${line.sku}-${index}`"
|
||||
class="border-t border-default/60 text-xs"
|
||||
>
|
||||
<td class="px-2.5 py-2 text-muted">{{ index + 1 }}</td>
|
||||
<td class="px-2.5 py-2 font-mono">{{ displayValue(line.sku) }}</td>
|
||||
<td class="px-2.5 py-2">{{ displayValue(line.qty) }}</td>
|
||||
<td class="px-2.5 py-2 font-mono">{{ displayValue(line.reservation_id) }}</td>
|
||||
<td class="px-2.5 py-2">{{ displayValue(line.source_type) }}</td>
|
||||
<td class="px-2.5 py-2 font-mono">{{ displayValue(line.hub_code) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div v-else class="text-muted">{{ t('chat.shippingParsedResult.noLines') }}</div>
|
||||
|
||||
<ShippingFieldEvidencePanel
|
||||
:evidence="sourceCandidate?.evidence || []"
|
||||
:compact="compact"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user