This commit is contained in:
2020-03-28 19:40:52 +00:00
parent 91822a6494
commit c559d09cd0

View File

@@ -27,7 +27,7 @@
> >
</v-select> </v-select>
</v-col> </v-col>
{{ obj }}
<!-- <template v-for="item in obj"> <!-- <template v-for="item in obj">
<v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2> <v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2>
<v-card> <v-card>
@@ -149,16 +149,23 @@ export default {
return window.$gz.translation.get(ltkey); return window.$gz.translation.get(ltkey);
}, },
templateSelected: function() { templateSelected: function() {
console.log("STUB: templateSelected", this.templateId); if (this.formState.dirty) {
window.$gz.dialog.confirmLeaveUnsaved().then(dialogResult => {
if (dialogResult != true) {
return;
}
});
}
this.getDataFromApi();
}, },
getDataFromApi(recordId) { getDataFromApi() {
//COP*IED FROM WIDGET TO BE MODIFIED //COP*IED FROM WIDGET TO BE MODIFIED
var vm = this; var vm = this;
vm.formState.loading = true; vm.formState.loading = true;
if (!recordId) { if (!vm.templateId || vm.templateId == 0) {
throw FORM_KEY + "::getDataFromApi -> Missing recordID!"; return;
} }
var url = API_BASE_URL + recordId; var url = API_BASE_URL + vm.templateId;
window.$gz.form.deleteAllErrorBoxErrors(vm); window.$gz.form.deleteAllErrorBoxErrors(vm);
@@ -166,16 +173,6 @@ export default {
.get(url) .get(url)
.then(res => { .then(res => {
if (res.error != undefined) { if (res.error != undefined) {
//Not found?
if (res.error.code == "2010") {
//notify not found error then navigate backwards
window.$gz.dialog
.displayLTErrorMessage("ErrorAPI2010")
.then(() => {
// navigate backwards
vm.$router.go(-1);
});
}
vm.formState.serverError = res.error; vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);
} else { } else {
@@ -189,8 +186,6 @@ export default {
loading: false, loading: false,
readOnly: res.readOnly ? true : false readOnly: res.readOnly ? true : false
}); });
//modify the menu as necessary
generateMenu(vm);
} }
}) })
.catch(function handleGetDataFromAPIError(error) { .catch(function handleGetDataFromAPIError(error) {