This commit is contained in:
2020-04-02 14:03:56 +00:00
parent b38a7b78f4
commit bb5a20a374

View File

@@ -11,13 +11,13 @@ export default {
// //
getSelectionList(enumKey) { getSelectionList(enumKey) {
enumKey = enumKey.toLowerCase(); enumKey = enumKey.toLowerCase();
var e = window.$gz.store.state.enums[enumKey]; let e = window.$gz.store.state.enums[enumKey];
if (!e) { if (!e) {
throw "ERROR enums::getSelectionList -> enumKey " + throw "ERROR enums::getSelectionList -> enumKey " +
enumKey + enumKey +
" is missing from store"; " is missing from store";
} }
var ret = []; let ret = [];
//turn it into an array suitable for selection lists //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 }); ret.push({ id: Number(key), name: value });
@@ -35,19 +35,19 @@ export default {
enumKey = [enumKey]; enumKey = [enumKey];
} }
for (var i = 0; i < enumKey.length; i++) { for (let i = 0; i < enumKey.length; i++) {
//check if list //check if list
//if not then fetch it and store it //if not then fetch it and store it
var k = enumKey[i].toLowerCase(); let k = enumKey[i].toLowerCase();
if (!window.$gz._.has(window.$gz.store.state.enums, k)) { if (!window.$gz._.has(window.$gz.store.state.enums, k)) {
var that = this; let that = this;
await that.fetch(k).then(dat => { await that.fetch(k).then(dat => {
//massage the data as necessary //massage the data as necessary
var e = { enumKey: k, items: {} }; let e = { enumKey: k, items: {} };
for (var i = 0; i < dat.length; i++) { for (let i = 0; i < dat.length; i++) {
var o = dat[i]; let o = dat[i];
e.items[o.id] = o.name; e.items[o.id] = o.name;
} }
//stuff the data into the store //stuff the data into the store