API ข้อมูลตำแหน่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-27 17:19:31 +07:00
parent a595c1a5e9
commit a6293efa69
5 changed files with 99 additions and 23 deletions

View file

@ -47,6 +47,7 @@ const {
success,
pathRegistryEmp,
onSearchDataTable,
formatDatePosition,
} = useCounterMixin();
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
@ -292,21 +293,15 @@ const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
const cardData = ref<any[]>([
{
label: "ระยะเวลาดำรงตำแหน่งในสายงาน",
data: [
{ name: "ตำแหน่ง", time: "1 ปี" },
{ name: "ตำแหน่ง", time: "1 ปี" },
{ name: "ตำแหน่ง", time: "1 ปี" },
{ name: "ตำแหน่ง", time: "1 ปี" },
{ name: "ตำแหน่ง", time: "1 ปี" },
],
data: [],
},
{
label: "ระยะเวลาดำรงตำแหน่งตามระดับ",
data: [{ name: "ละดับ", time: "1 ปี" }],
data: [],
},
{
label: "ระยะเวลาดำรงตำแหน่งทางการบริหาร",
data: [{ name: "ตำแหน่งทางการบริหาร", time: "1 ปี" }],
data: [],
},
]);
@ -731,9 +726,36 @@ function serchDataTable() {
);
}
async function fetchDataTenure() {
await http
.get(config.API.salaryTenurePosition(profileId.value, empType.value))
.then((res) => {
const data = res.data.result;
if (data) {
const formatData = (list: any) =>
list.map((e: any) => ({
name: e.name ?? "",
time: formatDatePosition(e.year, e.month, e.day),
}));
const position = formatData(data.position);
const posLevel = formatData(data.posLevel);
const posExecutive = formatData(data.posExecutive);
cardData.value[0].data = position;
cardData.value[1].data = posLevel;
cardData.value[2].data = posExecutive;
}
})
.catch((err) => {
messageError($q, err);
});
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => {
fetchListSalary();
fetchDataTenure();
});
</script>