feat(组件): 优化规格输入组件和标签渲染功能
- 将ProductSelect和RawMaterialSelect中的规格输入替换为MemoInput组件 - 调整ProductionTagPreview中的料卷号显示方式和二维码大小 - 优化LabelRender中的打印渲染参数,降低缩放比例并移除冗余样式
This commit is contained in:
@@ -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