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