This commit is contained in:
2020-12-30 19:25:20 +00:00
parent 044bcb0a3f
commit 8608341701

View File

@@ -170,7 +170,7 @@ export default {
}
},
async beforeRouteLeave(to, from, next) {
if (!this.formState.dirty || JUST_DELETED) {
if (!this.formState.dirty || JUST_SAVED) {
next();
return;
}
@@ -306,32 +306,9 @@ export default {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
if (res.data.id) {
//POST - whole new object returned
vm.obj = res.data;
//Change URL to new record
//NOTE: will not cause a page re-render, almost nothing does unless forced with a KEY property or using router.GO()
this.$router.push({
name: "service-bank-edit",
params: {
recordid: res.data.id,
obj: res.data, // Pass data object to new form,
name: this.name
}
});
} else {
//PUT - only concurrency token is returned (**warning, if server changes object other fields then this needs to act more like POST above but is more efficient this way**)
//Handle "put" of an existing record (UPDATE)
vm.obj.concurrency = res.data.concurrency;
}
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true
});
JUST_SAVED = true;
//success, back to list, nothing to see here
vm.$router.go(-1);
}
} catch (ex) {
window.$gz.errorHandler.handleFormError(ex, vm);
@@ -498,7 +475,7 @@ function generateMenu(vm) {
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
let JUST_DELETED = false;
let JUST_SAVED = false;
/////////////////////////////////
//