feat(组件): 优化规格输入组件和标签渲染功能
- 将ProductSelect和RawMaterialSelect中的规格输入替换为MemoInput组件 - 调整ProductionTagPreview中的料卷号显示方式和二维码大小 - 优化LabelRender中的打印渲染参数,降低缩放比例并移除冗余样式
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格">
|
||||
<el-input v-model="queryParams.specification" placeholder="请输入规格" clearable
|
||||
<MemoInput storageKey="coilSpec" v-model="queryParams.specification" placeholder="请输入规格" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="材质">
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格">
|
||||
<el-input v-model="queryParams.specification" placeholder="请输入规格" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
<MemoInput storageKey="coilSpec" v-model="queryParams.specification" placeholder="请输入规格" @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="材质">
|
||||
<MemoInput storageKey="material" v-model="queryParams.material" placeholder="请输入材质" @keyup.enter.native="handleQuery" />
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<tr>
|
||||
<td class="label-cell" colspan="1">料卷号</td>
|
||||
<td class="value-cell" colspan="2">
|
||||
<input type="text" class="nob" style="line-height: 95px;" :value="content.enterCoilNo || ''" />
|
||||
<div type="text" class="nob" style="display: flex; align-items: center; text-align: center; justify-content: center;">{{ content.enterCoilNo || '' }}</div>
|
||||
</td>
|
||||
<td class="value-cell" colspan="1">
|
||||
<QRCode :content="content.qrcodeRecordId || ' '" :size="5" />
|
||||
<QRCode :content="content.qrcodeRecordId || ' '" :size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -90,13 +90,13 @@ export default {
|
||||
|
||||
// 3. 用html2canvas生成高清Canvas(解决文字模糊+二维码丢失)
|
||||
const canvas = await html2canvas(labelContainer, {
|
||||
scale: 3, // 3倍高清渲染(核心)
|
||||
scale: 1.5, // 3倍高清渲染(核心)
|
||||
backgroundColor: '#ffffff', // 强制白色背景,避免打印时背景透明
|
||||
useCORS: true, // 支持跨域图片
|
||||
allowTaint: true, // 允许渲染canvas(二维码)
|
||||
taintTest: false, // 关闭canvas污染检测
|
||||
windowWidth: labelContainer.offsetWidth * 3, // 适配缩放后的宽度
|
||||
windowHeight: labelContainer.offsetHeight * 3, // 适配缩放后的高度
|
||||
windowWidth: labelContainer.offsetWidth * 1.5, // 适配缩放后的宽度
|
||||
windowHeight: labelContainer.offsetHeight * 1.5, // 适配缩放后的高度
|
||||
logging: false,
|
||||
});
|
||||
|
||||
@@ -104,17 +104,6 @@ export default {
|
||||
const printContainerId = 'temp-print-container-' + new Date().getTime();
|
||||
const tempPrintContainer = document.createElement('div');
|
||||
tempPrintContainer.id = printContainerId;
|
||||
// 样式:让打印容器居中、适配纸张
|
||||
tempPrintContainer.style.cssText = `
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
`;
|
||||
// 将高清Canvas插入临时容器
|
||||
tempPrintContainer.appendChild(canvas);
|
||||
// document.body.appendChild(tempPrintContainer);
|
||||
@@ -143,7 +132,6 @@ export default {
|
||||
body * { visibility: hidden; }
|
||||
#${printContainerId}, #${printContainerId} * { visibility: visible; }
|
||||
#${printContainerId} { position: absolute; top: 0; left: 0; }
|
||||
@page { margin: 10mm; } /* 打印纸张边距 */
|
||||
}
|
||||
`,
|
||||
printContainer: true,
|
||||
|
||||
Reference in New Issue
Block a user