diff --git a/dist.tar.gz b/dist.tar.gz index 0df61bd3..1150d881 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/src/api/storage.entry/entry.ts b/src/api/storage.entry/entry.ts index d5256038..e1e6ca05 100644 --- a/src/api/storage.entry/entry.ts +++ b/src/api/storage.entry/entry.ts @@ -514,23 +514,29 @@ export function getDirectInboundItems( export type DirectInboundAddItemBatchEntry = { stock_id: number - quantity: number + quantity?: number inbound_type: 'import' | 'pda' | string space_id?: number remark?: string + receiving_detail_id?: number + allocated_quantity?: number } export type DirectInboundAddItemSingleParams = { - entry_order_code: string + /** 入库单 ID */ + entry_order_id: number stock_id: number - quantity: number + quantity?: number inbound_type: 'import' | 'pda' | string space_id?: number remark?: string + receiving_detail_id?: number + allocated_quantity?: number } export type DirectInboundAddItemBatchParams = { - entry_order_code: string + /** 入库单 ID */ + entry_order_id: number items: DirectInboundAddItemBatchEntry[] } diff --git a/src/views/order/waveOrder/config/wave-config.ts b/src/views/order/waveOrder/config/wave-config.ts index f3b32d75..027dcc1e 100644 --- a/src/views/order/waveOrder/config/wave-config.ts +++ b/src/views/order/waveOrder/config/wave-config.ts @@ -1303,7 +1303,52 @@ function mapPendingOrderItemsToPrintDetails(items: Record[]) { }) } -/** 将 order.pendingOrder.detail 响应映射为出库单打印表单字段 */ +/** 打印脱敏:收件人仅保留首字(姓),其余替换为 * */ +export function maskPrintReceiverName(name: unknown): string { + const text = String(name ?? '').trim() + if (!text) return '' + if (text.length === 1) return text + return text.charAt(0) + '*'.repeat(text.length - 1) +} + +/** 打印脱敏:电话保留前三位和最后四位,中间替换为 * */ +export function maskPrintReceiverPhone(phone: unknown): string { + const text = String(phone ?? '').trim() + if (!text) return '' + if (text.length <= 7) { + if (text.length <= 3) return text + return text.slice(0, 3) + '*'.repeat(text.length - 3) + } + const prefix = text.slice(0, 3) + const suffix = text.slice(-4) + return prefix + '*'.repeat(text.length - 7) + suffix +} + +/** 打印脱敏:详细地址中的阿拉伯数字替换为 * */ +export function maskPrintDetailAddressDigits(address: unknown): string { + const text = String(address ?? '').trim() + if (!text) return '' + return text.replace(/[0-9]/g, '*') +} + +function applySandanOutboundPrintReceiverMask(form: Record): Record { + const mobile = maskPrintReceiverPhone(form.mobile ?? form.tel) + const tel = maskPrintReceiverPhone(form.tel ?? form.mobile) + const detailAddress = maskPrintDetailAddressDigits(form.detail_address) + const addressParts = [form.province, form.city, form.area, form.town, detailAddress] + .map((value) => (value == null ? '' : String(value).trim())) + .filter(Boolean) + return { + ...form, + name: maskPrintReceiverName(form.name), + mobile, + tel: tel || mobile, + detail_address: detailAddress, + address: addressParts.join(''), + } +} + +/** 将 order.pendingOrder.detail 响应映射为出库单打印表单字段(散单波次打印货单会对收件人/电话脱敏) */ export function mapPendingOrderToOutboundPrintForm( detailPayload: Record, wave: Record, @@ -1315,7 +1360,7 @@ export function mapPendingOrderToOutboundPrintForm( .map((value) => (value == null ? '' : String(value).trim())) .filter(Boolean) - return { + return applySandanOutboundPrintReceiverMask({ ...order, wave_no: String(wave.wave_no ?? wave.batch_no ?? wave.wave_code ?? order.wave_no ?? '—'), delivery_order_code: resolvePendingOrderDeliveryCode(order), @@ -1337,7 +1382,7 @@ export function mapPendingOrderToOutboundPrintForm( remark: order.remark ?? order.seller_message ?? order.buyer_message ?? '', print_time: formatOutboundPrintDateTime(new Date()), details: mapPendingOrderItemsToPrintDetails(items), - } + }) } /** @@ -1428,7 +1473,9 @@ export async function fetchOutboundPrintDataFromPendingOrders( if (!orderId) { if (deliveryCode) missingDeliveryCodes.push(deliveryCode) - dataMap[rowKey] = skeleton.dataMap[rowKey] || toOutboundPrintForm({}, wave) + dataMap[rowKey] = applySandanOutboundPrintReceiverMask( + (skeleton.dataMap[rowKey] || toOutboundPrintForm({}, wave)) as Record, + ) printRows[index] = row return } @@ -1444,7 +1491,9 @@ export async function fetchOutboundPrintDataFromPendingOrders( } if (deliveryCode) missingDeliveryCodes.push(deliveryCode) - dataMap[rowKey] = skeleton.dataMap[rowKey] || toOutboundPrintForm({}, wave) + dataMap[rowKey] = applySandanOutboundPrintReceiverMask( + (skeleton.dataMap[rowKey] || toOutboundPrintForm({}, wave)) as Record, + ) printRows[index] = row }, ) diff --git a/src/views/storage/entry/component/DirectInboundImportDialog.vue b/src/views/storage/entry/component/DirectInboundImportDialog.vue index 796f5221..eeeb4c59 100644 --- a/src/views/storage/entry/component/DirectInboundImportDialog.vue +++ b/src/views/storage/entry/component/DirectInboundImportDialog.vue @@ -230,7 +230,7 @@ import { ElMessage, type FormInstance, type FormRules, type UploadFile } from 'e import { Search } from '@element-plus/icons-vue' import UpperTable from '@/components/UpperTable/index.vue' import * as indexApi from '@/api/index/index' -import { addDirectInboundItem } from '@/api/storage.directinbound/directinbound' +import { addDirectInboundItem } from '@/api/storage.entry/entry' import { directInboundInboundTypeOptions } from '../entry-config' import { downloadDirectInboundImportTemplate, @@ -247,6 +247,8 @@ export type { DirectInboundImportRow } const props = defineProps<{ modelValue: boolean + /** 入库单 ID(storage.entry.addDirectInboundItem 必填) */ + entryOrderId?: string | number entryOrderCode?: string /** 单条导入目标 */ targetItem?: DirectInboundImportRow | null @@ -540,9 +542,9 @@ function handleClosed() { } async function handleSubmit() { - const code = props.entryOrderCode - if (!code) { - ElMessage.warning('缺少入库单号') + const entryOrderId = Number(props.entryOrderId) + if (!Number.isFinite(entryOrderId) || entryOrderId <= 0) { + ElMessage.warning('缺少入库单 ID') return } @@ -560,7 +562,7 @@ async function handleSubmit() { } const res = await addDirectInboundItem({ - entry_order_code: code, + entry_order_id: entryOrderId, stock_id: Number(singleTarget.value.stock_id), quantity: Number(singleForm.quantity), inbound_type: singleForm.inbound_type, @@ -592,7 +594,7 @@ async function handleSubmit() { } const res = await addDirectInboundItem({ - entry_order_code: code, + entry_order_id: entryOrderId, items: parsedRows.value.map((row) => ({ stock_id: Number(row.stock_id), quantity: Number(row.quantity), diff --git a/src/views/storage/entry/component/entrydetail.vue b/src/views/storage/entry/component/entrydetail.vue index f8d2e701..5357ca36 100644 --- a/src/views/storage/entry/component/entrydetail.vue +++ b/src/views/storage/entry/component/entrydetail.vue @@ -68,6 +68,7 @@ []>([]) const entryOrderStatus = ref('') +const entryOrderId = computed(() => { + const fromProps = Number(props.id) + if (Number.isFinite(fromProps) && fromProps > 0) return fromProps + const fromRow = Number(props.row?.id) + return Number.isFinite(fromRow) && fromRow > 0 ? fromRow : undefined +}) const entryOrderCode = ref('') const directSummary = ref>({})