mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 19:51:07 +03:30
feat : show item by udi
This commit is contained in:
Vendored
+3
-1
@@ -5,7 +5,9 @@ const urls = {
|
||||
showItem: function(id) {
|
||||
// return `/ShowItem/${id}`;
|
||||
return `/api/show-item/${id}`;
|
||||
|
||||
},
|
||||
showItemByUdi: function(udi) {
|
||||
return `/api/show-item/udi/${udi}`;
|
||||
},
|
||||
showPackage: function(id) {
|
||||
return `/api/show-package/${id}`;
|
||||
|
||||
Vendored
+6
@@ -19,6 +19,12 @@ export default [
|
||||
view: 'Item/ShowItem',
|
||||
meta: {public: true}
|
||||
},
|
||||
{
|
||||
path: '/Show/UDI/:udi',
|
||||
name: 'ShowItem',
|
||||
view: 'Item/ShowItem',
|
||||
meta: {public: true}
|
||||
},
|
||||
{
|
||||
path: '/Show/Package/:package',
|
||||
name: 'ShowPackage',
|
||||
|
||||
@@ -148,7 +148,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
imagesOnly() {
|
||||
return this.data.files && this.data.files.length? this.data.files.filter(file => file.file_type !== 'document') : [];
|
||||
return this.data.files && this.data.files.length ? this.data.files.filter(file => file.file_type !== 'document') : [];
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -166,6 +166,20 @@ export default {
|
||||
console.error("Error loading data:", error);
|
||||
}
|
||||
},
|
||||
async loadByUdi(udi) {
|
||||
try {
|
||||
const result = await axios.get(urls.showItemByUdi(udi));
|
||||
if (result.status == 200) {
|
||||
this.data = result.data.data;
|
||||
if (this.data) {
|
||||
this.generateBarcode(this.data);
|
||||
this.MedicalCenter = this.data.user.medical_center.name;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error loading data:", error);
|
||||
}
|
||||
},
|
||||
async generateBarcode(item) {
|
||||
let code = item.udi;
|
||||
if (code) {
|
||||
@@ -202,15 +216,7 @@ export default {
|
||||
"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.write(`<!DOCTYPE html><html><head>${stylesHtml}</head><body> ${prtHtml}</body></html>`);
|
||||
|
||||
WinPrint.document.close();
|
||||
WinPrint.focus();
|
||||
@@ -228,6 +234,8 @@ export default {
|
||||
created() {
|
||||
if (this.$route.params.item) {
|
||||
this.load(this.$route.params.item);
|
||||
} else if (this.$route.params.udi) {
|
||||
this.loadByUdi(this.$route.params.udi);
|
||||
}
|
||||
this.lightboxImages = this.imagesOnly && this.imagesOnly.length ? this.imagesOnly.map(file => ({
|
||||
src: file.thumbnail,
|
||||
|
||||
Reference in New Issue
Block a user