updated kpi

This commit is contained in:
Warunee Tamkoo 2024-06-26 20:24:39 +07:00
parent f7f0198613
commit c7cda1c7ba
11 changed files with 185 additions and 78 deletions

View file

@ -152,10 +152,6 @@ function fetchAssigned() {
});
}
function onInfo() {
modalCriteria.value = true;
}
function getCriteria() {
http
.get(config.API.KpiEvaluationInfo)
@ -195,6 +191,24 @@ watch(
store.indicatorScoreVal =
store.indicatorPercentVal * (store.indicatorScore / 100);
if (
store.isUpdate &&
store.tabMain === "3" &&
(store.dataEvaluation.evaluationStatus === "EVALUATOR" ||
store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR")
) {
http
.put(config.API.updatePoint(evaluationId.value), {
totalPoint1: store.indicatorScoreVal.toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
})
.then((res) => {});
}
}
}
);
@ -221,7 +235,12 @@ onMounted(() => {
</div>
<div class="q-gutter-md q-mt-sm">
<!-- องคประกอบท 1 -->
<div v-if="store.dataEvaluation.posExecutiveName != null">
<div
v-if="
store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'บริหาร'
"
>
<Work
v-model:data="rows_01"
:title="`มิติที่ 1 ภารกิจตามนโยบายและยุทธศาสตร์ของกรุงเทพมหานคร`"
@ -419,7 +438,8 @@ onMounted(() => {
:rows="[
{
name: `สรุปผลการประเมินสมรรถนะ (คะแนนเต็ม ${
!store.dataEvaluation.posExecutiveName
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
? store.competencyScore
: store.excusiveCompetencyScore
} คะแนน)`,
@ -446,7 +466,12 @@ onMounted(() => {
class="q-mt-xs q-mb-md"
/>
<div v-if="!store.dataEvaluation.posExecutiveName">
<div
v-if="
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
"
>
<Develop />
<div v-if="isShowScore">
@ -484,7 +509,10 @@ onMounted(() => {
<div v-if="isShowScore">
<div
v-if="store.dataEvaluation.posExecutiveName == null"
v-if="
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
"
class="row text-body2 text-weight-bold"
>
<div class="col-12 text-center row justify-center">

View file

@ -37,10 +37,10 @@ const additionalSuperiorComment = ref<string>("");
const superiorCommentCheck = ref<string>("");
const additionalSuperiorCheck = ref<string>("");
const weight1 = ref<number>(10);
const weight1 = ref<number>(0);
const result1 = ref<number>(0);
const weight2 = ref<number>(50);
const result2 = ref<number>(60);
const weight2 = ref<number>(0);
const result2 = ref<number>(0);
const sumWeight = computed(() => {
return weight1.value + weight2.value;
});
@ -179,6 +179,10 @@ async function fetchEvaluation() {
.then(async (res) => {
const data = res.data.result;
store.dataEvaluation = await data;
if (data.profileId == store.dataProfile.id) {
userOpen();
}
})
.catch((e) => {
messageError($q, e);
@ -188,6 +192,12 @@ async function fetchEvaluation() {
});
}
function userOpen() {
http.get(config.API.openPoint(id.value)).then(async (res) => {
// success($q, "");
});
}
function getData() {
http
.get(config.API.kpiSendToGet(id.value))
@ -202,9 +212,10 @@ function getData() {
additionalSuperiorCheck.value = data.isReasonCommanderHigh.toString();
additionalSuperiorComment.value = data.reasonCommanderHigh;
result1.value = data.totalPoint1
result2.value = data.totalPoint2_1 + data.totalPoint2_2
result1.value = data.totalPoint1;
result2.value = data.totalPoint2_1 + data.totalPoint2_2;
weight1.value = data.weightPoint1;
weight2.value = data.weightPoint2;
})
.catch((e) => {
messageError($q, e);
@ -456,7 +467,10 @@ onMounted(() => {
lazy-rules
v-model="superiorComment"
outlined
:readonly="superiorCommentCheck == 'true'||store.dataEvaluation.evaluationStatus !== 'SUMMARY_COMMANDER'"
:readonly="
superiorCommentCheck == 'true' ||
store.dataEvaluation.evaluationStatus !== 'SUMMARY_COMMANDER'
"
type="textarea"
label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไป"
hide-bottom-space

View file

@ -130,7 +130,7 @@ function onSubmit() {
dialogConfirm($q, async () => {
try {
showLoader();
console.log(rows.value);
store.isUpdate = true;
const formData = rows.value.map((e: any) => ({
id: e.id,

View file

@ -115,6 +115,7 @@ function onSubmit() {
dialogMessageNotify($q, "กรุณาเลือกระดับคะแนนตามเกณฑ์การประเมิน");
} else {
dialogConfirm($q, () => {
store.isUpdate = true;
const data = rows.value;
const body = data.map((i: any) => ({
id: i.id,

View file

@ -5,11 +5,14 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
import { ref } from "vue";
import { useKpiDataStore } from "@/modules/08_KPI/store";
const props = defineProps({
getAll: Function,
});
const store = useKpiDataStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
@ -89,6 +92,7 @@ function onSubmit() {
summary: i.summary,
}));
showLoader();
store.isUpdate = true;
http
.post(config.API.kpiAchievementDevelop + `/point`, data)
.then((res) => {

View file

@ -20,7 +20,7 @@ import DialogListCriteria from "@/modules/08_KPI/components/Tab/Dialog/DialogLis
import DialogCompetncyByRow from "@/modules/08_KPI/components/Tab/Dialog/DialogCompetncyByRow.vue";
import DialogLevel from "@/modules/08_KPI/components/Tab/Dialog/DialogLevel.vue";
const modalLevel = ref<boolean>(false)
const modalLevel = ref<boolean>(false);
const modalCompetncyByRow = ref<boolean>(false);
const dataCompetncyByRow = ref<any[]>([]);
const dataLevel = ref<any[]>([]);
@ -170,7 +170,10 @@ function getData(type: string) {
let weightAvg = weight / total;
let resultAvg = result / total;
if (store.dataEvaluation.posExecutiveName != null) {
if (
store.dataEvaluation.posTypeName == "อำนวยการ" &&
store.dataEvaluation.posTypeName == "บริหาร"
) {
store.competencyScoreVal =
weightAvg != 0
? (resultAvg / weightAvg) * store.excusiveCompetencyScore
@ -181,6 +184,24 @@ 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) => {});
}
}
});
}
@ -248,7 +269,7 @@ const isEditStep3 = computed(() => {
store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")||
store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")
@ -276,9 +297,9 @@ function onAchievement(data: any) {
dataCompetncyByRow.value = data;
}
function onLevel(num:number,list:any){
dataLevel.value = list.filter((i:any)=> i.level == num)
modalLevel.value = true
function onLevel(num: number, list: any) {
dataLevel.value = list.filter((i: any) => i.level == num);
modalLevel.value = true;
}
onMounted(() => {
@ -407,7 +428,12 @@ onMounted(() => {
}}
</div>
<div v-else-if="col.name == 'level'">
<div @click="onLevel(props.row.level,props.row.achievement)" class="text-teal">{{ props.row.level }}</div>
<div
@click="onLevel(props.row.level, props.row.achievement)"
class="text-teal"
>
{{ props.row.level }}
</div>
</div>
<div v-else>
{{ col.value }}
@ -595,10 +621,7 @@ onMounted(() => {
v-model:rows="dataCompetncyByRow"
/>
<DialogLevel
v-model:modal="modalLevel"
v-model:rows="dataLevel"
/>
<DialogLevel v-model:modal="modalLevel" v-model:rows="dataLevel" />
</template>
<style scoped>

View file

@ -32,6 +32,11 @@ const {
success,
} = mixin;
const isUpdate = defineModel("isUpdate", {
type: Boolean,
default: false,
});
const formData = reactive({
isDevelopment70: false,
isDevelopment20: false,
@ -121,6 +126,24 @@ 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) => {});
}
});
}
@ -181,7 +204,7 @@ const isEditStep3 = computed(() => {
store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")||
store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")