diff --git a/src/modules/08_KPI/components/Tab/01_Assessment.vue b/src/modules/08_KPI/components/Tab/01_Assessment.vue index e3b7464..1302797 100644 --- a/src/modules/08_KPI/components/Tab/01_Assessment.vue +++ b/src/modules/08_KPI/components/Tab/01_Assessment.vue @@ -152,10 +152,6 @@ function fetchAssigned() { }); } -function onInfo() { - modalCriteria.value = true; -} - function getCriteria() { http .get(config.API.KpiEvaluationInfo) @@ -195,6 +191,24 @@ watch( store.indicatorScoreVal = store.indicatorPercentVal * (store.indicatorScore / 100); + + if ( + store.isUpdate && + store.tabMain === "3" && + (store.dataEvaluation.evaluationStatus === "EVALUATOR" || + store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR") + ) { + http + .put(config.API.updatePoint(evaluationId.value), { + totalPoint1: store.indicatorScoreVal.toFixed(2), + summaryPoint: ( + store.indicatorScoreVal + + store.competencyScoreVal + + store.devScoreVal + ).toFixed(2), + }) + .then((res) => {}); + } } } ); @@ -221,7 +235,12 @@ onMounted(() => {
-
+
{ :rows="[ { name: `สรุปผลการประเมินสมรรถนะ (คะแนนเต็ม ${ - !store.dataEvaluation.posExecutiveName + store.dataEvaluation.posTypeName != 'อำนวยการ' && + store.dataEvaluation.posTypeName != 'บริหาร' ? store.competencyScore : store.excusiveCompetencyScore } คะแนน)`, @@ -446,7 +466,12 @@ onMounted(() => { class="q-mt-xs q-mb-md" /> -
+
@@ -484,7 +509,10 @@ onMounted(() => {
diff --git a/src/modules/08_KPI/components/Tab/04_Result.vue b/src/modules/08_KPI/components/Tab/04_Result.vue index 6e763fb..f553678 100644 --- a/src/modules/08_KPI/components/Tab/04_Result.vue +++ b/src/modules/08_KPI/components/Tab/04_Result.vue @@ -37,10 +37,10 @@ const additionalSuperiorComment = ref(""); const superiorCommentCheck = ref(""); const additionalSuperiorCheck = ref(""); -const weight1 = ref(10); +const weight1 = ref(0); const result1 = ref(0); -const weight2 = ref(50); -const result2 = ref(60); +const weight2 = ref(0); +const result2 = ref(0); const sumWeight = computed(() => { return weight1.value + weight2.value; }); @@ -179,6 +179,10 @@ async function fetchEvaluation() { .then(async (res) => { const data = res.data.result; store.dataEvaluation = await data; + + if (data.profileId == store.dataProfile.id) { + userOpen(); + } }) .catch((e) => { messageError($q, e); @@ -188,6 +192,12 @@ async function fetchEvaluation() { }); } +function userOpen() { + http.get(config.API.openPoint(id.value)).then(async (res) => { + // success($q, "เปิดการประเมินสำเร็จ"); + }); +} + function getData() { http .get(config.API.kpiSendToGet(id.value)) @@ -202,9 +212,10 @@ function getData() { additionalSuperiorCheck.value = data.isReasonCommanderHigh.toString(); additionalSuperiorComment.value = data.reasonCommanderHigh; - result1.value = data.totalPoint1 - result2.value = data.totalPoint2_1 + data.totalPoint2_2 - + result1.value = data.totalPoint1; + result2.value = data.totalPoint2_1 + data.totalPoint2_2; + weight1.value = data.weightPoint1; + weight2.value = data.weightPoint2; }) .catch((e) => { messageError($q, e); @@ -456,7 +467,10 @@ onMounted(() => { lazy-rules v-model="superiorComment" outlined - :readonly="superiorCommentCheck == 'true'||store.dataEvaluation.evaluationStatus !== 'SUMMARY_COMMANDER'" + :readonly=" + superiorCommentCheck == 'true' || + store.dataEvaluation.evaluationStatus !== 'SUMMARY_COMMANDER' + " type="textarea" label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไป" hide-bottom-space diff --git a/src/modules/08_KPI/components/Tab/DialogEvaluate/01_Indicator.vue b/src/modules/08_KPI/components/Tab/DialogEvaluate/01_Indicator.vue index 15ac908..4c07415 100644 --- a/src/modules/08_KPI/components/Tab/DialogEvaluate/01_Indicator.vue +++ b/src/modules/08_KPI/components/Tab/DialogEvaluate/01_Indicator.vue @@ -130,7 +130,7 @@ function onSubmit() { dialogConfirm($q, async () => { try { showLoader(); - console.log(rows.value); + store.isUpdate = true; const formData = rows.value.map((e: any) => ({ id: e.id, diff --git a/src/modules/08_KPI/components/Tab/DialogEvaluate/02_Competenct.vue b/src/modules/08_KPI/components/Tab/DialogEvaluate/02_Competenct.vue index 5aa515d..4e5450c 100644 --- a/src/modules/08_KPI/components/Tab/DialogEvaluate/02_Competenct.vue +++ b/src/modules/08_KPI/components/Tab/DialogEvaluate/02_Competenct.vue @@ -115,6 +115,7 @@ function onSubmit() { dialogMessageNotify($q, "กรุณาเลือกระดับคะแนนตามเกณฑ์การประเมิน"); } else { dialogConfirm($q, () => { + store.isUpdate = true; const data = rows.value; const body = data.map((i: any) => ({ id: i.id, diff --git a/src/modules/08_KPI/components/Tab/DialogEvaluate/03_DialogEvalutionDevelop.vue b/src/modules/08_KPI/components/Tab/DialogEvaluate/03_DialogEvalutionDevelop.vue index 4f2fe3c..33a0726 100644 --- a/src/modules/08_KPI/components/Tab/DialogEvaluate/03_DialogEvalutionDevelop.vue +++ b/src/modules/08_KPI/components/Tab/DialogEvaluate/03_DialogEvalutionDevelop.vue @@ -5,11 +5,14 @@ import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar, type QTableProps } from "quasar"; import { ref } from "vue"; +import { useKpiDataStore } from "@/modules/08_KPI/store"; const props = defineProps({ getAll: Function, }); +const store = useKpiDataStore(); + const $q = useQuasar(); const mixin = useCounterMixin(); const { @@ -89,6 +92,7 @@ function onSubmit() { summary: i.summary, })); showLoader(); + store.isUpdate = true; http .post(config.API.kpiAchievementDevelop + `/point`, data) .then((res) => { 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 26ba5b1..78d52ec 100644 --- a/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue +++ b/src/modules/08_KPI/components/Tab/Topic/02_Competency.vue @@ -20,7 +20,7 @@ import DialogListCriteria from "@/modules/08_KPI/components/Tab/Dialog/DialogLis import DialogCompetncyByRow from "@/modules/08_KPI/components/Tab/Dialog/DialogCompetncyByRow.vue"; import DialogLevel from "@/modules/08_KPI/components/Tab/Dialog/DialogLevel.vue"; -const modalLevel = ref(false) +const modalLevel = ref(false); const modalCompetncyByRow = ref(false); const dataCompetncyByRow = ref([]); const dataLevel = ref([]); @@ -170,7 +170,10 @@ function getData(type: string) { let weightAvg = weight / total; let resultAvg = result / total; - if (store.dataEvaluation.posExecutiveName != null) { + if ( + store.dataEvaluation.posTypeName == "อำนวยการ" && + store.dataEvaluation.posTypeName == "บริหาร" + ) { store.competencyScoreVal = weightAvg != 0 ? (resultAvg / weightAvg) * store.excusiveCompetencyScore @@ -181,6 +184,24 @@ function getData(type: string) { ? (resultAvg / weightAvg) * store.competencyScore : 0; } + + if ( + store.isUpdate && + store.tabMain === "3" && + (store.dataEvaluation.evaluationStatus === "EVALUATOR" || + store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR") + ) { + http + .put(config.API.updatePoint(store.dataEvaluation.id), { + totalPoint2_1: store.competencyScoreVal.toFixed(2), + summaryPoint: ( + store.indicatorScoreVal + + store.competencyScoreVal + + store.devScoreVal + ).toFixed(2), + }) + .then((res) => {}); + } } }); } @@ -248,7 +269,7 @@ const isEditStep3 = computed(() => { store.tabMain === "3") || (store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" && store.rolePerson === "EVALUATOR" && - store.tabMain === "3")|| + store.tabMain === "3") || (store.dataEvaluation.evaluationStatus === "EVALUATING" && store.rolePerson === "EVALUATOR" && store.tabMain === "3") @@ -276,9 +297,9 @@ function onAchievement(data: any) { dataCompetncyByRow.value = data; } -function onLevel(num:number,list:any){ - dataLevel.value = list.filter((i:any)=> i.level == num) - modalLevel.value = true +function onLevel(num: number, list: any) { + dataLevel.value = list.filter((i: any) => i.level == num); + modalLevel.value = true; } onMounted(() => { @@ -407,7 +428,12 @@ onMounted(() => { }}
-
{{ props.row.level }}
+
+ {{ props.row.level }} +
{{ col.value }} @@ -595,10 +621,7 @@ onMounted(() => { v-model:rows="dataCompetncyByRow" /> - +