hrms-user/src/modules/08_KPI/views/form.vue

1361 lines
47 KiB
Vue
Raw Normal View History

2024-04-04 14:14:25 +07:00
<script setup lang="ts">
2025-03-26 14:39:09 +07:00
import { ref, onMounted, reactive, computed } from "vue";
2024-04-09 15:22:23 +07:00
import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
2025-02-20 11:40:35 +07:00
import genReport from "@/plugins/genreport";
2025-02-20 14:46:35 +07:00
import axios from "axios";
2024-04-09 15:22:23 +07:00
2024-09-10 11:42:43 +07:00
import http from "@/plugins/http";
import config from "@/app.config";
2024-04-09 15:22:23 +07:00
import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/08_KPI/store";
2024-04-09 15:22:23 +07:00
import type { FormProfile } from "@/modules/08_KPI/interface/request/index";
2024-09-10 11:42:43 +07:00
import type {
DataOptions,
EvaluatorType,
} from "@/modules/08_KPI/interface/index/Main";
import type { EvaOptionType } from "@/modules/08_KPI/interface/response/index";
2024-08-29 16:56:29 +07:00
2024-09-10 11:42:43 +07:00
import TabMain from "@/modules/08_KPI/components/Tab/TabMain.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogGovernment from "@/modules/08_KPI/components/Tab/Dialog/DialogGovernment.vue";
2025-02-20 14:46:35 +07:00
interface ArrayFileList {
id: string;
pathName: string;
fileName: string;
}
2024-04-09 15:22:23 +07:00
const $q = useQuasar();
2024-09-10 11:42:43 +07:00
const store = useKpiDataStore();
2024-04-09 15:22:23 +07:00
const mixin = useCounterMixin();
2024-07-12 13:33:29 +07:00
const {
showLoader,
hideLoader,
messageError,
dialogConfirm,
success,
findOrgName,
2025-03-26 14:39:09 +07:00
findOrgNameHtml,
2025-02-20 14:46:35 +07:00
dialogRemove,
2024-07-12 13:33:29 +07:00
} = mixin;
2024-09-10 11:42:43 +07:00
const route = useRoute();
const router = useRouter();
const id = ref<string>(route.params.id as string);
2025-02-20 14:46:35 +07:00
const modalUpload = ref<boolean>(false);
const fileUpload = ref<any>(null);
const fileList = ref<ArrayFileList[]>([]);
2024-09-10 11:42:43 +07:00
const modalGovernment = ref<boolean>(false); // ตัวแปร dialog ช่วยราชการ
const modalEdit = ref<boolean>(false); // ตัวแปร dialog แก้ไขผู้ประเมิน
const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false);
2024-04-26 15:18:28 +07:00
2024-09-10 11:42:43 +07:00
const evaluatorIdOp = ref<DataOptions[]>([]); // ตัวแปรเก็บ option ผู้ประเมิน
const commanderIdOp = ref<DataOptions[]>([]); // ตัวแปรเก็บ option ผู้บังคับบัญชา
const commanderHighOp = ref<DataOptions[]>([]); // ตัวแปรเก็บ option ผู้บังคับบัญชาเหนือไปอีกขั้น
2024-04-26 15:18:28 +07:00
2024-09-10 11:42:43 +07:00
const evaluatorIdMainOp = ref<DataOptions[]>([]); // ตัวแปรเก็บ option ผู้ประเมิน
const commanderIdMainOp = ref<DataOptions[]>([]); // ตัวแปรเก็บ option ผู้บังคับบัญชา
const commanderHighMainOp = ref<DataOptions[]>([]); // ตัวแปรเก็บ option ผู้บังคับบัญชาเหนือไปอีกขั้น
2024-09-10 11:42:43 +07:00
const evaluatorId = ref<any>(null); // ตัวแปรเก็บ id ผู้ประเมิน
const commanderId = ref<any>(null); // ตัวแปรเก็บ id ผู้บังคับบัญชา
const commanderHighId = ref<any>(null); // ตัวแปรเก็บ id ผู้บังคับบัญชาเหนือไปอีกขั้น
2024-04-09 15:22:23 +07:00
const formProfile = reactive<FormProfile>({
fullName: "",
position: "",
type: "",
level: "",
status: "",
result: "",
score: "-",
avartar: "",
2024-04-09 15:22:23 +07:00
});
2024-04-04 14:14:25 +07:00
2024-09-10 11:42:43 +07:00
/** ฟังชั่นดึงข้อมูล ผู้ประเมิน */
2024-05-13 18:05:47 +07:00
async function fetchEvaluation() {
await http
.get(config.API.kpiEvaluation + `/${id.value}`)
2024-08-29 16:56:29 +07:00
.then(async (res) => {
const data = await res.data.result;
2025-01-14 16:23:28 +07:00
store.dataEvaluation = await res.data.result;
formProfile.status = store.convertStatus(data.evaluationStatus);
formProfile.result = store.convertResults(data.evaluationResults);
2024-06-26 22:15:23 +07:00
store.checkCompetencyDefaultCompetencyLevel();
2025-01-20 13:52:25 +07:00
await getAvatar(data.profileId);
})
.catch((e) => {
messageError($q, e);
});
}
2025-01-20 13:52:25 +07:00
async function getAvatar(id: string) {
await http
2025-01-20 13:52:25 +07:00
.get(config.API.orgCheckAvatar(id))
2024-05-13 18:05:47 +07:00
.then(async (res) => {
2024-06-18 09:03:04 +07:00
const data = await res.data.result;
2024-08-29 16:56:29 +07:00
if (data.avatarName) {
2025-01-20 13:52:25 +07:00
await fetchProfile(id, data.avatarName);
2024-08-29 16:56:29 +07:00
}
2024-04-09 15:22:23 +07:00
})
.catch((e) => {
messageError($q, e);
});
}
2024-04-09 16:30:20 +07:00
2024-09-10 11:42:43 +07:00
/** ดึงข้อมูล เพื่อเก็บรูปโปรไฟล์ */
2024-08-29 16:56:29 +07:00
async function fetchProfile(id: string, avatarName: string) {
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
.then(async (res) => {
2024-08-29 16:56:29 +07:00
store.dataEvaluation.avartar = res.data.downloadUrl;
});
}
2024-09-10 11:42:43 +07:00
/** เปิด dialog แก้ไขผู้ประเมิน */
2024-07-14 23:04:43 +07:00
function openEvaluator() {
modalEdit.value = true;
getOrgOp();
}
2024-09-10 11:42:43 +07:00
/** ปิด dialog */
2024-04-26 15:18:28 +07:00
function close() {
modalEdit.value = false;
evaluatorId.value = null;
commanderId.value = null;
commanderHighId.value = null;
2024-04-26 15:18:28 +07:00
}
2024-09-10 11:42:43 +07:00
/** บันทึกข้อมูล */
2024-04-26 15:18:28 +07:00
function onSubmit() {
dialogConfirm($q, () => {
if (id.value) {
2024-04-26 17:02:01 +07:00
showLoader();
http
.put(config.API.kpiEvaluationCheck + `/${id.value}`, {
evaluatorId: evaluatorId.value ? evaluatorId.value.id : null,
commanderId: commanderId.value ? commanderId.value.id : null,
commanderHighId: commanderHighId.value
? commanderHighId.value.id
: null,
})
2024-08-29 16:56:29 +07:00
.then(async () => {
await Promise.all([fetchEvaluation(), getOrgOp()]);
2024-06-27 12:30:40 +07:00
success($q, "บันทึกสำเร็จ");
2024-08-29 16:56:29 +07:00
close();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
2024-04-26 17:02:01 +07:00
}
2024-04-26 15:18:28 +07:00
});
}
2024-09-10 11:42:43 +07:00
/** ดึงข้อมูล ผู้ประเมิน */
async function getOrgOp() {
http
.get(config.API.Kpiorg)
.then((res) => {
const data = res.data.result;
2024-09-10 11:42:43 +07:00
evaluatorIdMainOp.value = data.caregiver.map((i: EvaOptionType) => ({
id: i.id,
name: `${i.prefix}${i.firstName} ${i.lastName}`,
}));
2024-09-10 11:42:43 +07:00
commanderIdMainOp.value = data.commander.map((i: EvaOptionType) => ({
id: i.id,
name: `${i.prefix}${i.firstName} ${i.lastName}`,
}));
2024-09-10 11:42:43 +07:00
commanderHighMainOp.value = data.chairman.map((i: EvaOptionType) => ({
id: i.id,
name: `${i.prefix}${i.firstName} ${i.lastName}`,
}));
evaluatorId.value = data.caregiver
2024-09-10 11:42:43 +07:00
.map((i: EvaOptionType) => ({
id: i.id,
name: `${i.prefix}${i.firstName} ${i.lastName}`,
}))
2024-09-10 11:42:43 +07:00
.find((i: EvaOptionType) => i.id == store.dataEvaluation.evaluatorId);
2024-06-26 17:00:34 +07:00
commanderId.value = data.commander
2024-09-10 11:42:43 +07:00
.map((i: EvaOptionType) => ({
id: i.id,
name: `${i.prefix}${i.firstName} ${i.lastName}`,
}))
2024-09-10 11:42:43 +07:00
.find((i: EvaOptionType) => i.id == store.dataEvaluation.commanderId);
2024-06-26 17:00:34 +07:00
commanderHighId.value = data.chairman
2024-09-10 11:42:43 +07:00
.map((i: EvaOptionType) => ({
id: i.id,
name: `${i.prefix}${i.firstName} ${i.lastName}`,
}))
2024-09-10 11:42:43 +07:00
.find(
(i: EvaOptionType) => i.id == store.dataEvaluation.commanderHighId
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
}
2024-09-10 11:42:43 +07:00
/** ฟิลเตอร์ input */
function filterOption(val: string, update: Function, refData: string) {
switch (refData) {
case "evaluatorIdOp":
update(() => {
evaluatorIdOp.value = evaluatorIdMainOp.value.filter(
2024-09-10 11:42:43 +07:00
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
case "commanderIdOp":
update(() => {
commanderIdOp.value = commanderIdMainOp.value.filter(
2024-09-10 11:42:43 +07:00
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
case "commanderHighOp":
update(() => {
commanderHighOp.value = commanderHighMainOp.value.filter(
2024-09-10 11:42:43 +07:00
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
default:
break;
}
}
2024-09-10 11:42:43 +07:00
/** ดึงข้อมูลทั้งหมดในหน้า */
2024-05-27 16:43:40 +07:00
async function getAll() {
2025-01-29 14:48:48 +07:00
await Promise.all([fetchEvaluation(), getOrgOp(), getProfile()]);
2025-01-14 17:12:59 +07:00
await store.checkStep();
}
2024-09-10 11:42:43 +07:00
/** ส่งให้ผู้ประเมิน */
2024-06-26 22:15:23 +07:00
function sendToEvaluatore() {
2024-05-09 12:12:58 +07:00
dialogConfirm(
$q,
() => {
if (id.value) {
2024-05-09 17:14:21 +07:00
showLoader();
http
.put(config.API.kpiSendToStatus(id.value), {
2024-06-26 22:15:23 +07:00
status: "NEW_EVALUATOR",
2024-05-09 17:14:21 +07:00
})
2024-08-29 16:56:29 +07:00
.then(async () => {
await fetchEvaluation();
await success($q, "ส่งข้อตกลงให้ผู้ประเมินอนุมัติสำเร็จ");
2024-05-09 17:14:21 +07:00
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
2024-05-09 12:12:58 +07:00
}
},
"ยืนยันการส่งข้อตกลงให้ผู้ประเมินอนุมัติ",
"ต้องการยืนยันส่งข้อตกลงนี้ให้ผู้ประเมินอนุมัติใช่หรือไม่?"
);
}
2024-08-29 16:56:29 +07:00
/**
* นยนการสงใหประเมนรายงานผลสำเรจของงาน
*/
2024-06-26 22:15:23 +07:00
function sendToEvaluateEvaluatore() {
dialogConfirm(
$q,
() => {
if (id.value) {
showLoader();
http
.put(config.API.kpiSendToStatus(id.value), {
status: "EVALUATING_EVALUATOR",
})
2024-08-29 16:56:29 +07:00
.then(async () => {
await fetchEvaluation();
await success($q, "ส่งให้ผู้ประเมินรายงานผลสำเร็จของงานสำเร็จ");
2024-06-26 22:15:23 +07:00
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
},
"ยืนยันการส่งให้ผู้ประเมินรายงานผลสำเร็จของงาน",
"ต้องการยืนยันส่งให้ผู้ประเมินรายงานผลสำเร็จของงานใช่หรือไม่?"
);
}
2024-08-29 16:56:29 +07:00
/**
* นยนการขอแกไขขอตกลง
*/
2024-05-09 12:12:58 +07:00
function requireEdit() {
dialogConfirm(
$q,
() => {
if (id.value) {
2024-05-09 18:09:43 +07:00
showLoader();
http
.put(config.API.kpiReqEdit(id.value), {
status: "EVALUATOR",
})
2024-08-29 16:56:29 +07:00
.then(async (res) => {
await fetchEvaluation();
await success($q, "ขอแก้ไขสำเร็จ");
2024-05-09 18:09:43 +07:00
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
2024-05-09 12:12:58 +07:00
}
},
"ยืนยันการขอแก้ไขข้อตกลง",
"ต้องการยืนยันการขอแก้ไขข้อตกลงนี้ใช่หรือไม่?"
);
}
2024-09-10 11:42:43 +07:00
/** เปิด dialog ช่วยราชการ */
function openGovernment() {
modalGovernment.value = true;
}
2024-08-29 16:56:29 +07:00
2024-09-10 11:42:43 +07:00
/** เช็ค สถานะการทดลองงาน */
function openStatus() {
2025-01-20 13:52:25 +07:00
router.push(`/probation-detail/${store.dataEvaluation.id}`);
}
2024-09-10 11:42:43 +07:00
/** ส่งให้ผู้ประเมิน */
2024-06-26 17:07:01 +07:00
function sendToEvauator() {
dialogConfirm($q, () => {
showLoader();
http
.post(config.API.sendToCommander, {
2024-06-26 22:15:23 +07:00
status: "EVALUATING",
id: [store.dataEvaluation.id],
})
2024-08-29 16:56:29 +07:00
.then(async () => {
await getAll();
store.tabMain = "3";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
2024-06-18 09:03:04 +07:00
hideLoader();
});
});
}
2024-08-29 16:56:29 +07:00
/**
* นยนการสงไปสรปผลการประเม
*/
2024-06-28 09:25:21 +07:00
async function goToSummary() {
2024-06-26 20:24:39 +07:00
dialogConfirm(
$q,
2024-06-28 09:25:21 +07:00
async () => {
2024-06-26 20:24:39 +07:00
showLoader();
2024-06-28 09:25:21 +07:00
await http
2024-06-26 20:24:39 +07:00
.get(config.API.sendToSummary(store.dataEvaluation.id))
2024-08-29 16:56:29 +07:00
.then(async () => {
2024-06-28 09:25:21 +07:00
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) => {});
2024-06-27 12:30:40 +07:00
await fetchEvaluation();
2024-06-26 20:24:39 +07:00
store.tabMain = "4";
2024-06-27 12:30:40 +07:00
store.tabOpen = 4;
2024-06-26 20:24:39 +07:00
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการส่งไปสรุปผลการประเมิน",
"ต้องการยืนยันส่งไปสรุปผลการประเมินใช่หรือไม่?"
);
2024-06-26 17:07:01 +07:00
}
2024-09-10 11:42:43 +07:00
/**
* เป dialog อมลผประเม
* @param profileId id ประเม
* @param type ประเภท
*/
2024-07-14 23:04:43 +07:00
const modalEvaluatorDetail = ref<boolean>(false);
const topic = ref<string>("");
2024-09-10 11:42:43 +07:00
2024-07-14 23:04:43 +07:00
function viewEvaluatorDetail(profileId: string, type: string) {
modalEvaluatorDetail.value = true;
topic.value =
type == "evaluator"
? "ข้อมูลของผู้ประเมิน"
: type == "commander"
? "ข้อมูลของผู้บังคับบัญชาเหนือขึ้นไป"
: "ข้อมูลของผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง";
fetchProfileEvaluator(profileId);
}
2024-09-10 11:42:43 +07:00
const evaluator = ref<EvaluatorType>({
2024-07-14 23:04:43 +07:00
fullName: "",
position: "",
avartar: "",
posTypeName: "",
posLevelName: "",
org: "",
2024-09-10 11:42:43 +07:00
posExecutiveName: "",
2024-08-20 10:12:57 +07:00
isPosmasterAct: false,
posmasterAct: [],
2024-07-14 23:04:43 +07:00
});
2024-08-29 16:56:29 +07:00
2024-09-10 11:42:43 +07:00
/**
* อมลของผประเม
* @param id อมลของผประเม
*/
2024-07-14 23:04:43 +07:00
async function fetchProfileEvaluator(id: string) {
showLoader();
http
.get(config.API.orgPosition + `/${id}`)
2024-08-29 16:56:29 +07:00
.then(async (res) => {
const data = await res.data.result;
2024-07-14 23:04:43 +07:00
evaluator.value.fullName =
data.prefix + data.firstName + " " + data.lastName;
evaluator.value.position = data.position;
evaluator.value.posTypeName = data.posTypeName;
evaluator.value.posLevelName = data.posLevelName;
2024-08-20 10:12:57 +07:00
evaluator.value.isPosmasterAct = data.isPosmasterAct;
evaluator.value.posmasterAct = data.posmasterAct;
2025-03-26 14:39:09 +07:00
evaluator.value.org = await findOrgNameHtml(data);
2024-07-14 23:04:43 +07:00
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
2025-01-29 14:48:48 +07:00
/** ดึงข้อมูลโปรไฟล์ */
async function getProfile() {
await http
.get(config.API.profilePosition())
.then(async (res) => {
const data = await res.data.result;
store.dataProfile = await data;
})
.catch((e) => {
messageError($q, e);
});
}
2025-02-20 11:40:35 +07:00
async function downloadReport() {
await http
.get(config.API.kpiReportList(id.value))
.then(async (res) => {
const data = res.data.result;
await genReport(
data,
2025-02-20 14:46:35 +07:00
"แบบกำหนดข้อตกลง" +
2025-02-20 11:40:35 +07:00
store.dataEvaluation.prefix +
store.dataEvaluation.firstName +
" " +
store.dataEvaluation.lastName
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
}
2025-02-20 14:46:35 +07:00
async function uploadReport() {
modalUpload.value = true;
getData();
}
function closeDialog() {
modalUpload.value = false;
fileUpload.value = null;
}
/** ฟังชั่น อัปโหลดไฟล์ */
async function clickUpload(file: any) {
const fileName = { fileName: file.name };
dialogConfirm(
$q,
async () => {
showLoader();
const selectedFile = file;
const formdata = new FormData();
formdata.append("file", selectedFile);
await http
.post(config.API.file("แบบกำหนดข้อตกลง", "KPI", id.value), {
replace: true,
fileList: fileName,
})
.then(async (res) => {
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey &&
uploadFileDoc(res.data[foundKey]?.uploadUrl, fileUpload.value);
})
.catch((err) => {
messageError($q, err);
});
},
"ยืนยันการอัปโหลดไฟล์",
"ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?"
);
}
/**
* ปโหลดไฟล
* @param uploadUrl url
* @param file ไฟล
*/
async function uploadFileDoc(uploadUrl: string, file: any) {
const Data = new FormData();
Data.append("file", fileUpload.value);
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(async (res) => {
await getData();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fileUpload.value = null;
hideLoader();
});
}
/** ดึงข้อมูล */
async function getData() {
showLoader();
await http
.get(config.API.file("แบบกำหนดข้อตกลง", "KPI", id.value))
.then((res) => {
fileList.value = res.data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* ลบไฟล
* @param fileName file name
*/
function deleteFile(fileName: string) {
dialogRemove($q, async () => {
showLoader();
http
.delete(
config.API.file("แบบกำหนดข้อตกลง", "KPI", id.value) + `/${fileName}`
)
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await getData();
setTimeout(() => {
success($q, `ลบไฟล์สำเร็จ`);
hideLoader();
}, 500);
});
});
}
/**
* ดาวนโหลดลงกไฟล
* @param fileName file name
*/
function downloadFile(fileName: string) {
showLoader();
http
.get(config.API.file("แบบกำหนดข้อตกลง", "KPI", id.value) + `/${fileName}`)
.then((res) => {
const data = res.data.downloadUrl;
window.open(data, "_blank");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
2025-03-26 14:39:09 +07:00
const sizeImg = ref<any>();
function onResize(size: { width: any; height: any }) {
if (size.height <= 156) {
sizeImg.value = "80px";
} else if (size.height > 156) {
sizeImg.value = "120px";
}
}
2024-05-27 16:43:40 +07:00
onMounted(async () => {
2024-05-02 16:13:34 +07:00
showLoader();
2025-01-14 16:23:28 +07:00
store.isUpdate = false;
2024-05-27 16:43:40 +07:00
await getAll();
2024-04-09 15:22:23 +07:00
});
2024-04-04 14:14:25 +07:00
</script>
<template>
2024-05-24 16:57:35 +07:00
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="
isReadonly ? router.push(`/KPI-evaluator`) : router.push(`/KPI`)
"
/>
{{
isReadonly
? "รายละเอียดการประเมินผลการปฏิบัติราชการระดับบุคคล"
: id
? `แก้ไขแบบประเมิน`
: `เพิ่มแบบประเมิน`
}}
<q-space />
</div>
<div class="col-12">
<q-card bordered flat class="relative-position">
2024-05-27 16:43:40 +07:00
<div class="row justify-center q-pa-md" v-if="!$q.screen.gt.xs">
2025-03-26 14:39:09 +07:00
<q-avatar :size="sizeImg">
2024-05-27 16:43:40 +07:00
<q-img
:src="store.dataEvaluation.avartar"
v-if="store.dataEvaluation.avartar !== undefined"
/>
<q-img src="@/assets/avatar_user.jpg" v-else />
</q-avatar>
</div>
2024-05-24 16:57:35 +07:00
<div
2024-05-27 16:43:40 +07:00
v-if="$q.screen.gt.xs"
2024-05-24 16:57:35 +07:00
class="absolute-center-left"
style="left: 2%; top: 50%; transform: translateY(-50%)"
>
2025-03-26 14:39:09 +07:00
<q-avatar :size="sizeImg">
2024-05-24 16:57:35 +07:00
<q-img
:src="store.dataEvaluation.avartar"
v-if="store.dataEvaluation.avartar !== undefined"
/>
<q-img src="@/assets/avatar_user.jpg" v-else />
</q-avatar>
</div>
<div class="row col-12">
2025-03-26 14:39:09 +07:00
<q-resize-observer @resize="onResize" />
2024-05-24 16:57:35 +07:00
<div class="row items-center col-12 q-pa-sm">
2024-05-27 16:43:40 +07:00
<div
class="col-12"
:style="$q.screen.gt.xs ? 'padding-left: 12%' : ''"
>
<div class="row col-12 items-center justify-center">
2024-07-12 13:33:29 +07:00
<div>
<span class="text-h6 text-weight-medium text-primary">{{
store.dataEvaluation.firstName
? `${store.dataEvaluation.prefix}${store.dataEvaluation.firstName} ${store.dataEvaluation.lastName}`
: ""
}}</span>
2025-03-26 14:39:09 +07:00
<p class="q-mb-none text-html">
{{ findOrgNameHtml(store.dataEvaluation) }}
2024-07-12 13:33:29 +07:00
</p>
</div>
2024-05-27 16:43:40 +07:00
<q-space v-if="$q.screen.gt.xs" />
2024-05-24 16:57:35 +07:00
<div class="q-gutter-x-sm">
<span
v-if="
2024-06-28 09:25:21 +07:00
store.tabMain === '1' &&
store.dataEvaluation.evaluationStatus == 'NEW' &&
((store.dataEvaluation.posTypeName != 'อำนวยการ' &&
2024-06-26 17:07:01 +07:00
store.dataEvaluation.posTypeName != 'บริหาร' &&
2024-05-24 16:57:35 +07:00
store.indicatorWeightTotal != 100) ||
2024-06-28 09:25:21 +07:00
((store.dataEvaluation.posTypeName == 'อำนวยการ' ||
store.dataEvaluation.posTypeName == 'บริหาร') &&
2025-01-29 14:48:48 +07:00
store.indicatorWeightTotal != 100))
2024-05-24 16:57:35 +07:00
"
class="text-red"
>*ำหน(อยละ) ผลสมฤทธของงานไมกตอง</span
>
<br v-if="!$q.screen.gt.xs" />
2024-05-24 16:57:35 +07:00
<q-btn
v-if="
store.rolePerson == 'USER' &&
store.dataEvaluation.evaluationStatus == 'NEW'
"
:disabled="
2025-01-29 14:48:48 +07:00
((store.dataEvaluation.posTypeName != 'อำนวยการ' ||
store.dataEvaluation.posTypeName != 'บริหาร') &&
2024-05-24 16:57:35 +07:00
store.indicatorWeightTotal != 100) ||
2024-06-27 16:10:06 +07:00
((store.dataEvaluation.posTypeName == 'อำนวยการ' ||
store.dataEvaluation.posTypeName == 'บริหาร') &&
2025-01-29 14:48:48 +07:00
store.indicatorWeightTotal != 100)
2024-05-24 16:57:35 +07:00
"
unelevated
round
icon="mdi-send"
color="grey-2"
text-color="blue-6"
size="md"
2024-06-26 22:15:23 +07:00
@click="sendToEvaluatore()"
2024-05-24 16:57:35 +07:00
>
<q-tooltip>งใหประเมนอน</q-tooltip>
</q-btn>
<q-btn
v-if="
2024-06-26 22:15:23 +07:00
store.rolePerson == 'USER' &&
store.tabMain == '2' &&
store.dataEvaluation.evaluationStatus == 'APPROVE'
"
unelevated
round
icon="mdi-send"
color="grey-2"
text-color="blue-6"
size="md"
2024-06-26 17:07:01 +07:00
@click="sendToEvauator"
>
<q-tooltip>ทำการประเม</q-tooltip>
</q-btn>
2024-05-24 16:57:35 +07:00
<q-btn
v-if="
store.rolePerson == 'USER' &&
2024-06-18 09:03:04 +07:00
store.dataEvaluation.evaluationStatus == 'EVALUATING' &&
store.tabMain == '3'
2024-05-24 16:57:35 +07:00
"
unelevated
round
icon="mdi-send"
color="grey-2"
text-color="blue-6"
size="md"
2024-06-26 22:15:23 +07:00
@click="sendToEvaluateEvaluatore()"
2024-05-24 16:57:35 +07:00
>
2024-06-26 12:10:54 +07:00
<q-tooltip
>งใหประเมนรายงานผลสำเรจของงาน</q-tooltip
>
2024-05-24 16:57:35 +07:00
</q-btn>
2024-05-24 16:57:35 +07:00
<q-btn
v-if="
store.rolePerson == 'USER' &&
store.tabOpen < 3 &&
store.dataEvaluation.evaluationStatus != 'NEW' &&
(store.dataEvaluation.evaluationReqEdit == null ||
store.dataEvaluation.evaluationReqEdit == 'DONE')
"
:disabled="store.dataEvaluation.evaluatorId == null"
unelevated
round
icon="mdi-file-edit"
color="grey-2"
text-color="red-6"
size="md"
@click="requireEdit()"
>
<q-tooltip>ขอแกไขขอตกลง</q-tooltip>
</q-btn>
2024-06-26 17:07:01 +07:00
<q-btn
v-if="
store.rolePerson == 'EVALUATOR' &&
store.tabMain === '3' &&
store.dataEvaluation.evaluationStatus ===
'EVALUATING_EVALUATOR'
"
:disabled="
2024-06-26 22:15:23 +07:00
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal <=
0
2024-06-26 17:07:01 +07:00
"
unelevated
round
icon="mdi-send"
color="grey-2"
text-color="blue-6"
size="md"
@click="goToSummary()"
>
<q-tooltip>สรปผลการประเม</q-tooltip>
</q-btn>
2024-05-24 16:57:35 +07:00
<q-btn
2024-06-26 22:15:23 +07:00
v-if="store.rolePerson == 'USER'"
2024-05-24 16:57:35 +07:00
unelevated
round
icon="mdi-account"
color="grey-2"
text-color="edit"
size="md"
2024-07-14 23:04:43 +07:00
@click="openEvaluator()"
2024-05-24 16:57:35 +07:00
>
<q-tooltip>{{
store.dataEvaluation.evaluationStatus === "NEW" &&
store.rolePerson === "USER"
? "แก้ไขผู้ประเมิน"
: "ข้อมูลผู้ประเมิน"
}}</q-tooltip>
</q-btn>
<q-btn
unelevated
round
icon="mdi-file-eye-outline"
color="grey-2"
text-color="primary"
size="md"
@click="openGovernment"
2024-05-24 16:57:35 +07:00
>
<q-tooltip>อมลการชวยราชการ</q-tooltip>
</q-btn>
<q-btn
unelevated
round
color="grey-2"
text-color="blue-5"
icon="mdi-file-eye-outline"
size="md"
@click="openStatus"
2024-05-24 16:57:35 +07:00
>
2024-06-26 12:10:54 +07:00
<q-tooltip
>อมลการทดลองปฏหนาทราชการ</q-tooltip
>
2024-05-24 16:57:35 +07:00
</q-btn>
2025-02-20 11:40:35 +07:00
<q-btn
v-if="
2025-02-20 14:46:35 +07:00
store.dataEvaluation.evaluationStatus !== 'NEW' &&
2025-02-20 11:40:35 +07:00
store.dataEvaluation.evaluationStatus !==
2025-02-20 14:46:35 +07:00
'NEW_EVALUATOR' &&
2025-02-20 11:40:35 +07:00
store.dataEvaluation.evaluationStatus !==
2025-02-20 14:46:35 +07:00
'NEW_COMMANDER' &&
2025-02-20 11:40:35 +07:00
store.dataEvaluation.evaluationStatus !==
'NEW_COMMANDER_HIGH'
"
unelevated
round
color="grey-2"
text-color="primary"
icon="download"
size="md"
@click="downloadReport()"
>
<q-tooltip
>ดาวนโหลดแบบกำหนดขอตกลงการประเมนผลสมฤทธของงานและพฤตกรรมการปฏราชการ</q-tooltip
>
</q-btn>
2025-02-20 14:46:35 +07:00
<q-btn
v-if="
store.dataEvaluation.evaluationStatus !== 'NEW' &&
store.dataEvaluation.evaluationStatus !==
'NEW_EVALUATOR' &&
store.dataEvaluation.evaluationStatus !==
'NEW_COMMANDER' &&
store.dataEvaluation.evaluationStatus !==
'NEW_COMMANDER_HIGH'
"
unelevated
round
color="grey-2"
text-color="blue"
icon="upload"
size="md"
@click="uploadReport()"
>
<q-tooltip
>ปโหลดแบบกำหนดขอตกลงการประเมนผลสมฤทธของงานและพฤตกรรมการปฏราชการ</q-tooltip
>
</q-btn>
2024-04-09 15:22:23 +07:00
</div>
2024-04-19 15:30:39 +07:00
</div>
2024-04-09 15:22:23 +07:00
</div>
2024-05-24 16:57:35 +07:00
</div>
2024-04-09 15:22:23 +07:00
2024-05-24 16:57:35 +07:00
<div class="row items-center bg-toolbar col-12 q-pa-sm">
2024-05-27 16:43:40 +07:00
<div
class="col-12 q-py-xs"
:style="
$q.screen.gt.xs ? 'padding-left: 12%' : 'padding-left:5%'
"
>
2024-06-05 11:36:57 +07:00
<div class="row">
<div class="col-xs-12 col-md-2">
<div :class="$q.screen.gt.sm ? 'column' : 'row'">
<span class="text-grey-6 col">ตำแหนงในสายงาน</span>
<span class="text-weight-medium text-dark col">{{
2024-05-24 16:57:35 +07:00
store.dataEvaluation.position
}}</span>
2024-04-09 15:22:23 +07:00
</div>
2024-05-24 16:57:35 +07:00
</div>
2024-06-05 11:36:57 +07:00
<div class="col-xs-12 col-md-2">
<div :class="$q.screen.gt.sm ? 'column' : 'row'">
2024-06-26 14:35:19 +07:00
<span class="text-grey-6 col">ตำแหนงประเภท</span>
2024-06-05 11:36:57 +07:00
<span class="text-weight-medium text-dark col">{{
2024-05-24 16:57:35 +07:00
store.dataEvaluation.posTypeName
}}</span>
2024-04-09 15:22:23 +07:00
</div>
2024-05-24 16:57:35 +07:00
</div>
2024-06-05 11:36:57 +07:00
<div class="col-xs-12 col-md-2">
<div :class="$q.screen.gt.sm ? 'column' : 'row'">
2024-06-26 14:35:19 +07:00
<span class="text-grey-6 col">ระด</span>
2024-06-05 11:36:57 +07:00
<span class="text-weight-medium text-dark col">{{
2024-05-24 16:57:35 +07:00
store.dataEvaluation.posLevelName
}}</span>
2024-04-09 15:22:23 +07:00
</div>
2024-05-24 16:57:35 +07:00
</div>
2024-06-05 11:36:57 +07:00
<div class="col-xs-12 col-md-2">
<div :class="$q.screen.gt.sm ? 'column' : 'row'">
<span class="text-grey-6 col">สถานะการประเม</span>
<span class="text-weight-medium text-dark col">{{
2024-05-24 16:57:35 +07:00
formProfile.status
}}</span>
2024-04-09 15:22:23 +07:00
</div>
2024-05-24 16:57:35 +07:00
</div>
2024-06-05 11:36:57 +07:00
<div class="col-xs-12 col-md-2">
<div :class="$q.screen.gt.sm ? 'column' : 'row'">
<span class="text-grey-6 col">ผลการประเม</span>
<span class="text-weight-medium text-dark col">{{
2024-05-24 16:57:35 +07:00
formProfile.result
}}</span>
</div>
2024-05-24 16:57:35 +07:00
</div>
2024-06-05 11:36:57 +07:00
<div class="col-xs-12 col-md-2">
<div :class="$q.screen.gt.sm ? 'column' : 'row'">
<span class="text-grey-6 col">คะแนนประเม</span>
<span class="text-weight-medium text-primary col">
2024-05-24 16:57:35 +07:00
{{
2024-06-26 17:07:01 +07:00
store.dataEvaluation.posTypeName != "อำนวยการ" &&
store.dataEvaluation.posTypeName != "บริหาร"
2024-05-24 16:57:35 +07:00
? (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2)
: (
store.excusiveIndicator1ScoreVal +
store.excusiveIndicator2ScoreVal +
store.competencyScoreVal
).toFixed(2)
}}
</span>
2024-04-09 15:22:23 +07:00
</div>
</div>
</div>
</div>
</div>
2024-05-24 16:57:35 +07:00
</div>
</q-card>
2024-04-09 15:22:23 +07:00
2024-05-24 16:57:35 +07:00
<q-card class="q-mt-md rounded">
<TabMain />
</q-card>
2024-04-04 14:14:25 +07:00
</div>
</div>
2024-05-24 16:57:35 +07:00
</div>
2024-04-26 15:18:28 +07:00
<q-dialog v-model="modalEdit" persistent>
<q-card bordered style="width: 50vh">
<q-form greedy @submit.prevent @validation-success="onSubmit">
2024-05-16 16:15:57 +07:00
<DialogHeader
:tittle="
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER'
? 'แก้ไขผู้ประเมิน'
: 'ข้อมูลผู้ประเมิน'
"
:close="close"
/>
2024-04-26 15:18:28 +07:00
<q-separator />
<q-card-section>
<div class="column q-gutter-sm">
2024-07-14 23:04:43 +07:00
<div class="row">
<div class="col-10">
<q-select
:readonly="
!(
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER'
)
"
v-model="evaluatorId"
outlined
label="ผู้ประเมิน"
dense
option-label="name"
option-value="id"
:options="evaluatorIdOp"
class="inputgreen"
map-options
hide-bottom-space
lazy-rules
:rules="[ (val:string) => !!val ||
2024-05-16 16:15:57 +07:00
`${'กรุณาเลือกผู้ประเมิน'}`, ]"
2024-07-14 23:04:43 +07:00
use-input
2024-09-10 11:42:43 +07:00
@filter="(inputValue:string,
2024-05-16 16:15:57 +07:00
doneFn:Function) => filterOption(inputValue, doneFn,'evaluatorIdOp'
) "
2024-07-14 23:04:43 +07:00
/>
</div>
<div class="col-2 q-pa-sm text-right">
<q-icon
v-if="evaluatorId"
name="mdi-eye"
size="sm"
color="info"
class="cursor-pointer"
@click="viewEvaluatorDetail(evaluatorId.id, 'evaluator')"
>
<q-tooltip>อมลผประเม</q-tooltip>
</q-icon>
</div>
</div>
<div class="row">
<div class="col-10">
<q-select
:readonly="
!(
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER'
)
"
v-model="commanderId"
outlined
label="ผู้บังคับบัญชาเหนือขึ้นไป"
dense
option-label="name"
option-value="id"
:options="commanderIdOp"
map-options
class="inputgreen"
use-input
2024-09-10 11:42:43 +07:00
@filter="(inputValue:string,
doneFn:Function) => filterOption(inputValue, doneFn,'commanderIdOp'
) "
2024-07-14 23:04:43 +07:00
>
<template
v-if="
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER' &&
commanderId
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="commanderId = null"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<div class="col-2 q-pa-sm text-right">
2024-04-26 15:18:28 +07:00
<q-icon
2024-07-14 23:04:43 +07:00
v-if="commanderId"
name="mdi-eye"
size="sm"
color="info"
2024-04-26 15:18:28 +07:00
class="cursor-pointer"
2024-07-14 23:04:43 +07:00
@click="viewEvaluatorDetail(commanderId.id, 'commander')"
>
<q-tooltip>อมลผงคบบญชาเหนอขนไป</q-tooltip>
</q-icon>
</div>
</div>
<div class="row">
<div class="col-10">
<q-select
:readonly="
!(
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER'
)
"
v-model="commanderHighId"
outlined
label="ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง"
dense
option-label="name"
option-value="id"
:options="commanderHighOp"
map-options
use-input
class="inputgreen"
2024-09-10 11:42:43 +07:00
@filter="(inputValue:string,
doneFn:Function) => filterOption(inputValue, doneFn,'commanderHighOp'
) "
2024-07-14 23:04:43 +07:00
>
<template
v-if="
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER' &&
commanderHighId
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="commanderHighId = null"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<div class="col-2 q-pa-sm text-right">
2024-04-26 15:18:28 +07:00
<q-icon
2024-07-14 23:04:43 +07:00
v-if="commanderHighId"
name="mdi-eye"
size="sm"
color="info"
2024-04-26 15:18:28 +07:00
class="cursor-pointer"
2024-07-14 23:04:43 +07:00
@click="
viewEvaluatorDetail(commanderHighId.id, 'commanderHigh')
"
>
<q-tooltip
>อมลผงคบบญชาเหนอขนไปอกชนหน</q-tooltip
>
</q-icon>
</div>
</div>
2024-04-26 15:18:28 +07:00
</div>
</q-card-section>
<q-separator />
2024-05-16 16:15:57 +07:00
<q-card-actions
v-if="
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER'
"
align="right"
class="bg-white text-teal"
>
2024-04-26 15:18:28 +07:00
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
2024-07-14 23:04:43 +07:00
<q-dialog v-model="modalEvaluatorDetail" persistent>
2025-03-26 14:39:09 +07:00
<q-card style="width: 60vw; max-width: 70vw; min-height: 40vh">
2024-07-14 23:04:43 +07:00
<DialogHeader
:tittle="topic"
:close="() => (modalEvaluatorDetail = false)"
/>
<q-separator />
2024-08-20 10:12:57 +07:00
<q-card-section class="q-pa-md">
<div class="q-pb-md">
2024-07-14 23:04:43 +07:00
<span class="text-teal text-weight-bold text-body2">{{
evaluator.fullName
}}</span>
</div>
2024-08-20 10:12:57 +07:00
<div class="row">
<div class="col-12 column justify-center no-wrap">
<div class="row text-grey-6">
<div class="col-3">ตำแหนงในสายงาน</div>
<div class="col-3">ตำแหนงประเภท</div>
<div class="col-3">ตำแหนงทางการบรหาร</div>
<div class="col-3">งก</div>
</div>
<div class="row">
<div class="col-3">
{{ evaluator.position ? evaluator.position : "-" }}
2024-07-14 23:04:43 +07:00
</div>
2024-08-20 10:12:57 +07:00
<div class="col-3">
{{ evaluator.posTypeName ? evaluator.posTypeName : "-" }}
{{
evaluator.posLevelName ? ` (${evaluator.posLevelName})` : "-"
}}
2024-07-14 23:04:43 +07:00
</div>
2024-08-20 10:12:57 +07:00
<div class="col-3">
{{
evaluator.posExecutiveName ? evaluator.posExecutiveName : "-"
}}
2024-07-14 23:04:43 +07:00
</div>
2025-03-26 14:39:09 +07:00
<div class="col-3 text-html">
2024-08-20 10:12:57 +07:00
{{ evaluator.org ? evaluator.org : "-" }}
2024-07-14 23:04:43 +07:00
</div>
</div>
2024-08-20 10:12:57 +07:00
<div class="row q-mt-md text-grey-6">
<div class="col-12">กษาการในตำแหน/การรกษาราชการแทน</div>
</div>
<div class="row">
<div class="col-12" v-if="evaluator.isPosmasterAct">
{{
2024-09-10 11:42:43 +07:00
`${evaluator.posmasterAct[0].prefix}${evaluator.posmasterAct[0].firstName} ${evaluator.posmasterAct[0].lastName} (${evaluator.posmasterAct[0].posNo})`
2024-08-20 10:12:57 +07:00
}}
</div>
<div class="col-12" v-else>-</div>
</div>
2024-07-14 23:04:43 +07:00
</div>
2024-08-20 10:12:57 +07:00
</div>
</q-card-section>
2024-07-14 23:04:43 +07:00
</q-card>
</q-dialog>
2025-02-20 14:46:35 +07:00
<q-dialog v-model="modalUpload" persistent>
<q-card class="col-12" style="width: 60vw">
<DialogHeader
tittle="อัปโหลดแบบกำหนดข้อตกลงการประเมินผลสัมฤทธิ์ของงานและพฤติกรรมการปฏิบัติราชการ"
:close="closeDialog"
/>
<q-separator />
<q-card-section>
<div class="row col-12 q-col-gutter-y-sm">
<div class="col-12 row" v-if="fileList.length == 0">
<q-file
for="inputFiles"
class="col-12"
outlined
dense
v-model="fileUpload"
label="ไฟล์เอกสารแบบกำหนดข้อตกลง"
hide-bottom-space
accept=".pdf"
clearable
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
<template v-slot:after>
<q-btn
size="14px"
v-if="fileUpload"
flat
round
dense
color="primary"
icon="mdi-upload"
@click="clickUpload(fileUpload)"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</template>
</q-file>
</div>
<div v-if="fileList.length > 0" class="col-xs-12 row">
<q-list class="full-width rounded-borders" bordered separator>
<q-item
clickable
v-ripple
v-for="data in fileList"
:key="data.id"
class="items-center"
>
<q-item-section>{{ data.fileName }}</q-item-section>
<q-space />
<div>
<q-btn
size="12px"
flat
round
dense
color="blue"
icon="mdi-download"
@click="downloadFile(data.fileName)"
><q-tooltip>ดาวนโหลดไฟล</q-tooltip></q-btn
>
<q-btn
size="12px"
flat
round
dense
color="red"
class="q-ml-sm"
icon="mdi-delete-outline"
@click="deleteFile(data.fileName)"
><q-tooltip>ลบไฟล</q-tooltip></q-btn
>
</div>
</q-item>
</q-list>
</div>
<div class="col-12" v-else>
<q-card class="q-pa-md" bordered> ไมรายการเอกสาร </q-card>
</div>
</div>
</q-card-section>
</q-card>
</q-dialog>
<DialogGovernment v-model:modal="modalGovernment" />
2024-04-04 14:14:25 +07:00
</template>
2024-04-19 15:30:39 +07:00
<style>
.bg-toolbar {
background-color: #f2fbfa;
2024-04-19 15:30:39 +07:00
}
.absolute-center-left {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
2024-04-19 15:30:39 +07:00
</style>