diff --git a/src/modules/07_insignia/components/4_Allocate/OrgAllocatePageList.vue b/src/modules/07_insignia/components/4_Allocate/OrgAllocatePageList.vue index 484e5b4a0..d53f3985e 100644 --- a/src/modules/07_insignia/components/4_Allocate/OrgAllocatePageList.vue +++ b/src/modules/07_insignia/components/4_Allocate/OrgAllocatePageList.vue @@ -107,7 +107,7 @@ const stat = ref({ /** * funcion เรียกข้อมูล stat */ -async function fecthDashboard() { +async function fetchDashboard() { await http .get(config.API.insigniaManageOrgDashboard(id.value)) .then((res) => { @@ -125,8 +125,8 @@ async function fecthDashboard() { /** * funcion เรียกข้อมูลรายชื่อ หน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ ตริตาภรณ์มงกุฎไทย () */ -async function fecthListData() { - showLoader(); +async function fetchListData() { + // showLoader(); await http .get(config.API.insigniaManageOrg(id.value)) .then((res) => { @@ -142,7 +142,7 @@ async function fecthListData() { messageError($q, err); }) .finally(() => { - hideLoader(); + // hideLoader(); }); } @@ -202,10 +202,9 @@ async function save(organizationId: string, total: string) { total: total, }) .then(async () => { - await fecthListData(); - await fecthDashboard(); - await success($q, "บันทึกมูลสำเร็จ"); - await close(); + await Promise.all([fetchListData(), fetchDashboard()]); + close(); + success($q, "บันทึกมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); @@ -227,13 +226,14 @@ async function saveEdit(organizationId: string, amount: number) { total: Number(amount), }) .then(async () => { - await fecthDashboard(); - await fecthListData(); - await close(); - await success($q, "แก้ไขมูลสำเร็จ"); + await Promise.all([fetchListData(), fetchDashboard()]); + close(); + success($q, "แก้ไขมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); + }) + .finally(() => { hideLoader(); }); } @@ -259,8 +259,7 @@ async function clickDelete(insigniaId: string) { await http .delete(config.API.insigniaManageOrg(insigniaId)) .then(async () => { - await fecthDashboard(); - await fecthListData(); + await Promise.all([fetchDashboard(), fetchListData()]); await success($q, "ลบข้อมูลสำเร็จ"); }) .catch((err) => { @@ -286,8 +285,13 @@ const resetFilter = () => { /** Hook*/ onMounted(async () => { + showLoader(); name.value = DataStore.insigniaName; - await Promise.all([fecthDashboard(), fecthListData(), fetchOrgList()]); + await Promise.all([ + fetchDashboard(), + fetchListData(), + fetchOrgList(), + ]).finally(() => hideLoader()); }); @@ -377,7 +381,6 @@ onMounted(async () => { map-options :options="columns" option-value="name" - style="min-width: 140px" class="col-xs-12 col-sm-3 col-md-2" />