From e930e583a961eaf2b8eb704b35a2fb45bd7adf7e Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Mon, 27 Jul 2026 21:14:59 +0800 Subject: [PATCH] feat(web-admin): support per-row planNo and multiline remarks on slip templates Co-authored-by: Cursor --- web-admin/src/utils/pl-delivery-slip-template.ts | 8 +++++--- web-admin/src/utils/pl-inbound-slip-template.ts | 8 +++++--- web-admin/src/utils/pl-subpack-slip-template.ts | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/web-admin/src/utils/pl-delivery-slip-template.ts b/web-admin/src/utils/pl-delivery-slip-template.ts index 01c956a97..17b1c07f1 100644 --- a/web-admin/src/utils/pl-delivery-slip-template.ts +++ b/web-admin/src/utils/pl-delivery-slip-template.ts @@ -1,4 +1,6 @@ import type { Plan, PlanProduct } from '@/api/pl' +import type { SlipPlanProduct } from '@/utils/pl-batch-print' +import { formatRemarkForSlipHtml } from '@/utils/pl-batch-print' import { applyPdfStableTableCellBorders } from '@/utils/pl-slip-pdf-render' /** 送(提)货单打印默认公司信息(可在富文本中修改) */ @@ -175,10 +177,10 @@ function buildProductRows( return `暂无产品信息` } - const planNoText = formatDeliverySlipProductGridCellContent(planNo) - const dataRows = products .map((product) => { + const rowPlanNo = (product as SlipPlanProduct).slipPlanNo || planNo + const planNoText = formatDeliverySlipProductGridCellContent(rowPlanNo) const qty = product.outboundQty ?? product.outboundEstimateQty ?? product.quantity ?? '' return ` ${planNoText} @@ -1800,7 +1802,7 @@ export function replaceDeliverySlipPlaceholders( '{{driverInfo}}': '', '{{planDateChinese}}': formatPlanDateChinese(plan.planDate), '{{productTable}}': buildProductRows(plan.products, plan.planNo || '', ctx), - '{{remark}}': plan.remark || '', + '{{remark}}': formatRemarkForSlipHtml(plan.remark), '{{companyAddress}}': DELIVERY_SLIP_DEFAULTS.companyAddress, '{{companyPhone}}': DELIVERY_SLIP_DEFAULTS.companyPhone, '{{contactPhone}}': DELIVERY_SLIP_DEFAULTS.contactPhone, diff --git a/web-admin/src/utils/pl-inbound-slip-template.ts b/web-admin/src/utils/pl-inbound-slip-template.ts index ad4a00d11..865986e7e 100644 --- a/web-admin/src/utils/pl-inbound-slip-template.ts +++ b/web-admin/src/utils/pl-inbound-slip-template.ts @@ -1,4 +1,6 @@ import type { Plan, PlanProduct } from '@/api/pl' +import type { SlipPlanProduct } from '@/utils/pl-batch-print' +import { formatRemarkForSlipHtml } from '@/utils/pl-batch-print' import { applyPdfStableTableCellBorders } from '@/utils/pl-slip-pdf-render' /** 入库单打印默认公司信息(可在富文本中修改) */ @@ -173,10 +175,10 @@ function buildProductRows( return `暂无产品信息` } - const planNoText = formatInboundSlipProductGridCellContent(planNo) - const dataRows = products .map((product) => { + const rowPlanNo = (product as SlipPlanProduct).slipPlanNo || planNo + const planNoText = formatInboundSlipProductGridCellContent(rowPlanNo) const qty = product.inboundQty ?? product.inboundEstimateQty ?? product.quantity ?? '' return ` ${planNoText} @@ -1364,7 +1366,7 @@ export function replaceInboundSlipPlaceholders( '{{driverInfo}}': '', '{{planDateChinese}}': formatPlanDateChinese(plan.planDate), '{{productTable}}': buildProductRows(plan.products, plan.planNo || '', ctx), - '{{remark}}': plan.remark || '', + '{{remark}}': formatRemarkForSlipHtml(plan.remark), '{{companyAddress}}': INBOUND_SLIP_DEFAULTS.companyAddress, '{{companyPhone}}': INBOUND_SLIP_DEFAULTS.companyPhone, '{{contactPhone}}': INBOUND_SLIP_DEFAULTS.contactPhone, diff --git a/web-admin/src/utils/pl-subpack-slip-template.ts b/web-admin/src/utils/pl-subpack-slip-template.ts index 3189f308e..0daa26949 100644 --- a/web-admin/src/utils/pl-subpack-slip-template.ts +++ b/web-admin/src/utils/pl-subpack-slip-template.ts @@ -1,4 +1,5 @@ import type { Plan, PlanProduct } from '@/api/pl' +import { formatRemarkForSlipHtml } from '@/utils/pl-batch-print' import { applyPdfStableTableCellBorders } from '@/utils/pl-slip-pdf-render' /** 分装单打印默认公司信息(可在富文本中修改) */ @@ -2119,7 +2120,7 @@ export function replaceSubpackSlipPlaceholders( '{{driverInfo}}': '', '{{planDateChinese}}': '', '{{productTable}}': buildProductRows(plan.products, ctx), - '{{remark}}': plan.remark || '', + '{{remark}}': formatRemarkForSlipHtml(plan.remark), '{{remarkExtra}}': '', '{{companyAddress}}': '', '{{companyPhone}}': '',