แก้ยกเลิกลา
This commit is contained in:
parent
7103587f8f
commit
92901c1753
2 changed files with 50 additions and 5 deletions
|
|
@ -14,6 +14,8 @@ import { checkPermission } from "@/utils/permissions";
|
|||
import type {
|
||||
LeaveType,
|
||||
FormReject,
|
||||
SeqTypeRow,
|
||||
RowsType,
|
||||
} from "@/modules/09_leave/interface/response/leave";
|
||||
import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
||||
|
||||
|
|
@ -63,6 +65,11 @@ function upLoadFile() {
|
|||
console.log("upload", filesUpload.value);
|
||||
}
|
||||
|
||||
const rows = ref<RowsType>();
|
||||
const statusCheck = ref<string>("");
|
||||
const isOfficer = ref<boolean>(false);
|
||||
const isStaff = ref<boolean>(false);
|
||||
|
||||
/** Form รายละเอียดข้อมูล*/
|
||||
const formDataReject = reactive<FormReject>({
|
||||
id: "", //*Id การยื่นขอลา
|
||||
|
|
@ -149,6 +156,7 @@ const formData = reactive<FremData>({
|
|||
dear: "",
|
||||
profileType: "",
|
||||
leaveSubTypeName: "",
|
||||
commanderPosition: "",
|
||||
leaveRangeEnd: "",
|
||||
});
|
||||
|
||||
|
|
@ -158,8 +166,9 @@ onMounted(async () => {
|
|||
if (paramsId) {
|
||||
showLoader();
|
||||
Promise.all([
|
||||
fetchDetailDeleteLeave(paramsId),
|
||||
fetchDetailLeave(paramsId),
|
||||
await fetchDetailDeleteLeave(paramsId),
|
||||
await fetchDetailLeave(paramsId),
|
||||
checkOfficer(),
|
||||
]).finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
|
@ -255,6 +264,7 @@ async function fetchDetailLeave(paramsId: string) {
|
|||
formData.ordainDayBuddhistLentAddress = data.ordainDayBuddhistLentAddress;
|
||||
formData.hajjDayStatus = data.hajjDayStatus;
|
||||
formData.absentDaySummon = data.absentDaySummon;
|
||||
statusCheck.value = data.status;
|
||||
formData.absentDayLocation = data.absentDayLocation;
|
||||
formData.absentDayRegistorDate =
|
||||
data.absentDayRegistorDate && date2Thai(data.absentDayRegistorDate);
|
||||
|
|
@ -282,10 +292,15 @@ async function fetchDetailLeave(paramsId: string) {
|
|||
formData.approveStep = data.approveStep;
|
||||
formData.dear = data.dear ? data.dear : "-";
|
||||
formData.profileType = data.profileType;
|
||||
formData.commanderPosition = data.commanderPosition;
|
||||
formData.leaveSubTypeName = data.leaveSubTypeName;
|
||||
formData.leaveRange = data.leaveRange;
|
||||
formData.leaveRangeEnd = data.leaveRangeEnd;
|
||||
isLoadData.value = true;
|
||||
rows.value = {
|
||||
commanders: data.commanders,
|
||||
approvers: data.approvers,
|
||||
};
|
||||
await fectOptionType();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -421,6 +436,26 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function checkOfficer() {
|
||||
http
|
||||
.get(
|
||||
config.API.checkIsofficer +
|
||||
`${
|
||||
formData.profileType == "OFFICER"
|
||||
? "SYS_LEAVE_LIST"
|
||||
: "SYS_LEAVE_LIST_EMP"
|
||||
}`
|
||||
)
|
||||
.then(async (res) => {
|
||||
isOfficer.value = await res.data.result.isOfficer;
|
||||
isStaff.value = await res.data.result.isStaff;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -736,14 +771,24 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
|
|||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<q-separator v-if="checkPermission($route)?.attrIsUpdate" />
|
||||
<div class="row q-pa-md q-gutter-md justify-end">
|
||||
<q-separator
|
||||
v-if="
|
||||
checkPermission($route)?.attrIsUpdate &&
|
||||
statusCheck == 'NEW' &&
|
||||
(isOfficer || isStaff)
|
||||
"
|
||||
/>
|
||||
<div
|
||||
class="row q-pa-md q-gutter-md justify-end"
|
||||
v-if="statusCheck == 'NEW' && (isOfficer || isStaff)"
|
||||
>
|
||||
<q-btn
|
||||
v-if="
|
||||
formDataReject.status === 'NEW' &&
|
||||
checkPermission($route)?.attrIsUpdate
|
||||
"
|
||||
unelevated
|
||||
:disable="rows?.approvers.length == 0 || rows?.commanders.length == 0"
|
||||
color="orange-5"
|
||||
label="ไม่อนุมัติการยกเลิก"
|
||||
@click="openModal('UnApprove')"
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ async function fecthLeaveList() {
|
|||
const { rowsPerPage, ...queryStingData } = querySting.value;
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.leaveList(), {
|
||||
.post(config.API.leaveListDelete(), {
|
||||
...queryStingData,
|
||||
pageSize: querySting.value.rowsPerPage,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue