fixing bug
This commit is contained in:
parent
080ef0b4e8
commit
700dcaee4a
6 changed files with 143 additions and 160 deletions
|
|
@ -185,22 +185,6 @@ watch(
|
|||
|
||||
store.indicatorScoreVal =
|
||||
store.indicatorPercentVal * (store.indicatorScore / 100);
|
||||
|
||||
if (store.isUpdate && store.tabMain === "3") {
|
||||
http
|
||||
.put(config.API.updatePoint(evaluationId.value), {
|
||||
totalPoint1: (
|
||||
store.indicatorPercentVal *
|
||||
(store.indicatorScore / 100)
|
||||
).toFixed(2),
|
||||
summaryPoint: (
|
||||
store.indicatorScoreVal +
|
||||
store.competencyScoreVal +
|
||||
store.devScoreVal
|
||||
).toFixed(2),
|
||||
})
|
||||
.then((res) => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import type {
|
|||
import DialogListCriteria from "@/modules/08_KPI/components/Tab/Dialog/DialogListCriteria.vue";
|
||||
import DialogCompetncyByRow from "@/modules/08_KPI/components/Tab/Dialog/DialogCompetncyByRow.vue";
|
||||
import DialogLevel from "@/modules/08_KPI/components/Tab/Dialog/DialogLevel.vue";
|
||||
import type { DataOptions } from "@/modules/08_KPI/interface/index/Main";
|
||||
|
||||
const modalLevel = ref<boolean>(false);
|
||||
const modalCompetncyByRow = ref<boolean>(false);
|
||||
|
|
@ -146,8 +147,8 @@ function getData(type: string) {
|
|||
let result = 0;
|
||||
let weight = 0;
|
||||
let total = 0;
|
||||
for (let index = 0; index < store.competencyType.length; index++) {
|
||||
const element = await store.competencyType[index];
|
||||
for (let index = 0; index < competencyType.value.length; index++) {
|
||||
const element = await competencyType.value[index];
|
||||
|
||||
const dataArr = await lists.value.find(
|
||||
(x: any) => x.type == element.id
|
||||
|
|
@ -184,24 +185,6 @@ 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) => {});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -273,18 +256,6 @@ const isEditStep3 = computed(() => {
|
|||
);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => store.dataEvaluation.capacityPoint,
|
||||
(newValue, oldValue) => {
|
||||
if (newValue !== oldValue) {
|
||||
for (let index = 0; index < store.competencyType.length; index++) {
|
||||
const element = store.competencyType[index];
|
||||
getData(element.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function onInfo() {
|
||||
modalCriteria.value = true;
|
||||
}
|
||||
|
|
@ -299,16 +270,32 @@ function onLevel(num: number, list: any) {
|
|||
modalLevel.value = true;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
for (let index = 0; index < store.competencyType.length; index++) {
|
||||
const element = store.competencyType[index];
|
||||
getData(element.id);
|
||||
}
|
||||
const competencyType = ref<DataOptions[]>([]);
|
||||
onMounted(async () => {
|
||||
setTimeout(async () => {
|
||||
competencyType.value = await (store.dataEvaluation.posTypeName ==
|
||||
"อำนวยการ" || store.dataEvaluation.posTypeName == "บริหาร"
|
||||
? store.competencyType.filter(
|
||||
(x: DataOptions) =>
|
||||
x.id == "HEAD" ||
|
||||
x.id == "EXECUTIVE" ||
|
||||
x.id == "INSPECTOR" ||
|
||||
x.id == "DIRECTOR"
|
||||
)
|
||||
: store.competencyType.filter(
|
||||
(x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
|
||||
));
|
||||
|
||||
for (let index = 0; index < competencyType.value.length; index++) {
|
||||
const element = competencyType.value[index];
|
||||
getData(element.id);
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-for="(item, index) in store.competencyType" :key="index">
|
||||
<div v-for="(item, index) in competencyType" :key="index">
|
||||
<q-card bordered style="border-radius: 5px" class="no-shadow q-mt-sm">
|
||||
<q-card-section class="bg-grey-2 q-py-sm">
|
||||
<div class="row items-center">
|
||||
|
|
|
|||
|
|
@ -126,24 +126,6 @@ function getDevelop() {
|
|||
(sum: number, e: any) => sum + e.summary,
|
||||
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_2: store.devScoreVal.toFixed(2),
|
||||
summaryPoint: (
|
||||
store.indicatorScoreVal +
|
||||
store.competencyScoreVal +
|
||||
store.devScoreVal
|
||||
).toFixed(2),
|
||||
})
|
||||
.then((res) => {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,39 +157,41 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
|
|||
}
|
||||
}
|
||||
|
||||
async function checkCompetency() {
|
||||
// const position = await dataEvaluation.value.position;
|
||||
// const executiveName = await dataEvaluation.value.posExecutiveName;
|
||||
const posTypeName = dataEvaluation.value.posTypeName;
|
||||
const posLevelName = dataEvaluation.value.posLevelName;
|
||||
// async function checkCompetency() {
|
||||
// // const position = await dataEvaluation.value.position;
|
||||
// // const executiveName = await dataEvaluation.value.posExecutiveName;
|
||||
// const posTypeName = await dataEvaluation.value.posTypeName;
|
||||
// const posLevelName = dataEvaluation.value.posLevelName;
|
||||
|
||||
// if (
|
||||
// position == "ผู้ตรวจราชการกรุงเทพมหานคร" ||
|
||||
// position == "ผู้ตรวจราชการ"
|
||||
// ) {
|
||||
// competencyType.value = competencyType.value.filter(
|
||||
// (x: DataOptions) => x.id == "HEAD" || x.id == "INSPECTOR"
|
||||
// );
|
||||
// } else if (position == "ผู้อำนวยการเขต") {
|
||||
// competencyType.value = competencyType.value.filter(
|
||||
// (x: DataOptions) => x.id == "HEAD" || x.id == "DIRECTOR"
|
||||
// );
|
||||
// } else {
|
||||
if (posTypeName == "อำนวยการ" || posTypeName == "บริหาร") {
|
||||
competencyType.value = competencyType.value.filter(
|
||||
(x: DataOptions) =>
|
||||
x.id == "HEAD" ||
|
||||
x.id == "EXECUTIVE" ||
|
||||
x.id == "INSPECTOR" ||
|
||||
x.id == "DIRECTOR"
|
||||
);
|
||||
} else {
|
||||
competencyType.value = competencyType.value.filter(
|
||||
(x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
|
||||
);
|
||||
}
|
||||
// }
|
||||
}
|
||||
// console.log("posTypeName===>", posTypeName);
|
||||
|
||||
// // if (
|
||||
// // position == "ผู้ตรวจราชการกรุงเทพมหานคร" ||
|
||||
// // position == "ผู้ตรวจราชการ"
|
||||
// // ) {
|
||||
// // competencyType.value = competencyType.value.filter(
|
||||
// // (x: DataOptions) => x.id == "HEAD" || x.id == "INSPECTOR"
|
||||
// // );
|
||||
// // } else if (position == "ผู้อำนวยการเขต") {
|
||||
// // competencyType.value = competencyType.value.filter(
|
||||
// // (x: DataOptions) => x.id == "HEAD" || x.id == "DIRECTOR"
|
||||
// // );
|
||||
// // } else {
|
||||
// if (posTypeName == "อำนวยการ" || posTypeName == "บริหาร") {
|
||||
// competencyType.value = await competencyType.value.filter(
|
||||
// (x: DataOptions) =>
|
||||
// x.id == "HEAD" ||
|
||||
// x.id == "EXECUTIVE" ||
|
||||
// x.id == "INSPECTOR" ||
|
||||
// x.id == "DIRECTOR"
|
||||
// );
|
||||
// } else {
|
||||
// competencyType.value = await competencyType.value.filter(
|
||||
// (x: DataOptions) => x.id == "HEAD" || x.id == "GROUP"
|
||||
// );
|
||||
// }
|
||||
// // }
|
||||
// }
|
||||
|
||||
const defaultCompetencyCoreLevel = ref<number>();
|
||||
const defaultCompetencyGroupLevel = ref<number | null>(null);
|
||||
|
|
@ -356,46 +358,46 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
|
|||
const indicatorScoreVal = ref<number>(0); // สรุปผลการประเมินผลสัมฤทธิ์ของงานที่ได้
|
||||
const competencyScoreVal = ref<number>(0); // ผลการประเมินสมรรถนะที่ได้กี่คะแนน
|
||||
|
||||
function getDataWork() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.orgPosition + `/${dataProfile.value.profileId}`)
|
||||
.then((res) => {
|
||||
const data = res.data.result.isProbation;
|
||||
work.value = data;
|
||||
if (data) {
|
||||
indicatorScore.value = 50;
|
||||
competencyScore.value = 40;
|
||||
excusiveCompetencyScore.value = 40;
|
||||
competencyDevScore.value = 10;
|
||||
} else {
|
||||
indicatorScore.value = 70;
|
||||
competencyScore.value = 20;
|
||||
excusiveCompetencyScore.value = 20;
|
||||
competencyDevScore.value = 30;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
// function getDataWork() {
|
||||
// showLoader();
|
||||
// http
|
||||
// .get(config.API.orgPosition + `/${dataProfile.value.profileId}`)
|
||||
// .then((res) => {
|
||||
// const data = res.data.result.isProbation;
|
||||
// work.value = data;
|
||||
// if (data) {
|
||||
// indicatorScore.value = 50;
|
||||
// competencyScore.value = 40;
|
||||
// excusiveCompetencyScore.value = 40;
|
||||
// competencyDevScore.value = 10;
|
||||
// } else {
|
||||
// indicatorScore.value = 70;
|
||||
// competencyScore.value = 20;
|
||||
// excusiveCompetencyScore.value = 20;
|
||||
// competencyDevScore.value = 30;
|
||||
// }
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
// }
|
||||
|
||||
watch(
|
||||
() => tabMain.value,
|
||||
() => {
|
||||
if (tabMain.value == "3" && tabOpen.value == 3) {
|
||||
getDataWork();
|
||||
} else {
|
||||
indicatorScore.value = 70;
|
||||
competencyScore.value = 20;
|
||||
excusiveCompetencyScore.value = 20;
|
||||
competencyDevScore.value = 30;
|
||||
}
|
||||
}
|
||||
);
|
||||
// watch(
|
||||
// () => tabMain.value,
|
||||
// () => {
|
||||
// if (tabMain.value == "3" && tabOpen.value == 3) {
|
||||
// getDataWork();
|
||||
// } else {
|
||||
// indicatorScore.value = 70;
|
||||
// competencyScore.value = 20;
|
||||
// excusiveCompetencyScore.value = 20;
|
||||
// competencyDevScore.value = 30;
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
return {
|
||||
tabMain,
|
||||
|
|
@ -405,7 +407,7 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
|
|||
convertCompetencyType,
|
||||
convertStatus,
|
||||
convertResults,
|
||||
checkCompetency,
|
||||
// checkCompetency,
|
||||
checkCompetencyDefaultCompetencyLevel,
|
||||
defaultCompetencyCoreLevel,
|
||||
defaultCompetencyGroupLevel,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, computed, watch } from "vue";
|
||||
import { ref, onMounted, reactive } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -66,7 +66,7 @@ async function fetchEvaluation() {
|
|||
store.dataEvaluation = await data;
|
||||
formProfile.status = store.convertStatus(data.evaluationStatus);
|
||||
formProfile.result = store.convertResults(data.evaluationResults);
|
||||
store.checkCompetency();
|
||||
// store.checkCompetency();
|
||||
store.checkCompetencyDefaultCompetencyLevel();
|
||||
|
||||
fetchProfile(data.profileId);
|
||||
|
|
@ -264,8 +264,8 @@ function filterOption(val: any, update: Function, refData: string) {
|
|||
|
||||
async function getAll() {
|
||||
await fetchEvaluation();
|
||||
getProfile();
|
||||
getOrgOp();
|
||||
await getProfile();
|
||||
await getOrgOp();
|
||||
}
|
||||
|
||||
function sendToEvaluatore() {
|
||||
|
|
@ -401,14 +401,44 @@ function sendToEvauator() {
|
|||
});
|
||||
}
|
||||
|
||||
function goToSummary() {
|
||||
async function goToSummary() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
async () => {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.sendToSummary(store.dataEvaluation.id))
|
||||
.then(async (res) => {
|
||||
await http
|
||||
.put(
|
||||
config.API.updatePoint(store.dataEvaluation.id),
|
||||
store.dataEvaluation.posTypeName != "อำนวยการ" &&
|
||||
store.dataEvaluation.posTypeName != "บริหาร"
|
||||
? {
|
||||
totalPoint1: store.indicatorScoreVal.toFixed(2),
|
||||
totalPoint2_1: store.competencyScoreVal.toFixed(2),
|
||||
totalPoint2_2: store.devScoreVal.toFixed(2),
|
||||
summaryPoint: (
|
||||
store.indicatorScoreVal +
|
||||
store.competencyScoreVal +
|
||||
store.devScoreVal
|
||||
).toFixed(2),
|
||||
}
|
||||
: {
|
||||
totalPoint1: (
|
||||
store.excusiveIndicator1ScoreVal +
|
||||
store.excusiveIndicator2ScoreVal
|
||||
).toFixed(2),
|
||||
totalPoint2_1: store.competencyScoreVal.toFixed(2),
|
||||
summaryPoint: (
|
||||
store.excusiveIndicator1ScoreVal +
|
||||
store.excusiveIndicator2ScoreVal +
|
||||
store.competencyScoreVal
|
||||
).toFixed(2),
|
||||
}
|
||||
)
|
||||
.then((res) => {});
|
||||
|
||||
await fetchEvaluation();
|
||||
store.tabMain = "4";
|
||||
store.tabOpen = 4;
|
||||
|
|
@ -502,15 +532,15 @@ onMounted(async () => {
|
|||
<div class="q-gutter-x-sm">
|
||||
<span
|
||||
v-if="
|
||||
(store.tabMain === '1' &&
|
||||
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
|
||||
store.tabMain === '1' &&
|
||||
store.dataEvaluation.evaluationStatus == 'NEW' &&
|
||||
((store.dataEvaluation.posTypeName != 'อำนวยการ' &&
|
||||
store.dataEvaluation.posTypeName != 'บริหาร' &&
|
||||
store.indicatorWeightTotal != 100) ||
|
||||
((store.dataEvaluation.posTypeName == 'อำนวยการ' ||
|
||||
store.dataEvaluation.posTypeName == 'บริหาร') &&
|
||||
(store.indicatorWeight1Total != 100 ||
|
||||
store.indicatorWeight2Total != 20) &&
|
||||
store.dataEvaluation.evaluationStatus == 'NEW')
|
||||
((store.dataEvaluation.posTypeName == 'อำนวยการ' ||
|
||||
store.dataEvaluation.posTypeName == 'บริหาร') &&
|
||||
(store.indicatorWeight1Total != 100 ||
|
||||
store.indicatorWeight2Total != 20)))
|
||||
"
|
||||
class="text-red"
|
||||
>*น้ำหนัก(ร้อยละ) ผลสัมฤทธิ์ของงานไม่ถูกต้อง</span
|
||||
|
|
|
|||
|
|
@ -275,8 +275,6 @@ function getProfile() {
|
|||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
store.dataProfile = data;
|
||||
store.checkCompetency();
|
||||
store.checkCompetencyDefaultCompetencyLevel();
|
||||
|
||||
formRound.profileId = data.profileId;
|
||||
formRound.prefix = data.prefix;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue