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