From f13832667c1d8e5338691c35c3a0021e0a42676f Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 28 Apr 2025 09:29:35 +0700 Subject: [PATCH] comment LeaveHistory --- .../components/07_LeaveHistory/DialogForm.vue | 13 +++++++++---- .../09_leave/views/07_LeaveHistoryMain.vue | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue b/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue index c71aee677..a93166282 100644 --- a/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue +++ b/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue @@ -76,10 +76,10 @@ const leaveTypeCode = ref(""); const profileId = ref(""); const rowId = ref(""); const formData = reactive({ - leaveTypeId: "", - leaveYear: new Date().getFullYear(), - leaveDays: "", - leaveDaysUsed: "", + leaveTypeId: "", //ประเภทการลา + leaveYear: new Date().getFullYear(), //ปี + leaveDays: "", //วันลาที่ยกมา + leaveDaysUsed: "", //วันลาที่ใช้ไป }); const leaveTypeOptions = ref([]); const leaveTypeOptionsMain = ref([]); @@ -141,6 +141,10 @@ async function fetchDataPerson() { }); } +/** + * ฟังก์ชันกำหนดค่าของ formData เมื่อมีการแก้ไขข้อมูล + * @param data ข้อมูลที่ต้องการแก้ไข + */ async function defineDataLeaveBeginning(data: DataLeaveBeginning) { profileId.value = data.profileId; rowId.value = data.id; @@ -235,6 +239,7 @@ function classInput(val: boolean) { }; } +/** Hook*/ watch( () => formFilter.pageSize, () => { diff --git a/src/modules/09_leave/views/07_LeaveHistoryMain.vue b/src/modules/09_leave/views/07_LeaveHistoryMain.vue index 06da571b3..1911be92f 100644 --- a/src/modules/09_leave/views/07_LeaveHistoryMain.vue +++ b/src/modules/09_leave/views/07_LeaveHistoryMain.vue @@ -97,9 +97,9 @@ const visibleColumns = ref([ "leaveDaysUsed", ]); -const modalDialogForm = ref(false); -const isStatusEdit = ref(false); -const rowData = ref(); +const modalDialogForm = ref(false); //modal Dialog บันทึกข้อมูลการลาย้อนหลัง +const isStatusEdit = ref(false); //สถานะการแก้ไข +const rowData = ref(); //ข้อมูลรายการที่ต้องการ /** ฟังก์ชันเรียกข้อมูลประเภทการลา*/ async function fetchLeaveType() { @@ -114,6 +114,7 @@ async function fetchLeaveType() { leaveTypeOptions.value = leaveTypeData.value; } +/** ฟังก์ชันเรียกข้อมูลรายการลาย้อนหลัง*/ async function fetchDataLeaveBeginning() { await http .post(config.API.leaveBeginning + `/list`, { @@ -147,6 +148,11 @@ async function onSearchData(newSearch: boolean = true) { } } +/** + * ฟังก์ชันเปิด Dialog form บันทึกข้อมูลย้อนหลัง + * @param isEdit สถานะก่ารแก้ไข + * @param data ข้อมูลที่ต้องการแก้ไข + */ function onOpenDialogForm( isEdit: boolean, data: DataLeaveBeginning = {} as DataLeaveBeginning @@ -169,6 +175,10 @@ function filterOptionFn(val: string, update: Function) { }); } +/** + * ฟังก์ชันยืนยันการลบรายการการลาย้อนหัง + * @param id รายการที่ต้องการลบ + */ function onDeleteLeaveBeginning(id: string) { dialogRemove($q, async () => { showLoader(); @@ -195,12 +205,14 @@ function updatePagination(newPagination: DataPagination) { formFilter.pageSize = newPagination.rowsPerPage; } +/** Hook*/ watch( () => formFilter.pageSize, () => { onSearchData(true); } ); + onMounted(async () => { try { showLoader();