This commit is contained in:
2020-07-28 18:04:39 +00:00
parent a132ebebe9
commit 49f1a78c4c
2 changed files with 16 additions and 12 deletions

View File

@@ -295,9 +295,7 @@ function generateMenu(vm) {
//
async function initForm(vm) {
await fetchTranslatedText(vm);
console.log("userIdList is ", vm.$route.params.userIdList);
if (vm.$route.params.userIdList != undefined) {
//userIdList is 1,2,3,4
await preFillSelection(vm);
}
}
@@ -320,15 +318,18 @@ async function fetchTranslatedText(vm) {
// Pre fill if pre-selected users
//
async function preFillSelection(vm) {
//iterate the list
//vm.$route.params.userIdList;
// let temp = new Array();
// temp = vm.$route.params.userIdList.split(",");
// for (a in temp) {
// temp[a] = parseInt(temp[a], 10); // Explicitly include base as per Álvaro's comment
// }
let t = vm.$route.params.userIdList.split(",").map(z => parseInt(z, 10));
console.log("Prefill selection array is", t);
let l = vm.$route.params.userIdList.split(",").map(z => parseInt(z, 10));
//iterate the array, fetch and store each user returned from
//pick-list/List?ayaType=3&preId=[IDVALUE]
//into vm.toUsers
for (let i of l) {
if (vm.toUsers.find(z => z.id == i)) {
continue;
}
let res = await window.$gz.api.get("pick-list/List?ayaType=3&preId=" + i);
if (res.data) {
vm.toUsers.push(res.data[0]);
}
}
}
</script>