เรียนในใบลา
This commit is contained in:
parent
49c316c062
commit
48d0c9febc
7 changed files with 342 additions and 52 deletions
|
|
@ -36,6 +36,7 @@ const {
|
|||
showLoader,
|
||||
hideLoader,
|
||||
convertDateToAPI,
|
||||
dialogMessageNotify,
|
||||
} = mixin;
|
||||
|
||||
const model = ref<string>("");
|
||||
|
|
@ -58,29 +59,34 @@ async function fectOptionType() {
|
|||
|
||||
function onSubmit(postData: FormData, isLeave: boolean = true) {
|
||||
if (isLeave) {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
if (model.value === "LV-006" || model.value === "LV-008") {
|
||||
postData.append("leaveSubTypeName", modelSpecific.value);
|
||||
}
|
||||
if (postData.get("leaveEndDate") === postData.get("leaveStartDate")) {
|
||||
postData.set("leaveRangeEnd", postData.get("leaveRange") as string);
|
||||
}
|
||||
if (dataStore.commanderPosition !== "" && dataStore.dear !== "") {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
if (model.value === "LV-006" || model.value === "LV-008") {
|
||||
postData.append("leaveSubTypeName", modelSpecific.value);
|
||||
}
|
||||
if (postData.get("leaveEndDate") === postData.get("leaveStartDate")) {
|
||||
postData.set("leaveRangeEnd", postData.get("leaveRange") as string);
|
||||
}
|
||||
postData.append("commanderPosition", dataStore.commanderPosition);
|
||||
postData.append("dear", dataStore.dear);
|
||||
await http
|
||||
.post(config.API.leaveUser(), postData)
|
||||
|
||||
await http
|
||||
.post(config.API.leaveUser(), postData)
|
||||
|
||||
.then((res) => {
|
||||
router.push(`/leave/edit/${res.data.result.id}`);
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
.then((res) => {
|
||||
router.push(`/leave/edit/${res.data.result.id}`);
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
dialogMessageNotify($q, "กรุณาเพิ่มรายชื่อ ผู้บังคับบัญชา");
|
||||
}
|
||||
} else {
|
||||
messageError($q, "", "ไม่มีสิทธิ์ลา");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ const {
|
|||
success,
|
||||
date2Thai,
|
||||
dialogRemove,
|
||||
dialogMessageNotify,
|
||||
} = mixin;
|
||||
|
||||
const titleName = ref<string>("");
|
||||
|
|
@ -221,27 +222,33 @@ async function fetchDataDetail(id: string) {
|
|||
*/
|
||||
function onSubmit(formData: any, isLeave: boolean = true) {
|
||||
if (isLeave) {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
if (model.value === "LV-006" || model.value === "LV-008") {
|
||||
formData.append("leaveSubTypeName", modelSpecific.value);
|
||||
}
|
||||
if (formData.get("leaveEndDate") === formData.get("leaveStartDate")) {
|
||||
formData.set("leaveRangeEnd", formData.get("leaveRange") as string);
|
||||
}
|
||||
await http
|
||||
.put(config.API.leaveUserId(personalId.value), formData)
|
||||
.then(async () => {
|
||||
await fetchDataDetail(personalId.value);
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
if (dataStore.commanderPosition !== "" && dataStore.dear !== "") {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
if (model.value === "LV-006" || model.value === "LV-008") {
|
||||
formData.append("leaveSubTypeName", modelSpecific.value);
|
||||
}
|
||||
if (formData.get("leaveEndDate") === formData.get("leaveStartDate")) {
|
||||
formData.set("leaveRangeEnd", formData.get("leaveRange") as string);
|
||||
}
|
||||
formData.append("commanderPosition", dataStore.commanderPosition);
|
||||
formData.append("dear", dataStore.dear);
|
||||
await http
|
||||
.put(config.API.leaveUserId(personalId.value), formData)
|
||||
.then(async () => {
|
||||
await fetchDataDetail(personalId.value);
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
dialogMessageNotify($q, "กรุณาเพิ่มรายชื่อ ผู้บังคับบัญชา");
|
||||
}
|
||||
} else {
|
||||
messageError($q, "", "ไม่มีสิทธิ์ลา");
|
||||
}
|
||||
|
|
@ -426,7 +433,7 @@ onMounted(async () => {
|
|||
:on-confirm="onConfirm"
|
||||
:click-delete="clickDelete"
|
||||
/>
|
||||
<HelpWifeBirthForm
|
||||
<HelpWifeBirthForm5
|
||||
v-if="model === 'LV-004'"
|
||||
:data="formData"
|
||||
:on-submit="onSubmit"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue