diff --git a/src/modules/08_KPI/store.ts b/src/modules/08_KPI/store.ts index 34b82ad..b0337f2 100644 --- a/src/modules/08_KPI/store.ts +++ b/src/modules/08_KPI/store.ts @@ -4,7 +4,7 @@ import type { DataOptions } from "./interface/index/Main"; export const useKpiDataStore = defineStore("KPIDate", () => { const tabMain = ref("1"); - const dataProfile = ref(); + const dataProfile = ref(null); const dataEvaluation = ref({ plannedPoint: 0, rolePoint: 0, diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index 583456b..91be026 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -97,11 +97,6 @@ function getProfile() { store.dataProfile = data; store.checkCompetency(); store.checkCompetencyDefaultCompetencyLevel(); - - formProfile.fullName = `${data.prefix}${data.firstName} ${data.lastName}`; - formProfile.position = data.position; - formProfile.type = data.posTypeName; - formProfile.level = data.posLevelName; }) .catch((e) => { messageError($q, e); @@ -117,7 +112,7 @@ async function fetchProfile(id: string) { config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`) ) .then(async (res) => { - formProfile.avartar = res.data.downloadUrl; + store.dataProfile.avartar = res.data.downloadUrl; }) .catch(() => { // profilePicture.value = avatar; @@ -264,9 +259,7 @@ function onSubmitScore() { }) .then(async (res) => { await fetchEvaluation(); - await getProfile(); - await getOrgOp(); - await success($q, "บันทึกสำเร็จ"); + success($q, "บันทึกสำเร็จ"); modalScore.value = false; }) .catch((e) => { @@ -288,7 +281,7 @@ async function clearScore() { async function getAll() { await fetchEvaluation(); - await getProfile(); + await (store.dataProfile === null ? getProfile() : ""); await getOrgOp(); } @@ -330,7 +323,7 @@ onMounted(async () => { style="left: 2%; top: 50%; transform: translateY(-50%)" > - +
@@ -338,7 +331,7 @@ onMounted(async () => {
{{ - formProfile.fullName ? formProfile.fullName : "-" + `${store.dataProfile.prefix}${store.dataProfile.firstName} ${store.dataProfile.lastName}` }}
@@ -398,7 +391,7 @@ onMounted(async () => {
ตำแหน่งในสายงาน {{ - formProfile.position + store.dataProfile.position }}
@@ -406,7 +399,7 @@ onMounted(async () => {
ประเภทตำแหน่ง {{ - formProfile.type + store.dataProfile.posTypeName }}
@@ -414,7 +407,7 @@ onMounted(async () => {
ระดับตำแหน่ง {{ - formProfile.level + store.dataProfile.posLevelName }}
diff --git a/src/modules/08_KPI/views/main.vue b/src/modules/08_KPI/views/main.vue index 4125190..287ee12 100644 --- a/src/modules/08_KPI/views/main.vue +++ b/src/modules/08_KPI/views/main.vue @@ -213,22 +213,25 @@ function onSubmit() { } function getProfile() { - showLoader(); http - .get(config.API.profileBykeycloak()) + .get(config.API.profilePosition()) .then((res) => { const data = res.data.result; - formRound.profileId = data.id; + store.dataProfile = data; + store.checkCompetency(); + store.checkCompetencyDefaultCompetencyLevel(); + + formRound.profileId = data.profileId; formRound.prefix = data.prefix; formRound.firstName = data.firstName; formRound.lastName = data.lastName; }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); + // .finally(() => { + // hideLoader(); + // }); } function checkClosed() {