diff --git a/src/api/09_leave/api.leave.ts b/src/api/09_leave/api.leave.ts index f07fdd30c..3d345b7de 100644 --- a/src/api/09_leave/api.leave.ts +++ b/src/api/09_leave/api.leave.ts @@ -13,9 +13,13 @@ export default { /** เปลี่ยนแปลงลงเวลา*/ leaveSearch: () => `${leave}/search`, + leaveSearchEMP: () => `${leave}/emp/search`, leaveRound: () => `${leave}/round`, + leaveRoundEMP: () => `${leave}/emp/round`, leaveRoundById: (id: string) => `${leave}/round/${id}`, + leaveRoundByIdEMP: (id: string) => `${leave}/emp/round/${id}`, leaveWorkByid: (id: string) => `${leave}/admin/work/${id}`, + leaveWorkByidEMP: (id: string) => `${leave}/admin/emp/work/${id}`, /**ลงเวลาพิเศษ */ specialTime: () => `${leave}/admin/edit`, diff --git a/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue b/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue index 6957013bd..0448729fb 100644 --- a/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue +++ b/src/modules/09_leave/components/03_ChangeRound/DialogForm.vue @@ -36,6 +36,10 @@ const props = defineProps({ editCheck: String, DataRow: Object, personId: String, + type: { + type: String, + default: "", + }, }); /**FormData */ @@ -114,9 +118,11 @@ function onSubmit() { async function changeRound() { const formattedDateForAPI = await convertDateToAPI(formData.effectiveDate); + const url = + props.type == "emp" ? config.API.leaveRoundEMP() : config.API.leaveRound(); showLoader(); await http - .post(config.API.leaveRound(), { + .post(url, { profileId: props.personId, roundId: formData.round, effectiveDate: formattedDateForAPI, @@ -140,8 +146,14 @@ async function changeRound() { */ async function fetchDataOption() { props.editCheck !== "history" && showLoader(); + const url = + props.editCheck == "edit" + ? config.API.leaveRound() + : props.type == "emp" + ? config.API.leaveRoundEMP() + : config.API.leaveRound(); await http - .get(config.API.leaveRound()) + .get(url) .then((res) => { const data = res.data.result; let option: DataOption[] = []; @@ -202,7 +214,11 @@ watch( formData.reson = ""; formData.effectiveDate = null; } - if (props.modal === true && dataStore.roundOp.length == 0) { + if ( + props.modal === true && + dataStore.roundOp.length == 0 && + props.editCheck !== "history" + ) { currentPage.value = 1; await fetchDataOption(); } else { diff --git a/src/modules/09_leave/router.ts b/src/modules/09_leave/router.ts index 8c745e47d..319379bce 100644 --- a/src/modules/09_leave/router.ts +++ b/src/modules/09_leave/router.ts @@ -10,7 +10,8 @@ const ChangeRoundMain = () => const SpecialTimeMain = () => import("@/modules/09_leave/views/04_SpecialTimeMain.vue"); const leaveReport = () => import("@/modules/09_leave/views/06_ReportMain.vue"); - +const ChangeRoundEMP = () => + import("@/modules/09_leave/views/ChangeRoundEMP.vue"); // const CheckinReport = () => // import("@/modules/09_leave/views/!07_ReportCheckin.vue"); @@ -37,6 +38,16 @@ export default [ Role: "STAFF", }, }, + { + path: "/change-round-emp", + name: "changeRoundEmp", + component: ChangeRoundEMP, + meta: { + Auth: true, + Key: "SYS_WORK_ROUND_EDIT_EMP", + Role: "STAFF", + }, + }, { path: "/work-list", name: "workList", diff --git a/src/modules/09_leave/stores/ChangeRoundStore.ts b/src/modules/09_leave/stores/ChangeRoundStore.ts index 82c89fa7b..0a6706079 100644 --- a/src/modules/09_leave/stores/ChangeRoundStore.ts +++ b/src/modules/09_leave/stores/ChangeRoundStore.ts @@ -123,11 +123,15 @@ export const useChangeRoundDataStore = defineStore( const maxPageMain = ref(0); const totalListMain = ref(0); - async function fetchDataForCardId(dataDetail: any) { + async function fetchDataForCardId(dataDetail: any, type?: string) { if (dataDetail) { showLoader(); + const url = + type && type == "emp" + ? config.API.leaveSearchEMP() + : config.API.leaveSearch(); await http - .post(config.API.leaveSearch(), { + .post(url, { citizenId: dataDetail.cardId.trim() || "", //เลขประจำตัวประชาชน firstname: dataDetail.firstName.trim() || "", //ชื่อจริง lastname: dataDetail.lastName.trim() || "", //นามสกุล @@ -180,18 +184,26 @@ export const useChangeRoundDataStore = defineStore( * @param pageVal page * @param pageSizeVal pagesize */ - async function changePage(pageVal: number, pageSizeVal: number) { + async function changePage( + pageVal: number, + pageSizeVal: number, + type?: string + ) { page.value = pageVal; pageSize.value = pageSizeVal; - fetchDatainHistory(); + fetchDatainHistory(type); } /**ฟังก์ชั่นดึงดาต้าประวัติ */ - async function fetchDatainHistory() { + async function fetchDatainHistory(type?: string) { rowsHistory.value = []; showLoader(); + const url = + type == "emp" + ? config.API.leaveRoundByIdEMP(profileId.value) + : config.API.leaveRoundById(profileId.value); await http .get( - config.API.leaveRoundById(profileId.value) + + url + `?page=${page.value}&pageSize=${pageSize.value}&keyword=${filter.value}` ) .then((res) => { @@ -237,7 +249,7 @@ export const useChangeRoundDataStore = defineStore( totalListMain, maxPageMain, roundOp, - roundOpMain + roundOpMain, }; } ); diff --git a/src/modules/09_leave/views/ChangeRoundEMP.vue b/src/modules/09_leave/views/ChangeRoundEMP.vue new file mode 100644 index 000000000..683bb8405 --- /dev/null +++ b/src/modules/09_leave/views/ChangeRoundEMP.vue @@ -0,0 +1,384 @@ + + + +