This commit is contained in:
2020-02-12 23:31:42 +00:00
parent 362e48c59e
commit 3edb54e568
3 changed files with 49 additions and 32 deletions

View File

@@ -284,7 +284,7 @@ export default {
// GET DATA FROM API SERVER
//
get(route) {
console.log("gzapi::get(" + route + ")");
//console.log("gzapi::get(" + route + ")");
var that = this;
return new Promise(function getDataFromServer(resolve, reject) {
fetch(that.APIUrl(route), that.fetchGetOptions())

View File

@@ -73,20 +73,15 @@ export default {
window.$gz.locale.fetch(ltKeysRequired).then(next);
},
beforeCreate() {
var vm = this;
vm.dataListKey = this.$route.params.dataListKey;
vm.recordid = this.$route.params.recordid;
//debugger;
initForm(vm)
.then(() => {
vm.formState.ready = true;
})
.catch(err => {
debugger;
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err);
});
// var vm = this;
// initForm(vm)
// .then(() => {
// vm.formState.ready = true;
// })
// .catch(err => {
// vm.formState.ready = true;
// window.$gz.errorHandler.handleFormError(err);
// });
},
beforeRouteLeave(to, from, next) {
//var vm = this;
@@ -106,18 +101,39 @@ export default {
window.$gz.eventBus.$off("menu-click", clickHandler);
},
created() {
window.$gz.eventBus.$on("menu-click", clickHandler);
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
//modify the menu as necessary
generateMenu(this, false); //default is never read only and passing in this vm
//init disable save button so it can be enabled only on edit to show dirty form
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
var vm = this;
initForm(vm)
.then(() => {
vm.formState.ready = true;
vm.dataListKey = this.$route.params.dataListKey;
vm.recordid = this.$route.params.recordid;
window.$gz.eventBus.$on("menu-click", clickHandler);
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
//modify the menu as necessary
generateMenu(this, false); //default is never read only and passing in this vm
//init disable save button so it can be enabled only on edit to show dirty form
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
})
.catch(err => {
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err);
});
// vm.dataListKey = this.$route.params.dataListKey;
// vm.recordid = this.$route.params.recordid;
// window.$gz.eventBus.$on("menu-click", clickHandler);
// //NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
// //modify the menu as necessary
// generateMenu(this, false); //default is never read only and passing in this vm
// //init disable save button so it can be enabled only on edit to show dirty form
// window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
},
data() {
return {
obj: [],
recordid: undefined,
dataListKey: "",
recordid: 0,
dataListKey: "-",
concurrencyToken: undefined,
formCustomTemplateKey: this.$route.params.formCustomTemplateKey,
selectedDataListSortFilter: {},
@@ -160,6 +176,7 @@ export default {
enableSaveButton();
},
filterChanged: function() {
console.log(this.selectedDataListSortFilter);
alert("STUB:FILTER SELECTED");
// //nothing to scan here just set form dirty
// this.formState.dirty = true;
@@ -309,13 +326,12 @@ function generateMenu(vm) {
//
//
function initForm(vm) {
return populatePickLists(vm).then(() => {
//Must use return here
return initDataObject(vm);
});
// .catch(function handlePopulatePickListError(error) {
// debugger;
// });
return populatePickLists(vm);
//If need to call more then...:
// .then(() => {
// //Must use return here
// return initDataObject(vm);
// });
}
////////////////////
@@ -323,7 +339,7 @@ function initForm(vm) {
function populatePickLists(vm) {
//http://localhost:7575/api/v8/DataListSortFilter/PickList?ListKey=TestWidgetDataList
return window.$gz.api
.get("DataListSortFilter/PickList?ListKey=" + vm.dataListKey)
.get("DataListSortFilter/PickList?ListKey=" + vm.$route.params.dataListKey)
.then(res => {
if (res.error != undefined) {
window.$gz.errorHandler.handleFormError(res.error, vm);