Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-06-28 14:07:55 +07:00
commit 55182b688d
23 changed files with 1461 additions and 652 deletions

View file

@ -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) => {});
}
}
}
);
@ -229,7 +213,7 @@ onMounted(() => {
<!-- องคประกอบท 1 -->
<div
v-if="
store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'อำนวยการ' ||
store.dataEvaluation.posTypeName == 'บริหาร'
"
>

View file

@ -6,6 +6,7 @@ import { useKpiDataStore } from "@/modules/08_KPI/store";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRoute } from "vue-router";
import genReport from "@/plugins/genreport";
const store = useKpiDataStore();
const $q = useQuasar();
@ -191,6 +192,33 @@ function getData() {
.finally(() => {});
}
/**
* งกนดาวนโหลดรายงาน
*/
async function downloadReport() {
showLoader();
await http
.get(config.API.kpiReport(id.value))
.then(async (res) => {
console.log(res.data.result.data);
const data = res.data.result;
await genReport(
data,
"แบบรายงานผลการปฏิบัติราชการ " +
store.dataEvaluation.prefix +
store.dataEvaluation.fileName +
" " +
store.dataEvaluation.lastName
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
getData();
fetchEvaluation();
@ -206,6 +234,21 @@ onMounted(() => {
<q-toolbar-title class="text-subtitle2 text-bold"
>สรปผลการประเม</q-toolbar-title
>
<q-space />
<q-btn
v-if="store.dataEvaluation.evaluationStatus === 'COMPLETE'"
outline
flat
dense
color="blue"
icon="mdi-download"
size="12px"
class="q-mr-md"
@click="downloadReport"
>
<q-tooltip>ดาวนโหลดแบบรายงานผลการปฏราชการ</q-tooltip>
</q-btn>
</q-toolbar>
<q-separator />
<q-card-section>

View file

@ -277,12 +277,22 @@ watch(
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 85%">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader :tittle="`เพิ่มสมรรถนะ`" :close="closeDialog" />
<DialogHeader
:tittle="
competencyType == 'HEAD' || competencyType == 'GROUP'
? `รายละเอียดสมรรถนะ`
: `เพิ่มสมรรถนะ`
"
:close="closeDialog"
/>
<q-separator />
<q-card-section class="q-pa-none scroll" style="max-height: 80vh">
<div class="row">
<div class="bg-grey-1 q-pa-md col-xs-12 col-md-3 row lineRight">
<div
v-if="competencyType != 'HEAD' && competencyType != 'GROUP'"
class="bg-grey-1 q-pa-md col-xs-12 col-md-3 row lineRight"
>
<div class="col-12 q-col-gutter-sm fit">
<div class="col-12">
<q-select
@ -362,7 +372,13 @@ watch(
</div>
</div>
<div class="col-xs-12 col-md-9 q-pa-md q-col-gutter-sm">
<div
:class="
competencyType == 'HEAD' || competencyType == 'GROUP'
? `col-xs-12 col-md-12 q-pa-md q-col-gutter-sm`
: `col-xs-12 col-md-9 q-pa-md q-col-gutter-sm`
"
>
<span class="text-body2 text-weight-medium"
>รายละเอยดสมรรถนะ</span
>

View file

@ -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
@ -171,7 +172,7 @@ function getData(type: string) {
let resultAvg = result / total;
if (
store.dataEvaluation.posTypeName == "อำนวยการ" &&
store.dataEvaluation.posTypeName == "อำนวยการ" ||
store.dataEvaluation.posTypeName == "บริหาร"
) {
store.competencyScoreVal =
@ -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">
@ -468,7 +455,10 @@ onMounted(() => {
color="info"
@click.stop.pervent="onEdit(props.row, item.id)"
>
<q-tooltip>แกไข </q-tooltip>
<q-tooltip v-if="item.id == 'HEAD' || item.id == 'GROUP'"
>รายละเอยด</q-tooltip
>
<q-tooltip v-else>แก้ไข</q-tooltip>
</q-btn>
<q-btn
flat

View file

@ -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) => {});
}
});
}

View file

@ -58,7 +58,9 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const dataEvaluation = ref<any>({
evaluationReqEdit: null,
evaluationResults: null,
evaluationStatus: null,
isOpen: null,
profileId: null,
evaluatorId: null,
commanderId: null,
@ -66,6 +68,17 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
plannedPoint: 0,
rolePoint: 0,
specialPoint: 0,
prefix: "",
firstName: "",
lastName: "",
posExecutiveName: "",
posLevelName: "",
posTypeName: "",
position: "",
summaryPoint: 0,
totalPoint1: 0,
totalPoint2_1: 0,
totalPoint2_2: 0,
});
const competencyType = ref<DataOptions[]>([
@ -144,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);
@ -343,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,
@ -392,7 +407,7 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
convertCompetencyType,
convertStatus,
convertResults,
checkCompetency,
// checkCompetency,
checkCompetencyDefaultCompetencyLevel,
defaultCompetencyCoreLevel,
defaultCompetencyGroupLevel,

View file

@ -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
@ -525,8 +555,8 @@ onMounted(async () => {
(store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร' &&
store.indicatorWeightTotal != 100) ||
(store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'บริหาร' &&
((store.dataEvaluation.posTypeName == 'อำนวยการ' ||
store.dataEvaluation.posTypeName == 'บริหาร') &&
(store.indicatorWeight1Total != 100 ||
store.indicatorWeight2Total != 20))
"

View file

@ -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;