hrms-user/src/modules/08_KPI/components/Tab/04_Result.vue

453 lines
16 KiB
Vue
Raw Normal View History

2024-06-20 16:35:41 +07:00
<script setup lang="ts">
import { computed, ref } from "vue";
2024-06-20 18:05:00 +07:00
import DialogHeader from "@/components/DialogHeader.vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/08_KPI/store";
const store = useKpiDataStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogConfirm, success, showLoader, hideLoader, dialogMessageNotify } =
mixin;
2024-06-20 16:35:41 +07:00
const separator = ref<any>("cell");
2024-06-20 18:05:00 +07:00
const additionalSuperiorCommentRef = ref<any>(null);
const superiorCommentRef = ref<any>(null);
2024-06-20 16:35:41 +07:00
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>(10);
const result1 = ref<number>(20);
const weight2 = ref<number>(50);
const result2 = ref<number>(60);
const sumWeight = computed(() => {
return weight1.value + weight2.value;
});
const sumResult = computed(() => {
return result1.value + result2.value;
});
const group = computed(() => {
return convert(sumResult.value);
});
const options = ref<any[]>([
{
label: "ดีเด่น (คะแนนร้อยละ ๙๐. ขึ้นไป)",
value: "EXCELLENT",
},
{
label: "ดีมาก (คะแนนร้อยละ ๘๐. - ๘๙.๙๙)",
value: "VERYGOOD",
},
{
label: "ดี (คะแนนร้อยละ ๗๐. - ๗๙.๙๙)",
value: "GOOD",
},
{
label: "พอใช้ (คะแนนร้อยละ ๖๐. - ๖๙.๙๙)",
value: "FAIR",
},
{
label: "ต้องปรับปรุง (คะแนนต่ำกว่าร้อยละ ๖๐.)",
value: "IMPROVEMENT",
},
]);
function convert(score: any): string {
if (score >= 90) {
return "EXCELLENT";
} else if (score >= 80) {
return "VERYGOOD";
} else if (score >= 70) {
return "GOOD";
} else if (score >= 60) {
return "FAIR";
} else {
return "IMPROVEMENT";
}
}
2024-06-20 18:05:00 +07:00
function onSubmit() {
dialogConfirm($q, () => {});
}
2024-06-20 16:35:41 +07:00
2024-06-20 18:05:00 +07:00
function onSubmitCommander() {
if (superiorCommentCheck.value == "") {
dialogMessageNotify($q, "กรุณาเลือกความคิดเห็น");
} else {
dialogConfirm($q, () => {});
}
}
function onSubmitCommanderHigh() {
if (additionalSuperiorCheck.value == "") {
dialogMessageNotify($q, "กรุณาเลือกความคิดเห็น");
} else {
dialogConfirm($q, () => {});
}
2024-06-20 16:35:41 +07:00
}
2024-06-20 18:05:00 +07:00
function resetCommander() {
superiorComment.value = "";
superiorCommentRef.value.resetValidation();
2024-06-20 16:35:41 +07:00
}
2024-06-20 18:05:00 +07:00
function resetCommanderHigh() {
additionalSuperiorComment.value = "";
additionalSuperiorCommentRef.value.resetValidation();
2024-06-20 16:35:41 +07:00
}
</script>
2024-06-18 17:48:47 +07:00
<template>
2024-06-20 18:05:00 +07:00
<div class="q-pa-sm">
2024-06-20 16:35:41 +07:00
<!-- 1-4 สรปผลการประเม -->
<q-card bordered>
<q-form greedy @submit.prevent @validation-success="onSubmit">
2024-06-20 18:05:00 +07:00
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold"
>สรปผลการประเม</q-toolbar-title
>
</q-toolbar>
<q-separator />
2024-06-20 16:35:41 +07:00
<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">องคประกอบท ผลสมฤทธของงาน</td>
<td class="text-left">{{ weight1 }}</td>
<td class="text-left">{{ result1 }}</td>
</tr>
<tr>
<td class="text-left">
องคประกอบท พฤตกรรมการปฎราชการ (สมรรถนะ)
</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="group"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="EXCELLENT"
label="ดีเด่น (คะแนนร้อยละ ๙๐. ขึ้นไป)"
/>
<q-radio
v-model="group"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="VERYGOOD"
label="ดีมาก (คะแนนร้อยละ ๘๐. - ๘๙.๙๙)"
/>
<q-radio
v-model="group"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="GOOD"
label="ดี (คะแนนร้อยละ ๗๐. - ๗๙.๙๙)"
/>
<q-radio
v-model="group"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="FAIR"
label="พอใช้ (คะแนนร้อยละ ๖๐. - ๖๙.๙๙)"
/>
<q-radio
v-model="group"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="IMPROVEMENT"
label="ต้องปรับปรุง (คะแนนต่ำกว่าร้อยละ ๖๐.)"
/>
</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
2024-06-20 18:05:00 +07:00
hide-bottom-space
2024-06-20 16:35:41 +07:00
type="textarea"
label="ชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา"
2024-06-20 18:05:00 +07:00
:readonly="store.rolePerson !== 'EVALUATOR'"
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา'}`,]"
2024-06-20 16:35:41 +07:00
/>
</div>
<div class="col-12">
<q-input
v-model="developmentMethod"
outlined
2024-06-20 18:05:00 +07:00
hide-bottom-space
2024-06-20 16:35:41 +07:00
type="textarea"
label="วิธีการพัฒนา"
2024-06-20 18:05:00 +07:00
:readonly="store.rolePerson !== 'EVALUATOR'"
:rules="[(val:string) => !!val || `${'กรุณากรอกวิธีการพัฒนา'}`,]"
2024-06-20 16:35:41 +07:00
/>
</div>
<div class="col-12">
<q-input
v-model="developmentPeriod"
outlined
2024-06-20 18:05:00 +07:00
hide-bottom-space
2024-06-20 16:35:41 +07:00
type="textarea"
label="ช่วงเวลาการพัฒนา"
2024-06-20 18:05:00 +07:00
:readonly="store.rolePerson !== 'EVALUATOR'"
:rules="[(val:string) => !!val || `${'กรุณากรอกช่วงเวลาการพัฒนา'}`,]"
2024-06-20 16:35:41 +07:00
/>
</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
type="textarea"
2024-06-20 18:05:00 +07:00
hide-bottom-space
2024-06-20 16:35:41 +07:00
label="ความเห็นของผู้ประเมิน"
2024-06-20 18:05:00 +07:00
:readonly="store.rolePerson !== 'EVALUATOR'"
:rules="[(val:string) => !!val || `${'กรุณากรอกความเห็นของ'}`,]"
2024-06-20 16:35:41 +07:00
/>
</div>
</div>
</q-card-section>
2024-06-20 18:05:00 +07:00
<q-separator v-if="store.rolePerson == 'EVALUATOR'" />
<q-card-actions v-if="store.rolePerson == 'EVALUATOR'" align="right">
2024-06-20 16:35:41 +07:00
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
2024-06-20 18:05:00 +07:00
<q-card
bordered
class="q-mt-md"
v-if="store.rolePerson == 'COMMANDER' && evaluatorComment !== '' && store.dataEvaluation.commanderId !== null"
>
2024-06-20 16:35:41 +07:00
<q-form greedy @submit.prevent @validation-success="onSubmitCommander">
2024-06-20 18:05:00 +07:00
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold"
>ความเหนของผงคบบญชาเหนอขนไป</q-toolbar-title
>
</q-toolbar>
<q-separator />
2024-06-20 16:35:41 +07:00
<q-card-section>
2024-06-20 18:05:00 +07:00
<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"
label="เห็นด้วยกับผลการประเมิน"
@click="resetCommander()"
/>
<q-radio
v-model="superiorCommentCheck"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="false"
label="มีความเห็นต่าง ดังนี้"
/>
</div>
</div>
2024-06-20 16:35:41 +07:00
2024-06-20 18:05:00 +07:00
<div class="col-12">
<q-input
v-model="superiorComment"
outlined
:readonly="superiorCommentCheck == 'true'"
type="textarea"
label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไป"
hide-bottom-space
ref="superiorCommentRef"
:rules="[(val:string) => superiorCommentCheck !== 'false'||!!val || `${'กรุณากรอกความเห็น'}`,]"
/>
</div>
</div>
</q-card-section>
2024-06-20 16:35:41 +07:00
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
2024-06-20 18:05:00 +07:00
<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 />
2024-06-20 16:35:41 +07:00
<q-card-section>
2024-06-20 18:05:00 +07:00
<div class="row q-col-gutter-sm">
<div class="col-12">
<div class="column">
<q-radio
v-model="additionalSuperiorCheck"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="true"
label="เห็นด้วยกับผลการประเมิน"
@click="resetCommanderHigh()"
/>
<q-radio
v-model="additionalSuperiorCheck"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="false"
label="มีความเห็นต่าง ดังนี้"
/>
</div>
</div>
<div class="col-12">
<q-input
ref="additionalSuperiorCommentRef"
v-model="additionalSuperiorComment"
outlined
hide-bottom-space
type="textarea"
label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง"
:readonly="additionalSuperiorCheck == 'true'"
:rules="[(val:string) => additionalSuperiorCheck !== 'false'||!!val || `${'กรุณากรอกความเห็น'}`,]"
/>
</div>
2024-06-20 16:35:41 +07:00
</div>
2024-06-20 18:05:00 +07:00
</q-card-section>
2024-06-20 16:35:41 +07:00
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</div>
2024-06-18 17:48:47 +07:00
</template>
2024-06-20 16:35:41 +07:00
<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>