diff --git a/src/modules/13_salary/views/salaryLists.vue b/src/modules/13_salary/views/salaryLists.vue index be6e350e8..0f1286e5d 100644 --- a/src/modules/13_salary/views/salaryLists.vue +++ b/src/modules/13_salary/views/salaryLists.vue @@ -58,6 +58,8 @@ async function getRound() { (Number(x.year) + 543), })); + console.log(roundOptions.value); + roundFilter.value = await (roundOptions.value ? roundOptions.value[0] : ""); @@ -127,19 +129,20 @@ function getSnap(code: string) { * @param id revisionId */ async function getAgency(id: string) { - await http - .get(config.API.activeOrganizationRootById(id)) - .then(async (res) => { - const data = res.data.result; - agencyOptions.value = await data.map((x: DataAgency) => ({ - id: x.id, - name: x.orgRootName, + id && + (await http + .get(config.API.activeOrganizationRootById(id)) + .then(async (res) => { + const data = res.data.result; + agencyOptions.value = await data.map((x: DataAgency) => ({ + id: x.id, + name: x.orgRootName, + })); + agencyFilter.value = store.rootId; + }) + .catch((err) => { + messageError($q, err); })); - agencyFilter.value = store.rootId; - }) - .catch((err) => { - messageError($q, err); - }); } /** @@ -147,19 +150,21 @@ async function getAgency(id: string) { * @param id revisionId */ async function getAgencyPosition(id: string) { - await http - .get(config.API.keycloakPositionByid(id)) - .then(async (res) => { - const data = res.data.result; + if (id) { + await http + .get(config.API.keycloakPositionByid(id)) + .then(async (res) => { + const data = res.data.result; - const position = agencyOptions.value?.find( - (e: DataOption) => e.id === data.rootId - ); - agencyFilter.value = position ? position.id : ""; - }) - .catch((err) => { - messageError($q, err); - }); + const position = agencyOptions.value?.find( + (e: DataOption) => e.id === data.rootId + ); + agencyFilter.value = position ? position.id : ""; + }) + .catch((err) => { + messageError($q, err); + }); + } else agencyFilter.value = ""; } /** @@ -214,6 +219,8 @@ async function onChangeRound() { ); store.tabType = "PENDING"; store.roundMainCode = roundFilter.value.shortCode; + } else { + isLoad.value = false; } }