From 806f53d1d6ae24b0a2e597a9dd5a51b61f7216bf Mon Sep 17 00:00:00 2001 From: liufumingren Date: Fri, 3 Jul 2026 21:57:28 +0800 Subject: [PATCH] 1 --- src/api/storage.entry/entry.ts | 3 ++ .../storage/entry/component/entrydetail.vue | 48 +++++++++++++++---- src/views/storage/entry/index.vue | 16 ++++--- 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/api/storage.entry/entry.ts b/src/api/storage.entry/entry.ts index 09c880ee..3fc99784 100644 --- a/src/api/storage.entry/entry.ts +++ b/src/api/storage.entry/entry.ts @@ -171,6 +171,7 @@ export type EntryOrderDetail = { entry_order_code?: string purchase_order_code?: string store_name?: string + store_remask?: string order_status?: string items?: EntryDetailItem[] receivingBindings?: EntryOrderReceivingBinding[] @@ -185,6 +186,8 @@ export type GetEntryDetailResponse = { entryOrder?: EntryOrderDetail data?: { entryOrder?: EntryOrderDetail + items?: EntryDetailItem[] + receivingBindings?: EntryOrderReceivingBinding[] } } diff --git a/src/views/storage/entry/component/entrydetail.vue b/src/views/storage/entry/component/entrydetail.vue index 8196582d..7fb9f507 100644 --- a/src/views/storage/entry/component/entrydetail.vue +++ b/src/views/storage/entry/component/entrydetail.vue @@ -87,6 +87,7 @@ import { commit, getEntryDetail, type EntryDetailItem, + type EntryDetailItemBarcode, } from '@/api/storage.entry/entry' import DirectInboundImportDialog, { type DirectInboundImportRow, @@ -218,17 +219,46 @@ async function loadEntryDetail() { const entryOrder = res.data.entryOrder entryOrderStatus.value = entryOrder.order_status || '' entryOrderCode.value = entryOrder.entry_order_code || '' - const items = entryOrder.items || [] - tableData.value = items.map((item: EntryDetailItem) => ({ - ...item, - direct_inbound_quantity: item.direct_inbound_quantity ?? 0, - remaining_quantity: item.remaining_quantity ?? item.count ?? 0, - entry_order_code: entryOrder.entry_order_code || '', - purchase_order_code: entryOrder.purchase_order_code || '', - store_name: entryOrder.store_name || '', - })) + // items 与 entryOrder 同级,在 res.data 下 + const rawItems: any[] = res.data.items || [] + const items: EntryDetailItem[] = rawItems.map((item: any) => { + const stock = item.stock || {} + const barcodes: EntryDetailItemBarcode[] = (stock.barcodes || []).map((b: any) => ({ + id: b.id, + barcode: b.barcode, + })) + const imageUrls: string[] = Array.isArray(stock.image_url) ? stock.image_url : [] + return { + id: item.id, + stock_id: item.stock_id ?? stock.id, + external_item_code: item.external_item_code ?? '', + external_item_id: item.external_item_id, + warehouse_item_code: stock.item_code || '', + warehouse_item_name: stock.item_name || '', + warehouse_item_spec: stock.sku_property || '', + count: item.planned ?? item.count ?? 0, + received_quantity: item.completed ?? item.received_quantity ?? 0, + confirm_quantity: item.confirm_quantity ?? 0, + warehouse_quantity: stock.quantity ?? null, + warehouse_locked_quantity: stock.locked_quantity ?? null, + warehouse_is_batch_mgmt: stock.is_batch_mgmt ?? null, + warehouse_is_shelf_life_mgmt: stock.is_shelf_life_mgmt ?? null, + warehouse_image_url: imageUrls.length > 0 ? imageUrls[0] : '', + warehouse_is_images: stock.is_images ?? null, + barcodes, + direct_inbound_quantity: item.direct_inbound_quantity ?? 0, + remaining_quantity: item.remaining_quantity ?? ((item.planned ?? item.count ?? 0) - (item.completed ?? item.received_quantity ?? 0)), + pending_total: item.pending_total ?? 0, + bindings: item.bindings || [], + direct_logs: item.direct_logs || [], + entry_order_code: entryOrder.entry_order_code || '', + purchase_order_code: entryOrder.purchase_order_code || '', + store_name: entryOrder.store_remask || entryOrder.store_name || '', + } + }) + tableData.value = items directSummary.value = buildDirectSummary(items) pagination.total = tableData.value.length } else { diff --git a/src/views/storage/entry/index.vue b/src/views/storage/entry/index.vue index b452172b..4bed492c 100644 --- a/src/views/storage/entry/index.vue +++ b/src/views/storage/entry/index.vue @@ -483,16 +483,20 @@ async function fetchEntryPrintData(row: any, _index: number): Promise const result: Record = { ...entryOrder } - // 表格渲染使用 details 字段,将 items 映射过去 - if (Array.isArray(entryOrder.items)) { - result.details = (entryOrder.items as any[]).map((item: any, idx: number) => ({ + + // items 与 entryOrder 同级,在 res.data 下 + const items: any[] = res.data.items || [] + result.details = items.map((item: any, idx: number) => { + const stock = item.stock || {} + return { ...item, + ...stock, // 条码:取 barcodes 数组第一条的 barcode - barcode: item.barcode ?? item.barcodes?.[0]?.barcode ?? '', + barcode: item.barcode ?? stock.barcodes?.[0]?.barcode ?? '', // 序号 seq_no: idx + 1, - })) - } + } + }) return result }