feat :use barcode scaner in add package and cycle

This commit is contained in:
zeinab.ashrafi
2025-04-28 12:13:44 +03:30
parent d3895d6e37
commit 662bfd8c86
5 changed files with 67 additions and 19 deletions
+2 -9
View File
@@ -182,15 +182,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();
@@ -198,6 +190,7 @@ export default {
WinPrint.close();
},
openLightbox(index) {
console.log(index, '00')
this.lightboxIndex = index;
this.showLightbox = false;
this.$nextTick(() => {
+33 -4
View File
@@ -46,9 +46,9 @@
<v-flex xs12 sm6 md4 class="WM-FlexCenter WM-DuplicateInput" style="position: relative"
v-for="(label, key) in formData.labels" :key="key">
<div class="Inner">
<v-icon class="fa fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-icon class="fa fa-check mr-2 WM-Margin-B-8"/>
<v-autocomplete
@keydown.enter.native.prevent="duplicateForm(key)"
@keydown.enter.native.prevent="handleEnterScan(key)"
@change="duplicateForm(key)"
:ref="`selectItem-${key}`"
color="black"
@@ -108,7 +108,7 @@
<script>
import {ApiService} from "@/services";
import {urls} from "@/config/urls";
import {mapMutations} from "vuex";
import toast from "@/services/global/toast.service";
export default {
metaInfo() {
@@ -135,9 +135,15 @@ export default {
},
created() {
this.loadLabels();
console.log()
if (this.$route.params.cycle) {
this.load(this.$route.params.cycle);
}else {
this.$nextTick(() => {
const firstRef = this.$refs[`selectItem-0`];
if (firstRef && firstRef[0]) {
firstRef[0].focus();
}
});
}
},
methods: {
@@ -175,6 +181,29 @@ export default {
this.$router.push({name: "AllCycle"});
}
},
handleEnterScan(key) {
const inputRef = this.$refs[`selectItem-${key}`][0];
const searchText = inputRef.searchValue || inputRef.lazySearch;
const selectedItemId = this.formData.labels[key].id;
if (!selectedItemId) {
const foundItem = this.labels.find(i =>
i.udi === searchText ||
i.name === searchText ||
i.id == searchText
);
if (foundItem) {
this.formData.labels[key].id = foundItem.id;
if (inputRef.isMenuActive) {
console.log(inputRef.isMenuActive)
inputRef.isMenuActive = false;
}
this.duplicateForm(key);
} else {
toast.error('item is not in the list');
}
}
},
duplicateForm() {
this.formData.labels.push({name: "",});
this.$nextTick( () => {
-1
View File
@@ -251,7 +251,6 @@ export default {
async download() {
const result = await ApiService.get(urls.exportCycles());
if (result && result.status == 200) {
console.log(result)
window.open(result.download, '_blank');
}
},
-1
View File
@@ -76,7 +76,6 @@
<script>
import {ApiService} from "@/services";
import {urls} from "@/config/urls";
import {mapMutations} from 'vuex';
import Dropzone from '@/components/core/Dropzone'
export default {
+32 -4
View File
@@ -42,7 +42,7 @@
style="position: relative" v-for="(item, key) in formData.items" :key="key">
<div class="Inner">
<v-autocomplete
@keydown.enter.native.prevent="duplicateForm(key)"
@keydown.enter.native.prevent="handleEnterScan(key)"
@change="duplicateForm(key)"
:ref="`selectItem-${key}`"
class="py-3 pr-3"
@@ -115,7 +115,7 @@
<script>
import {ApiService} from "@/services";
import {urls} from "@/config/urls";
import {mapMutations} from "vuex";
import toast from "@/services/global/toast.service";
export default {
metaInfo() {
@@ -152,8 +152,14 @@ export default {
this.loadItems();
if (this.$route.params.package) {
this.load(this.$route.params.package);
}else {
this.$nextTick(() => {
const firstRef = this.$refs[`selectItem-0`];
if (firstRef && firstRef[0]) {
firstRef[0].focus();
}
});
}
},
methods: {
customFilter(item, queryText) {
@@ -198,10 +204,32 @@ export default {
this.$router.push({name: "AllPackage"});
}
},
handleEnterScan(key) {
const inputRef = this.$refs[`selectItem-${key}`][0];
const searchText = inputRef.searchValue || inputRef.lazySearch;
const selectedItemId = this.formData.items[key].id;
if (!selectedItemId) {
const foundItem = this.items.find(i =>
i.udi === searchText ||
i.name === searchText ||
i.id == searchText
);
if (foundItem) {
this.formData.items[key].id = foundItem.id;
if (inputRef.isMenuActive) {
console.log(inputRef.isMenuActive)
inputRef.isMenuActive = false;
}
this.duplicateForm(key);
} else {
toast.error('item is not in the list');
}
}
},
duplicateForm() {
this.formData.items.push({name: "",});
this.$nextTick( () => {
this.$nextTick(() => {
const newIndex = this.formData.items.length - 1;
const ref = this.$refs[`selectItem-${newIndex}`];
if (ref && ref[0]) {