This commit is contained in:
2020-10-07 15:30:34 +00:00
parent 2eb32a4fd8
commit 0185b6941c
12 changed files with 480 additions and 291 deletions

View File

@@ -30,7 +30,7 @@ export default {
// Used by forms to fetch selection list data
// Sorts alphabetically by default but can be turned off with do not sort
//
getSelectionList(enumKey, doNotSort) {
getSelectionList(enumKey) {
enumKey = enumKey.toLowerCase();
let e = window.$gz.store.state.enums[enumKey];
if (!e) {
@@ -41,16 +41,24 @@ export default {
);
}
let ret = [];
//turn it into an array suitable for selection lists
window.$gz._.forOwn(e, function(value, key) {
ret.push({ id: Number(key), name: value });
});
if (doNotSort == true) {
return ret;
} else {
return window.$gz._.sortBy(ret, "name");
//de-lodash
// //turn it into an array suitable for selection lists
// window.$gz._.forOwn(e, function(value, key) {
// ret.push({ id: Number(key), name: value });
// });
//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");
},
///////////////////////////////////
//