This commit is contained in:
2021-06-10 21:55:43 +00:00
parent a9d6cc5adb
commit 48bc82c6aa
2 changed files with 32 additions and 10 deletions

View File

@@ -570,9 +570,23 @@ export default {
pvm: { pvm: {
default: null, default: null,
type: Object 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: { methods: {
newItem() { newItem() {
let newIndex = this.value.items.length; let newIndex = this.value.items.length;

View File

@@ -19,6 +19,7 @@
:form-key="formCustomTemplateKey" :form-key="formCustomTemplateKey"
:readonly="formState.readOnly" :readonly="formState.readOnly"
:pvm="this" :pvm="this"
:goto="this.goto"
data-cy="woItems" data-cy="woItems"
@change="setDirty()" @change="setDirty()"
class="mt-16" class="mt-16"
@@ -78,14 +79,6 @@ export default {
}); });
} else { } else {
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading 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 { } else {
window.$gz.form.setFormState({ window.$gz.form.setFormState({
@@ -105,6 +98,20 @@ export default {
window.$gz.errorHandler.handleFormError(error, vm); window.$gz.errorHandler.handleFormError(error, vm);
} finally { } finally {
vm.formState.ready = true; 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) { async beforeRouteLeave(to, from, next) {
@@ -273,7 +280,8 @@ export default {
errors: null //contains error objects from save errors: null //contains error objects from save
}, },
lastGetContractId: -1, //note: -1 so that a new record updates 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 //WATCHERS