แก้ fetch data ระบบ kpi

This commit is contained in:
Warunee Tamkoo 2024-05-08 11:35:18 +07:00
parent c01ad19889
commit 525d363825
3 changed files with 12 additions and 11 deletions

View file

@ -4,7 +4,7 @@ import type { DataOptions } from "./interface/index/Main";
export const useKpiDataStore = defineStore("KPIDate", () => { export const useKpiDataStore = defineStore("KPIDate", () => {
const tabMain = ref<string>("1"); const tabMain = ref<string>("1");
const dataProfile = ref<any>(); const dataProfile = ref<any>(null);
const dataEvaluation = ref<any>({ const dataEvaluation = ref<any>({
plannedPoint: 0, plannedPoint: 0,
rolePoint: 0, rolePoint: 0,

View file

@ -264,9 +264,7 @@ function onSubmitScore() {
}) })
.then(async (res) => { .then(async (res) => {
await fetchEvaluation(); await fetchEvaluation();
await getProfile(); success($q, "บันทึกสำเร็จ");
await getOrgOp();
await success($q, "บันทึกสำเร็จ");
modalScore.value = false; modalScore.value = false;
}) })
.catch((e) => { .catch((e) => {
@ -288,7 +286,7 @@ async function clearScore() {
async function getAll() { async function getAll() {
await fetchEvaluation(); await fetchEvaluation();
await getProfile(); await (store.dataProfile === null ? getProfile() : "");
await getOrgOp(); await getOrgOp();
} }

View file

@ -213,22 +213,25 @@ function onSubmit() {
} }
function getProfile() { function getProfile() {
showLoader();
http http
.get(config.API.profileBykeycloak()) .get(config.API.profilePosition())
.then((res) => { .then((res) => {
const data = res.data.result; 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.prefix = data.prefix;
formRound.firstName = data.firstName; formRound.firstName = data.firstName;
formRound.lastName = data.lastName; formRound.lastName = data.lastName;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
// .finally(() => {
// hideLoader();
// });
} }
function checkClosed() { function checkClosed() {