From 9100062af6da7669f33656dfb565dc8d8101dcad Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 28 Nov 2023 12:07:06 +0700 Subject: [PATCH] =?UTF-8?q?API=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=A5?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=AD=E0=B8=B5=E0=B8=A2=E0=B8=94=20?= =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A5?= =?UTF-8?q?=E0=B8=87=E0=B9=80=E0=B8=A7=E0=B8=A5=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/09_leave/api.leave.ts | 2 +- .../09_leave/components/1_Work/DialogDetail.vue | 12 +++++++++--- src/modules/09_leave/components/1_Work/Tab1.vue | 2 +- src/modules/09_leave/components/1_Work/Tab2.vue | 2 +- .../09_leave/components/1_Work/TableList.vue | 15 ++++++++++----- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/api/09_leave/api.leave.ts b/src/api/09_leave/api.leave.ts index e419b80dc..5e29ef1b2 100644 --- a/src/api/09_leave/api.leave.ts +++ b/src/api/09_leave/api.leave.ts @@ -7,7 +7,7 @@ export default { /**รายการลงเวลาปฏิบัติงาน */ logRecord: () => `${leave}/log-record`, timeRecord: () => `${leave}/time-record`, - timeRecordById: (id: string) => `${leave}/time-record/${id}`, + recordById: (id: string, type: string) => `${leave}/${type}/${id}`, /** เปลี่ยนแปลงลงเวลา*/ leaveSearch: () => `${leave}/search`, leaveRound: () => `${leave}/round`, diff --git a/src/modules/09_leave/components/1_Work/DialogDetail.vue b/src/modules/09_leave/components/1_Work/DialogDetail.vue index 2abcf4389..f68a2385e 100644 --- a/src/modules/09_leave/components/1_Work/DialogDetail.vue +++ b/src/modules/09_leave/components/1_Work/DialogDetail.vue @@ -24,6 +24,10 @@ const props = defineProps({ type: Boolean, require: true, }, + typeTab: { + type: String, + require: true, + }, detail: { type: Object, require: true, @@ -59,10 +63,10 @@ const formData = reactive({ * function เรียกรายการลงเวลาตาม * @param id รายการลงเวลาปฏิบัติงาน */ -async function fetchDetailByid(id: string) { +async function fetchDetailByid(id: string, type: string) { showLoader(); await http - .get(config.API.timeRecordById(id)) + .get(config.API.recordById(id, type)) .then((res) => { const data = res.data.result; formData.checkInDate = data.checkInDate && date2Thai(data.checkInDate); @@ -111,7 +115,9 @@ function closePopup() { watch( () => props.modal, () => { - props.modal === true && props.detail && fetchDetailByid(props.detail.id); + props.modal === true && + props.detail && + fetchDetailByid(props.detail.id, props.typeTab as string); } ); diff --git a/src/modules/09_leave/components/1_Work/Tab1.vue b/src/modules/09_leave/components/1_Work/Tab1.vue index fd1245107..5156d6679 100644 --- a/src/modules/09_leave/components/1_Work/Tab1.vue +++ b/src/modules/09_leave/components/1_Work/Tab1.vue @@ -206,7 +206,7 @@ onMounted(async () => { :rowsPerPage="rowsPerPage" :maxPage="maxPage" @update:pagination="updatePaging" - :tab="'1'" + :tab="'time-record'" /> diff --git a/src/modules/09_leave/components/1_Work/Tab2.vue b/src/modules/09_leave/components/1_Work/Tab2.vue index 901a3e4c4..69cac47d5 100644 --- a/src/modules/09_leave/components/1_Work/Tab2.vue +++ b/src/modules/09_leave/components/1_Work/Tab2.vue @@ -165,7 +165,7 @@ onMounted(async () => { :rowsPerPage="rowsPerPage" :maxPage="maxPage" @update:pagination="updatePagingProp" - :tab="'2'" + :tab="'log-record'" /> diff --git a/src/modules/09_leave/components/1_Work/TableList.vue b/src/modules/09_leave/components/1_Work/TableList.vue index d829d1767..2056d5350 100644 --- a/src/modules/09_leave/components/1_Work/TableList.vue +++ b/src/modules/09_leave/components/1_Work/TableList.vue @@ -64,15 +64,15 @@ function updateProp(newPagination: any, page: number) { emit("update:pagination", newPagination, page); } +const typeTab = ref(""); /** * Function openPopup และแสดงรายละเอียด * @param data ข้อมูลรายละเอียด */ function clickDetail(data: any) { - if (props.tab === "1") { - modal.value = true; - dataDetail.value = data; - } + typeTab.value = props.tab as string; + modal.value = true; + dataDetail.value = data; } /** Function ปิด popup */ @@ -156,7 +156,12 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => { - +