feat(web-admin): allow multi planIds in transport slip print dialogs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
e930e583a9
commit
25978401e1
3 files changed
+55
-19
No files matched your search
@@ -69,6 +69,7 @@ import {
|
||||
setupDeliverySlipEditorTypeCheckboxes,
|
||||
type DeliverySlipRenderContext
|
||||
} from '@/utils/pl-delivery-slip-template'
|
||||
import { buildBatchPrintPlanView, normalizePlanIds } from '@/utils/pl-batch-print'
|
||||
import { injectSlipSealImages, stripSlipSealImages } from '@/utils/pl-slip-red-seal'
|
||||
import { getPlSlipPdfCanvasScale } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
@@ -136,19 +137,32 @@ async function buildSlipRenderContext(plan: Plan): Promise<DeliverySlipRenderCon
|
||||
}
|
||||
}
|
||||
|
||||
async function open(planId: string) {
|
||||
currentPlanId.value = planId
|
||||
async function open(planIdOrIds: string | string[]) {
|
||||
const ids = normalizePlanIds(planIdOrIds)
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('无法获取计划ID')
|
||||
return
|
||||
}
|
||||
currentPlanId.value = ids[0]
|
||||
isPreviewMode.value = false
|
||||
showRedSeal.value = true
|
||||
try {
|
||||
ElMessage.info({ message: '正在生成送(提)货单...', duration: 800 })
|
||||
const res = await planApi.get(planId)
|
||||
const plan = (res.data ?? res) as Plan
|
||||
ElMessage.info({
|
||||
message: ids.length > 1 ? '正在生成合打送(提)货单...' : '正在生成送(提)货单...',
|
||||
duration: 800
|
||||
})
|
||||
const plans = await Promise.all(
|
||||
ids.map(async (id) => {
|
||||
const res = await planApi.get(id)
|
||||
return (res.data ?? res) as Plan
|
||||
})
|
||||
)
|
||||
const plan = ids.length === 1 ? plans[0] : buildBatchPrintPlanView(plans)
|
||||
currentPlan.value = plan
|
||||
|
||||
let htmlContent = ''
|
||||
try {
|
||||
const templateRes = await planApi.getDeliverySlipTemplate(planId)
|
||||
const templateRes = await planApi.getDeliverySlipTemplate(ids[0])
|
||||
const saved = (templateRes.data ?? templateRes) as string
|
||||
if (saved?.trim()) {
|
||||
htmlContent = saved
|
||||
|
||||
@@ -67,6 +67,7 @@ import {
|
||||
restoreInboundSlipPlaceholders,
|
||||
type InboundSlipRenderContext
|
||||
} from '@/utils/pl-inbound-slip-template'
|
||||
import { buildBatchPrintPlanView, normalizePlanIds } from '@/utils/pl-batch-print'
|
||||
import { injectSlipSealImages, stripSlipSealImages } from '@/utils/pl-slip-red-seal'
|
||||
import { getPlSlipPdfCanvasScale } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
@@ -134,19 +135,29 @@ async function buildSlipRenderContext(plan: Plan): Promise<InboundSlipRenderCont
|
||||
}
|
||||
}
|
||||
|
||||
async function open(planId: string) {
|
||||
currentPlanId.value = planId
|
||||
async function open(planIdOrIds: string | string[]) {
|
||||
const ids = normalizePlanIds(planIdOrIds)
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('无法获取计划ID')
|
||||
return
|
||||
}
|
||||
currentPlanId.value = ids[0]
|
||||
isPreviewMode.value = false
|
||||
showRedSeal.value = true
|
||||
try {
|
||||
ElMessage.info({ message: '正在生成入库单...', duration: 800 })
|
||||
const res = await planApi.get(planId)
|
||||
const plan = (res.data ?? res) as Plan
|
||||
ElMessage.info({ message: ids.length > 1 ? '正在生成合打入库单...' : '正在生成入库单...', duration: 800 })
|
||||
const plans = await Promise.all(
|
||||
ids.map(async (id) => {
|
||||
const res = await planApi.get(id)
|
||||
return (res.data ?? res) as Plan
|
||||
})
|
||||
)
|
||||
const plan = ids.length === 1 ? plans[0] : buildBatchPrintPlanView(plans)
|
||||
currentPlan.value = plan
|
||||
|
||||
let htmlContent = ''
|
||||
try {
|
||||
const templateRes = await planApi.getInboundSlipTemplate(planId)
|
||||
const templateRes = await planApi.getInboundSlipTemplate(ids[0])
|
||||
const saved = (templateRes.data ?? templateRes) as string
|
||||
if (saved?.trim()) {
|
||||
htmlContent = saved
|
||||
|
||||
@@ -70,6 +70,7 @@ import {
|
||||
setupSubpackSlipEditorCheckboxes,
|
||||
type SubpackSlipRenderContext
|
||||
} from '@/utils/pl-subpack-slip-template'
|
||||
import { buildBatchPrintPlanView, normalizePlanIds } from '@/utils/pl-batch-print'
|
||||
import { injectSlipSealImages, stripSlipSealImages } from '@/utils/pl-slip-red-seal'
|
||||
import { getPlSlipPdfCanvasScale } from '@/utils/pl-slip-pdf-render'
|
||||
|
||||
@@ -127,22 +128,32 @@ async function buildSlipRenderContext(plan: Plan): Promise<SubpackSlipRenderCont
|
||||
}
|
||||
}
|
||||
|
||||
async function open(planId: string) {
|
||||
currentPlanId.value = planId
|
||||
async function open(planIdOrIds: string | string[]) {
|
||||
const ids = normalizePlanIds(planIdOrIds)
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('无法获取计划ID')
|
||||
return
|
||||
}
|
||||
currentPlanId.value = ids[0]
|
||||
isPreviewMode.value = false
|
||||
showRedSeal.value = true
|
||||
try {
|
||||
ElMessage.info({ message: '正在生成分装单...', duration: 800 })
|
||||
const res = await planApi.get(planId)
|
||||
const plan = (res.data ?? res) as Plan
|
||||
ElMessage.info({ message: ids.length > 1 ? '正在生成合打分装单...' : '正在生成分装单...', duration: 800 })
|
||||
const plans = await Promise.all(
|
||||
ids.map(async (id) => {
|
||||
const res = await planApi.get(id)
|
||||
return (res.data ?? res) as Plan
|
||||
})
|
||||
)
|
||||
const plan = ids.length === 1 ? plans[0] : buildBatchPrintPlanView(plans)
|
||||
currentPlan.value = plan
|
||||
|
||||
const slipNoRes = await planApi.ensureSubpackSlipNo(planId)
|
||||
const slipNoRes = await planApi.ensureSubpackSlipNo(ids[0])
|
||||
currentSubpackSlipNo.value = String((slipNoRes as { data?: string }).data ?? slipNoRes ?? '').trim()
|
||||
|
||||
let htmlContent = ''
|
||||
try {
|
||||
const templateRes = await planApi.getSubpackSlipTemplate(planId)
|
||||
const templateRes = await planApi.getSubpackSlipTemplate(ids[0])
|
||||
const saved = (templateRes.data ?? templateRes) as string
|
||||
if (saved?.trim()) {
|
||||
htmlContent = saved
|
||||
|
||||
Reference in new issue
Block a user