fix(wms): 修复标签打印容器选择器和PDF导出空白问题
重构标签容器选择器从ID改为class选择器,解决打印功能失效问题 优化PDF导出逻辑,动态设置页面尺寸并裁剪空白区域,彻底解决多页导出时的空白页问题 统一重量和长度输入框为el-input-number组件,提升表单交互体验
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="material-label-container" :style="{ '--print-scale': printScale }">
|
||||
<div class="label-container" :style="{ '--print-scale': printScale }">
|
||||
<table class="material-label-table">
|
||||
<!-- 调整第一行结构,使label和value各占2列(等宽) -->
|
||||
<tr>
|
||||
@@ -144,7 +144,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.material-label-container {
|
||||
.label-container {
|
||||
width: 25em;
|
||||
height: 15em;
|
||||
padding: 0px;
|
||||
@@ -212,11 +212,11 @@ export default {
|
||||
}
|
||||
|
||||
/* 隐藏所有其他内容,只显示标签 */
|
||||
body > *:not(.material-label-container) {
|
||||
body > *:not(.label-container) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.material-label-container {
|
||||
.label-container {
|
||||
/* 使用固定纸张尺寸 */
|
||||
width: 180mm !important;
|
||||
height: 100mm !important;
|
||||
|
||||
@@ -76,7 +76,7 @@ export default {
|
||||
// -------- 重构后的打印方法(核心优化) --------
|
||||
async printLabel() {
|
||||
// 1. 获取标签容器DOM
|
||||
const labelContainer = document.getElementById('label-preview-container');
|
||||
const labelContainer = document.querySelector('.label-container');
|
||||
if (!labelContainer) {
|
||||
Message.error('未找到标签容器,无法打印');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user