From 01dc0ad34880384cb9c7e8e60f7bd3b74396e959 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 15 Aug 2025 11:00:12 +0700 Subject: [PATCH] fix: load skeleton --- .../08_KPI/components/Tab/01_Assessment.vue | 1 + .../components/Tab/Dialog/DialogDevelop.vue | 106 +++++++++--------- src/modules/08_KPI/views/form.vue | 15 ++- src/modules/08_KPI/views/main.vue | 17 ++- src/modules/09_scholarship/views/main.vue | 12 +- 5 files changed, 85 insertions(+), 66 deletions(-) diff --git a/src/modules/08_KPI/components/Tab/01_Assessment.vue b/src/modules/08_KPI/components/Tab/01_Assessment.vue index 9ee4872..df1b369 100644 --- a/src/modules/08_KPI/components/Tab/01_Assessment.vue +++ b/src/modules/08_KPI/components/Tab/01_Assessment.vue @@ -270,6 +270,7 @@ const groupNo = computed(() => { }); onMounted(() => { + store.indicatorWeightTotal = 0 getCriteria(); fetchListPlanned(); fetchListRole(); diff --git a/src/modules/08_KPI/components/Tab/Dialog/DialogDevelop.vue b/src/modules/08_KPI/components/Tab/Dialog/DialogDevelop.vue index 6874370..7ec9cbc 100644 --- a/src/modules/08_KPI/components/Tab/Dialog/DialogDevelop.vue +++ b/src/modules/08_KPI/components/Tab/Dialog/DialogDevelop.vue @@ -30,7 +30,7 @@ const props = defineProps({ const route = useRoute(); const idKpi = ref(route.params.id.toLocaleString()); -const isLoadMain = defineModel('isLoadMain',{required:true}) +const isLoadMain = defineModel("isLoadMain", { required: true }); const isLoad = ref(false); const development = ref([]); //ตัวแปรเก็บ ตัวเลือกการพัฒนา const reasonDevelopment70 = ref(""); //อื่นๆ การลงมือปฏิบัติ (โดยผู้บังคับบัญชามอบหมาย) @@ -187,8 +187,6 @@ function close() { reasonDevelopment20.value = ""; reasonDevelopment10.value = ""; development.value = []; - - props.getAll?.(); } /** บันทึกข้อมูลการพัฒนาตน */ @@ -222,7 +220,7 @@ function onSubmit() { selectTypeYear: formData.year ? formData.year.toString() : null, selectTypeId: projectName.value ? projectName.value.id : null, }; - isLoadMain.value = true + isLoadMain.value = true; http[id.value ? "put" : "post"](url, body) .then((res) => { close(); @@ -238,9 +236,10 @@ function onSubmit() { } } +const isLoadYear = ref(false); async function getDataByYear() { if (formData.year) { - showLoader(); + isLoadYear.value = true; http .get(config.API.developmentMain + `/done?year=${formData.year}`) .then(async (res) => { @@ -251,13 +250,14 @@ async function getDataByYear() { messageError($q, e); }) .finally(() => { - hideLoader(); + isLoadYear.value = false; }); } } +const isLoadProject = ref(false); function getProjectDetail(val: any) { - showLoader(); + isLoadProject.value = true; http .get(config.API.developmentMain + `/tab3_1/${val.id}`) .then((res) => { @@ -285,7 +285,7 @@ function getProjectDetail(val: any) { messageError($q, e); }) .finally(() => { - hideLoader(); + isLoadProject.value = false; }); } @@ -429,7 +429,7 @@ watch(
70 การลงมือปฏิบัติ (โดยผู้บังคับบัญชามอบหมาย) - - - - - + + + + + + +
20 การเรียนรู้จากผู้อื่น (Coach/Mentor/Consulting) - - - - - + + + + + + +
10 การฝึกอบรมอื่นๆ - - - - - + + + + + + +
(false); async function getData() { - showLoader(); + isLoadUpload.value = true; await http .get(config.API.file("แบบกำหนดข้อตกลง", "KPI", id.value)) .then((res) => { fileList.value = res.data; + isLoadUpload.value = false; }) .catch((e) => { messageError($q, e); + isLoadUpload.value = false; }) - .finally(() => { - hideLoader(); - }); + .finally(() => {}); } /** @@ -1355,7 +1356,11 @@ onMounted(async () => {
-
+
+ +
+ +
(false); async function fetchRoundOption(type: string) { const y = type === "main" ? year.value : yearDialog.value; - isLoadOp.value = true; + type == "main" && (isLoadOp.value = true); + type == "dialog" && (isLoadDialog.value = true); await http .get( config.API.kpiPeriod + `?page=${1}&pageSize=${10}&keyword=${""}&year=${y}` @@ -199,7 +201,8 @@ async function fetchRoundOption(type: string) { messageError($q, err); }) .finally(() => { - isLoadOp.value = false; + type == "main" && (isLoadOp.value = false); + type == "dialog" && (isLoadDialog.value = false); }); } @@ -207,7 +210,7 @@ async function fetchRoundOption(type: string) { * fetch รายการขอรับประเมินผลการปฏิบัติราชการระดับบุคคล */ async function fetchList() { - isLoad.value = true + isLoad.value = true; let queryParams = { page: formQuery.page, pageSize: formQuery.pageSize, @@ -225,10 +228,10 @@ async function fetchList() { total.value = data.total; totalList.value = Math.ceil(data.total / formQuery.pageSize); rows.value = data.data; - isLoad.value = false + isLoad.value = false; }) .catch((err) => { - isLoad.value = false + isLoad.value = false; messageError($q, err); }) .finally(() => {}); @@ -612,7 +615,7 @@ onMounted(async () => {
{
{ :rules="[(val:DataOptions) => !!val.id || `${'กรุณาเลือกรอบการประเมิน'}`]" @update:model-value="checkClosed" /> +
diff --git a/src/modules/09_scholarship/views/main.vue b/src/modules/09_scholarship/views/main.vue index b25beef..44470f4 100644 --- a/src/modules/09_scholarship/views/main.vue +++ b/src/modules/09_scholarship/views/main.vue @@ -88,7 +88,7 @@ const visibleColumns = ref(["scholarshipYear", "scholarshipType"]); /** ดึงข้อมูล */ async function getData() { - showLoader(); + await http .get( config.API.developmentScholarship + @@ -96,12 +96,13 @@ async function getData() { ) .then(async (res) => { rows.value = res.data.result; + isLoad.value = false }) .catch((e) => { messageError($q, e); }) .finally(() => { - hideLoader(); + isLoad.value = false }); } @@ -127,19 +128,20 @@ function onEdit(id: string) { // ); async function getProfileId() { + isLoad.value = true if (dataStore.profileId) { profilId.value = dataStore.profileId; } else { - isLoad.value = true; + try { const res = await http.get(config.API.profilePosition()); dataStore.profileId = res.data.result.profileId; profilId.value = dataStore.profileId; - isLoad.value = false; + } catch (e) { messageError($q, e); } finally { - isLoad.value = false; + } }