diff --git a/src/modules/09_leave/views/06_ReportMain.vue b/src/modules/09_leave/views/06_ReportMain.vue index 9f1c7f11e..bc10b0d54 100644 --- a/src/modules/09_leave/views/06_ReportMain.vue +++ b/src/modules/09_leave/views/06_ReportMain.vue @@ -46,6 +46,7 @@ const dateMonth = ref({ }); const dateWeek = ref(getCurrentWeek()); +const date = ref(new Date()); const typeReport = ref(""); const optionReport = ref([]); @@ -67,19 +68,25 @@ const optionReportMain = ref([ const employeeClass = ref("officer"); const yearType = ref("FULL"); +const leaveType = ref("DAY"); const employeeClassMain = ref([ { id: "officer", name: "ข้าราชการ กทม. สามัญ" }, { id: "employee", name: "ลูกจ้างประจำ กทม." }, ]); +const leaveTypeOptionMain = ref([ + { id: "DAY", name: "รายวัน" }, + { id: "WEEKLY", name: "รายสัปดาห์" }, + { id: "MONTH", name: "รายเดือน" }, +]); const yearTypeOptionMain = ref([ { id: "FULL", name: "รายปี" }, { id: "MONTH", name: "รายเดือน" }, - { id: "WEEKLY", name: "รายสัปดาห์" }, { id: "FIRSTHAFT", name: "ครึ่งปีแรก" }, { id: "SECONDHAFT", name: "ครึ่งปีหลัง" }, ]); const employeeClassOption = ref(employeeClassMain.value); const yearTypeOptionOption = ref(yearTypeOptionMain.value); +const leaveTypeOptionOption = ref(leaveTypeOptionMain.value); const detailReport = ref(); const isReport = ref(false); @@ -122,7 +129,11 @@ function onSelectedNode(data: any) { * และเรียกข้อมูลรายงาน */ async function updateLeaveday() { - switch (yearType.value) { + const list = + typeReport.value == "3" || typeReport.value == "4" + ? leaveType.value + : yearType.value; + switch (list) { case "FULL": dateStart.value = new Date(year.value - 1, 9, 1); dateEnd.value = new Date(year.value, 8, 30); @@ -157,6 +168,12 @@ async function updateLeaveday() { }; break; + case "DAY": + dateStart.value = new Date(date.value); + dateEnd.value = new Date(date.value); + + break; + case "SECONDHAFT": dateStart.value = new Date(year.value, 3, 1); dateEnd.value = new Date(year.value, 8, 30); @@ -196,6 +213,8 @@ async function fetchLeaveday( ? "MONTH" : year == "HAFT" ? "HAFT" + : year == "DAY" + ? "DAY" : "WEEKLY", startDate: dateToISO(startDate), endDate: dateToISO(endDate), @@ -304,6 +323,7 @@ function clearData() { org.value = ""; typeReport.value = ""; yearType.value = "FULL"; + leaveType.value = "DAY"; pdfSrc.value = undefined; detailReport.value = undefined; @@ -322,7 +342,9 @@ function onSearch() { updateLeaveday(); fetchLeaveday( employeeClass.value, - yearType.value, + typeReport.value == "3" || typeReport.value == "4" + ? leaveType.value + : yearType.value, dateStart.value, dateEnd.value ); @@ -338,6 +360,13 @@ function getCurrentWeek() { return [firstDayOfWeek, lastDayOfWeek]; } +function updateValue(val: string) { + if (typeReport.value == "3" || typeReport.value == "4") { + leaveType.value = val; + } else { + yearType.value = val; + } +} function formatWeekDisplay(week: Date[]) { if (week) { if (!week[0] || !week[1]) return ""; @@ -598,19 +627,33 @@ onMounted(() => {
{
{
{
-
+
{
-
+
{
+
+ + + + + +