This commit is contained in:
2021-07-05 22:03:54 +00:00
parent b52add10d2
commit 6563bd63c0

View File

@@ -20,6 +20,12 @@
<v-icon>$ayiPlus</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canAdd" @click="bulkUnitsDialog = true">
<v-list-item-icon>
<v-icon>$ayiFan</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("UnitList") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
<v-list-item-icon>
@@ -322,6 +328,56 @@ export default {
}
},
methods: {
async bulkUnitsSearch() {
this.selectedBulkUnits.splice(0);
this.availableBulkUnits.splice(0);
let res = await window.$gz.api.post(`unit/bulk-add-selection-list`, {
tags: [],
restrictToCustomerId: null
});
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
window.$gz.errorHandler.errorToString(res, this)
);
} else {
this.availableBulkUnits = res.data;
}
},
addSelectedBulkUnits() {
if (res.data && res.data.items) {
let newIndex = this.value.items[this.activeWoItemIndex].parts.length;
res.data.items.forEach(z => {
newIndex++;
this.value.items[this.activeWoItemIndex].parts.push({
id: 0,
concurrency: 0,
userId: null,
description: null,
serials: null,
partId: z.partId,
partWarehouseId: this.selectedPartWarehouse,
quantity: z.quantity,
taxPartSaleId: null,
price: 0,
priceOverride: null,
cost: 0,
listPrice: 0,
isDirty: true,
workOrderItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now(),
partWarehouseViz: null,
partViz: z.partViz,
taxCodeViz: null
});
});
this.$emit("change");
this.selectedRow = [{ index: newIndex }];
this.activeItemIndex = newIndex;
}
this.partAssemblyDialog = false;
},
unitChange(newName) {
this.value.items[this.activeWoItemIndex].units[
this.activeItemIndex