updated kpi

This commit is contained in:
Warunee Tamkoo 2024-05-09 17:14:21 +07:00
parent a121569433
commit a69d9e331d
8 changed files with 97 additions and 107 deletions

View file

@ -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<QTableProps["columns"]>([
},
]);
const weightPlanned = ref<number>(0);
const weightRole = ref<number>(0);
const weightAssigned = ref<number>(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(() => {
<div class="q-gutter-md q-mt-sm">
<!-- องคประกอบท 1 -->
<Work
v-model:data="rows_01"
: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 v-if="store.dataProfile.posExecutiveName != null">
<Work
v-model:data="rows_01"
:title="`มิติที่ 1 ภารกิจตามนโยบายและยุทธศาสตร์ของกรุงเทพมหานคร`"
:page="1"
:fetchList="fetchListPlanned"
:total="totalResults1"
/>
<Work
v-model:data="rows_03"
:title="`มิติที่ 2 วาระเร่งด่วนที่ได้รับมอบหมายพิเศษ (ถ้ามี)`"
:page="3"
:fetchList="fetchAssigned"
:total="totalResults3"
/>
</div>
<div v-else>
<Work
v-model:data="rows_01"
: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>
<div class="row text-body2 text-weight-bold">
<!-- <div class="col-6 text-center row justify-center">
<span>รวมผลการประเม (อยละ) 100</span>
@ -389,10 +398,7 @@ onMounted(() => {
</q-btn>
</div>
<Competency
v-model:dataListCriteria="dataListCriteria"
v-model:competencyScore="competencyScore"
/>
<Competency v-model:dataListCriteria="dataListCriteria" />
<q-card bordered style="border-radius: 5px" class="no-shadow">
<q-card-section class="bg-grey-2 q-py-sm">
@ -548,9 +554,9 @@ onMounted(() => {
<div class="row text-body2 text-weight-bold justify-center">
<span
>สรปผลการประเมนสมรรถนะ (คะแนนเต
{{ store.dataEvaluation.capacityPoint }} คะแนน)</span
{{ store.competencyScore }} คะแนน)</span
>
<div class="text-primary q-pl-md">{{ competencyScore }}</div>
<div class="text-primary q-pl-md">{{ store.competencyScoreVal }}</div>
</div>
</div>
</q-scroll-area>

View file

@ -175,7 +175,6 @@ function onSubmit() {
kpiCapacityId: formDetail.id,
level: expectedLevel.value.toString(),
weight: weight.value,
summary: 0,
};
showLoader();
http[idProps.value ? `put` : `post`](url, body)
@ -489,9 +488,9 @@ watch(
</template>
<template v-slot:no-data="{ icon, message }">
<div
class="q-pa-md text-weight-bold full-width text-center "
class="q-pa-md text-weight-bold full-width text-center"
>
<span style="font-size: 16px;">ไมพบขอมลสมรรถนะ</span>
<span style="font-size: 16px">ไมพบขอมลสมรรถนะ</span>
</div>
</template>
</q-table>

View file

@ -119,6 +119,7 @@ function onSubmit() {
const body = data.map((i: any) => ({
id: i.id,
point: i.point,
summary: i.point * 20,
}));
http
.post(config.API.kpiUserCapacity + `/point`, body)

View file

@ -11,18 +11,11 @@ import File from "@/modules/08_KPI/components/Tab/05_File.vue";
const store = useKpiDataStore();
const route = useRoute();
const isReadonly = ref<boolean>(
route.name === "KPIEditEvaluator" ? true : false
);
const step = ref<number>(1); // 1 = , 2 = , 3 =
const indicatorScore = defineModel("indicatorScore", {
type: Number,
default: 0,
});
const competencyScore = defineModel("competencyScore", {
const indicatorWeightTotal = defineModel("indicatorWeightTotal", {
type: Number,
default: 0,
});
const itemsTab = ref<any>([
{
name: "1",
@ -108,8 +101,7 @@ const splitterModel = ref<number>(12);
>
<Assessment
v-if="store.tabMain === '1'"
v-model:indicatorScore="indicatorScore"
v-model:competencyScore="competencyScore"
v-model:indicatorWeightTotal="indicatorWeightTotal"
/>
<Assessment v-if="store.tabMain === '2'" :type="'evaluator'" />
<Assessment v-if="store.tabMain === '3'" :type="'commander'" />

View file

@ -373,19 +373,7 @@ watch(
</td>
</q-tr>
</template>
<template v-slot:bottom>
<span class="text-body2 text-weight-bold"
>รวมผลการประเม (อยละ)</span
>
<div class="text-primary q-pl-md">{{ evaluationTotal }}</div>
</template>
</q-table>
<!-- <div class="row text-body2 text-weight-bold q-pa-md">
<div class="col-12 text-center row justify-center">
<span>รวมผลการประเม (อยละ)</span>
<div class="text-primary q-pl-md">{{ evaluationTotal }}</div>
</div>
</div> -->
</q-card-section>
</q-card>

View file

@ -18,10 +18,6 @@ import type {
const dataListCriteria = defineModel<ListCriteria[]>("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;
}
});
}

View file

@ -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<number>(0);
onMounted(async () => {
showLoader();
await getAll();
@ -402,12 +399,23 @@ onMounted(async () => {
}}</span>
<q-space />
<div class="q-gutter-x-sm">
<span
v-if="
indicatorWeightTotal > 0 && indicatorWeightTotal != 100
"
class="text-red"
>*ำหน(อยละ) ผลสมฤทธของงานไมกตอง</span
>
<q-btn
v-if="
store.rolePerson == 'USER' &&
store.dataEvaluation.evaluationStatus == 'NEW'
"
:disabled="store.dataEvaluation.evaluatorId == null"
:disabled="
store.dataEvaluation.evaluatorId == null ||
(indicatorWeightTotal > 0 &&
indicatorWeightTotal != 100)
"
unelevated
round
icon="mdi-send"
@ -548,6 +556,7 @@ onMounted(async () => {
<TabMain
v-model:indicatorScore="indicatorScore"
v-model:competencyScore="competencyScore"
v-model:indicatorWeightTotal="indicatorWeightTotal"
/>
</q-card>
</div>