From a69d9e331d304ca2941d75f8c31baf8154b1e1c6 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 9 May 2024 17:14:21 +0700 Subject: [PATCH] updated kpi --- src/api/KPI/api.kpis.ts | 2 +- .../08_KPI/components/Tab/01_Assessment.vue | 116 +++++++++--------- .../Tab/Dialog/04_FormCompetency.vue | 5 +- .../Tab/DialogEvaluate/02_Competenct.vue | 1 + src/modules/08_KPI/components/Tab/TabMain.vue | 14 +-- .../components/Tab/Topic/01_Indicator.vue | 12 -- .../components/Tab/Topic/02_Competency.vue | 5 - src/modules/08_KPI/views/form.vue | 49 +++++--- 8 files changed, 97 insertions(+), 107 deletions(-) diff --git a/src/api/KPI/api.kpis.ts b/src/api/KPI/api.kpis.ts index 2ec25e7..eaf5e66 100644 --- a/src/api/KPI/api.kpis.ts +++ b/src/api/KPI/api.kpis.ts @@ -34,7 +34,7 @@ export default { KpiEvaluationInfo, Kpiorg, kpiEvaluationCheck: `${kpiEvaluation}/check`, - + kpiSendToStatus: (id: string) => `${kpiEvaluation}/status/${id}`, /**ประเมิน*/ kpiAchievementDevelop:`${kpiAchievement}/development` }; diff --git a/src/modules/08_KPI/components/Tab/01_Assessment.vue b/src/modules/08_KPI/components/Tab/01_Assessment.vue index 7c5fadb..7c4bb1a 100644 --- a/src/modules/08_KPI/components/Tab/01_Assessment.vue +++ b/src/modules/08_KPI/components/Tab/01_Assessment.vue @@ -18,11 +18,7 @@ import { useKpiDataStore } from "@/modules/08_KPI/store"; import type { ListCriteria } from "@/modules/08_KPI/interface/request/index"; -const indicatorScore = defineModel("indicatorScore", { - type: Number, - default: 0, -}); -const competencyScore = defineModel("competencyScore", { +const indicatorWeightTotal = defineModel("indicatorWeightTotal", { type: Number, default: 0, }); @@ -119,6 +115,9 @@ const columns = ref([ }, ]); +const weightPlanned = ref(0); +const weightRole = ref(0); +const weightAssigned = ref(0); function fetchListPlanned() { http .get(config.API.kpiAchievement("planned") + `?id=${evaluationId.value}`) @@ -140,6 +139,8 @@ function fetchListPlanned() { 0 ); + weightPlanned.value = weight; + totalResults1.value = (result * store.dataEvaluation.plannedPoint) / weight; } @@ -170,6 +171,8 @@ function fetchListRole() { 0 ); + weightRole.value = weight; + totalResults2.value = (result * store.dataEvaluation.rolePoint) / weight; } @@ -201,6 +204,8 @@ function fetchAssigned() { 0 ); + weightAssigned.value = weight; + totalResults3.value = (result * store.dataEvaluation.specialPoint) / weight; } @@ -216,7 +221,6 @@ function onInfo() { const resultWork = computed(() => { const total = totalResults1.value + totalResults2.value + totalResults3.value; - indicatorScore.value = total; return total.toFixed(2); }); @@ -233,28 +237,13 @@ function getCriteria() { } watch( - () => store.dataEvaluation.plannedPoint, - (newValue, oldValue) => { - if (newValue !== oldValue) { - fetchListPlanned(); - } - } -); - -watch( - () => store.dataEvaluation.rolePoint, - (newValue, oldValue) => { - if (newValue !== oldValue) { - fetchListRole(); - } - } -); - -watch( - () => store.dataEvaluation.specialPoint, - (newValue, oldValue) => { - if (newValue !== oldValue) { - fetchAssigned(); + [weightPlanned, weightRole, weightAssigned], + ([newA, newB, newC], [prevA, prevB, prevC]) => { + if (newA !== prevA || newB !== prevB || newC !== prevC) { + indicatorWeightTotal.value = + Number(weightPlanned.value) + + Number(weightAssigned.value) + + Number(weightRole.value); } } ); @@ -330,27 +319,47 @@ onMounted(() => {
- - - +
+ + +
+ +
+ + + +
+
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 27abba3..a0558f9 100644 --- a/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue +++ b/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue @@ -18,10 +18,6 @@ import type { const dataListCriteria = defineModel("dataListCriteria", { required: true, }); -const competencyScore = defineModel("competencyScore", { - type: Number, - default: 0, -}); const sortedDataListCriteria = computed(() => { return dataListCriteria.value.sort((a, b) => a.level - b.level); @@ -168,7 +164,6 @@ function getData(type: string) { ? (resultAvg / weightAvg) * store.dataEvaluation.capacityPoint : 0; // resultEvaluation.value = sum.toFixed(2); - competencyScore.value = sum; } }); } diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index 881fcd9..78d8e11 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -293,25 +293,21 @@ function sendToEvaluatore() { $q, () => { if (id.value) { - // showLoader(); - // http - // .put(config.API.kpiEvaluationCheck + `/${id.value}`, { - // evaluatorId: evaluatorId.value ? evaluatorId.value.id : null, - // commanderId: commanderId.value ? commanderId.value.id : null, - // commanderHighId: commanderHighId.value - // ? commanderHighId.value.id - // : null, - // }) - // .then((res) => { - // success($q, "บันทึกสำเร็จ"); - // close(); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); + showLoader(); + http + .put(config.API.kpiSendToStatus(id.value), { + status: "NEW_EVALUATOR", + }) + .then((res) => { + success($q, "ส่งข้อตกลงให้ผู้ประเมินอนุมัติสำเร็จ"); + close(); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); } }, "ยืนยันการส่งข้อตกลงให้ผู้ประเมินอนุมัติ", @@ -350,6 +346,7 @@ function requireEdit() { ); } +const indicatorWeightTotal = ref(0); onMounted(async () => { showLoader(); await getAll(); @@ -402,12 +399,23 @@ onMounted(async () => { }}
+ *น้ำหนัก(ร้อยละ) ผลสัมฤทธิ์ของงานไม่ถูกต้อง {