diff --git a/src/api/KPI/api.kpis.ts b/src/api/KPI/api.kpis.ts index 0fb124b..933bb8d 100644 --- a/src/api/KPI/api.kpis.ts +++ b/src/api/KPI/api.kpis.ts @@ -14,6 +14,10 @@ const Kpiorg = `${env.API_URI}/org/profile/commander`; const KpiUser = `${env.API_URI}/kpi/user`; const kpiAchievement = `${env.API_URI}/kpi/user/achievement`; const kpiReason = `${env.API_URI}/kpi/reason`; + + +const placementKeycloak = `${env.API_URI}/placement/officer/keycloak`; +const orgPosition = `${env.API_URI}/org/profile/keycloak/position `; export default { kpiPeriod, kpiEvaluation, @@ -42,5 +46,9 @@ export default { /**ประเมิน*/ kpiAchievementDevelop: `${kpiAchievement}/development`, - kpiCommentP:(typP:string,type:string,role:string,id:string)=>`${kpiReason}/${typP}/${type}/${role}/${id}` + kpiCommentP:(typP:string,type:string,role:string,id:string)=>`${kpiReason}/${typP}/${type}/${role}/${id}`, + + placementKeycloak, + orgPosition, + sendToCommander:`${KpiUser}/evaluation/admin/change-status` }; diff --git a/src/modules/08_KPI/components/Tab/Dialog/DialogGovernment.vue b/src/modules/08_KPI/components/Tab/Dialog/DialogGovernment.vue new file mode 100644 index 0000000..15d8201 --- /dev/null +++ b/src/modules/08_KPI/components/Tab/Dialog/DialogGovernment.vue @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + {{ col.label }} + + + + + + + + {{ props.rowIndex + 1 }} + + + {{ col.value ? col.value : "-" }} + + + + + + + + + + + + diff --git a/src/modules/08_KPI/components/Tab/Dialog/DialogStatus.vue b/src/modules/08_KPI/components/Tab/Dialog/DialogStatus.vue new file mode 100644 index 0000000..d0a926f --- /dev/null +++ b/src/modules/08_KPI/components/Tab/Dialog/DialogStatus.vue @@ -0,0 +1,69 @@ + + + + + + + + + + {{work ? `อยู่ระหว่างทดลองงาน`:'พ้นจากการทดลองงาน'}} + + + + + + diff --git a/src/modules/08_KPI/store.ts b/src/modules/08_KPI/store.ts index 636dd18..01fc798 100644 --- a/src/modules/08_KPI/store.ts +++ b/src/modules/08_KPI/store.ts @@ -230,17 +230,19 @@ export const useKpiDataStore = defineStore("KPIDate", () => { // ROLE & TAB const rolePerson = ref("USER"); //"USER" | "EVALUATOR" | "COMMANDER", "COMMANDERHIGH" const tabOpen = ref(1); - function checkStep() { - const role = - dataEvaluation.value.profileId == dataProfile.value.profileId + async function checkStep() { + const role = + + dataEvaluation.value.profileId == await dataProfile.value.profileId ? "USER" - : dataEvaluation.value.evaluatorId == dataProfile.value.profileId + : dataEvaluation.value.evaluatorId == await dataProfile.value.profileId ? "EVALUATOR" - : dataEvaluation.value.commanderId == dataProfile.value.profileId + : dataEvaluation.value.commanderId == await dataProfile.value.profileId ? "COMMANDER" - : dataEvaluation.value.commanderHighId == dataProfile.value.profileId + : dataEvaluation.value.commanderHighId == await dataProfile.value.profileId ? "COMMANDERHIGH" : ""; + console.log("🚀 ~ checkStep ~ role:", role) rolePerson.value = role; switch (dataEvaluation.value.evaluationStatus) { diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index c380572..d21d4e6 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -12,7 +12,11 @@ import { useKpiDataStore } from "@/modules/08_KPI/store"; import DialogHeader from "@/components/DialogHeader.vue"; import type { FormProfile } from "@/modules/08_KPI/interface/request/index"; import type { DataOptions } from "@/modules/08_KPI/interface/index/Main"; +import DialogGovernment from "@/modules/08_KPI/components/Tab/Dialog/DialogGovernment.vue"; +import DialogStatus from "@/modules/08_KPI/components/Tab/Dialog/DialogStatus.vue"; +const modalGovernment = ref(false); +const modalStatus = ref(false); // const modalScore = ref(false); const modalEdit = ref(false); const route = useRoute(); @@ -58,7 +62,8 @@ async function fetchEvaluation() { await http .get(config.API.kpiEvaluation + `/${id.value}`) .then(async (res) => { - const data = await res.data.result; + const data = res.data.result; + console.log("🚀 ~ .then ~ data:", data) store.dataEvaluation = await data; formProfile.status = store.convertStatus(data.evaluationStatus); @@ -82,11 +87,11 @@ async function fetchEvaluation() { // }); } -function getProfile() { - http +async function getProfile() { + await http .get(config.API.profilePosition()) .then(async (res) => { - const data = await res.data.result; + const data = res.data.result; store.dataProfile = await data; }) .catch((e) => { @@ -144,7 +149,7 @@ function onSubmit() { }); } -function getOrgOp() { +async function getOrgOp() { http .get(config.API.Kpiorg) .then((res) => { @@ -249,10 +254,8 @@ function filterOption(val: any, update: Function, refData: string) { async function getAll() { await getProfile(); await fetchEvaluation(); - - await store.checkStep(); - await getOrgOp(); + await store.checkStep(); } function sendToEvaluatore(status: string) { @@ -309,10 +312,37 @@ function requireEdit() { ); } +function openGovernment() { + modalGovernment.value = true; +} +function openStatus() { + modalStatus.value = true; +} + +function sendToCommander() { + dialogConfirm($q, () => { + showLoader(); + http + .post(config.API.sendToCommander, { + status: "EVALUATING", + id: [store.dataEvaluation.id], + }) + .then(async (res) => { + await getAll(); + store.tabMain = "3"; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader() + }); + }); +} + onMounted(async () => { showLoader(); await getAll(); - console.log(store.dataEvaluation.avartar); }); @@ -388,7 +418,7 @@ onMounted(async () => { store.indicatorWeightTotal != 100) || (store.dataEvaluation.posExecutiveName != null && (store.indicatorWeight1Total != 100 || - store.indicatorWeight2Total != 20)) + store.indicatorWeight2Total != 20)) && store.dataEvaluation.evaluationStatus == 'NEW' " class="text-red" >*น้ำหนัก(ร้อยละ) ผลสัมฤทธิ์ของงานไม่ถูกต้อง { > ส่งให้ผู้ประเมินอนุมัติ - + + ทำการประเมิน + { color="grey-2" text-color="primary" size="md" + @click="openGovernment" > ดูข้อมูลการช่วยราชการ @@ -487,6 +532,7 @@ onMounted(async () => { text-color="blue-5" icon="mdi-file-eye-outline" size="md" + @click="openStatus" > ดูข้อมูลการทดลองงาน @@ -783,6 +829,9 @@ onMounted(async () => { --> + + +