feat: 仓库简易打印、工作站标签打印、生产订单打印工序修复
- 仓库管理(mom-frontend-vue2): 新增简易标签打印,不依赖MinIO,使用前端qrcode+window.print - 工作站(erp-frontend-vue): 新增WorkstationLabelPrint组件,支持批量打印工作站标签 - 生产订单: handlePrint改用getProcessTasksByWorkorder,从工艺路线获取工序数据,解决无pro_task时打印无数据问题 Made-with: Cursor
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
"js-cookie": "3.0.1",
|
||||
"jsencrypt": "3.0.0-rc.1",
|
||||
"nprogress": "0.2.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"quill": "1.3.7",
|
||||
"screenfull": "5.0.2",
|
||||
"sortablejs": "1.10.2",
|
||||
|
||||
51
mom-frontend-vue2/src/components/print/QrCode.vue
Normal file
51
mom-frontend-vue2/src/components/print/QrCode.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<img v-if="dataUrl" :src="dataUrl" :width="size" :height="size" alt="QR Code" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QRCode from 'qrcode'
|
||||
|
||||
export default {
|
||||
name: 'QrCode',
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
default: 80
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataUrl: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: 'generate',
|
||||
size: 'generate'
|
||||
},
|
||||
mounted() {
|
||||
this.generate()
|
||||
},
|
||||
methods: {
|
||||
async generate() {
|
||||
if (!this.value) {
|
||||
this.dataUrl = ''
|
||||
return
|
||||
}
|
||||
try {
|
||||
this.dataUrl = await QRCode.toDataURL(this.value, {
|
||||
width: this.size * 2,
|
||||
margin: 1,
|
||||
errorCorrectionLevel: 'M'
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('QR code generation failed:', err)
|
||||
this.dataUrl = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
173
mom-frontend-vue2/src/components/print/WarehouseLabelPrint.vue
Normal file
173
mom-frontend-vue2/src/components/print/WarehouseLabelPrint.vue
Normal file
@@ -0,0 +1,173 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible="visible"
|
||||
@close="handleClose"
|
||||
fullscreen
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
class="warehouse-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="warehouses.length === 0" class="label-empty">暂无仓库数据</div>
|
||||
<div v-else class="label-grid">
|
||||
<div
|
||||
v-for="(wh, idx) in warehouses"
|
||||
:key="wh.warehouseId || idx"
|
||||
class="label-card"
|
||||
>
|
||||
<div class="label-qr">
|
||||
<QrCode :value="wh.warehouseCode || String(wh.warehouseId || '')" :size="72" />
|
||||
</div>
|
||||
<div class="label-name">{{ wh.warehouseName || '-' }}</div>
|
||||
<div class="label-code">{{ wh.warehouseCode || '-' }}</div>
|
||||
<div class="label-info">
|
||||
<span v-if="wh.location">位置:{{ wh.location }}</span>
|
||||
<span v-if="wh.area != null">面积:{{ wh.area }} ㎡</span>
|
||||
<span v-if="wh.charge">负责人:{{ wh.charge }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QrCode from './QrCode.vue'
|
||||
|
||||
export default {
|
||||
name: 'WarehouseLabelPrint',
|
||||
components: { QrCode },
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
warehouses: {
|
||||
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(3, 1fr);
|
||||
gap: 16px;
|
||||
max-width: 900px;
|
||||
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>
|
||||
@@ -91,7 +91,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="操作" align="center" width="200px" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" width="260px" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@@ -123,6 +123,13 @@
|
||||
@click="handleHiPrint(scope.row)"
|
||||
v-hasPermi="['mes:wm:warehouse:print']"
|
||||
>标签打印</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-document"
|
||||
@click="handleSimplePrint(scope.row)"
|
||||
v-hasPermi="['mes:wm:warehouse:print']"
|
||||
>简易打印</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -207,6 +214,12 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 简易标签打印(不依赖MinIO) -->
|
||||
<WarehouseLabelPrint
|
||||
:visible.sync="printDialogVisible"
|
||||
:warehouses="printWarehouses"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -215,13 +228,14 @@ import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehous
|
||||
import UserSingleSelect from "@/components/userSelect/single.vue"
|
||||
import {genCode} from "@/api/system/autocode/rule"
|
||||
import BarcodeImg from "@/components/barcodeImg/index.vue"
|
||||
import WarehouseLabelPrint from "@/components/print/WarehouseLabelPrint.vue"
|
||||
import { getBarcodeUrl } from '@/api/mes/wm/barcode';
|
||||
import {print} from "../../../../utils/print"
|
||||
import {getByTemplateType} from "@/api/print/template";
|
||||
import { hiprintMixin } from "../../../../mixins/hiprintMixin";
|
||||
export default {
|
||||
name: "Warehouse",
|
||||
components: { BarcodeImg ,UserSingleSelect} ,
|
||||
components: { BarcodeImg, UserSingleSelect, WarehouseLabelPrint },
|
||||
mixins: [hiprintMixin],
|
||||
data() {
|
||||
return {
|
||||
@@ -246,6 +260,9 @@ export default {
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 简易打印弹窗
|
||||
printDialogVisible: false,
|
||||
printWarehouses: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -297,6 +314,11 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
// 简易打印(不依赖MinIO,纯前端二维码+window.print)
|
||||
handleSimplePrint(row) {
|
||||
this.printWarehouses = [row]
|
||||
this.printDialogVisible = true
|
||||
},
|
||||
// 使用HiPrint打印
|
||||
async handleHiPrint(row) {
|
||||
let printData = row
|
||||
|
||||
Reference in New Issue
Block a user