From 48bc82c6aa520cb239ed53db87e97c88e4dbf589 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 10 Jun 2021 21:55:43 +0000 Subject: [PATCH] --- ayanova/src/components/work-order-items.vue | 16 ++++++++++++- ayanova/src/views/svc-workorder.vue | 26 ++++++++++++++------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ayanova/src/components/work-order-items.vue b/ayanova/src/components/work-order-items.vue index df9dbdcc..242a806d 100644 --- a/ayanova/src/components/work-order-items.vue +++ b/ayanova/src/components/work-order-items.vue @@ -570,9 +570,23 @@ export default { pvm: { default: null, type: Object + }, + goto: { + default: null, + type: Object + } + }, + watch: { + goto(val, oldVal) { + if (val != oldVal) { + console.log("WOITEM WATCH GOTO VALUE CHANGED", val); + // if (gotype != window.$gz.type.WorkOrder) { + // //not workorder? Then must be a descendant so let's gooooooooooo! + // this.goto = { type: gotype, id: goid }; + // } + } } }, - methods: { newItem() { let newIndex = this.value.items.length; diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index 2d7724fe..6bb0d950 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -19,6 +19,7 @@ :form-key="formCustomTemplateKey" :readonly="formState.readOnly" :pvm="this" + :goto="this.goto" data-cy="woItems" @change="setDirty()" class="mt-16" @@ -78,14 +79,6 @@ export default { }); } else { await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading - //navigate somewhere?? - console.log("workorder init params:", this.$route.params); - if (this.$route.params.gotype != null) { - //find out which woitem and then find out which type to set and then set them as the active item somehow - const gotype = Number(this.$route.params.gotype); - const goid = Number(this.$route.params.goid); - console.log("GO ACTIVATED, GOING...."); - } } } else { window.$gz.form.setFormState({ @@ -105,6 +98,20 @@ export default { window.$gz.errorHandler.handleFormError(error, vm); } finally { vm.formState.ready = true; + //navigate somewhere?? + console.log("workorder init params:", this.$route.params); + if (this.$route.params.gotype != null) { + //find out which woitem and then find out which type to set and then set them as the active item somehow + const gotype = Number(this.$route.params.gotype); + const goid = Number(this.$route.params.goid); + console.log("GO ACTIVATED, GOING...."); + if (gotype != window.$gz.type.WorkOrder) { + this.$nextTick(() => { + //not workorder? Then must be a descendant so let's gooooooooooo! + this.goto = { type: gotype, id: goid }; + }); + } + } } }, async beforeRouteLeave(to, from, next) { @@ -273,7 +280,8 @@ export default { errors: null //contains error objects from save }, lastGetContractId: -1, //note: -1 so that a new record updates - lastGetCustomerId: -1 + lastGetCustomerId: -1, + goto: null //{type:ayatype,id:wodescendant id} picked up by woitem when set non-null to trigger navigate to the item in question }; }, //WATCHERS