From b5829ec905a8831de2e0d9b0fdf1da5dd48c6d26 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 30 Sep 2024 17:26:20 +0700 Subject: [PATCH] fix load --- src/modules/17_acting/views/main.vue | 36 +++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/modules/17_acting/views/main.vue b/src/modules/17_acting/views/main.vue index a45f7c996..7b041e42d 100644 --- a/src/modules/17_acting/views/main.vue +++ b/src/modules/17_acting/views/main.vue @@ -2,12 +2,11 @@ import { ref, onMounted } from "vue"; import { useQuasar } from "quasar"; -import http from "@/plugins/http"; -import config from "@/app.config"; - import { checkPermission } from "@/utils/permissions"; import { useCounterMixin } from "@/stores/mixin"; import { useStructureTree } from "@/stores/structureTree"; +import http from "@/plugins/http"; +import config from "@/app.config"; /** importType*/ import type { QTableProps } from "quasar"; @@ -17,7 +16,7 @@ import type { ListPerson, } from "@/modules/17_acting/interface/response/Main"; -/** importStore*/ +import LoadView from "@/components/LoadView.vue"; /** use*/ const $q = useQuasar(); @@ -59,14 +58,20 @@ async function fetchOrganizationActive() { } } +const isLaod = ref(false); + /** - * function เลือกตำแหน่งที่จะให่รักษาการ + * function เลือกตำแหน่งที่จะให้ษาการ * @param data ข้อมูลตำแหน่ง */ async function updateSelected(data: PosMaster) { posmasterId.value = data.posmasterId; + isLaod.value = true; // เรียกใช้ function fetch รายชื่อ ,fetch รายชื่อรักษาการ - await Promise.all([fetchPosMaster(), fetchListAct()]); + await Promise.all([fetchPosMaster(), fetchListAct()]).finally(() => { + isLaod.value = false; + console.log("test"); + }); } /** ตำแหน่ง*/ @@ -143,9 +148,8 @@ const keyword = ref(""); /** * function fetch รายชื่อ */ -function fetchPosMaster() { - showLoader(); - http +async function fetchPosMaster() { + await http .post(config.API.orgPosAct + `/search`, { posmasterId: posmasterId.value, isAll: isAll.value, @@ -156,9 +160,6 @@ function fetchPosMaster() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -198,9 +199,8 @@ const keywordAct = ref(""); /** * function fetch รายชื่อรักษาการ */ -function fetchListAct() { - showLoader(); - http +async function fetchListAct() { + await http .get(config.API.orgPosAct + `/${posmasterId.value}`) .then((res) => { const data = res.data.result; @@ -208,9 +208,6 @@ function fetchListAct() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -341,7 +338,8 @@ onMounted(() => { class="col-lg-9 col-md-8 col-xs-12 scroll" style="height: 80vh" > -
+ +