KPI ==> ปรับ fetch profile
This commit is contained in:
parent
b5b281f991
commit
8aa280db98
1 changed files with 44 additions and 127 deletions
|
|
@ -13,21 +13,14 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
import type { FormProfile } from "@/modules/08_KPI/interface/request/index";
|
import type { FormProfile } from "@/modules/08_KPI/interface/request/index";
|
||||||
import type { DataOptions } from "@/modules/08_KPI/interface/index/Main";
|
import type { DataOptions } from "@/modules/08_KPI/interface/index/Main";
|
||||||
import DialogGovernment from "@/modules/08_KPI/components/Tab/Dialog/DialogGovernment.vue";
|
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<boolean>(false);
|
const modalGovernment = ref<boolean>(false);
|
||||||
// const modalStatus = ref<boolean>(false);
|
|
||||||
// const modalScore = ref<boolean>(false);
|
|
||||||
const modalEdit = ref<boolean>(false);
|
const modalEdit = ref<boolean>(false);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const id = ref<string>(route.params.id as string);
|
const id = ref<string>(route.params.id as string);
|
||||||
const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false);
|
const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false);
|
||||||
|
|
||||||
// const plannedPoint = ref<string>("");
|
|
||||||
// const rolePoint = ref<string>("");
|
|
||||||
// const specialPoint = ref<string>("");
|
|
||||||
// const capacityPoint = ref<string>("");
|
|
||||||
|
|
||||||
const store = useKpiDataStore();
|
const store = useKpiDataStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
|
|
@ -68,28 +61,17 @@ const router = useRouter();
|
||||||
async function fetchEvaluation() {
|
async function fetchEvaluation() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.kpiEvaluation + `/${id.value}`)
|
.get(config.API.kpiEvaluation + `/${id.value}`)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
store.dataEvaluation = res.data.result;
|
store.dataEvaluation = res.data.result;
|
||||||
formProfile.status = store.convertStatus(data.evaluationStatus);
|
formProfile.status = await store.convertStatus(data.evaluationStatus);
|
||||||
formProfile.result = store.convertResults(data.evaluationResults);
|
formProfile.result = await store.convertResults(data.evaluationResults);
|
||||||
// store.checkCompetency();
|
// store.checkCompetency();
|
||||||
store.checkCompetencyDefaultCompetencyLevel();
|
store.checkCompetencyDefaultCompetencyLevel();
|
||||||
|
|
||||||
fetchProfile(data.profileId);
|
|
||||||
|
|
||||||
// plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint;
|
|
||||||
// rolePoint.value = data.rolePoint == null ? "" : data.rolePoint;
|
|
||||||
// specialPoint.value = data.specialPoint == null ? "" : data.specialPoint;
|
|
||||||
// capacityPoint.value =
|
|
||||||
// data.capacityPoint == null ? "" : data.capacityPoint;
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
});
|
});
|
||||||
// .finally(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getProfile() {
|
async function getProfile() {
|
||||||
|
|
@ -98,37 +80,23 @@ async function getProfile() {
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result;
|
||||||
store.dataProfile = await data;
|
store.dataProfile = await data;
|
||||||
|
|
||||||
|
if (data.avatarName) {
|
||||||
|
await fetchProfile(data.profileId, data.avatarName);
|
||||||
|
}
|
||||||
|
|
||||||
await store.checkStep();
|
await store.checkStep();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
});
|
});
|
||||||
// .finally(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchProfile(id: string) {
|
async function fetchProfile(id: string, avatarName: string) {
|
||||||
await http
|
http
|
||||||
.get(config.API.orgCheckAvatar(id))
|
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
if (res.data.result.avatarName) {
|
store.dataEvaluation.avartar = res.data.downloadUrl;
|
||||||
http
|
|
||||||
.get(
|
|
||||||
config.API.fileByFile(
|
|
||||||
"ทะเบียนประวัติ",
|
|
||||||
"โปรไฟล์",
|
|
||||||
id,
|
|
||||||
res.data.result.avatarName
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.then(async (res) => {
|
|
||||||
store.dataEvaluation.avartar = res.data.downloadUrl;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
// profilePicture.value = avatar;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,11 +124,10 @@ function onSubmit() {
|
||||||
? commanderHighId.value.id
|
? commanderHighId.value.id
|
||||||
: null,
|
: null,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async () => {
|
||||||
fetchEvaluation();
|
await Promise.all([fetchEvaluation(), getOrgOp()]);
|
||||||
getOrgOp();
|
|
||||||
close();
|
|
||||||
success($q, "บันทึกสำเร็จ");
|
success($q, "บันทึกสำเร็จ");
|
||||||
|
close();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -243,41 +210,8 @@ function filterOption(val: any, update: Function, refData: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function onSubmitScore() {
|
|
||||||
// showLoader();
|
|
||||||
// http
|
|
||||||
// .put(config.API.kpiScoreTotal() + `/${id.value}`, {
|
|
||||||
// plannedPoint: plannedPoint.value,
|
|
||||||
// rolePoint: rolePoint.value,
|
|
||||||
// specialPoint: specialPoint.value,
|
|
||||||
// capacityPoint: capacityPoint.value,
|
|
||||||
// })
|
|
||||||
// .then(async (res) => {
|
|
||||||
// await fetchEvaluation();
|
|
||||||
// success($q, "บันทึกสำเร็จ");
|
|
||||||
// modalScore.value = false;
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// messageError($q, e);
|
|
||||||
// })
|
|
||||||
// .finally(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// async function clearScore() {
|
|
||||||
// modalScore.value = false;
|
|
||||||
// plannedPoint.value = "";
|
|
||||||
// rolePoint.value = "";
|
|
||||||
// specialPoint.value = "";
|
|
||||||
// capacityPoint.value = "";
|
|
||||||
// getAll();
|
|
||||||
// }
|
|
||||||
|
|
||||||
async function getAll() {
|
async function getAll() {
|
||||||
await fetchEvaluation();
|
await Promise.all([fetchEvaluation(), getProfile(), getOrgOp()]);
|
||||||
await getProfile();
|
|
||||||
await getOrgOp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendToEvaluatore() {
|
function sendToEvaluatore() {
|
||||||
|
|
@ -290,9 +224,9 @@ function sendToEvaluatore() {
|
||||||
.put(config.API.kpiSendToStatus(id.value), {
|
.put(config.API.kpiSendToStatus(id.value), {
|
||||||
status: "NEW_EVALUATOR",
|
status: "NEW_EVALUATOR",
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async () => {
|
||||||
success($q, "ส่งข้อตกลงให้ผู้ประเมินอนุมัติสำเร็จ");
|
await fetchEvaluation();
|
||||||
fetchEvaluation();
|
await success($q, "ส่งข้อตกลงให้ผู้ประเมินอนุมัติสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -307,6 +241,9 @@ function sendToEvaluatore() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ยืนยันการส่งให้ผู้ประเมินรายงานผลสำเร็จของงาน
|
||||||
|
*/
|
||||||
function sendToEvaluateEvaluatore() {
|
function sendToEvaluateEvaluatore() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -317,9 +254,9 @@ function sendToEvaluateEvaluatore() {
|
||||||
.put(config.API.kpiSendToStatus(id.value), {
|
.put(config.API.kpiSendToStatus(id.value), {
|
||||||
status: "EVALUATING_EVALUATOR",
|
status: "EVALUATING_EVALUATOR",
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async () => {
|
||||||
success($q, "ส่งให้ผู้ประเมินรายงานผลสำเร็จของงานสำเร็จ");
|
await fetchEvaluation();
|
||||||
fetchEvaluation();
|
await success($q, "ส่งให้ผู้ประเมินรายงานผลสำเร็จของงานสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -333,31 +270,10 @@ function sendToEvaluateEvaluatore() {
|
||||||
"ต้องการยืนยันส่งให้ผู้ประเมินรายงานผลสำเร็จของงานใช่หรือไม่?"
|
"ต้องการยืนยันส่งให้ผู้ประเมินรายงานผลสำเร็จของงานใช่หรือไม่?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// function sendToSummary(status: string) {
|
|
||||||
// dialogConfirm(
|
/**
|
||||||
// $q,
|
* ยืนยันการขอแก้ไขข้อตกลง
|
||||||
// () => {
|
*/
|
||||||
// if (id.value) {
|
|
||||||
// showLoader();
|
|
||||||
// http
|
|
||||||
// .get(config.API.kpiSendToSummary(id.value))
|
|
||||||
// .then((res) => {
|
|
||||||
// success($q, "ส่งไปสรุปผลการประเมินสำเร็จ");
|
|
||||||
// getAll();
|
|
||||||
// store.tabMain = "4";
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// messageError($q, e);
|
|
||||||
// })
|
|
||||||
// .finally(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// "ยืนยันการส่งไปสรุปผลการประเมิน",
|
|
||||||
// "ต้องการยืนยันส่งไปสรุปผลการประเมินใช่หรือไม่?"
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
function requireEdit() {
|
function requireEdit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -368,9 +284,9 @@ function requireEdit() {
|
||||||
.put(config.API.kpiReqEdit(id.value), {
|
.put(config.API.kpiReqEdit(id.value), {
|
||||||
status: "EVALUATOR",
|
status: "EVALUATOR",
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
success($q, "ขอแก้ไขสำเร็จ");
|
await fetchEvaluation();
|
||||||
fetchEvaluation();
|
await success($q, "ขอแก้ไขสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -388,11 +304,9 @@ function requireEdit() {
|
||||||
function openGovernment() {
|
function openGovernment() {
|
||||||
modalGovernment.value = true;
|
modalGovernment.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openStatus() {
|
function openStatus() {
|
||||||
// router.push(`/probation/${store.dataEvaluation.profileId}`);
|
|
||||||
// router.push(`/probation`);
|
|
||||||
router.push(`/probation-detail/${store.dataEvaluation.profileId}`);
|
router.push(`/probation-detail/${store.dataEvaluation.profileId}`);
|
||||||
// modalStatus.value = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendToEvauator() {
|
function sendToEvauator() {
|
||||||
|
|
@ -403,7 +317,7 @@ function sendToEvauator() {
|
||||||
status: "EVALUATING",
|
status: "EVALUATING",
|
||||||
id: [store.dataEvaluation.id],
|
id: [store.dataEvaluation.id],
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async () => {
|
||||||
await getAll();
|
await getAll();
|
||||||
store.tabMain = "3";
|
store.tabMain = "3";
|
||||||
})
|
})
|
||||||
|
|
@ -416,6 +330,9 @@ function sendToEvauator() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ยืนยันการส่งไปสรุปผลการประเมิน
|
||||||
|
*/
|
||||||
async function goToSummary() {
|
async function goToSummary() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -423,7 +340,7 @@ async function goToSummary() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.sendToSummary(store.dataEvaluation.id))
|
.get(config.API.sendToSummary(store.dataEvaluation.id))
|
||||||
.then(async (res) => {
|
.then(async () => {
|
||||||
await http
|
await http
|
||||||
.put(
|
.put(
|
||||||
config.API.updatePoint(store.dataEvaluation.id),
|
config.API.updatePoint(store.dataEvaluation.id),
|
||||||
|
|
@ -493,13 +410,13 @@ const evaluator = ref<any>({
|
||||||
isPosmasterAct: false,
|
isPosmasterAct: false,
|
||||||
posmasterAct: [],
|
posmasterAct: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
async function fetchProfileEvaluator(id: string) {
|
async function fetchProfileEvaluator(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.orgPosition + `/${id}`)
|
.get(config.API.orgPosition + `/${id}`)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
console.log(res.data.result);
|
const data = await res.data.result;
|
||||||
const data = res.data.result;
|
|
||||||
evaluator.value.fullName =
|
evaluator.value.fullName =
|
||||||
data.prefix + data.firstName + " " + data.lastName;
|
data.prefix + data.firstName + " " + data.lastName;
|
||||||
evaluator.value.position = data.position;
|
evaluator.value.position = data.position;
|
||||||
|
|
@ -507,7 +424,7 @@ async function fetchProfileEvaluator(id: string) {
|
||||||
evaluator.value.posLevelName = data.posLevelName;
|
evaluator.value.posLevelName = data.posLevelName;
|
||||||
evaluator.value.isPosmasterAct = data.isPosmasterAct;
|
evaluator.value.isPosmasterAct = data.isPosmasterAct;
|
||||||
evaluator.value.posmasterAct = data.posmasterAct[0];
|
evaluator.value.posmasterAct = data.posmasterAct[0];
|
||||||
evaluator.value.org = findOrgName(data);
|
evaluator.value.org = await findOrgName(data);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue