This commit is contained in:
@@ -310,6 +310,16 @@ let editor = null;
|
||||
export default {
|
||||
async created() {
|
||||
let vm = this;
|
||||
//Not valid without report data options
|
||||
if (vm.$route.params.reportDataOptions == null) {
|
||||
throw new Error(
|
||||
"ay-report-edit::created - missing report data options cannot proceed"
|
||||
);
|
||||
// // navigate backwards
|
||||
vm.$router.go(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await initForm(vm);
|
||||
|
||||
@@ -317,32 +327,7 @@ export default {
|
||||
vm.formState.readOnly = !vm.rights.change;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
|
||||
// //id 0 means create or duplicate to new
|
||||
// if (vm.$route.params.recordid != 0) {
|
||||
// //is there already an obj from a prior operation?
|
||||
// if (vm.$route.params.obj) {
|
||||
// //yes, no need to fetch it
|
||||
// vm.obj = vm.$route.params.obj;
|
||||
// window.$gz.form.setFormState({
|
||||
// vm: vm,
|
||||
// loading: false
|
||||
// });
|
||||
// } else {
|
||||
// await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
|
||||
// }
|
||||
|
||||
// //Ok, we're here now fetch the report data and can handle includeWoItemDescendants if necessary
|
||||
// await fetchReportData(vm);
|
||||
// } else {
|
||||
// //New record so there *MUST* be an aType on the route params
|
||||
|
||||
// await fetchReportData(vm); //go ahead and fetch report data now, no need to handle includeWoItemDescendants
|
||||
|
||||
// window.$gz.form.setFormState({
|
||||
// vm: vm,
|
||||
// loading: false
|
||||
// });
|
||||
// }
|
||||
//console.log("report-edit created params are:", vm.$route.params);
|
||||
|
||||
let setDirty = false;
|
||||
let setValid = true;
|
||||
@@ -366,9 +351,15 @@ export default {
|
||||
"Copy"
|
||||
)}`;
|
||||
setDirty = true;
|
||||
} else {
|
||||
//brand new report, not a duplicate or previous data
|
||||
vm.obj.aType = vm.$route.params.reportDataOptions.AType;
|
||||
}
|
||||
}
|
||||
|
||||
//in any case we need the sample data so fetch it here after the setup for new or existing or duplicate is completed above
|
||||
await fetchReportData(vm);
|
||||
|
||||
//---------------
|
||||
//setup the editor and models
|
||||
|
||||
@@ -848,7 +839,7 @@ Handlebars.registerHelper('loud', function (aString) {
|
||||
//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({
|
||||
this.$router.replace({
|
||||
name: "ay-report-edit",
|
||||
params: {
|
||||
recordid: res.data.id,
|
||||
@@ -926,7 +917,8 @@ Handlebars.registerHelper('loud', function (aString) {
|
||||
name: "ay-report-edit",
|
||||
params: {
|
||||
recordid: 0,
|
||||
obj: this.obj
|
||||
obj: this.obj, // Pass data object to new form
|
||||
reportDataOptions: this.$route.params.reportDataOptions
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user