|
@@ -43,10 +43,15 @@
|
|
|
<div class="ju_ren_four_level">
|
|
<div class="ju_ren_four_level">
|
|
|
<span>{{ enforceStandards ? enforceStandards : ' ' }}</span>
|
|
<span>{{ enforceStandards ? enforceStandards : ' ' }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="qr_code">
|
|
|
|
|
+ <img :src="url" />
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+ import QRCode from 'qrcode';
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -62,7 +67,10 @@
|
|
|
specification: '',
|
|
specification: '',
|
|
|
warrantyPeriod: '',
|
|
warrantyPeriod: '',
|
|
|
warrantyPeriodUnit: '',
|
|
warrantyPeriodUnit: '',
|
|
|
- weightUnit: ''
|
|
|
|
|
|
|
+ weightUnit: '',
|
|
|
|
|
+ url: '',
|
|
|
|
|
+ workOrderId: '',
|
|
|
|
|
+ qrCodeUrl: ''
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -79,7 +87,8 @@
|
|
|
specification,
|
|
specification,
|
|
|
warrantyPeriod,
|
|
warrantyPeriod,
|
|
|
warrantyPeriodUnit,
|
|
warrantyPeriodUnit,
|
|
|
- weightUnit
|
|
|
|
|
|
|
+ weightUnit,
|
|
|
|
|
+ workOrderId
|
|
|
} = this.$route.query;
|
|
} = this.$route.query;
|
|
|
this.productName = productName ? productName : '';
|
|
this.productName = productName ? productName : '';
|
|
|
this.batchNo = batchNo ? batchNo : '';
|
|
this.batchNo = batchNo ? batchNo : '';
|
|
@@ -95,6 +104,7 @@
|
|
|
warrantyPeriod && !warrantyPeriod ? warrantyPeriod : '';
|
|
warrantyPeriod && !warrantyPeriod ? warrantyPeriod : '';
|
|
|
this.warrantyPeriodUnit = warrantyPeriodUnit ? warrantyPeriodUnit : '';
|
|
this.warrantyPeriodUnit = warrantyPeriodUnit ? warrantyPeriodUnit : '';
|
|
|
this.weightUnit = weightUnit ? weightUnit : '';
|
|
this.weightUnit = weightUnit ? weightUnit : '';
|
|
|
|
|
+ this.workOrderId = workOrderId ? workOrderId : '';
|
|
|
|
|
|
|
|
if (this.warrantyPeriodUnit === '1') {
|
|
if (this.warrantyPeriodUnit === '1') {
|
|
|
this.warrantyPeriodUnit = '分钟';
|
|
this.warrantyPeriodUnit = '分钟';
|
|
@@ -110,15 +120,39 @@
|
|
|
this.warrantyPeriodUnit = '';
|
|
this.warrantyPeriodUnit = '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ this.qrCodeUrl =
|
|
|
|
|
+ window.location.origin + `/traceability?id=${this.workOrderId}`;
|
|
|
|
|
+
|
|
|
|
|
+ // console.log(window.location.origin, 'window.location.origin');
|
|
|
|
|
+
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
|
|
+ this.generateQRCodes();
|
|
|
window.print();
|
|
window.print();
|
|
|
});
|
|
});
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ generateQRCodes() {
|
|
|
|
|
+ if (this.workOrderId) {
|
|
|
|
|
+ QRCode.toDataURL(this.qrCodeUrl)
|
|
|
|
|
+ .then((url) => {
|
|
|
|
|
+ // item.qrcode = url;
|
|
|
|
|
+ this.url = url;
|
|
|
|
|
+ console.log(url, 'url');
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ console.error(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
.label-container {
|
|
.label-container {
|
|
|
|
|
+ position: relative;
|
|
|
width: 90mm;
|
|
width: 90mm;
|
|
|
height: 70mm;
|
|
height: 70mm;
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
@@ -186,5 +220,18 @@
|
|
|
margin-left: 42px;
|
|
margin-left: 42px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ .qr_code {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ right: 15px;
|
|
|
|
|
+ width: 60px;
|
|
|
|
|
+ height: 60px;
|
|
|
|
|
+
|
|
|
|
|
+ img {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|