API การลา ข้าราชการ, ลูกจ้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-05-29 14:17:39 +07:00
parent 6bde04376f
commit 32dcdc9336
28 changed files with 525 additions and 868 deletions

View file

@ -31,6 +31,8 @@ const {
} = mixin;
const pageId = ref<string>(route.params.id as string);
const routeName = ref<string>(route?.name as string);
const keyword = ref<string>("");
const isAct = ref<boolean>(false);
@ -114,6 +116,7 @@ async function getData() {
keyword: keyword.value,
isAct: isAct.value,
keycloakId: props.keycloakUserId,
type: props.profileType === "officer" ? props.profileType : "employee",
})
.then(async (res) => {
const data = res.data.result;
@ -146,17 +149,25 @@ function onSubmit() {
keycloakId: items.keycloakId,
}));
showLoader();
const profileSuffix =
(props.profileType?.toLocaleLowerCase() as string) === "officer"
? ""
: "-employee";
const apiEndpoint =
routeName.value === "resignReject" || routeName.value === "resignRejectEMP"
? config.API.addResignCancel(
profileSuffix,
props.type?.toLocaleLowerCase() as string,
pageId.value
)
: config.API.addResign(
profileSuffix,
props.type?.toLocaleLowerCase() as string,
pageId.value
);
await http
.post(
config.API.addResign(
(props.profileType?.toLocaleLowerCase() as string) == "officer"
? ""
: "-employee",
props.type?.toLocaleLowerCase() as string,
pageId.value
),
body
)
.post(apiEndpoint, body)
.then(async () => {
await props.getData?.(pageId.value);
closeDialog();
@ -165,7 +176,9 @@ function onSubmit() {
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
} else {
closeDialog();
}