mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 19:51:07 +03:30
95 lines
3.5 KiB
Vue
95 lines
3.5 KiB
Vue
<template>
|
|
<v-container grid-list-xs>
|
|
<material-card color="black" title="Barcode Image">
|
|
<v-layout id="printMe" align-left justify-left wrap class="px-5 my-3">
|
|
<!-- <h3 class="ml-3">Barcode And QRCode Image</h3>
|
|
<v-flex xs12>
|
|
<hr class="v-divider theme--light">
|
|
</v-flex> -->
|
|
<v-layout row wrap class="ml-4">
|
|
<v-flex xs12 md6 sm6 v-if="barcodeimg">
|
|
<img :src="barcodeimg" class="WM-Width-350"><br />
|
|
<span v-if="Type != 'TestType'">{{ `${Type} ${item.udi ? 'UDI :' : 'ID :'} ${ID}` }}</span>
|
|
<span v-else>{{ Type + ':' + ID }}</span>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout row wrap class="ml-4">
|
|
<v-flex xs12 md6 sm6 v-if="QRCodeimg">
|
|
<a v-if="Type != 'TestType'" :href="ShowLink" target="_blank"><img :src="QRCodeimg"
|
|
class="WM-Width-150"></a>
|
|
<img v-else :src="QRCodeimg" class="WM-Width-150">
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-layout>
|
|
<v-layout row wrap align-center justify-center>
|
|
<v-flex class xs12 md2 sm2 @click="print">
|
|
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
|
|
<v-icon class="white--text mr-2 caption">fas fa-print</v-icon>
|
|
<span class="white--text">Print</span>
|
|
</v-btn>
|
|
</v-flex>
|
|
</v-layout>
|
|
</material-card>
|
|
</v-container>
|
|
</template>
|
|
<script>
|
|
import { mapGetters } from "vuex";
|
|
export default {
|
|
data: () => ({
|
|
barcodeimg: null,
|
|
QRCodeimg: null,
|
|
ShowLink: '',
|
|
Type: '',
|
|
ID: '',
|
|
item: {}
|
|
}),
|
|
created() {
|
|
this.item = this.getModalProperties.item ? this.getModalProperties.item : {};
|
|
this.barcodeimg = this.getModalProperties.result.data.data.Barcode ? this.getModalProperties.result.data.data.Barcode : null;
|
|
this.QRCodeimg = this.getModalProperties.result.data.data.QRCode ? this.getModalProperties.result.data.data.QRCode : null;
|
|
this.ShowLink = this.getModalProperties.result.data.data.ShowLink ? this.getModalProperties.result.data.data.ShowLink : '#';
|
|
this.Type = this.ShowLink.split('/')[1];
|
|
this.ID = this.ShowLink.split('/')[2];
|
|
|
|
},
|
|
computed: {
|
|
...mapGetters("modal", ["getModalProperties", "getModalLink"])
|
|
},
|
|
methods: {
|
|
print() {
|
|
const prtHtml = document.getElementById("printMe").innerHTML;
|
|
|
|
// Get all stylesheets HTML
|
|
let stylesHtml = "";
|
|
for (const node of [
|
|
...document.querySelectorAll('link[rel="stylesheet"], style')
|
|
]) {
|
|
stylesHtml += node.outerHTML;
|
|
}
|
|
|
|
// Open the print window
|
|
const WinPrint = window.open(
|
|
"",
|
|
"",
|
|
"left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0"
|
|
);
|
|
|
|
WinPrint.document.write(`<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
${stylesHtml}
|
|
</head>
|
|
<body>
|
|
${prtHtml}
|
|
</body>
|
|
</html>`);
|
|
|
|
WinPrint.document.close();
|
|
WinPrint.focus();
|
|
WinPrint.print();
|
|
WinPrint.close();
|
|
}
|
|
}
|
|
};
|
|
</script>
|