Merge branch 'NiceDev' into develop

# Conflicts:
#	src/api/KPI/api.kpis.ts
#	src/modules/08_KPI/components/Tab/01_Assessment.vue
This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-24 15:02:19 +07:00
commit 673ac3dd04
6 changed files with 245 additions and 77 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { ref, onMounted, computed } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
@ -26,8 +26,10 @@ const rows_01 = ref<any[]>();
const rows_02 = ref<any[]>();
const rows_03 = ref<any[]>();
const total = ref<number>(0);
const resultWork = ref<number>(0);
const totalResults1 = ref<number>(0);
const totalResults2 = ref<number>(0);
const totalResults3 = ref<number>(0);
// const resultWork = ref<number>(0);
const resultEvaluation = ref<number>(0);
function fetchListPlanned() {
@ -36,7 +38,16 @@ function fetchListPlanned() {
.get(config.API.kpiAchievement("planned") + `?id=${evaluationId.value}`)
.then((res) => {
const data = res.data.result;
rows_01.value = data;
const newRow = data.map((e: any) => ({
...e,
evaluationResults: (e.point / 5) * e.weight,
}));
rows_01.value = newRow;
const result = newRow.reduce(
(sum: number, e: any) => sum + e.evaluationResults,
0
);
totalResults1.value = (result * 80) / 100;
})
.catch((err) => {
messageError($q, err);
@ -52,7 +63,16 @@ function fetchListRole() {
.get(config.API.kpiAchievement("role") + `?id=${evaluationId.value}`)
.then((res) => {
const data = res.data.result;
rows_02.value = data;
const newRow = data.map((e: any) => ({
...e,
evaluationResults: (e.point / 5) * e.weight,
}));
rows_02.value = newRow;
const result = newRow.reduce(
(sum: number, e: any) => sum + e.evaluationResults,
0
);
totalResults2.value = (result * 80) / 100;
})
.catch((err) => {
messageError($q, err);
@ -63,22 +83,38 @@ function fetchListRole() {
}
function fetchAssigned() {
const data = [
{
includingName: "name",
target: "เป่า",
point: "12",
weight: "12",
achievement: "12",
evaluationResults: "12",
},
];
rows_03.value = data;
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;
const result = newRow.reduce(
(sum: number, e: any) => sum + e.evaluationResults,
0
);
totalResults3.value = (result * 80) / 100;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function onInfo(){
modalCriteria.value = true
}
const resultWork = computed(() => {
const total = totalResults1.value + totalResults2.value + totalResults3.value;
return (total * 80) / 100;
});
onMounted(() => {
fetchListPlanned();
@ -104,18 +140,21 @@ onMounted(() => {
:title="`1. งานตามแผนปฏิบัติราชการประจำปี`"
:page="1"
:fetchList="fetchListPlanned"
:total="totalResults1"
/>
<Work
v-model:data="rows_02"
:title="`2. งานตามหน้าที่ความรับผิดชอบหลัก`"
:page="2"
:fetchList="fetchListRole"
:total="totalResults2"
/>
<Work
v-model:data="rows_03"
:title="`3. งานที่ได้รับมอบหมายพิเศษ`"
:page="3"
:fetchList="fetchAssigned"
:total="totalResults3"
/>
<div class="row text-body2 text-weight-bold">
<!-- <div class="col-6 text-center row justify-center">
@ -124,7 +163,7 @@ onMounted(() => {
</div> -->
<div class="col-12 text-center row justify-center">
<span>สรปผลการประเมนผลสมฤทธของงาน (คะแนนเต 70 คะแนน)</span>
<span>สรปผลการประเมนผลสมฤทธของงาน (คะแนนเต 80 คะแนน)</span>
<div class="text-primary q-pl-md">{{ resultWork }}</div>
</div>
</div>