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

View File

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