This commit is contained in:
2020-10-07 17:33:37 +00:00
parent 0185b6941c
commit 2a2bcc5f7f
7 changed files with 80 additions and 39 deletions

View File

@@ -44,21 +44,18 @@ export default {
//de-lodash
// //turn it into an array suitable for selection lists
// window.$gz._.forOwn(e, function(value, key) {
// window.$gz. _.forOwn(e, function(value, key) {
// ret.push({ id: Number(key), name: value });
// });
//return window.$gz. _.sortBy(ret, "name");
//turn it into an array suitable for selection lists
for (const [key, value] of Object.entries(e)) {
ret.push({ id: Number(key), name: value });
}
//e is an object with keys of id values i.e. {1:"display1",2:"display 2"}
//what needs to be returned is an array of objects like: [{id:1,name:"display1"},{id:2,name:"display2"}]
console.log("enum::getSelectionList, e is: ", e);
console.log("ret is", ret);
return window.$gz._.sortBy(ret, "name");
//sort by name
ret.sort(window.$gz.util.sortByKey("name"));
return ret;
},
///////////////////////////////////
//
@@ -67,7 +64,7 @@ export default {
// ACCEPTS an ARRAY or a single STRING KEY
//
async fetchEnumList(enumKey) {
if (!window.$gz._.isArray(enumKey)) {
if (!Array.isArray(enumKey)) {
enumKey = [enumKey];
}
for (let i = 0; i < enumKey.length; i++) {
@@ -75,7 +72,10 @@ export default {
//if not then fetch it and store it
let k = enumKey[i].toLowerCase();
if (!window.$gz._.has(window.$gz.store.state.enums, k)) {
//de-lodash
// if (!window.$gz. _.has(window.$gz.store.state.enums, k)) {
//enums is an object this is checking if that object has a key with the name in k
if (!window.$gz.util.has(window.$gz.store.state.enums, k)) {
let that = this;
// eslint-disable-next-line
let dat = await that.fetchEnumKey(k);