This commit is contained in:
2021-01-25 23:56:39 +00:00
parent 0ebf4a07d6
commit 531c86a943

View File

@@ -1,6 +1,5 @@
<template>
<div>
{{ obj }}
<gz-report-selector ref="reportSelector"></gz-report-selector>
<div v-if="formState.ready">
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
@@ -44,7 +43,7 @@
</thead>
<tbody>
<!-- Note the use of partid which is unique plus quantity, without that quantity Vue doesn't update the display of quantity if it's changed by the quanittyChanged method -->
<!-- Note the use of partWarehouseId which is unique plus quantity, without that quantity Vue doesn't update the display of quantity if it's changed by the quanittyChanged method -->
<tr
v-for="item in sortedList()"
:key="
@@ -53,7 +52,7 @@
"
>
<td>
{{ item.partWareHouseDisplay }}
{{ item.partWarehouseDisplay }}
<template v-if="$vuetify.breakpoint.xs">
<div class="my-3">
<v-icon class="ml-2" @click="openItem(item)">
@@ -65,7 +64,7 @@
</div>
</template>
<template v-else>
<v-icon class="ml-2" @click="openItem(item)">
<v-icon class="ml-6" @click="openItem(item)">
$ayiEdit
</v-icon>
<v-icon class="ml-6" @click="removeItem(item)">
@@ -104,9 +103,8 @@
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
const FORM_KEY = "inv-part-serials";
const FORM_KEY = "inv-part-stock-levels";
//const API_BASE_URL = "part/";
const FORM_CUSTOM_TEMPLATE_KEY = "inv-part-serials"; //<-- Should always be CoreBizObject AyaType name here where possible
export default {
async created() {
@@ -156,7 +154,6 @@ export default {
},
data() {
return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
obj: [],
formState: {
ready: false,
@@ -196,17 +193,17 @@ export default {
methods: {
sortedList: function() {
function compare(a, b) {
if (a.partDisplay < b.partDisplay) return -1;
if (a.partDisplay > b.partDisplay) return 1;
if (a.partWarehouseDisplay < b.partWarehouseDisplay) return -1;
if (a.partWarehouseDisplay > b.partWarehouseDisplay) return 1;
return 0;
}
return this.obj.slice().sort(compare);
},
addItem: function() {
let vm = this;
let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
//vm.selectedPartWarehouseId = null;
if (selectedPartWarehouse == null || selectedPartWarehouse.id == null) {
return;
}
@@ -221,7 +218,7 @@ export default {
vm.obj.push({
partId: vm.$route.params.recordid,
partWarehouseId: selectedPartWarehouse.id,
partWareHouseDisplay: selectedPartWarehouse.name,
partWarehouseDisplay: selectedPartWarehouse.name,
minimumQuantity: 1
});
@@ -238,12 +235,12 @@ export default {
vm.obj.splice(index, 1);
vm.formState.dirty = true;
},
// openItem: function(item) {
// window.$gz.eventBus.$emit("openobject", {
// type: window.$gz.type.Part,
// id: item.partId
// });
// },
openItem: function(item) {
window.$gz.eventBus.$emit("openobject", {
type: window.$gz.type.PartWarehouse,
id: item.partWarehouseId
});
},
quantityChanged: function(item) {
let vm = this;
if (item.minimumQuantity == null || item.minimumQuantity < 1) {