feat(web-admin): enable multi-select batch slip print on plan list toolbar

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-07-27 21:16:19 +08:00
1 parent 25978401e1
commit 246da286e2
1 file changed
+23 -7
+23 -7
View File
@@ -104,10 +104,10 @@
</el-button>
<el-dropdown
trigger="click"
:disabled="!selectedPlan"
:disabled="selectedRows.length < 1"
@command="handleToolbarPrintSlip"
>
<el-button class="btn-ghost" :disabled="!selectedPlan">
<el-button class="btn-ghost" :disabled="selectedRows.length < 1">
<el-icon><Printer /></el-icon>打印单据
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
@@ -115,19 +115,19 @@
<el-dropdown-menu>
<el-dropdown-item
command="inbound"
:disabled="!canPrintSlipCommand(selectedPlan?.planType, 'inbound')"
:disabled="!canBatchPrintSlip(selectedRows, 'inbound').ok"
>
入库单
</el-dropdown-item>
<el-dropdown-item
command="delivery"
:disabled="!canPrintSlipCommand(selectedPlan?.planType, 'delivery')"
:disabled="!canBatchPrintSlip(selectedRows, 'delivery').ok"
>
送(提)货单
</el-dropdown-item>
<el-dropdown-item
command="subpack"
:disabled="!canPrintSlipCommand(selectedPlan?.planType, 'subpack')"
:disabled="!canBatchPrintSlip(selectedRows, 'subpack').ok"
>
分装单
</el-dropdown-item>
@@ -436,6 +436,7 @@ import ListToolbarDateShortcuts from '@/components/core/list-toolbar-date-shortc
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
import { useListDateShortcut } from '@/composables/useListDateShortcut'
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { canBatchPrintSlip } from '@/utils/pl-batch-print'
import {
canPrintSlipCommand,
formatPlVehiclePlateDisplay,
@@ -767,8 +768,23 @@ function handleViewPrintSlipCommand(command: string) {
}
function handleToolbarPrintSlip(command: string) {
if (selectedRows.value.length !== 1) return
handlePrintSlip(command as PlPrintSlipCommand, selectedRows.value[0])
const cmd = command as PlPrintSlipCommand
const plans = selectedRows.value
const check = canBatchPrintSlip(plans, cmd)
if (!check.ok) {
ElMessage.warning(check.reason || '无法打印')
return
}
const ids = plans.map((p) => p.id)
if (cmd === 'inbound') {
inboundSlipPrintRef.value?.open(ids)
return
}
if (cmd === 'delivery') {
deliverySlipPrintRef.value?.open(ids)
return
}
subpackSlipPrintRef.value?.open(ids)
}
function handleToolbarEdit() {