From d642f663f304a626cbafffdceeac163565cc8961 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 2 May 2024 16:13:34 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20load=20=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B8=9A=E0=B8=9A=20kpi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../08_KPI/components/Tab/01_Assessment.vue | 47 ++++++------------- src/modules/08_KPI/components/Tab/TabMain.vue | 16 +++++-- .../components/Tab/Topic/02_Competency.vue | 8 +--- src/modules/08_KPI/views/form.vue | 38 +++++++-------- 4 files changed, 48 insertions(+), 61 deletions(-) diff --git a/src/modules/08_KPI/components/Tab/01_Assessment.vue b/src/modules/08_KPI/components/Tab/01_Assessment.vue index 680a5d6..97d2620 100644 --- a/src/modules/08_KPI/components/Tab/01_Assessment.vue +++ b/src/modules/08_KPI/components/Tab/01_Assessment.vue @@ -16,13 +16,20 @@ import { useKpiDataStore } from "@/modules/08_KPI/store"; import type { ListCriteria } from "@/modules/08_KPI/interface/request/index"; -const score = defineModel("score", { type: Number, default: 0 }); +const indicatorScore = defineModel("indicatorScore", { + type: Number, + default: 0, +}); +const competencyScore = defineModel("competencyScore", { + type: Number, + default: 0, +}); const dataListCriteria = ref([]); const modalCriteria = ref(false); const $q = useQuasar(); const route = useRoute(); -const { showLoader, hideLoader, messageError } = useCounterMixin(); +const { hideLoader, messageError } = useCounterMixin(); const store = useKpiDataStore(); const evaluationId = ref(route.params.id.toString()); @@ -37,7 +44,6 @@ const totalResults3 = ref(0); // const resultWork = ref(0); function fetchListPlanned() { - showLoader(); http .get(config.API.kpiAchievement("planned") + `?id=${evaluationId.value}`) .then((res) => { @@ -64,14 +70,10 @@ function fetchListPlanned() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } function fetchListRole() { - showLoader(); http .get(config.API.kpiAchievement("role") + `?id=${evaluationId.value}`) .then((res) => { @@ -98,14 +100,10 @@ function fetchListRole() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } function fetchAssigned() { - showLoader(); http .get(config.API.kpiAchievement("special") + `?id=${evaluationId.value}`) .then((res) => { @@ -133,9 +131,6 @@ function fetchAssigned() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -143,10 +138,9 @@ function onInfo() { modalCriteria.value = true; } -const totalCompetency = ref(0); const resultWork = computed(() => { const total = totalResults1.value + totalResults2.value + totalResults3.value; - score.value = total; + indicatorScore.value = total; return total.toFixed(2); }); @@ -159,25 +153,9 @@ function getCriteria() { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); } -watch( - () => totalCompetency.value, - (newValue, oldValue) => { - if (newValue !== oldValue) { - score.value = - totalResults1.value + - totalResults2.value + - totalResults3.value + - newValue; - } - } -); - watch( () => store.dataEvaluation.plannedPoint, (newValue, oldValue) => { @@ -210,6 +188,9 @@ onMounted(() => { fetchListPlanned(); fetchListRole(); fetchAssigned(); + setTimeout(() => { + hideLoader(); + }, 1000); }); @@ -286,7 +267,7 @@ onMounted(() => { diff --git a/src/modules/08_KPI/components/Tab/TabMain.vue b/src/modules/08_KPI/components/Tab/TabMain.vue index 9e701c3..431b664 100644 --- a/src/modules/08_KPI/components/Tab/TabMain.vue +++ b/src/modules/08_KPI/components/Tab/TabMain.vue @@ -12,8 +12,14 @@ import File from "@/modules/08_KPI/components/Tab/05_File.vue"; const store = useKpiDataStore(); const route = useRoute(); const isReadonly = (route.name === "KPIEditEvaluator" ? true : false); -const score = defineModel("score", { type: Number, default: 0 }); - +const indicatorScore = defineModel("indicatorScore", { + type: Number, + default: 0, +}); +const competencyScore = defineModel("competencyScore", { + type: Number, + default: 0, +}); const itemsTab = ref([ { name: "1", @@ -84,7 +90,11 @@ const splitterModel = ref(12); :name="tab.name" class="q-pa-none" > - + diff --git a/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue b/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue index 7ee27a2..ec1f213 100644 --- a/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue +++ b/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue @@ -18,7 +18,7 @@ import type { const dataListCriteria = defineModel("dataListCriteria", { required: true, }); -const totalCompetency = defineModel("totalCompetency", { +const competencyScore = defineModel("competencyScore", { type: Number, default: 0, }); @@ -118,7 +118,6 @@ const lists = ref([]); const resultEvaluation = ref(0); function getData(type: string) { - showLoader(); http .get(config.API.kpiUserCapacity + `?id=${id.value}&type=${type}`) .then(async (res) => { @@ -163,11 +162,8 @@ function getData(type: string) { ? (resultAvg / weightAvg) * store.dataEvaluation.capacityPoint : 0; resultEvaluation.value = sum.toFixed(2); - totalCompetency.value = sum; + competencyScore.value = sum; } - // end cal summary - - hideLoader(); }); } diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index e685def..4b1340c 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -49,7 +49,8 @@ const commanderHighMainOp = ref([]); const evaluatorId = ref(null); const commanderId = ref(null); const commanderHighId = ref(null); -const score = ref(0); +const indicatorScore = ref(0); +const competencyScore = ref(0); const formProfile = reactive({ fullName: "", @@ -65,7 +66,6 @@ const formProfile = reactive({ const router = useRouter(); function fetchEvaluation() { - showLoader(); http .get(config.API.kpiEvaluation + `/${id.value}`) .then((res) => { @@ -83,14 +83,13 @@ function fetchEvaluation() { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); + // .finally(() => { + // hideLoader(); + // }); } function getProfile() { - showLoader(); http .get(config.API.profilePosition()) .then((res) => { @@ -106,14 +105,13 @@ function getProfile() { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); + // .finally(() => { + // hideLoader(); + // }); } async function fetchProfile(id: string) { - showLoader(); await http .get( config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`) @@ -123,9 +121,6 @@ async function fetchProfile(id: string) { }) .catch(() => { // profilePicture.value = avatar; - }) - .finally(() => { - hideLoader(); }); } @@ -251,9 +246,10 @@ watch( } else { scoreTotal.value = true; } - } else { - console.log(2); } + // else { + // console.log(2); + // } } ); @@ -296,8 +292,9 @@ async function getAll() { await getOrgOp(); } -onMounted(() => { - getAll(); +onMounted(async () => { + showLoader(); + await getAll(); }); @@ -441,7 +438,7 @@ onMounted(() => {
คะแนนประเมิน {{ - score.toFixed(2) + (indicatorScore + competencyScore).toFixed(2) }}
@@ -452,7 +449,10 @@ onMounted(() => { - +