Commit 32cf111d authored by 沈翠玲's avatar 沈翠玲

序列号打印

parent ae482473
...@@ -70,7 +70,8 @@ ...@@ -70,7 +70,8 @@
"vue-print-nb": "^1.7.5", "vue-print-nb": "^1.7.5",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vuedraggable": "2.24.3", "vuedraggable": "2.24.3",
"vuex": "3.6.0" "vuex": "3.6.0",
"bwip-js": "4.5.1"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "4.4.6", "@vue/cli-plugin-babel": "4.4.6",
......
...@@ -313,7 +313,7 @@ ...@@ -313,7 +313,7 @@
<div style="overflow: hidden;width: 0;height: 0;"> <div style="overflow: hidden;width: 0;height: 0;">
<div id="tesla1Template"> <div id="tesla1Template">
<div v-for="(item, index) in printData" :key="'tesla1' + index"> <div v-for="(item, index) in printData" :key="'tesla1' + index">
<tesla1 :templateData="item"></tesla1> <tesla1 :templateData="item" :index="index"></tesla1>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<div class="cdbh">Part Name:</div> <div class="cdbh">Part Name:</div>
<div class="cdbh1">{{templateData.specification}}</div> <div class="cdbh1">{{templateData.specification}}</div>
</div> </div>
<div class="titles" style=""> <div class="titles">
<div id="qrCode" ref="qrCodeDiv"></div> <canvas :id="'barcode' + index" style="width: 100%;height: 100%;"></canvas>
</div> </div>
<div style="page-break-after:always"></div> <div style="page-break-after:always"></div>
</div> </div>
...@@ -17,31 +17,42 @@ ...@@ -17,31 +17,42 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
import VueBarcode from 'vue-barcode' import * as bwipjs from 'bwip-js'
import QRCode from "qrcodejs2";
export default { export default {
components: { VueBarcode }, props: ['templateData', 'index'],
props: ['templateData'],
dicts: ['pro_requisition_type'], dicts: ['pro_requisition_type'],
data() { data() {
return { return {
date: dayjs().format('YYYY-MM-DD'), date: dayjs().format('YYYY-MM-DD'),
// templateData: {itemCode: '', qrcode: '', specification: ''},
mytable: { mytable: {
} }
} }
}, },
mounted() { mounted() {
if (this.$refs.qrCodeDiv) { // if (this.$refs.qrCodeDiv) {
this.$refs.qrCodeDiv.innerHTML = ''; // this.$refs.qrCodeDiv.innerHTML = '';
// }
// new QRCode(this.$refs.qrCodeDiv, {
// text: "1234", // 需要转换为二维码的内容
// width: 37, //宽度
// height: 37, //高度
// colorDark: '#000000', //二维码方块颜色
// colorLight: '#ffffff', //背景颜色
// correctLevel: QRCode.CorrectLevel.Q, //容错率:L M Q H 依次递减
// });
console.log('this.templateData.qrcode', this.templateData.qrcode)
let options = {
bcid: 'datamatrix', // Barcode type
text: this.templateData.qrcode, // Text to encode
scale: 3, // 3x scaling factor
height: 4,
width: 4, // Bar height, in millimeters
includetext: false, // Show human-readable text
textxalign: 'center', // Always good to set this
} }
new QRCode(this.$refs.qrCodeDiv, { bwipjs.toCanvas('barcode' + this.index, options);
text: "1234", // 需要转换为二维码的内容
width: 37, //宽度
height: 37, //高度
colorDark: '#000000', //二维码方块颜色
colorLight: '#ffffff', //背景颜色
correctLevel: QRCode.CorrectLevel.Q, //容错率:L M Q H 依次递减
});
}, },
computed: { computed: {
} }
...@@ -53,6 +64,7 @@ export default { ...@@ -53,6 +64,7 @@ export default {
font-family: "Arial narrow2"; font-family: "Arial narrow2";
margin: 0; margin: 0;
position: relative; position: relative;
display: flex;
width: 35.6mm; width: 35.6mm;
height: 12.7mm; height: 12.7mm;
padding: 2px 0 0 4px; padding: 2px 0 0 4px;
...@@ -71,14 +83,17 @@ export default { ...@@ -71,14 +83,17 @@ export default {
} }
.cdbh{ .cdbh{
height: 8px; height: 6px;
} }
.titles{ .titles{
float: left;
padding-top: 2px; padding-top: 2px;
width: 37px;
height: 37px;
overflow: hidden;
} }
.titles1{ .titles1{
float: left; font-size: 6px;
line-height: 6px;
width: 23mm; width: 23mm;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment