|
|
@ -1,15 +1,9 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<div class="app-container">
|
|
|
|
<!-- 打印预览弹出层 -->
|
|
|
|
|
|
|
|
<el-dialog title="" :visible.sync="printDialogVisible" width="990px">
|
|
|
|
<el-dialog title="" :visible.sync="printDialogVisible" width="990px">
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<el-input v-model="idCardsNum" placeholder="请输入板次数量" style="width:100px"/>
|
|
|
|
|
|
|
|
<el-button type="primary" icon="el-icon-check" circle @click="showPrint()"/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="printFrom" class="my-print-box">
|
|
|
|
<div id="printFrom" class="my-print-box">
|
|
|
|
<div v-for="(item, index) in printData.idCardList" :key="index">
|
|
|
|
<div v-for="(item, index) in printData.idCardList" :key="index">
|
|
|
|
<el-form>
|
|
|
|
<el-form class="print-card">
|
|
|
|
<!-- 表头-工单信息 -->
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="7">
|
|
|
|
<el-col :span="7">
|
|
|
|
<img src="@/assets/logo/lanjv.png" class="report-logo" />
|
|
|
|
<img src="@/assets/logo/lanjv.png" class="report-logo" />
|
|
|
@ -17,25 +11,24 @@
|
|
|
|
<el-col :span="10" class="center-text">
|
|
|
|
<el-col :span="10" class="center-text">
|
|
|
|
<span>产品标识卡</span>
|
|
|
|
<span>产品标识卡</span>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row class="my-print-head">
|
|
|
|
|
|
|
|
<el-col><el-divider/></el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<div class="custom-divider"></div>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row class="my-print-foot">
|
|
|
|
<el-row class="my-print-foot">
|
|
|
|
<el-col :offset="1" :span="10">
|
|
|
|
<el-col :offset="1" :span="10">
|
|
|
|
<div>产品名称:{{ printData.factory }}</div><br/>
|
|
|
|
<div>产品名称: {{ printData.factory }}</div><br />
|
|
|
|
<div>批次号:{{ printData.factory }}</div><br/>
|
|
|
|
<div>批次号: {{ printData.factory }}</div><br />
|
|
|
|
<div>生产日期:{{ printData.factory }}</div><br/>
|
|
|
|
<div>生产日期: {{ printData.factory }}</div><br />
|
|
|
|
<div>板次:{{ printData.factory }}</div><br/>
|
|
|
|
<div>板次: {{ printData.factory }}</div><br />
|
|
|
|
<div>数量:{{ printData.factory }}</div>
|
|
|
|
<div>数量: {{ printData.factory }}</div>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col :offset="1" :span="10">
|
|
|
|
<el-col :offset="1" :span="10">
|
|
|
|
<canvas ref="qrCanvas"></canvas>
|
|
|
|
<canvas :id="'qrcode-' + index" class="qrcode"></canvas>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
<div style="clear: both; margin-bottom: 30px;"></div>
|
|
|
|
|
|
|
|
<div v-if="(index + 1) % 2 === 0" class="print-page"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
@ -45,6 +38,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
getIdCardList,
|
|
|
|
getIdCardList,
|
|
|
@ -79,7 +73,8 @@ export default {
|
|
|
|
ignore: ["no-print"],
|
|
|
|
ignore: ["no-print"],
|
|
|
|
workCenter: "暂无数据",
|
|
|
|
workCenter: "暂无数据",
|
|
|
|
factory: null,
|
|
|
|
factory: null,
|
|
|
|
idCardList: []
|
|
|
|
idCardList: [],
|
|
|
|
|
|
|
|
//gridStyle:'border: 1px solid lightgray; margin-bottom: -1px;'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
workorderCode: '',
|
|
|
|
workorderCode: '',
|
|
|
|
//工单重新渲染表格
|
|
|
|
//工单重新渲染表格
|
|
|
@ -92,6 +87,10 @@ export default {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
//this.showPrint();
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
init(workorderCode){
|
|
|
|
init(workorderCode){
|
|
|
@ -101,41 +100,33 @@ export default {
|
|
|
|
// 打印预览-浏览器打印
|
|
|
|
// 打印预览-浏览器打印
|
|
|
|
handlePrint(params) {
|
|
|
|
handlePrint(params) {
|
|
|
|
printJS({
|
|
|
|
printJS({
|
|
|
|
printable: params.printable, // 'printFrom', // 标签元素id
|
|
|
|
printable: params.printable,
|
|
|
|
type: params.type || "html",
|
|
|
|
type: params.type || 'html',
|
|
|
|
maxWidth: 1500, // 最大宽度
|
|
|
|
maxWidth: 1500,
|
|
|
|
font_size: "", // 设置字体大小
|
|
|
|
font_size: "", // 设置字体大小
|
|
|
|
header: params.header, // '表单',
|
|
|
|
header: params.header, // '表单',
|
|
|
|
targetStyles: ["*"],
|
|
|
|
targetStyles: ['*'],
|
|
|
|
style: "@page {margin:0 10mm};", // 可选-打印时去掉眉页眉尾
|
|
|
|
style: `
|
|
|
|
ignoreElements: params.ignore || [], // ['no-print']
|
|
|
|
@page { margin: 30mm 10mm; }
|
|
|
|
properties: params.properties || null,
|
|
|
|
.print-page { page-break-after: always; }
|
|
|
|
|
|
|
|
`,
|
|
|
|
|
|
|
|
ignoreElements: params.ignore || [],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 打印预览-点击打印预览按钮
|
|
|
|
// 打印预览-点击打印预览按钮
|
|
|
|
showPrint() {
|
|
|
|
async showPrint() {
|
|
|
|
// 清楚缓存
|
|
|
|
console.log('执行了打印预览');
|
|
|
|
//this.printData.workCenter = "暂无数据";
|
|
|
|
let response = await getIdCardList(this.workorderCode,this.idCardNum);
|
|
|
|
getIdCardList(this.workorderCode,this.idCardNum).then((response) => {
|
|
|
|
|
|
|
|
debugger
|
|
|
|
|
|
|
|
//this.reset();
|
|
|
|
|
|
|
|
this.printData.idCardList = response.idCards;
|
|
|
|
this.printData.idCardList = response.idCards;
|
|
|
|
// 使用 Vue 的 nextTick 来确保 DOM 已经更新
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
|
|
this.printData.idCardList.forEach((item, index) => {
|
|
|
|
//for(var i=0;0<response.idCards.length;i++){
|
|
|
|
const canvas = document.getElementById('qrcode-' + index);
|
|
|
|
let qrCanvasIndex = "qrCanvas"+0;
|
|
|
|
QRCode.toCanvas(canvas, item, { width: 350,margin:1 }, function (error) {
|
|
|
|
const canvas = this.$refs.qrCanvas;
|
|
|
|
|
|
|
|
const options = {
|
|
|
|
|
|
|
|
width: 350, // 设定二维码的宽度
|
|
|
|
|
|
|
|
height: 350 // 设定二维码的高度
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
QRCode.toCanvas(canvas,response.idCards[0], options, error => {
|
|
|
|
|
|
|
|
if (error) console.error(error);
|
|
|
|
if (error) console.error(error);
|
|
|
|
});
|
|
|
|
console.log('success!');
|
|
|
|
//}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -150,6 +141,7 @@ export default {
|
|
|
|
text-align: left;
|
|
|
|
text-align: left;
|
|
|
|
font-size: 63px;
|
|
|
|
font-size: 63px;
|
|
|
|
font-weight: 800;
|
|
|
|
font-weight: 800;
|
|
|
|
|
|
|
|
color: black;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.report-logo {
|
|
|
|
.report-logo {
|
|
|
@ -178,4 +170,25 @@ export default {
|
|
|
|
.my-print-box{
|
|
|
|
.my-print-box{
|
|
|
|
width:100%
|
|
|
|
width:100%
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-divider {
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
height: 1px;
|
|
|
|
|
|
|
|
background-color: #a5a4a4 !important;
|
|
|
|
|
|
|
|
margin: 20px 0 !important;
|
|
|
|
|
|
|
|
-webkit-print-color-adjust: exact;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.print-page {
|
|
|
|
|
|
|
|
page-break-after: always;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@media print {
|
|
|
|
|
|
|
|
.custom-divider {
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
height: 1px;
|
|
|
|
|
|
|
|
background-color: #a5a4a4 !important;
|
|
|
|
|
|
|
|
margin: 20px 0 !important;
|
|
|
|
|
|
|
|
-webkit-print-color-adjust: exact;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|