2024-04-09 15:22:23 +07:00
|
|
|
<script setup lang="ts">
|
2024-04-30 10:14:11 +07:00
|
|
|
import { ref, onMounted, computed, watch } from "vue";
|
2024-04-23 15:43:41 +07:00
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
import { useRoute } from "vue-router";
|
|
|
|
|
|
2024-04-24 14:24:59 +07:00
|
|
|
import DialogListCriteria from "@/modules/08_KPI/components/Tab/Dialog/DialogListCriteria.vue";
|
|
|
|
|
|
2024-04-23 15:43:41 +07:00
|
|
|
import config from "@/app.config";
|
|
|
|
|
import http from "@/plugins/http";
|
2024-04-09 15:22:23 +07:00
|
|
|
|
2024-04-22 18:14:48 +07:00
|
|
|
import Work from "@/modules/08_KPI/components/Tab/Topic/01_Indicator.vue";
|
|
|
|
|
import Competency from "@/modules/08_KPI/components/Tab/Topic/02_Competency.vue";
|
2024-04-09 15:22:23 +07:00
|
|
|
|
2024-04-23 15:43:41 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import { useKpiDataStore } from "@/modules/08_KPI/store";
|
|
|
|
|
|
2024-04-25 16:53:07 +07:00
|
|
|
import type { ListCriteria } from "@/modules/08_KPI/interface/request/index";
|
|
|
|
|
|
2024-04-29 17:56:09 +07:00
|
|
|
const score = defineModel("score", { type: Number, default: 0 });
|
2024-04-25 16:53:07 +07:00
|
|
|
const dataListCriteria = ref<ListCriteria[]>([]);
|
|
|
|
|
|
2024-04-25 09:47:29 +07:00
|
|
|
const modalCriteria = ref<boolean>(false);
|
2024-04-23 15:43:41 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
|
|
|
|
const store = useKpiDataStore();
|
|
|
|
|
|
|
|
|
|
const evaluationId = ref<string>(route.params.id.toString());
|
|
|
|
|
|
2024-04-09 15:22:23 +07:00
|
|
|
const rows_01 = ref<any[]>();
|
|
|
|
|
const rows_02 = ref<any[]>();
|
|
|
|
|
const rows_03 = ref<any[]>();
|
|
|
|
|
|
2024-04-24 15:00:53 +07:00
|
|
|
const totalResults1 = ref<number>(0);
|
|
|
|
|
const totalResults2 = ref<number>(0);
|
|
|
|
|
const totalResults3 = ref<number>(0);
|
|
|
|
|
// const resultWork = ref<number>(0);
|
2024-04-09 15:22:23 +07:00
|
|
|
|
2024-04-23 15:43:41 +07:00
|
|
|
function fetchListPlanned() {
|
|
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(config.API.kpiAchievement("planned") + `?id=${evaluationId.value}`)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data.result;
|
2024-04-24 15:00:53 +07:00
|
|
|
const newRow = data.map((e: any) => ({
|
|
|
|
|
...e,
|
|
|
|
|
evaluationResults: (e.point / 5) * e.weight,
|
|
|
|
|
}));
|
|
|
|
|
rows_01.value = newRow;
|
2024-04-25 15:49:45 +07:00
|
|
|
|
2024-04-25 16:29:38 +07:00
|
|
|
if (newRow.length > 0) {
|
|
|
|
|
const result = newRow.reduce(
|
|
|
|
|
(sum: number, e: any) => sum + e.evaluationResults,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
const weight = newRow.reduce(
|
|
|
|
|
(sum: number, e: any) => sum + e.weight,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
|
2024-04-29 17:56:09 +07:00
|
|
|
totalResults1.value =
|
|
|
|
|
(result * store.dataEvaluation.plannedPoint) / weight;
|
2024-04-25 16:29:38 +07:00
|
|
|
}
|
2024-04-23 15:43:41 +07:00
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
messageError($q, err);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-04-09 15:22:23 +07:00
|
|
|
|
2024-04-23 15:43:41 +07:00
|
|
|
function fetchListRole() {
|
|
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(config.API.kpiAchievement("role") + `?id=${evaluationId.value}`)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data.result;
|
2024-04-24 15:00:53 +07:00
|
|
|
const newRow = data.map((e: any) => ({
|
|
|
|
|
...e,
|
|
|
|
|
evaluationResults: (e.point / 5) * e.weight,
|
|
|
|
|
}));
|
|
|
|
|
rows_02.value = newRow;
|
2024-04-25 16:29:38 +07:00
|
|
|
|
|
|
|
|
if (newRow.length > 0) {
|
|
|
|
|
const result = newRow.reduce(
|
|
|
|
|
(sum: number, e: any) => sum + e.evaluationResults,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
const weight = newRow.reduce(
|
|
|
|
|
(sum: number, e: any) => sum + e.weight,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
|
2024-04-29 17:56:09 +07:00
|
|
|
totalResults2.value =
|
|
|
|
|
(result * store.dataEvaluation.rolePoint) / weight;
|
2024-04-25 16:29:38 +07:00
|
|
|
}
|
2024-04-23 15:43:41 +07:00
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
messageError($q, err);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
2024-04-09 15:22:23 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-23 17:31:57 +07:00
|
|
|
function fetchAssigned() {
|
2024-04-24 15:00:53 +07:00
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(config.API.kpiAchievement("special") + `?id=${evaluationId.value}`)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data.result;
|
|
|
|
|
const newRow = data.map((e: any) => ({
|
|
|
|
|
...e,
|
|
|
|
|
evaluationResults: (e.point / 5) * e.weight,
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
rows_03.value = newRow;
|
2024-04-25 15:49:45 +07:00
|
|
|
|
2024-04-25 16:29:38 +07:00
|
|
|
if (newRow.length > 0) {
|
|
|
|
|
const result = newRow.reduce(
|
|
|
|
|
(sum: number, e: any) => sum + e.evaluationResults,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
const weight = newRow.reduce(
|
|
|
|
|
(sum: number, e: any) => sum + e.weight,
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
|
2024-04-29 17:56:09 +07:00
|
|
|
totalResults3.value =
|
|
|
|
|
(result * store.dataEvaluation.specialPoint) / weight;
|
2024-04-25 16:29:38 +07:00
|
|
|
}
|
2024-04-24 15:00:53 +07:00
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
messageError($q, err);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
2024-04-23 17:31:57 +07:00
|
|
|
}
|
2024-04-23 15:43:41 +07:00
|
|
|
|
2024-04-25 09:47:29 +07:00
|
|
|
function onInfo() {
|
|
|
|
|
modalCriteria.value = true;
|
2024-04-24 14:24:59 +07:00
|
|
|
}
|
2024-05-02 14:44:22 +07:00
|
|
|
|
|
|
|
|
const totalCompetency = ref<number>(0);
|
2024-04-24 15:00:53 +07:00
|
|
|
const resultWork = computed(() => {
|
|
|
|
|
const total = totalResults1.value + totalResults2.value + totalResults3.value;
|
2024-05-02 14:44:22 +07:00
|
|
|
score.value = total;
|
2024-04-25 16:29:38 +07:00
|
|
|
return total.toFixed(2);
|
2024-04-24 15:00:53 +07:00
|
|
|
});
|
2024-04-24 14:24:59 +07:00
|
|
|
|
2024-04-25 16:53:07 +07:00
|
|
|
function getCriteria() {
|
|
|
|
|
http
|
2024-04-29 09:55:15 +07:00
|
|
|
.get(config.API.KpiEvaluationInfo)
|
2024-04-25 16:53:07 +07:00
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data.result.data;
|
|
|
|
|
dataListCriteria.value = data;
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-02 14:44:22 +07:00
|
|
|
watch(
|
|
|
|
|
() => totalCompetency.value,
|
|
|
|
|
(newValue, oldValue) => {
|
|
|
|
|
if (newValue !== oldValue) {
|
|
|
|
|
score.value =
|
|
|
|
|
totalResults1.value +
|
|
|
|
|
totalResults2.value +
|
|
|
|
|
totalResults3.value +
|
|
|
|
|
newValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2024-04-30 10:14:11 +07:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2024-04-09 15:22:23 +07:00
|
|
|
onMounted(() => {
|
2024-04-29 17:56:09 +07:00
|
|
|
getCriteria();
|
2024-04-23 15:43:41 +07:00
|
|
|
fetchListPlanned();
|
|
|
|
|
fetchListRole();
|
2024-04-23 17:31:57 +07:00
|
|
|
fetchAssigned();
|
2024-04-09 15:22:23 +07:00
|
|
|
});
|
|
|
|
|
</script>
|
2024-04-22 18:14:48 +07:00
|
|
|
|
2024-04-09 15:22:23 +07:00
|
|
|
<template>
|
2024-04-22 17:25:58 +07:00
|
|
|
<q-scroll-area
|
2024-04-23 11:18:33 +07:00
|
|
|
style="height: 100vh"
|
2024-04-22 17:25:58 +07:00
|
|
|
class="bg-white row col-12 text-dark q-pa-md"
|
|
|
|
|
>
|
2024-04-19 15:30:39 +07:00
|
|
|
<div class="text-weight-bold text-body2">
|
2024-05-02 14:44:22 +07:00
|
|
|
<span class="txt-under text-blue-6">องค์ประกอบที่ 1 </span>
|
2024-04-19 15:30:39 +07:00
|
|
|
<span class="q-ml-sm"> ผลสัมฤทธิ์ของงาน</span>
|
2024-04-09 15:22:23 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="q-gutter-md q-mt-sm">
|
|
|
|
|
<!-- องค์ประกอบที่ 1 -->
|
2024-04-22 17:25:58 +07:00
|
|
|
<Work
|
|
|
|
|
v-model:data="rows_01"
|
|
|
|
|
:title="`1. งานตามแผนปฏิบัติราชการประจำปี`"
|
|
|
|
|
:page="1"
|
2024-04-23 15:43:41 +07:00
|
|
|
:fetchList="fetchListPlanned"
|
2024-04-24 15:00:53 +07:00
|
|
|
:total="totalResults1"
|
2024-04-22 17:25:58 +07:00
|
|
|
/>
|
|
|
|
|
<Work
|
|
|
|
|
v-model:data="rows_02"
|
|
|
|
|
:title="`2. งานตามหน้าที่ความรับผิดชอบหลัก`"
|
|
|
|
|
:page="2"
|
2024-04-23 15:43:41 +07:00
|
|
|
:fetchList="fetchListRole"
|
2024-04-24 15:00:53 +07:00
|
|
|
:total="totalResults2"
|
2024-04-22 17:25:58 +07:00
|
|
|
/>
|
|
|
|
|
<Work
|
|
|
|
|
v-model:data="rows_03"
|
|
|
|
|
:title="`3. งานที่ได้รับมอบหมายพิเศษ`"
|
|
|
|
|
:page="3"
|
2024-04-23 15:43:41 +07:00
|
|
|
:fetchList="fetchAssigned"
|
2024-04-24 15:00:53 +07:00
|
|
|
:total="totalResults3"
|
2024-04-22 17:25:58 +07:00
|
|
|
/>
|
2024-04-19 15:30:39 +07:00
|
|
|
<div class="row text-body2 text-weight-bold">
|
2024-04-24 13:08:19 +07:00
|
|
|
<!-- <div class="col-6 text-center row justify-center">
|
2024-04-09 15:22:23 +07:00
|
|
|
<span>รวมผลการประเมิน (ร้อยละ) 100</span>
|
2024-04-19 15:30:39 +07:00
|
|
|
<div class="text-primary q-pl-md">{{ total }}</div>
|
2024-04-24 13:08:19 +07:00
|
|
|
</div> -->
|
2024-04-22 17:25:58 +07:00
|
|
|
|
2024-04-24 13:08:19 +07:00
|
|
|
<div class="col-12 text-center row justify-center">
|
2024-04-29 17:56:09 +07:00
|
|
|
<span
|
|
|
|
|
>สรุปผลการประเมินผลสัมฤทธิ์ของงาน (คะแนนเต็ม
|
|
|
|
|
{{
|
|
|
|
|
store.dataEvaluation.plannedPoint +
|
|
|
|
|
store.dataEvaluation.rolePoint +
|
|
|
|
|
store.dataEvaluation.specialPoint
|
|
|
|
|
}}
|
|
|
|
|
คะแนน)</span
|
|
|
|
|
>
|
2024-04-22 17:25:58 +07:00
|
|
|
<div class="text-primary q-pl-md">{{ resultWork }}</div>
|
2024-04-09 15:22:23 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-04-19 15:30:39 +07:00
|
|
|
<q-separator size="3px" class="q-my-lg" />
|
2024-04-09 15:22:23 +07:00
|
|
|
|
|
|
|
|
<!-- องค์ประกอบที่ 2 -->
|
2024-04-19 15:30:39 +07:00
|
|
|
<div class="text-weight-bold text-body2 q-mb-sm">
|
|
|
|
|
<span class="txt-under text-blue-6">องค์ประกอบที่ 2</span>
|
|
|
|
|
<span class="q-ml-sm"> พฤติกรรมการปฎิบัติราชการ (สมรรถนะ)</span>
|
2024-04-25 09:47:29 +07:00
|
|
|
<q-btn
|
|
|
|
|
flat
|
|
|
|
|
icon="info"
|
|
|
|
|
color="info"
|
|
|
|
|
round
|
|
|
|
|
class="q-ml-xs"
|
|
|
|
|
@click="onInfo"
|
|
|
|
|
>
|
2024-04-24 14:24:59 +07:00
|
|
|
<q-tooltip>เกณฑ์การประเมิน</q-tooltip>
|
|
|
|
|
</q-btn>
|
2024-04-09 15:22:23 +07:00
|
|
|
</div>
|
|
|
|
|
|
2024-05-02 14:44:22 +07:00
|
|
|
<Competency
|
|
|
|
|
v-model:dataListCriteria="dataListCriteria"
|
|
|
|
|
v-model:total-competency="totalCompetency"
|
|
|
|
|
/>
|
2024-04-09 15:22:23 +07:00
|
|
|
</div>
|
|
|
|
|
</q-scroll-area>
|
2024-04-24 14:24:59 +07:00
|
|
|
|
2024-04-29 17:56:09 +07:00
|
|
|
<DialogListCriteria
|
|
|
|
|
v-model:modal="modalCriteria"
|
|
|
|
|
v-model:dataListCriteria="dataListCriteria"
|
|
|
|
|
/>
|
2024-04-09 15:22:23 +07:00
|
|
|
</template>
|
2024-04-22 18:14:48 +07:00
|
|
|
|
2024-04-09 15:22:23 +07:00
|
|
|
<style scoped>
|
|
|
|
|
.txt-under {
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
}
|
|
|
|
|
</style>
|