feat(pl): 按单据类型限制打印项并调整送(提)货单布局

按入库/出库/直销限制可打印单据;送(提)货单信息区改为一行布局,物料表增加单据编号列,并修正条款列宽与类型多选不换行。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-07-26 21:05:11 +08:00
1 parent 1e2e8ab0fc
commit 70bdd820ce
4 files changed
+367 -191

No files matched your search

+90 -72
View File
@@ -88,64 +88,70 @@
<el-icon><Plus /></el-icon>新增计划
</el-button>
<el-button
v-if="selectedPlan && canEditPlan(selectedPlan)"
class="btn-ghost"
:disabled="selectedRows.length !== 1"
:disabled="!selectedPlan || !canEditPlan(selectedPlan)"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>编辑
</el-button>
<el-button
v-if="selectedPlan && canArrangeTransport(selectedPlan)"
class="btn-ghost"
:disabled="selectedRows.length !== 1"
:disabled="!selectedPlan || !canArrangeTransport(selectedPlan)"
@click="handleToolbarArrange"
>
<el-icon><Van /></el-icon>{{ arrangeTransportLabel(selectedPlan) }}
<el-icon><Van /></el-icon>
{{ selectedPlan ? arrangeTransportLabel(selectedPlan) : '安排运输' }}
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarPrintInboundSlip"
<el-dropdown
trigger="click"
:disabled="!selectedPlan"
@command="handleToolbarPrintSlip"
>
<el-icon><Printer /></el-icon>入库单
</el-button>
<el-button class="btn-ghost" :disabled="!selectedPlan">
<el-icon><Printer /></el-icon>打印单据
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
command="inbound"
:disabled="!canPrintSlipCommand(selectedPlan?.planType, 'inbound')"
>
入库单
</el-dropdown-item>
<el-dropdown-item
command="delivery"
:disabled="!canPrintSlipCommand(selectedPlan?.planType, 'delivery')"
>
送(提)货单
</el-dropdown-item>
<el-dropdown-item
command="subpack"
:disabled="!canPrintSlipCommand(selectedPlan?.planType, 'subpack')"
>
分装单
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarPrintDeliverySlip"
>
<el-icon><Printer /></el-icon>送(提)货单
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarPrintSubpackSlip"
>
<el-icon><Printer /></el-icon>分装单
</el-button>
<el-button
v-if="selectedPlan && canVoidPlan(selectedPlan)"
class="btn-ghost"
type="danger"
:disabled="selectedRows.length !== 1"
:disabled="!selectedPlan || !canVoidPlan(selectedPlan)"
:loading="voidLoading"
@click="handleToolbarVoid"
>
<el-icon><CircleClose /></el-icon>作废
</el-button>
<el-button
v-if="selectedPlan && canDeletePlan(selectedPlan)"
class="btn-ghost"
type="danger"
:disabled="
selectedRows.length !== 1 || !canDeleteByCreator(selectedPlan)
"
:title="
selectedRows.length === 1
? getDeletePlanDisabledTitle(selectedPlan)
: ''
!selectedPlan ||
!canDeletePlan(selectedPlan) ||
!canDeleteByCreator(selectedPlan)
"
:title="selectedPlan ? getDeletePlanDisabledTitle(selectedPlan) : ''"
:loading="deleteLoading"
@click="handleToolbarDelete"
>
@@ -338,24 +344,34 @@
>
<el-icon><Van /></el-icon>{{ arrangeTransportLabel(viewingPlan) }}
</el-button>
<el-button
class="btn-ghost"
@click="handlePrintInboundSlip(viewingPlan)"
>
<el-icon><Printer /></el-icon>入库单
</el-button>
<el-button
class="btn-ghost"
@click="handlePrintDeliverySlip(viewingPlan)"
>
<el-icon><Printer /></el-icon>送(提)货单
</el-button>
<el-button
class="btn-ghost"
@click="handlePrintSubpackSlip(viewingPlan)"
>
<el-icon><Printer /></el-icon>分装单
</el-button>
<el-dropdown trigger="click" @command="handleViewPrintSlipCommand">
<el-button class="btn-ghost">
<el-icon><Printer /></el-icon>打印单据
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
command="inbound"
:disabled="!canPrintSlipCommand(viewingPlan?.planType, 'inbound')"
>
入库单
</el-dropdown-item>
<el-dropdown-item
command="delivery"
:disabled="!canPrintSlipCommand(viewingPlan?.planType, 'delivery')"
>
送(提)货单
</el-dropdown-item>
<el-dropdown-item
command="subpack"
:disabled="!canPrintSlipCommand(viewingPlan?.planType, 'subpack')"
>
分装单
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button
v-if="canVoidPlan(viewingPlan)"
class="btn-ghost"
@@ -393,6 +409,7 @@
<script setup lang="ts">
import {
ArrowDown,
CircleClose,
Delete,
Edit,
@@ -420,10 +437,12 @@ import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
import { useListDateShortcut } from '@/composables/useListDateShortcut'
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import {
canPrintSlipCommand,
formatPlVehiclePlateDisplay,
normalizePlPersonnelSummaryDisplay,
plPlanTypeTabToFilter,
type PlPlanTypeTab
type PlPlanTypeTab,
type PlPrintSlipCommand
} from '@/utils/pl-display'
import { syncViewRowFromFlatList } from '@/utils/view-dialog-refresh'
const route = useRoute()
@@ -726,31 +745,30 @@ function handleArrange(row: Plan) {
arrangeDialogVisible.value = true
}
function handlePrintInboundSlip(row: Plan) {
inboundSlipPrintRef.value?.open(row.id)
}
function handlePrintDeliverySlip(row: Plan) {
deliverySlipPrintRef.value?.open(row.id)
}
function handlePrintSubpackSlip(row: Plan) {
function handlePrintSlip(command: PlPrintSlipCommand, row: Plan) {
if (!canPrintSlipCommand(row.planType, command)) {
ElMessage.warning('当前单据类型不支持打印该单据')
return
}
if (command === 'inbound') {
inboundSlipPrintRef.value?.open(row.id)
return
}
if (command === 'delivery') {
deliverySlipPrintRef.value?.open(row.id)
return
}
subpackSlipPrintRef.value?.open(row.id)
}
function handleToolbarPrintInboundSlip() {
if (selectedRows.value.length !== 1) return
handlePrintInboundSlip(selectedRows.value[0])
function handleViewPrintSlipCommand(command: string) {
if (!viewingPlan.value) return
handlePrintSlip(command as PlPrintSlipCommand, viewingPlan.value)
}
function handleToolbarPrintDeliverySlip() {
function handleToolbarPrintSlip(command: string) {
if (selectedRows.value.length !== 1) return
handlePrintDeliverySlip(selectedRows.value[0])
}
function handleToolbarPrintSubpackSlip() {
if (selectedRows.value.length !== 1) return
handlePrintSubpackSlip(selectedRows.value[0])
handlePrintSlip(command as PlPrintSlipCommand, selectedRows.value[0])
}
function handleToolbarEdit() {