This commit is contained in:
2020-12-15 15:01:15 +00:00
parent 329e3078e5
commit 3e3686657f

View File

@@ -237,7 +237,7 @@ export default {
} }
}, },
async beforeRouteLeave(to, from, next) { async beforeRouteLeave(to, from, next) {
if (!this.formState.dirty || JUST_DELETED) { if (!this.formState.dirty || LEAVE_OK) {
next(); next();
return; return;
} }
@@ -454,18 +454,8 @@ export default {
vm.formState.serverError = res.error; vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);
} else { } else {
LEAVE_OK = true;
vm.$router.go(-1); vm.$router.go(-1);
// vm.pickListSelectedUserId = null;
// vm.items = [];
// vm.toUsers = [];
// vm.obj.notes = null;
// vm.obj.name = null;
// //Only a post, no data returned
// window.$gz.form.setFormState({
// vm: vm,
// dirty: false
// });
// vm.updateSave();
} }
} catch (ex) { } catch (ex) {
window.$gz.errorHandler.handleFormError(ex, vm); window.$gz.errorHandler.handleFormError(ex, vm);
@@ -492,7 +482,7 @@ export default {
//No need to delete a new record, just abandon it... //No need to delete a new record, just abandon it...
if (vm.$route.params.recordid == 0) { if (vm.$route.params.recordid == 0) {
//this should not get offered for delete but to be safe and clear just in case: //this should not get offered for delete but to be safe and clear just in case:
JUST_DELETED = true; LEAVE_OK = true;
// navigate backwards // navigate backwards
vm.$router.go(-1); vm.$router.go(-1);
} else { } else {
@@ -506,7 +496,7 @@ export default {
} else { } else {
//workaround to prevent warning about leaving dirty record //workaround to prevent warning about leaving dirty record
//For some reason I couldn't just reset isdirty in formstate //For some reason I couldn't just reset isdirty in formstate
JUST_DELETED = true; LEAVE_OK = true;
// navigate backwards // navigate backwards
vm.$router.go(-1); vm.$router.go(-1);
} }
@@ -677,7 +667,7 @@ function generateMenu(vm) {
window.$gz.eventBus.$emit("menu-change", menuOptions); window.$gz.eventBus.$emit("menu-change", menuOptions);
} }
let JUST_DELETED = false; let LEAVE_OK = false;
///////////////////////////////// /////////////////////////////////
// //