This commit is contained in:
2021-05-26 21:37:24 +00:00
parent 31451efde0
commit 1eca2968de
2 changed files with 67 additions and 55 deletions

View File

@@ -5,20 +5,16 @@
<v-menu offset-y> <v-menu offset-y>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<div class="text-h6"> <div class="text-h6">
<v-icon large color="primary" class="mr-2">$ayiBoxes</v-icon> <v-icon large color="primary" class="mr-2"
{{ $ay.t("WorkOrderItemPartList") }} >$ayiParachuteBox</v-icon
>
{{ $ay.t("WorkOrderItemPartRequestList") }}
<v-btn v-if="!parentDeleted" large icon v-bind="attrs" v-on="on"> <v-btn v-if="!parentDeleted" large icon v-bind="attrs" v-on="on">
<v-icon small color="primary">$ayiEllipsisV</v-icon> <v-icon small color="primary">$ayiEllipsisV</v-icon>
</v-btn> </v-btn>
</div> </div>
</template> </template>
<v-list> <v-list>
<v-list-item v-if="canAdd" @click="newItem">
<v-list-item-icon>
<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="canDelete && !isDeleted" @click="deleteItem"> <v-list-item v-if="canDelete && !isDeleted" @click="deleteItem">
<v-list-item-icon> <v-list-item-icon>
<v-icon>$ayiTrashAlt</v-icon> <v-icon>$ayiTrashAlt</v-icon>
@@ -146,39 +142,39 @@ export default {
} }
}, },
methods: { methods: {
warehouseChange(newName) { // warehouseChange(newName) {
this.value.items[this.activeWoItemIndex].partRequests[ // this.value.items[this.activeWoItemIndex].partRequests[
this.activeItemIndex // this.activeItemIndex
].partWarehouseViz = newName; // ].partWarehouseViz = newName;
}, // },
partChange(newName) { // partChange(newName) {
this.value.items[this.activeWoItemIndex].partRequests[ // this.value.items[this.activeWoItemIndex].partRequests[
this.activeItemIndex // this.activeItemIndex
].partViz = newName; // ].partViz = newName;
}, // },
newItem() { // newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].partRequests // let newIndex = this.value.items[this.activeWoItemIndex].partRequests
.length; // .length;
this.value.items[this.activeWoItemIndex].partRequests.push({ // this.value.items[this.activeWoItemIndex].partRequests.push({
id: 0, // id: 0,
concurrency: 0, // concurrency: 0,
userId: null, // userId: null,
description: null, // description: null,
serials: null, // serials: null,
partId: null, // partId: null,
partWarehouseId: null, // partWarehouseId: null,
quantity: 1, // quantity: 1,
received: null, // received: null,
purchaseOrderItemId: null, // purchaseOrderItemId: null,
isDirty: true, // isDirty: true,
workOrderItemId: this.value.items[this.activeWoItemIndex].id, // workOrderItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now() //used for error tracking / display // uid: Date.now() //used for error tracking / display
}); // });
this.$emit("change"); // this.$emit("change");
this.selectedRow = [{ index: newIndex }]; // this.selectedRow = [{ index: newIndex }];
this.activeItemIndex = newIndex; // this.activeItemIndex = newIndex;
}, // },
unDeleteItem() { unDeleteItem() {
this.value.items[this.activeWoItemIndex].partRequests[ this.value.items[this.activeWoItemIndex].partRequests[
this.activeItemIndex this.activeItemIndex
@@ -209,15 +205,15 @@ export default {
form() { form() {
return window.$gz.form; return window.$gz.form;
}, },
fieldValueChanged(ref) { // fieldValueChanged(ref) {
if (!this.formState.loading && !this.formState.readonly) { // if (!this.formState.loading && !this.formState.readonly) {
//flag this record dirty so it gets picked up by save // //flag this record dirty so it gets picked up by save
this.value.items[this.activeWoItemIndex].partRequests[ // this.value.items[this.activeWoItemIndex].partRequests[
this.activeItemIndex // this.activeItemIndex
].isDirty = true; // ].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref); // window.$gz.form.fieldValueChanged(this.pvm, ref);
} // }
}, // },
itemRowClasses: function(item) { itemRowClasses: function(item) {
let ret = ""; let ret = "";
const isDeleted = const isDeleted =
@@ -386,9 +382,9 @@ export default {
showTable: function() { showTable: function() {
return this.value.items[this.activeWoItemIndex].partRequests.length > 1; return this.value.items[this.activeWoItemIndex].partRequests.length > 1;
}, },
canAdd: function() { // canAdd: function() {
return this.pvm.rights.change && this.pvm.subRights.partRequests.create; // return this.pvm.rights.change && this.pvm.subRights.partRequests.create;
}, // },
canDelete: function() { canDelete: function() {
return ( return (
this.activeItemIndex != null && this.activeItemIndex != null &&

View File

@@ -396,7 +396,7 @@
<v-col <v-col
cols="12" cols="12"
v-if=" v-if="
pvm.subRights.tasks.visible && pvm.subRights.parts.visible &&
form().showMe(this, 'WorkOrderItemPartList') form().showMe(this, 'WorkOrderItemPartList')
" "
> >
@@ -409,7 +409,21 @@
/> />
</v-col> </v-col>
<!-- //todo WorkOrderItemPartRequestList here --> <v-col
cols="12"
v-if="
pvm.subRights.partRequests.visible &&
form().showMe(this, 'WorkOrderItemPartRequestList')
"
>
<GzWoItemPartRequests
v-model="value"
:pvm="pvm"
:active-wo-item-index="activeItemIndex"
data-cy="woItemPartRequests"
@change="$emit('change')"
/>
</v-col>
<v-col <v-col
cols="12" cols="12"
@@ -473,6 +487,7 @@ import GzWoItemTravels from "../components/work-order-item-travels.vue";
import GzWoItemExpenses from "../components/work-order-item-expenses.vue"; import GzWoItemExpenses from "../components/work-order-item-expenses.vue";
import GzWoItemTasks from "../components/work-order-item-tasks.vue"; import GzWoItemTasks from "../components/work-order-item-tasks.vue";
import GzWoItemParts from "../components/work-order-item-parts.vue"; import GzWoItemParts from "../components/work-order-item-parts.vue";
import GzWoItemPartRequests from "../components/work-order-item-part-requests.vue";
export default { export default {
components: { components: {
@@ -481,7 +496,8 @@ export default {
GzWoItemLabors, GzWoItemLabors,
GzWoItemTravels, GzWoItemTravels,
GzWoItemTasks, GzWoItemTasks,
GzWoItemParts GzWoItemParts,
GzWoItemPartRequests
}, },
created() { created() {
this.setDefaultView(); this.setDefaultView();