This commit is contained in:
STW_TTTY\stwtt 2024-06-28 14:03:08 +07:00
parent 7bb72d96f9
commit a86a9e498d
5 changed files with 638 additions and 16 deletions

View file

@ -54,8 +54,8 @@ export default {
kpiUserCapacity: `${KpiUser}/capacity`,
KpiEvaluationInfo,
Kpiorg,
kpiEvaluationCheck: `${kpiEvaluation}/check`,
kpiSendToStatus: (id: string) => `${kpiEvaluation}/status/${id}`,
kpiEvaluationCheck: `${kpiEvaluationUser}/check`,
kpiSendToStatus: (id: string) => `${kpiEvaluationUser}/status/${id}`,
kpiReqEdit: (id: string) => `${kpiEvaluation}/edit/${id}`,
/**ประเมิน*/
kpiAchievementDevelop: `${kpiAchievement}/development`,
@ -70,12 +70,17 @@ export default {
kpiLink,
profilePosition:`${env.API_URI}/org/profile/profileid/position`,
profilePosition: `${env.API_URI}/org/profile/profileid/position`,
placementKeycloak,
profilePositionKey: () => `${env.API_URI}/org/profile/keycloak/position`,
/** Report*/
kpiReport: () => `${KPI}/report/announcement`,
sendToCommander: `${KpiUser}/evaluation/admin/change-status`,
sendToSummary: (id: string) => `${kpiEvaluation}/summary/${id}`,
updatePoint: (id: string) => `${kpiEvaluation}/point/${id}`,
sendToSummary: (id: string) => `${kpiEvaluationUser}/summary/${id}`,
updatePoint: (id: string) => `${kpiEvaluationUser}/point/${id}`,
kpiSendToReason: (id: string, type: string) =>
`${kpiEvaluationUser}/reason/${type}/${id}`,
kpiSendToGet: (id: string) => `${kpiEvaluationUser}/reason/${id}`,
openPoint: (id: string) => `${kpiEvaluationUser}/open/${id}`,
};

View file

@ -1,6 +1,6 @@
import env from "../index";
const url = `${env.API_URI}/salary`;
const KpiFile = `${env.API_URI}/salary/file`;
export default {
subFile: (name: string, group: string, id: string, subId: string) =>
`${url}/sub-file/${name}/${group}/${id}/${subId}`,
@ -15,7 +15,7 @@ export default {
file: (name: string, group: string, id: string) =>
`${url}/file/${name}/${group}/${id}`,
KpiFile,
fileByPath: (name: string) =>
`${url}/file/${name}`,
fileByFile: (name: string, group: string, id: string, fileName: string) =>

View file

@ -0,0 +1,616 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/14_KPI/store";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRoute } from "vue-router";
const store = useKpiDataStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
dialogConfirm,
success,
showLoader,
hideLoader,
dialogMessageNotify,
messageError,
} = mixin;
const separator = ref<any>("cell");
const route = useRoute();
const id = ref<string>(route.params.id as string);
const additionalSuperiorCommentRef = ref<any>(null);
const superiorCommentRef = ref<any>(null);
const title = ref<string>("");
const developmentMethod = ref<string>("");
const developmentPeriod = ref<string>("");
const evaluatorComment = ref<string>("");
const superiorComment = ref<string>("");
const additionalSuperiorComment = ref<string>("");
const superiorCommentCheck = ref<string>("");
const additionalSuperiorCheck = ref<string>("");
const weight1 = ref<number>(0);
const result1 = ref<number>(0);
const weight2 = ref<number>(0);
const result2 = ref<number>(0);
const sumWeight = ref<number>(0);
const sumResult = ref<number>(0);
const result = ref<string>("");
function onSubmit() {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.kpiSendToReason(id.value, "user"), {
topicEvaluator: title.value,
developEvaluator: developmentMethod.value,
timeEvaluator: developmentPeriod.value,
reasonEvaluator: evaluatorComment.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
fetchEvaluation();
getData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
function onSubmitCommander() {
if (superiorCommentCheck.value == "") {
dialogMessageNotify($q, "กรุณาเลือกความคิดเห็น");
} else {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.kpiSendToReason(id.value, "commander"), {
isReason: superiorCommentCheck.value == "true" ? true : false,
reason: superiorComment.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
fetchEvaluation();
getData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
}
function onSubmitCommanderHigh() {
if (additionalSuperiorCheck.value == "") {
dialogMessageNotify($q, "กรุณาเลือกความคิดเห็น");
} else {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.kpiSendToReason(id.value, "commanderHigh"), {
isReason: additionalSuperiorCheck.value == "true" ? true : false,
reason: additionalSuperiorComment.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
fetchEvaluation();
getData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
}
function resetCommander() {
superiorComment.value = "";
superiorCommentRef.value.resetValidation();
}
function resetCommanderHigh() {
additionalSuperiorComment.value = "";
additionalSuperiorCommentRef.value.resetValidation();
}
/**
* งขอมลการประเม
*/
async function fetchEvaluation() {
await http
.get(config.API.kpiEvaluationUser + `/${id.value}`)
.then(async (res) => {
const data = res.data.result;
// store
store.dataEvaluation = await data;
//
if (
!store.dataEvaluation.isOpen &&
data.profileId == store.dataProfile.profileId
) {
userOpen();
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function userOpen() {
http.get(config.API.openPoint(id.value)).then(async (res) => {
// success($q, "");
});
}
function getData() {
http
.get(config.API.kpiSendToGet(id.value))
.then((res) => {
const data = res.data.result;
title.value = data.topicEvaluator;
developmentMethod.value = data.developEvaluator;
developmentPeriod.value = data.timeEvaluator;
evaluatorComment.value = data.reasonEvaluator;
superiorCommentCheck.value = data.isReasonCommander.toString();
superiorComment.value = data.reasonCommander;
additionalSuperiorCheck.value = data.isReasonCommanderHigh.toString();
additionalSuperiorComment.value = data.reasonCommanderHigh;
result1.value = data.totalPoint1;
result2.value = data.totalPoint2_1 + data.totalPoint2_2;
weight1.value = data.weightPoint1;
weight2.value = data.weightPoint2;
sumWeight.value = data.weightPoint1 + data.weightPoint2;
sumResult.value = data.summaryPoint;
result.value = data.evaluationResults;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
}
onMounted(() => {
getData();
fetchEvaluation();
});
</script>
<template>
<div class="q-pa-sm">
<!-- 1-4 สรปผลการประเม -->
<q-card bordered>
<q-form greedy @submit.prevent @validation-success="onSubmit">
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold"
>สรปผลการประเม</q-toolbar-title
>
</q-toolbar>
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="col-12">
<q-markup-table
:separator="separator"
flat
bordered
class="custom-table2"
>
<thead>
<tr>
<th class="text-left txt-customHead">
องคประกอบการประเม
</th>
<th class="text-left txt-customHead">ำหนกคะแนน</th>
<th class="text-left txt-customHead">ผลการประเม</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left">องคประกอบท 1 ผลสมฤทธของงาน</td>
<td class="text-left">{{ weight1 }}</td>
<td class="text-left">{{ result1 }}</td>
</tr>
<tr>
<td class="text-left">
องคประกอบท 2 พฤตกรรมการปฎราชการ (สมรรถนะ)
</td>
<td class="text-left">{{ weight2 }}</td>
<td class="text-left">{{ result2 }}</td>
</tr>
<tr>
<td class="text-right text-bold" style="font-size: 16px">
รวม
</td>
<td class="text-left">{{ sumWeight }}</td>
<td class="text-left">{{ sumResult }}</td>
</tr>
</tbody>
</q-markup-table>
</div>
<div class="col-12">
<div class="text-weight-bold text-body2">
<span class="txt-under text-blue-6">ระดบผลการประเม</span>
</div>
</div>
<div class="col-12 no-pointer">
<div class="column">
<q-radio
v-model="result"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="EXCELLENT"
label="ดีเด่น (คะแนนร้อยละ 90.00 ขึ้นไป)"
/>
<q-radio
v-model="result"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="VERY_GOOD"
label="ดีมาก (คะแนนร้อยละ 80.00 - 89.99)"
/>
<q-radio
v-model="result"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="GOOD"
label="ดี (คะแนนร้อยละ 70.00 - 79.99)"
/>
<q-radio
v-model="result"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="FAIR"
label="พอใช้ (คะแนนร้อยละ 60.00 - 69.99)"
/>
<q-radio
v-model="result"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="IMPROVEMENT"
label="ต้องปรับปรุง (คะแนนต่ำกว่าร้อยละ 60.00)"
/>
</div>
</div>
<div class="col-12">
<div class="text-weight-bold text-body2">
<span class="txt-under text-blue-6">ความร/กษะ/สมรรถนะ</span>
</div>
</div>
<div class="col-12">
<q-input
v-model="title"
outlined
lazy-rules
hide-bottom-space
type="textarea"
label="ชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา"
:readonly="
store.rolePerson !== 'EVALUATOR' ||
store.dataEvaluation.evaluationStatus !== 'SUMMARY'
"
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา'}`,]"
/>
</div>
<div class="col-12">
<q-input
v-model="developmentMethod"
outlined
lazy-rules
hide-bottom-space
type="textarea"
label="วิธีการพัฒนา"
:readonly="
store.rolePerson !== 'EVALUATOR' ||
store.dataEvaluation.evaluationStatus !== 'SUMMARY'
"
:rules="[(val:string) => !!val || `${'กรุณากรอกวิธีการพัฒนา'}`,]"
/>
</div>
<div class="col-12">
<q-input
v-model="developmentPeriod"
outlined
hide-bottom-space
lazy-rules
type="textarea"
label="ช่วงเวลาการพัฒนา"
:readonly="
store.rolePerson !== 'EVALUATOR' ||
store.dataEvaluation.evaluationStatus !== 'SUMMARY'
"
:rules="[(val:string) => !!val || `${'กรุณากรอกช่วงเวลาการพัฒนา'}`,]"
/>
</div>
<div class="col-12">
<div class="text-weight-bold text-body2">
<span class="txt-under text-blue-6">ความเหนของผประเม</span>
</div>
</div>
<div class="col-12">
<q-input
v-model="evaluatorComment"
outlined
lazy-rules
type="textarea"
hide-bottom-space
label="ความเห็นของผู้ประเมิน"
:readonly="
store.rolePerson !== 'EVALUATOR' ||
store.dataEvaluation.evaluationStatus !== 'SUMMARY'
"
:rules="[(val:string) => !!val || `${'กรุณากรอกความเห็นของ'}`,]"
/>
</div>
</div>
</q-card-section>
<q-separator
v-if="
store.rolePerson == 'EVALUATOR' &&
store.dataEvaluation.evaluationStatus == 'SUMMARY'
"
/>
<q-card-actions
v-if="
store.rolePerson == 'EVALUATOR' &&
store.dataEvaluation.evaluationStatus == 'SUMMARY'
"
align="right"
>
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
<q-card
bordered
class="q-mt-md"
v-if="
store.rolePerson == 'COMMANDER' &&
evaluatorComment !== null &&
store.dataEvaluation.commanderId !== null
"
>
<q-form greedy @submit.prevent @validation-success="onSubmitCommander">
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold"
>ความเหนของผงคบบญชาเหนอขนไป</q-toolbar-title
>
</q-toolbar>
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="col-12">
<div class="column">
<q-radio
v-model="superiorCommentCheck"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="true"
:disable="
store.dataEvaluation.evaluationStatus !==
'SUMMARY_COMMANDER'
"
label="เห็นด้วยกับผลการประเมิน"
@click="resetCommander()"
/>
<q-radio
v-model="superiorCommentCheck"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="false"
label="มีความเห็นต่าง ดังนี้"
:disable="
store.dataEvaluation.evaluationStatus !==
'SUMMARY_COMMANDER'
"
/>
</div>
</div>
<div class="col-12">
<q-input
lazy-rules
v-model="superiorComment"
outlined
:readonly="
superiorCommentCheck == 'true' ||
store.dataEvaluation.evaluationStatus !== 'SUMMARY_COMMANDER'
"
type="textarea"
label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไป"
hide-bottom-space
ref="superiorCommentRef"
:rules="[(val:string) => superiorCommentCheck !== 'false'||!!val || `${'กรุณากรอกความเห็น'}`,]"
/>
</div>
</div>
</q-card-section>
<q-separator
v-if="store.dataEvaluation.evaluationStatus == 'SUMMARY_COMMANDER'"
/>
<q-card-actions
align="right"
v-if="store.dataEvaluation.evaluationStatus == 'SUMMARY_COMMANDER'"
>
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
<q-card
bordered
class="q-mt-md"
v-if="
store.rolePerson == 'COMMANDERHIGH' &&
superiorComment !== '' &&
store.dataEvaluation.commanderHighId !== null
"
>
<q-form
greedy
@submit.prevent
@validation-success="onSubmitCommanderHigh"
>
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold"
>ความเหนของผงคบบญชาเหนอขนไปอกชนหน</q-toolbar-title
>
</q-toolbar>
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="col-12">
<div class="column">
<q-radio
:disable="
store.dataEvaluation.evaluationStatus !==
'SUMMARY_COMMANDER_HIGH'
"
v-model="additionalSuperiorCheck"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="true"
label="เห็นด้วยกับผลการประเมิน"
@click="resetCommanderHigh()"
/>
<q-radio
:disable="
store.dataEvaluation.evaluationStatus !==
'SUMMARY_COMMANDER_HIGH'
"
v-model="additionalSuperiorCheck"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="false"
label="มีความเห็นต่าง ดังนี้"
/>
</div>
</div>
<div class="col-12">
<q-input
lazy-rules
ref="additionalSuperiorCommentRef"
v-model="additionalSuperiorComment"
outlined
hide-bottom-space
type="textarea"
label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง"
:readonly="
additionalSuperiorCheck == 'true' ||
store.dataEvaluation.evaluationStatus !==
'SUMMARY_COMMANDER_HIGH'
"
:rules="[(val:string) => additionalSuperiorCheck !== 'false'||!!val || `${'กรุณากรอกความเห็น'}`,]"
/>
</div>
</div>
</q-card-section>
<q-separator
v-if="
store.dataEvaluation.evaluationStatus == 'SUMMARY_COMMANDER_HIGH'
"
/>
<q-card-actions
align="right"
v-if="
store.dataEvaluation.evaluationStatus == 'SUMMARY_COMMANDER_HIGH'
"
>
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</div>
</template>
<style scoped>
.no-pointer {
pointer-events: none;
}
.txt-customHead {
font-size: 14px;
font-weight: 500;
}
.txt-under {
text-decoration: underline;
}
.custom-table2 {
max-height: 64vh;
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr th {
position: sticky;
}
.q-table td:nth-of-type(2) {
z-index: 3 !important;
}
.q-table th:nth-of-type(2),
.q-table td:nth-of-type(2) {
position: sticky;
left: 0;
z-index: 1;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
.q-table thead tr:first-child th {
top: 0;
}
.q-btn-group--outline > .q-btn-item:not(:last-child):before {
border-right: 1px solid #c4c4c4;
}
.q-btn-group--outline > .q-btn-item.active {
color: #2196f3 !important;
background-color: #fff;
}
.q-btn-group--outline > .q-btn-item.active:not(:last-child):before {
border: 1px solid #2196f3;
}
}
</style>

View file

@ -25,7 +25,7 @@ interface ArrayFileList {
fileName: string;
}
const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false);
const isReadonly = ref<boolean>(route.name === "KPIEditEvaluator" ? true : false);
const documentFile = ref<any>(null);
const fileList = ref<ArrayFileList[]>([]);
@ -77,7 +77,7 @@ async function clickUpload(file: any) {
const formdata = new FormData();
formdata.append("file", selectedFile);
await http
.post(config.API.file + `/KPI/ไฟล์เอกสาร/${id.value}`, {
.post(config.API.KpiFile + `/KPI/ไฟล์เอกสาร/${id.value}`, {
replace: false,
fileList: fileName,
})
@ -106,7 +106,7 @@ async function clickUpload(file: any) {
function downloadFile(fileName: string) {
showLoader();
http
.get(config.API.file + `/KPI/ไฟล์เอกสาร/${id.value}/${fileName}`)
.get(config.API.KpiFile + `/KPI/ไฟล์เอกสาร/${id.value}/${fileName}`)
.then((res) => {
const data = res.data.downloadUrl;
window.open(data, "_blank");
@ -127,7 +127,7 @@ function deleteFile(fileName: string) {
dialogRemove($q, async () => {
showLoader();
http
.delete(config.API.file + `/KPI/ไฟล์เอกสาร/${id.value}/${fileName}`)
.delete(config.API.KpiFile + `/KPI/ไฟล์เอกสาร/${id.value}/${fileName}`)
.then((res) => {
success($q, `ลบไฟล์สำเร็จ`);
@ -158,7 +158,7 @@ onMounted(() => {
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-col-gutter-y-sm q-pa-sm">
<div class="col-12 row" v-if="!isReadonly">
<div class="col-12 row">
<q-file
for="inputFiles"
class="col-12"

View file

@ -8,6 +8,7 @@ import Avatar from "@/assets/!avatar_user.jpg";
import DialogHeader from "@/components/DialogHeader.vue";
import Assessment from "@/modules/14_KPI/components/Tab/01_Assessment.vue";
import Result from "@/modules/14_KPI/components/Tab/04_Result.vue";
import File from "@/modules/14_KPI/components/Tab/05_File.vue";
import DialogGovernment from "@/modules/14_KPI/components/Tab/Dialog/DialogGovernment.vue";
import DialogStatus from "@/modules/14_KPI/components/Tab/Dialog/DialogStatus.vue";
@ -94,7 +95,7 @@ async function fetchEvaluation() {
.then(async (res) => {
const data = res.data.result;
store.dataEvaluation = await data;
store.dataProfile = await data;
// store.dataProfile = await data;
formProfile.status = store.convertStatus(data.evaluationStatus);
formProfile.result = store.convertResults(data.evaluationResults);
store.checkCompetency();
@ -278,11 +279,11 @@ function filterOption(val: any, update: Function, refData: string) {
// }
async function getProfile() {
await http
.get(config.API.profilePositionKey())
.get(config.API.profilePosition+`/${store.dataEvaluation.profileId}`)
.then(async (res) => {
const data = await res.data.result;
store.dataProfile = await data;
await store.checkStep();
})
.catch((e) => {
messageError($q, e);
@ -293,7 +294,7 @@ async function getProfile() {
}
async function getAll() {
await fetchEvaluation();
await store.checkStep();
getProfile();
getOrgOp();
}