feat: 采购到货单、库区标签打印、EBOM表格优化

- 采购到货单: 新建 arrivalnotice API,重构 Checkin 页面对齐到货通知功能
- 库区标签打印: 新增 LocationLabelPrint 组件,支持单个/批量打印(4列排版)
- EBOM: 表格表头和内容不换行,过长截断显示

Made-with: Cursor
This commit is contained in:
panchengyong
2026-03-14 14:58:17 +08:00
parent 7aee39d98e
commit dcb77279a0
6 changed files with 1041 additions and 67 deletions

View File

@@ -0,0 +1,171 @@
<template>
<el-dialog
:visible="visible"
@close="handleClose"
fullscreen
destroy-on-close
:show-close="false"
class="location-label-print-dialog"
append-to-body
>
<template slot="title">
<div class="label-print-actions">
<el-button type="primary" size="small" @click="doPrint">打印</el-button>
<el-button size="small" @click="handleClose">关闭</el-button>
</div>
</template>
<div class="label-print-content" ref="printContentRef">
<div v-if="locations.length === 0" class="label-empty">暂无库区数据</div>
<div v-else class="label-grid">
<div
v-for="(loc, idx) in locations"
:key="loc.locationId || idx"
class="label-card"
>
<div class="label-qr">
<QrCode :value="loc.locationCode || String(loc.locationId || '')" :size="72" />
</div>
<div class="label-name">{{ loc.locationName || '-' }}</div>
<div class="label-code">{{ loc.locationCode || '-' }}</div>
<div class="label-info">
<span v-if="loc.area != null">面积{{ loc.area }} </span>
</div>
</div>
</div>
</div>
</el-dialog>
</template>
<script>
import QrCode from './QrCode.vue'
export default {
name: 'LocationLabelPrint',
components: { QrCode },
props: {
visible: {
type: Boolean,
default: false
},
locations: {
type: Array,
default: () => []
}
},
methods: {
doPrint() {
window.print()
},
handleClose() {
this.$emit('update:visible', false)
}
}
}
</script>
<style>
@media print {
body > *:not(.el-overlay) {
display: none !important;
}
.el-overlay {
position: static !important;
overflow: visible !important;
background: none !important;
}
.el-dialog__wrapper {
position: static !important;
overflow: visible !important;
}
.el-dialog {
box-shadow: none !important;
border: none !important;
margin: 0 !important;
width: 100% !important;
max-width: 100% !important;
}
.el-dialog__header,
.el-dialog__footer,
.label-print-actions {
display: none !important;
}
.el-dialog__body {
padding: 0 !important;
}
.label-print-content {
padding: 8mm !important;
}
.label-card {
page-break-inside: avoid;
}
}
</style>
<style scoped>
.label-print-actions {
display: flex;
gap: 8px;
justify-content: flex-end;
}
.label-print-content {
padding: 24px;
background: #fff;
font-family: 'Microsoft YaHei', 'SimSun', sans-serif;
color: #333;
}
.label-empty {
text-align: center;
padding: 48px;
color: #909399;
font-size: 14px;
}
.label-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
max-width: 1200px;
margin: 0 auto;
}
.label-card {
border: 1px solid #dcdfe6;
border-radius: 6px;
padding: 12px;
text-align: center;
min-height: 120px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
}
.label-qr {
margin-bottom: 8px;
}
.label-name {
font-size: 16px;
font-weight: 600;
color: #303133;
margin-bottom: 4px;
}
.label-code {
font-size: 12px;
color: #606266;
margin-bottom: 8px;
}
.label-info {
font-size: 11px;
color: #909399;
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
}
</style>

View File

@@ -48,6 +48,17 @@
v-hasPermi="['mes:wm:location:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-printer"
size="mini"
:disabled="multiple"
@click="handleBatchPrint"
v-hasPermi="['mes:wm:location:print']"
>批量打印</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -107,6 +118,13 @@
@click="handleHiPrint(scope.row)"
v-hasPermi="['mes:wm:location:print']"
>标签打印</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-document"
@click="handleSimplePrint(scope.row)"
v-hasPermi="['mes:wm:location:print']"
>简易打印</el-button>
</template>
</el-table-column>
</el-table>
@@ -240,6 +258,12 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 简易标签打印不依赖MinIO -->
<LocationLabelPrint
:visible.sync="printDialogVisible"
:locations="printLocations"
/>
</div>
</template>
@@ -247,6 +271,7 @@
import { listLocation, getLocation, delLocation, addLocation, updateLocation, changeFrozenState, setProductMixing, setBatchMixing } from "@/api/mes/wm/location";
import {genCode} from "@/api/system/autocode/rule"
import BarcodeImg from "@/components/barcodeImg/index.vue"
import LocationLabelPrint from "@/components/print/LocationLabelPrint.vue"
import { getBarcodeUrl } from '@/api/mes/wm/barcode';
import {print} from "../../../../utils/print"
import {getByTemplateType} from "@/api/print/template";
@@ -255,7 +280,7 @@ export default {
name: "Location",
dicts: ['sys_yes_no'],
mixins: [hiprintMixin],
components: { BarcodeImg } ,
components: { BarcodeImg, LocationLabelPrint },
data() {
return {
//自动生成编码
@@ -266,6 +291,7 @@ export default {
loading: true,
// 选中数组
ids: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
@@ -280,6 +306,9 @@ export default {
title: "",
// 是否显示弹出层
open: false,
// 简易打印弹窗
printDialogVisible: false,
printLocations: [],
// 查询参数
queryParams: {
pageNum: 1,
@@ -314,6 +343,16 @@ export default {
this.getList();
},
methods: {
// 简易打印不依赖MinIO纯前端二维码+window.print
handleSimplePrint(row) {
this.printLocations = [row]
this.printDialogVisible = true
},
// 批量打印
handleBatchPrint() {
this.printLocations = this.selectedRows || this.locationList.filter(l => this.ids.includes(l.locationId))
this.printDialogVisible = true
},
// 使用HiPrint打印
async handleHiPrint(row) {
let printData = row
@@ -393,6 +432,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.locationId)
this.selectedRows = selection
this.single = selection.length!==1
this.multiple = !selection.length
},