refactor(shipping-notice): 统一料号字段,移除过时的 SKU 相关字段,更新相关逻辑以支持新字段命名
This commit is contained in:
1 parent
dde25344ca
commit
46eb63f5bb
111 files changed
+3116
-1250
No files matched your search
@@ -79,6 +79,7 @@ const emit = defineEmits<{
|
||||
stop: [];
|
||||
'voice-click': [];
|
||||
'remove-attachment': [id: string];
|
||||
'retry-attachment': [id: string];
|
||||
'retry-shipping-notice-attachment': [id: string];
|
||||
'resolve-shipping-notice-duplicate': [id: string];
|
||||
'select-shipping-candidate': [candidateNo: string, selected: boolean];
|
||||
@@ -365,6 +366,22 @@ watch(
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="a.kind === 'local' && a.uploadStatus === 'failed'"
|
||||
class="absolute bottom-1.5 right-2 flex items-center gap-1"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded p-1 text-red-500 hover:bg-red-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-400 disabled:cursor-not-allowed disabled:opacity-30 dark:hover:bg-red-950/30"
|
||||
:disabled="isUploadingAttachments"
|
||||
:title="t('chat.attachment.retry')"
|
||||
:aria-label="t('chat.attachment.retryNamed', { name: getAttachmentName(a) })"
|
||||
@click="emit('retry-attachment', a.id)"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="a.kind === 'shipping_notice' && (canRetryShippingNoticeParse(a) || (!a.candidates?.length && a.duplicate?.blocking && !a.duplicateResolution?.action))"
|
||||
class="absolute bottom-1.5 right-2 flex items-center gap-1"
|
||||
|
||||
@@ -287,6 +287,7 @@ watch(() => page.currentAgentId, () => {
|
||||
@stop="page.stopActiveGeneration()"
|
||||
@voice-click="page.handleVoiceFeatureClick"
|
||||
@remove-attachment="page.removeAttachment"
|
||||
@retry-attachment="page.retryAttachment"
|
||||
@retry-shipping-notice-attachment="page.retryShippingNoticeAttachment"
|
||||
@resolve-shipping-notice-duplicate="page.openShippingDuplicateDialog"
|
||||
@select-shipping-candidate="page.setShippingCandidateSelected"
|
||||
|
||||
@@ -11,11 +11,12 @@ import type { ShippingDuplicateAction, ShippingNoticePendingAttachment } from '.
|
||||
|
||||
interface EditableCandidateLine {
|
||||
source: Record<string, unknown>;
|
||||
sku: string;
|
||||
part_number: string;
|
||||
customer_part_number: string;
|
||||
aws_part_number: string;
|
||||
qty: string;
|
||||
reservation_id: string;
|
||||
source_type: string;
|
||||
hub_code: string;
|
||||
inventory_source_hint: string;
|
||||
uom: string;
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ watch(() => props.attachment.candidates, () => {
|
||||
|
||||
/**
|
||||
* 将 Candidate 摘要投影为可编辑的 PO 与订单行。
|
||||
* 核心逻辑:保留原始扩展字段,并显式映射 SKU、数量、Reservation ID、Source Type、Hub Code 与单位。
|
||||
* 核心逻辑:保留原始扩展字段,并显式映射三类料号、数量、Reservation ID、库存源线索与单位。
|
||||
* @param candidateNo - 待编辑的 Candidate 编号
|
||||
* @returns 无返回值;Candidate 不存在时保持当前编辑状态
|
||||
*/
|
||||
@@ -61,11 +62,12 @@ function startEdit(candidateNo: string): void {
|
||||
editPoNumber.value = String(candidate.businessSummary.po_number || candidate.poNumber || '');
|
||||
editLines.splice(0, editLines.length, ...sourceLines.map((line) => ({
|
||||
source: { ...line },
|
||||
sku: String(line.sku || ''),
|
||||
part_number: String(line.part_number || ''),
|
||||
customer_part_number: String(line.customer_part_number || ''),
|
||||
aws_part_number: String(line.aws_part_number || ''),
|
||||
qty: String(line.qty ?? ''),
|
||||
reservation_id: String(line.reservation_id || ''),
|
||||
source_type: String(line.source_type || ''),
|
||||
hub_code: String(line.hub_code || ''),
|
||||
inventory_source_hint: String(line.inventory_source_hint || ''),
|
||||
uom: String(line.uom || 'EA'),
|
||||
})));
|
||||
if (!editLines.length) addLine();
|
||||
@@ -74,16 +76,25 @@ function startEdit(candidateNo: string): void {
|
||||
|
||||
/**
|
||||
* 新增一条待修订订单行。
|
||||
* 核心逻辑:创建带可选 Source Type / Hub Code 路由线索的空白草稿。
|
||||
* 核心逻辑:创建带三类料号和可选库存源线索的空白草稿。
|
||||
* @returns 无返回值
|
||||
*/
|
||||
function addLine(): void {
|
||||
editLines.push({ source: {}, sku: '', qty: '', reservation_id: '', source_type: '', hub_code: '', uom: 'EA' });
|
||||
editLines.push({
|
||||
source: {},
|
||||
part_number: '',
|
||||
customer_part_number: '',
|
||||
aws_part_number: '',
|
||||
qty: '',
|
||||
reservation_id: '',
|
||||
inventory_source_hint: '',
|
||||
uom: 'EA',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并提交 Candidate 修订。
|
||||
* 核心逻辑:保留原始扩展字段;Source Type 与 Hub Code 分开提交,避免编辑时静默丢失 Hub Code。
|
||||
* 核心逻辑:保留原始扩展字段,并按 v2 契约提交三类料号与唯一库存源线索。
|
||||
* @returns 无返回值;校验失败时写入本地错误提示
|
||||
*/
|
||||
function saveEdit(): void {
|
||||
@@ -93,15 +104,16 @@ function saveEdit(): void {
|
||||
const source = { ...line.source };
|
||||
return {
|
||||
...source,
|
||||
sku: line.sku.trim(),
|
||||
part_number: line.part_number.trim(),
|
||||
customer_part_number: line.customer_part_number.trim() || undefined,
|
||||
aws_part_number: line.aws_part_number.trim() || undefined,
|
||||
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,
|
||||
inventory_source_hint: line.inventory_source_hint.trim() || undefined,
|
||||
uom: line.uom.trim() || 'EA',
|
||||
};
|
||||
});
|
||||
if (normalizedLines.some((line) => !line.sku || !Number.isFinite(line.qty) || line.qty <= 0)) {
|
||||
if (normalizedLines.some((line) => !line.part_number || !Number.isFinite(line.qty) || line.qty <= 0)) {
|
||||
editError.value = t('chat.shippingCandidateInvalidLine');
|
||||
return;
|
||||
}
|
||||
@@ -198,6 +210,21 @@ 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="candidate.fieldAdjudication?.decisions?.length"
|
||||
class="mt-2 rounded-lg border border-sky-200 bg-sky-50/70 px-2 py-1.5"
|
||||
>
|
||||
<div class="font-semibold text-sky-900">{{ t('chat.shippingParsedResult.adjudicationTitle') }}</div>
|
||||
<div class="mt-1 flex flex-wrap gap-1">
|
||||
<span
|
||||
v-for="decision in candidate.fieldAdjudication.decisions"
|
||||
:key="`${decision.line_index}-${decision.field}`"
|
||||
class="rounded border border-sky-100 bg-white px-1.5 py-0.5 font-mono text-[10px] text-sky-900"
|
||||
>
|
||||
#{{ Number(decision.line_index) + 1 }} {{ decision.field }} · {{ decision.status }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="editingCandidateNo !== candidate.candidateNo && readonlyLines(candidate).length"
|
||||
class="mt-2 overflow-x-auto rounded-lg border border-default bg-surface"
|
||||
@@ -205,11 +232,12 @@ function submitForceCreate(candidateNo: string): void {
|
||||
<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.shippingNoticeUi.partNumber') }}</th>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingNoticeUi.customerPartNumber') }}</th>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingNoticeUi.awsPartNumber') }}</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>
|
||||
<th class="px-2 py-1">{{ t('chat.shippingNoticeUi.inventorySourceHint') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -218,11 +246,12 @@ function submitForceCreate(candidateNo: string): void {
|
||||
: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 font-mono">{{ displayCell(line.part_number) }}</td>
|
||||
<td class="px-2 py-1 font-mono">{{ displayCell(line.customer_part_number) }}</td>
|
||||
<td class="px-2 py-1 font-mono">{{ displayCell(line.aws_part_number) }}</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>
|
||||
<td class="px-2 py-1">{{ displayCell(line.inventory_source_hint) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -264,12 +293,13 @@ 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-6">
|
||||
<input v-model="line.sku" :placeholder="t('chat.shippingCandidateSku')" class="rounded border border-default px-2 py-1" />
|
||||
<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-4">
|
||||
<input v-model="line.part_number" :placeholder="t('chat.shippingNoticeUi.partNumber')" class="rounded border border-default px-2 py-1" />
|
||||
<input v-model="line.customer_part_number" :placeholder="t('chat.shippingNoticeUi.customerPartNumber')" class="rounded border border-default px-2 py-1" />
|
||||
<input v-model="line.aws_part_number" :placeholder="t('chat.shippingNoticeUi.awsPartNumber')" 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" />
|
||||
<input v-model="line.inventory_source_hint" :placeholder="t('chat.shippingNoticeUi.inventorySourceHint')" 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>
|
||||
|
||||
@@ -65,6 +65,10 @@ const missingFields = computed(() => {
|
||||
return Array.from(new Set([...gateMissing, ...candidateMissing].map((item) => String(item)).filter(Boolean)));
|
||||
});
|
||||
|
||||
const adjudicationDecisions = computed(() => (
|
||||
props.sourceCandidate?.field_adjudication?.decisions || []
|
||||
).filter((item) => item && typeof item === 'object'));
|
||||
|
||||
const hasBlocking = computed(() =>
|
||||
gateIssues.value.some((issue) => String(issue.severity || '') === 'blocking')
|
||||
|| missingFields.value.includes('reservation_id')
|
||||
@@ -167,7 +171,9 @@ function issueReasonLabel(reason?: string | null): string {
|
||||
<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>
|
||||
<div v-if="issue.part_number" class="mt-0.5 text-[11px] opacity-80">
|
||||
{{ t('chat.shippingNoticeUi.partNumber') }} {{ issue.part_number }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -176,31 +182,49 @@ function issueReasonLabel(reason?: string | null): string {
|
||||
<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.partNumber') }}</th>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingNoticeUi.customerPartNumber') }}</th>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingNoticeUi.awsPartNumber') }}</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>
|
||||
<th class="px-2.5 py-2">{{ t('chat.shippingNoticeUi.inventorySourceHint') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(line, index) in orderLines"
|
||||
:key="`${line.sku}-${index}`"
|
||||
:key="`${line.part_number}-${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 font-mono">{{ displayValue(line.part_number) }}</td>
|
||||
<td class="px-2.5 py-2 font-mono">{{ displayValue(line.customer_part_number) }}</td>
|
||||
<td class="px-2.5 py-2 font-mono">{{ displayValue(line.aws_part_number) }}</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>
|
||||
<td class="px-2.5 py-2">{{ displayValue(line.inventory_source_hint) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div v-else class="text-muted">{{ t('chat.shippingParsedResult.noLines') }}</div>
|
||||
|
||||
<div v-if="adjudicationDecisions.length" class="rounded-xl border border-sky-200 bg-sky-50/70 p-2.5">
|
||||
<div class="font-semibold text-sky-900">{{ t('chat.shippingParsedResult.adjudicationTitle') }}</div>
|
||||
<div class="mt-2 grid gap-1.5 md:grid-cols-2">
|
||||
<div
|
||||
v-for="decision in adjudicationDecisions"
|
||||
:key="`${decision.line_index}-${decision.field}`"
|
||||
class="rounded border border-sky-100 bg-white/80 px-2 py-1.5 text-[11px]"
|
||||
>
|
||||
<span class="font-mono">#{{ Number(decision.line_index) + 1 }} {{ decision.field }}</span>
|
||||
<span class="ml-1 font-semibold text-sky-800">{{ decision.status }}</span>
|
||||
<span v-if="decision.score != null" class="ml-1 text-muted">{{ t('chat.shippingParsedResult.score', { score: decision.score }) }}</span>
|
||||
<div class="mt-0.5 truncate text-secondary">{{ displayValue(decision.value) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ShippingFieldEvidencePanel
|
||||
:evidence="sourceCandidate?.evidence || []"
|
||||
:compact="compact"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/chat/components/messages/ChatMessageAttachmentList.vue
|
||||
* 用途:在用户消息中展示已发送附件快照。
|
||||
* 用途:在用户消息气泡内部展示已发送附件快照。
|
||||
* 依赖:lucide 文件图标、attachmentCard.utils 的大小格式化、chat.types 的消息附件契约。
|
||||
* 逻辑:ChatMessageBubble 将当前用户消息附件传入;本组件只读展示,不提供删除、重试或上传状态操作。
|
||||
* 逻辑:ChatMessageBubble 将当前用户消息附件传入;卡片继承品牌气泡语境,只读展示且不提供删除或重试。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { FileAudio, FileImage, FileText, FileVideo, Link2 } from 'lucide-vue-next';
|
||||
@@ -35,16 +35,16 @@ function attachmentBadge(attachment: ChatMessageAttachment): string {
|
||||
<div
|
||||
v-if="attachments.length > 0"
|
||||
data-testid="chat-message-attachment-list"
|
||||
class="mb-2 flex w-full flex-wrap justify-end gap-2"
|
||||
class="flex w-full flex-wrap justify-end gap-2"
|
||||
>
|
||||
<article
|
||||
v-for="(attachment, attachmentIndex) in attachments"
|
||||
:key="attachment.id || `${attachment.name}-${attachment.size ?? 'unknown'}-${attachmentIndex}`"
|
||||
class="flex min-w-0 basis-full items-center gap-2.5 rounded-xl border border-default bg-surface px-3 py-2.5 shadow-sm dark:bg-slate-900 sm:basis-[calc(50%-0.25rem)] sm:min-w-[220px] sm:max-w-[290px]"
|
||||
class="flex min-w-0 basis-full items-center gap-2.5 rounded-xl border border-white/20 bg-white/10 px-3 py-2.5 shadow-sm backdrop-blur-sm sm:basis-[calc(50%-0.25rem)] sm:min-w-[220px] sm:max-w-[290px]"
|
||||
:title="attachment.name"
|
||||
>
|
||||
<div
|
||||
class="flex h-10 w-9 shrink-0 flex-col items-center justify-center rounded-lg bg-brand-50 text-brand-700 dark:bg-brand-900/30 dark:text-brand-300"
|
||||
class="flex h-10 w-9 shrink-0 flex-col items-center justify-center rounded-lg bg-white/15 text-white"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<component :is="attachmentIcon(attachment)" class="h-4 w-4" />
|
||||
@@ -53,8 +53,8 @@ function attachmentBadge(attachment: ChatMessageAttachment): string {
|
||||
</span>
|
||||
</div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="truncate text-sm font-semibold text-primary">{{ attachment.name }}</div>
|
||||
<div v-if="attachment.size !== undefined" class="mt-1 text-[11px] leading-none text-muted">
|
||||
<div class="truncate text-sm font-semibold text-white">{{ attachment.name }}</div>
|
||||
<div v-if="attachment.size !== undefined" class="mt-1 text-[11px] leading-none text-white/70">
|
||||
{{ formatAttachmentSize(attachment.size) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* features/chat/components/messages/ChatMessageBubble.vue
|
||||
* 用途:渲染单条聊天消息,统一承接用户气泡、助手 Markdown、内嵌文件下载、请假/出货子组件与操作栏。
|
||||
* 依赖:Vue computed、lucide 图标、消息附件/Leave/Shipping 子组件、chat.types 与页面级 handlers。
|
||||
* 逻辑:由 ChatMessageList 按消息逐条挂载;用户附件显示在文字气泡上方,助手正文与特殊交互委托页面 handlers。
|
||||
* 逻辑:由 ChatMessageList 按消息逐条挂载;用户附件与文字共用同一气泡,助手正文与特殊交互委托页面 handlers。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
@@ -125,6 +125,8 @@ const showSourceSection = computed(() => {
|
||||
});
|
||||
|
||||
const hasUserContent = computed(() => message.role === 'user' && String(message.content || '').trim().length > 0);
|
||||
const hasUserAttachments = computed(() => message.role === 'user' && !!message.attachments?.length);
|
||||
const hasUserPayload = computed(() => hasUserContent.value || hasUserAttachments.value);
|
||||
const showActions = computed(() => (
|
||||
message.type !== 'leave-form'
|
||||
&& (message.role !== 'user' || hasUserContent.value)
|
||||
@@ -655,18 +657,20 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
class="flex flex-col"
|
||||
:class="message.role === 'user' ? 'max-w-[88%] md:max-w-[74%] items-end' : 'w-full'"
|
||||
>
|
||||
<ChatMessageAttachmentList
|
||||
v-if="message.role === 'user' && message.attachments?.length"
|
||||
:attachments="message.attachments"
|
||||
/>
|
||||
<div
|
||||
v-if="message.role === 'assistant' || hasUserContent"
|
||||
v-if="message.role === 'assistant' || hasUserPayload"
|
||||
class="text-[15px] leading-relaxed"
|
||||
:class="message.role === 'user'
|
||||
? 'rounded-2xl rounded-tr-sm bg-brand-600 px-5 py-2.5 text-white shadow-sm shadow-brand-500/15'
|
||||
? 'rounded-2xl rounded-tr-sm bg-brand-600 p-2.5 text-white shadow-sm shadow-brand-500/15'
|
||||
: 'chat-msg-assistant'"
|
||||
>
|
||||
<div v-if="message.role === 'user'" class="whitespace-pre-wrap">{{ message.content }}</div>
|
||||
<template v-if="message.role === 'user'">
|
||||
<ChatMessageAttachmentList
|
||||
v-if="message.attachments?.length"
|
||||
:attachments="message.attachments"
|
||||
/>
|
||||
<div v-if="hasUserContent" class="whitespace-pre-wrap px-2.5 py-1">{{ message.content }}</div>
|
||||
</template>
|
||||
<div v-else>
|
||||
<div
|
||||
v-if="shippingOrderExtractionState"
|
||||
|
||||
@@ -59,20 +59,20 @@ const { message, handlers } = defineProps<{
|
||||
<div class="space-y-2">
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-muted">{{ $t('chat.shippingNoticeMapping.orderDetails') }}</div>
|
||||
<div class="text-xs text-muted">
|
||||
{{ $t('chat.shippingNoticeMapping.orderRowCount', { count: handlers.getPayload(message)!.order.line_count }) }};{{ $t('chat.shippingNoticeMapping.orderSkuPreview', { count: handlers.getPayload(message)!.order.skus.length, skus: handlers.getPayload(message)!.order.skus.join(',') || $t('chat.shippingNoticeMapping.unrecognized') }) }}
|
||||
{{ $t('chat.shippingNoticeMapping.orderRowCount', { count: handlers.getPayload(message)!.order.line_count }) }};{{ $t('chat.shippingNoticeMapping.orderPartNumberPreview', { count: handlers.getPayload(message)!.order.part_numbers.length, partNumbers: handlers.getPayload(message)!.order.part_numbers.join(',') || $t('chat.shippingNoticeMapping.unrecognized') }) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 md:grid-cols-2">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.shippingNoticeMapping.skuColumnRequired') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.shippingNoticeMapping.partNumberColumnRequired') }}</span>
|
||||
<select
|
||||
v-model="handlers.getPayload(message)!.form.sku"
|
||||
v-model="handlers.getPayload(message)!.form.part_number"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="handlers.getPayload(message)!.applying"
|
||||
>
|
||||
<option value="" disabled>{{ $t('chat.shippingNoticeMapping.selectHeader') }}</option>
|
||||
<option v-for="h in (handlers.getPayload(message)!.schema_preview.headers || [])" :key="`sku-${h}`" :value="h">{{ handlers.normalizeHeader(h) }}</option>
|
||||
<option v-for="h in (handlers.getPayload(message)!.schema_preview.headers || [])" :key="`part-number-${h}`" :value="h">{{ handlers.normalizeHeader(h) }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
@@ -87,13 +87,13 @@ const { message, handlers } = defineProps<{
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5 md:col-span-2">
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.shippingNoticeMapping.reservationIdColumnOptional') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.shippingNoticeMapping.reservationIdColumnRequired') }}</span>
|
||||
<select
|
||||
v-model="handlers.getPayload(message)!.form.reservation_id"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="handlers.getPayload(message)!.applying"
|
||||
>
|
||||
<option value="">{{ $t('chat.shippingNoticeMapping.reservationIdNotUsed') }}</option>
|
||||
<option value="" disabled>{{ $t('chat.shippingNoticeMapping.selectHeader') }}</option>
|
||||
<option v-for="h in (handlers.getPayload(message)!.schema_preview.headers || [])" :key="`rid-${h}`" :value="h">{{ handlers.normalizeHeader(h) }}</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
@@ -76,7 +76,7 @@ const hasShortage = () => Array.isArray(props.shortageLines) && props.shortageLi
|
||||
<tr>
|
||||
<th class="px-3 py-2">#</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.reservationId') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.sku') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.partNumber') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.orderDemand') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.inventoryAvailable') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.shortageQty') }}</th>
|
||||
@@ -91,7 +91,7 @@ const hasShortage = () => Array.isArray(props.shortageLines) && props.shortageLi
|
||||
>
|
||||
<td class="px-3 py-2 text-secondary">{{ index + 1 }}</td>
|
||||
<td class="px-3 py-2 text-secondary">{{ line.reservation_id || '-' }}</td>
|
||||
<td class="px-3 py-2 font-mono text-secondary">{{ line.sku || '-' }}</td>
|
||||
<td class="px-3 py-2 font-mono text-secondary">{{ line.part_number || '-' }}</td>
|
||||
<td class="px-3 py-2 text-secondary">{{ formatQty(line.required_qty) }}</td>
|
||||
<td class="px-3 py-2 text-secondary">{{ formatQty(line.available_qty) }}</td>
|
||||
<td class="px-3 py-2" :class="Number(line.shortage_qty || 0) > 0 ? 'font-semibold text-rose-700' : 'text-secondary'">
|
||||
@@ -121,7 +121,7 @@ const hasShortage = () => Array.isArray(props.shortageLines) && props.shortageLi
|
||||
v-for="(line, index) in shortageLines"
|
||||
:key="`${taskId}-shortage-${index}`"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.shortageRowDetail', { index: index + 1, reservationId: line.reservation_id || '-', sku: line.sku || '-', shortage: formatQty(line.shortage_qty) }) }}
|
||||
{{ t('chat.shippingNoticeUi.shortageRowDetail', { index: index + 1, reservationId: line.reservation_id || '-', partNumber: line.part_number || '-', shortage: formatQty(line.shortage_qty) }) }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -36,7 +36,10 @@ const headerForm = reactive<ShippingNoticeHeader>({
|
||||
});
|
||||
const lineForm = reactive<Partial<ShippingNoticeLine>>({
|
||||
reservation_id: '',
|
||||
sku: '',
|
||||
part_number: '',
|
||||
customer_part_number: '',
|
||||
aws_part_number: '',
|
||||
inventory_source_hint: '',
|
||||
qty: 0,
|
||||
required_date: '',
|
||||
uom: '',
|
||||
@@ -61,7 +64,10 @@ watch(
|
||||
const line = payload.value.lines[value];
|
||||
if (!line) return;
|
||||
lineForm.reservation_id = line.reservation_id ?? '';
|
||||
lineForm.sku = line.sku;
|
||||
lineForm.part_number = line.part_number;
|
||||
lineForm.customer_part_number = line.customer_part_number ?? '';
|
||||
lineForm.aws_part_number = line.aws_part_number ?? '';
|
||||
lineForm.inventory_source_hint = line.inventory_source_hint ?? '';
|
||||
lineForm.qty = line.qty;
|
||||
lineForm.required_date = line.required_date ?? '';
|
||||
lineForm.uom = line.uom ?? '';
|
||||
@@ -84,7 +90,10 @@ const saveLine = async () => {
|
||||
if (editingLineIndex.value == null) return;
|
||||
const ok = await handlers.updateLine(message, editingLineIndex.value, {
|
||||
reservation_id: lineForm.reservation_id,
|
||||
sku: lineForm.sku,
|
||||
part_number: lineForm.part_number,
|
||||
customer_part_number: lineForm.customer_part_number,
|
||||
aws_part_number: lineForm.aws_part_number,
|
||||
inventory_source_hint: lineForm.inventory_source_hint,
|
||||
qty: Number(lineForm.qty || 0),
|
||||
required_date: lineForm.required_date,
|
||||
uom: lineForm.uom,
|
||||
@@ -96,7 +105,10 @@ const startAddLine = () => {
|
||||
addingLine.value = true;
|
||||
editingLineIndex.value = null;
|
||||
lineForm.reservation_id = '';
|
||||
lineForm.sku = '';
|
||||
lineForm.part_number = '';
|
||||
lineForm.customer_part_number = '';
|
||||
lineForm.aws_part_number = '';
|
||||
lineForm.inventory_source_hint = '';
|
||||
lineForm.qty = 0;
|
||||
lineForm.required_date = '';
|
||||
lineForm.uom = '';
|
||||
@@ -105,7 +117,10 @@ const startAddLine = () => {
|
||||
const saveAddedLine = async () => {
|
||||
const ok = await handlers.addLine(message, {
|
||||
reservation_id: lineForm.reservation_id,
|
||||
sku: lineForm.sku,
|
||||
part_number: lineForm.part_number,
|
||||
customer_part_number: lineForm.customer_part_number,
|
||||
aws_part_number: lineForm.aws_part_number,
|
||||
inventory_source_hint: lineForm.inventory_source_hint,
|
||||
qty: Number(lineForm.qty || 0),
|
||||
required_date: lineForm.required_date,
|
||||
uom: lineForm.uom,
|
||||
@@ -207,7 +222,9 @@ const removeLine = async (lineIndex: number) => {
|
||||
<tr>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">#</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.reservationId') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.sku') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.partNumber') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.customerPartNumber') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.awsPartNumber') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.qty') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.requiredDate') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.actions') }}</th>
|
||||
@@ -217,7 +234,9 @@ const removeLine = async (lineIndex: number) => {
|
||||
<tr v-for="(line, lineIndex) in payload.lines" :key="`${payload.taskId}-${line.line_no || lineIndex}`">
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ lineIndex + 1 }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.reservation_id || '-' }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.sku }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.part_number }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.customer_part_number || '-' }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.aws_part_number || '-' }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.qty }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.required_date || '-' }}</td>
|
||||
<td class="border border-default px-3 py-2">
|
||||
@@ -251,8 +270,20 @@ const removeLine = async (lineIndex: number) => {
|
||||
<input v-model="lineForm.reservation_id" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.sku') }}</span>
|
||||
<input v-model="lineForm.sku" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.partNumber') }}</span>
|
||||
<input v-model="lineForm.part_number" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.customerPartNumber') }}</span>
|
||||
<input v-model="lineForm.customer_part_number" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.awsPartNumber') }}</span>
|
||||
<input v-model="lineForm.aws_part_number" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.inventorySourceHint') }}</span>
|
||||
<input v-model="lineForm.inventory_source_hint" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.qty') }}</span>
|
||||
@@ -291,8 +322,20 @@ const removeLine = async (lineIndex: number) => {
|
||||
<input v-model="lineForm.reservation_id" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.sku') }}</span>
|
||||
<input v-model="lineForm.sku" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.partNumber') }}</span>
|
||||
<input v-model="lineForm.part_number" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.customerPartNumber') }}</span>
|
||||
<input v-model="lineForm.customer_part_number" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.awsPartNumber') }}</span>
|
||||
<input v-model="lineForm.aws_part_number" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.inventorySourceHint') }}</span>
|
||||
<input v-model="lineForm.inventory_source_hint" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.qty') }}</span>
|
||||
|
||||
Reference in new issue
Block a user