From d478001f327583d2bce11f5fec814e4f87dfd01a Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 26 Mar 2025 17:48:04 +0700 Subject: [PATCH] =?UTF-8?q?fix=20load=20=20=E0=B8=A3=E0=B8=B1=E0=B8=81?= =?UTF-8?q?=E0=B8=A9=E0=B8=B2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=83=E0=B8=99?= =?UTF-8?q?=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/17_acting/views/main.vue | 50 +++++++++++++--------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/modules/17_acting/views/main.vue b/src/modules/17_acting/views/main.vue index a04bac858..e76cce14f 100644 --- a/src/modules/17_acting/views/main.vue +++ b/src/modules/17_acting/views/main.vue @@ -48,7 +48,7 @@ async function fetchOrganizationActive() { nodeTree.value = await fetchTreeActing(""); } else { showLoader(); - http + await http .get(config.API.activeOrganization) .then(async (res) => { const data = res.data.result; @@ -154,9 +154,7 @@ const columns = ref([ ]); const keyword = ref(""); -/** - * function fetch รายชื่อ - */ +/**function fetch รายชื่อ*/ async function fetchPosMaster() { await http .post(config.API.orgPosAct + `/search`, { @@ -209,9 +207,7 @@ const rowListPerson = ref([]); const dataListPerson = ref([]); const keywordAct = ref(""); -/** - * function fetch รายชื่อรักษาการ - */ +/** function fetch รายชื่อรักษาการ*/ async function fetchListAct() { await http .get(config.API.orgPosAct + `/${posmasterId.value}`) @@ -267,21 +263,19 @@ function onDelete(id: string) { }); } -function getWorkFlow() { - showLoader(); - http - .get(config.API.workflowKeycloakSystem("SYS_ACTING")) - .then((res) => { - const data = res.data.result; - storeActing.isOfficer = data.isOfficer; - storeActing.isStaff = data.isStaff; - hideLoader(); - }) - .catch((e) => { - messageError($q, e); - hideLoader(); - }) - .finally(() => {}); +async function getWorkFlow() { + if (storeActing.isOfficer == null && storeActing.isStaff == null) { + await http + .get(config.API.workflowKeycloakSystem("SYS_ACTING")) + .then((res) => { + const data = res.data.result; + storeActing.isOfficer = data.isOfficer; + storeActing.isStaff = data.isStaff; + }) + .catch((e) => { + messageError($q, e); + }); + } } function onSearchRowPosition() { @@ -300,10 +294,14 @@ function onSearchListPerson() { ); } -onMounted(() => { - fetchOrganizationActive(); - if (storeActing.isOfficer == null && storeActing.isStaff == null) { - getWorkFlow(); +onMounted(async () => { + try { + showLoader(); + await Promise.all([fetchOrganizationActive(), getWorkFlow()]); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); } });