diff --git a/src/modules/09_leave/components/1_Work/Tab1.vue b/src/modules/09_leave/components/1_Work/Tab1.vue index fa8374955..ec4859380 100644 --- a/src/modules/09_leave/components/1_Work/Tab1.vue +++ b/src/modules/09_leave/components/1_Work/Tab1.vue @@ -145,16 +145,16 @@ async function fetchListTimeRecord() { checkInDate: e.checkInDate ? date2Thai(e.checkInDate) : "-", checkInTime: e.checkInTime, checkInLocation: e.checkInLocation, - checkInLat: e.checkInLat, - checkInLon: e.checkInLon, + checkInLat: e.checkInLat ? e.checkInLat : "", + checkInLon: e.checkInLon ? e.checkInLon : "", checkInStatus: e.checkInStatus ? workStore.convertSatatus(e.checkInStatus) : "-", checkOutDate: e.checkOutDate ? date2Thai(e.checkOutDate) : "-", checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-", checkOutTime: e.checkOutTime ? e.checkOutTime : "-", - checkOutLat: e.checkOutLocation ? e.checkOutLat : "", - checkOutLon: e.checkOutLocation ? e.checkOutLon : "", + checkOutLat: e.checkOutLat ? e.checkOutLat : "", + checkOutLon: e.checkOutLat ? e.checkOutLon : "", checkOutStatus: e.checkOutStatus ? workStore.convertSatatus(e.checkOutStatus) : "-", diff --git a/src/modules/09_leave/components/4_specialTime/DialogApprove.vue b/src/modules/09_leave/components/4_specialTime/DialogApprove.vue index c56708d53..93e3953f5 100644 --- a/src/modules/09_leave/components/4_specialTime/DialogApprove.vue +++ b/src/modules/09_leave/components/4_specialTime/DialogApprove.vue @@ -43,8 +43,8 @@ const formData = reactive({ checkIn: "", checkOut: "", note: "", - checkInStatus: "", - checkOutStatus: "", + checkInStatus: "NORMAL", + checkOutStatus: "NORMAL", checkInEdit: false, checkOutEdit: false, }); @@ -95,8 +95,8 @@ async function approveData() { const body = { checkInTime: formData.checkIn, checkOutTime: formData.checkOut, - checkInStatus: SpecialTimeStore.checkInStatus, - checkOutStatus: SpecialTimeStore.checkOutStatus, + checkInStatus: formData.checkInStatus, + checkOutStatus: formData.checkOutStatus, reason: formData.note, }; await http @@ -123,14 +123,29 @@ function close() { watch( () => props.modal, () => { + console.log("props===>", props); if (props.editCheck === "APPROVE") { formData.checkIn = ""; formData.checkOut = ""; formData.note = ""; } else if (props.editCheck === "PENDING") { if (props.detailData) { - formData.checkIn = props.detailData.checkIn; - formData.checkOut = props.detailData.checkOut; + if (props.detailData.checkInEdit) { + formData.checkIn = props.detailData.startTimeMorning; + formData.checkOut = props.detailData.endTimeAfternoon; + } else if ( + props.detailData.checkInEdit && + !props.detailData.checkOutEdit + ) { + formData.checkIn = props.detailData.startTimeMorning; + formData.checkOut = props.detailData.endTimeMorning; + } else if ( + !props.detailData.checkInEdit && + props.detailData.checkOutEdit + ) { + formData.checkIn = props.detailData.startAfternoon; + formData.checkOut = props.detailData.endTimeAfternoon; + } formData.note = props.detailData.note; formData.checkInEdit = props.detailData.checkInEdit; formData.checkOutEdit = props.detailData.checkOutEdit; @@ -142,7 +157,7 @@ watch(