This commit is contained in:
@@ -5,6 +5,25 @@ export default {
|
|||||||
enumKey = enumKey.toLowerCase();
|
enumKey = enumKey.toLowerCase();
|
||||||
return window.$gz.store.state.enums[enumKey][enumValue];
|
return window.$gz.store.state.enums[enumKey][enumValue];
|
||||||
},
|
},
|
||||||
|
//////////////////////////////////
|
||||||
|
//
|
||||||
|
// Used by forms to fetch picklist data
|
||||||
|
//
|
||||||
|
getPickList(enumKey) {
|
||||||
|
enumKey = enumKey.toLowerCase();
|
||||||
|
var e = window.$gz.store.state.enums[enumKey];
|
||||||
|
if (!e) {
|
||||||
|
throw "ERROR enums::getPickList -> enumKey " +
|
||||||
|
enumKey +
|
||||||
|
" is missing from store";
|
||||||
|
}
|
||||||
|
var ret = [];
|
||||||
|
//turn it into an array suitable for picklists
|
||||||
|
window.$gz._.forOwn(e, function(value, key) {
|
||||||
|
ret.push({ id: Number(key), name: value });
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
},
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
//
|
//
|
||||||
// Fetches enum list from server
|
// Fetches enum list from server
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
xl="3"
|
xl="3"
|
||||||
>
|
>
|
||||||
<v-select
|
<v-select
|
||||||
v-model="obj.usertype"
|
v-model="obj.userType"
|
||||||
:items="pickLists.usertypes"
|
:items="pickLists.usertypes"
|
||||||
item-text="name"
|
item-text="name"
|
||||||
item-value="id"
|
item-value="id"
|
||||||
@@ -275,6 +275,7 @@ export default {
|
|||||||
var vm = this;
|
var vm = this;
|
||||||
initForm(this)
|
initForm(this)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
vm.pickLists.usertypes = window.$gz.enums.getPickList("usertype");
|
||||||
vm.formState.ready = true;
|
vm.formState.ready = true;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -352,7 +353,7 @@ export default {
|
|||||||
serial: 0,
|
serial: 0,
|
||||||
dollarAmount: null,
|
dollarAmount: null,
|
||||||
active: null,
|
active: null,
|
||||||
usertype: 0,
|
userType: 0,
|
||||||
startDate: null,
|
startDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
notes: null,
|
notes: null,
|
||||||
@@ -729,12 +730,15 @@ function initForm(vm) {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
function populatePickLists(vm) {
|
function populatePickLists(vm) {
|
||||||
return window.$gz.api.get("EnumPickList/list/usertypes").then(res => {
|
//ensure the pick lists required are pre-fetched
|
||||||
if (res.error) {
|
//this is called before form is fully opened
|
||||||
throw res.error;
|
return window.$gz.enums.fetchEnumList("usertype");
|
||||||
}
|
// return window.$gz.api.get("EnumPickList/list/usertype").then(res => {
|
||||||
vm.pickLists.usertypes = res.data;
|
// if (res.error) {
|
||||||
});
|
// throw res.error;
|
||||||
|
// }
|
||||||
|
// vm.pickLists.usertypes = res.data;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user