diff --git a/src/api/leave/api.leave.ts b/src/api/leave/api.leave.ts index 8c2b537..6101b03 100644 --- a/src/api/leave/api.leave.ts +++ b/src/api/leave/api.leave.ts @@ -6,16 +6,18 @@ const holiday = `${env.API_URI}/metadata/holiday/`; export default { listUser: () => `${retirementResign}/resign/user`, - listUserByType:(type:string) => `${retirementResign}/resign${type}/user`, + listUserByType: (type: string) => `${retirementResign}/resign${type}/user`, listResign: () => `${retirementResign}/resign`, - listResignByType: (type:string) => `${retirementResign}/resign${type}`, + listResignByType: (type: string) => `${retirementResign}/resign${type}`, resingByid: (id: string) => `${retirementResign}/resign/${id}`, - resingByidType: (type:string,id: string) => `${retirementResign}/resign${type}/${id}`, + resingByidType: (type: string, id: string) => + `${retirementResign}/resign${type}/user/${id}`, questionnaireByid: (id: string) => `${retirementResign}/resign/questionnaire/${id}`, listquestionnaire: () => `${retirementResign}/resign/questionnaire`, cancelResign: (id: string) => `${retirementResign}/resign/cancel/${id}`, - cancelResignByType: (type:string,id: string) => `${retirementResign}/resign${type}/cancel/${id}`, + cancelResignByType: (type: string, id: string) => + `${retirementResign}/resign${type}/cancel/${id}`, // คำถาม questionList: () => `${retirementResign}/resign/questionnaire/question`, diff --git a/src/app.config.ts b/src/app.config.ts index 56d83a8..34a4e5d 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -46,14 +46,14 @@ const generatePopupPath = (routeName: any, type: string) => { if (routeName.includes("organizationChart")) { return `${path}/chapter-1-user${type}-organization-chart`; } - if (routeName.includes("registry")) { + if (routeName.includes("registry") || routeName.includes("request-edit")) { return `${path}/chapter-2-user${type}-registry`; } if (routeName.includes("evaluate")) { return `${path}/chapter-3-user-evaluate`; } - if (routeName.includes("leave")) { + if (routeName.includes("leave") || routeName.includes("addAbsence")) { return `${path}/chapter-${type ? "3" : "4"}-user${type}-leave`; } @@ -79,7 +79,7 @@ const generatePopupPath = (routeName: any, type: string) => { return `${path}/chapter-14-user-service-testing`; } if (routeName.includes("Retire")) { - return `${path}/chapter-${type ? "5" : "11"}-user${type}-retire`; + return `${path}/chapter-${type ? "6" : "12"}-user${type}-retire`; } else { return manualConfig[routeName as keyof typeof manualConfig]; } @@ -93,6 +93,8 @@ const manualConfig = { addPortfolio: `${path}/chapter-5-user-portfolio`, addTransfer: `${path}/chapter-6-user-transfer`, KPIMain: `${path}/chapter-8-user-KPI`, + KPIAdd: `${path}/chapter-8-user-KPI`, + KPIEdit: `${path}/chapter-8-user-KPI`, KPIMainEvaluator: `${path}/chapter-9-user-KPI-evaluator`, }; diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index bc52e15..9dfae70 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -162,12 +162,12 @@ watch(modal, (val) => { } }); -watch( - () => [formDataQuery.isAct, formDataQuery.pageSize], - () => { - onSearchData(); - } -); +// watch( +// () => [formDataQuery.isAct, formDataQuery.pageSize], +// () => { +// onSearchData(); +// } +// ); /** * function updatePagination diff --git a/src/modules/00_support/store/Main.ts b/src/modules/00_support/store/Main.ts index 12383f0..d4b3174 100644 --- a/src/modules/00_support/store/Main.ts +++ b/src/modules/00_support/store/Main.ts @@ -17,7 +17,6 @@ import { getToken, tokenParsed } from "@/plugins/auth"; export const useSupportStore = defineStore("supportServiceStore", () => { const { showLoader, hideLoader, messageError } = useCounterMixin(); - const $q = useQuasar(); const openChat = ref(false); const icon = ref("mdi-account-check"); @@ -114,7 +113,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const res = await http .get(config.API.supportMessageStatus(issueId)) .catch((err) => { - messageError($q, err); + console.log(err); }) .finally(() => { hideLoader(); @@ -129,7 +128,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const res = await http .get(config.API.supportMessage(issueId)) .catch((err) => { - messageError($q, err); + console.log(err); }) .finally(() => { hideLoader(); @@ -149,7 +148,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const res = await http .get(config.API.supportIssueUserId(userId.value)) .catch((err) => { - messageError($q, err); + console.log(err); }) .finally(() => { hideLoader(); @@ -166,7 +165,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const res = await http .get(config.API.supportIssueCategory) .catch((err) => { - messageError($q, err); + console.log(err); }) .finally(() => { hideLoader(); @@ -188,7 +187,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const res = await http .post(config.API.supportNewIssue, requestBody) .catch((err) => { - messageError($q, err); + console.log(err); }) .finally(() => { hideLoader(); @@ -203,7 +202,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const res = await http .get(config.API.supportSearchIssue(searchData)) .catch((err) => { - messageError($q, err); + console.log(err); }); if (res && res.data) { issue.value = res.data; diff --git a/src/modules/02_transfer/views/AddTransfer.vue b/src/modules/02_transfer/views/AddTransfer.vue index fa53bde..b1c980e 100644 --- a/src/modules/02_transfer/views/AddTransfer.vue +++ b/src/modules/02_transfer/views/AddTransfer.vue @@ -1,60 +1,64 @@ diff --git a/src/modules/03_retire/interface/Main.ts b/src/modules/03_retire/interface/Main.ts index 1bb3486..28b5f01 100644 --- a/src/modules/03_retire/interface/Main.ts +++ b/src/modules/03_retire/interface/Main.ts @@ -62,6 +62,8 @@ interface DataOptions { interface RowsType { commanders: SeqTypeRow[]; approvers: SeqTypeRow[]; + cancelCommanders: SeqTypeRow[] | null; + cancelApprovers: SeqTypeRow[] | null; } interface SeqTypeRow { seq: number; diff --git a/src/modules/03_retire/views/addRetire.vue b/src/modules/03_retire/views/addRetire.vue index 2dfe2ff..c6c3a6c 100644 --- a/src/modules/03_retire/views/addRetire.vue +++ b/src/modules/03_retire/views/addRetire.vue @@ -144,19 +144,6 @@ const columnsCommanders = ref([ }, ]); -/** - * ฟังก์ชั่นเปลี่ยนเป็น string ของ status - * @param val value ของ status true/false - */ -function statusOrder(val: boolean) { - switch (val) { - case true: - return "ยับยั้ง"; - case false: - return "อนุญาต"; - } -} - /** * บันทึกข้อมูลการลาออก */ @@ -233,6 +220,8 @@ async function fectDataresign(id: string) { rowsApprover.value = { commanders: data.commanders, approvers: data.approvers, + cancelCommanders: data.cancelCommanders ?? null, + cancelApprovers: data.cancelApprovers ?? null, }; files.value = data.docs; dataDetail.value = data; @@ -586,137 +575,308 @@ onMounted(async () => { --> - -
- -
-
- ผลการพิจารณาของผู้บังคับบัญชา -
-
- -
- - - - +
+
+
+ วันสุดท้ายที่ยับยั้ง +
+
+ {{ + rowsApprover && + rowsApprover.approvers && + rowsApprover.approvers[0]?.rejectDate + ? date2Thai( + rowsApprover?.approvers[0].rejectDate + ) + : "-" + }} +
+
+
+
+ ความคิดเห็นและเหตุผล +
+
+ {{ + rowsApprover && + rowsApprover.approvers && + rowsApprover.approvers[0]?.comment + ? rowsApprover?.approvers[0].comment + : "-" + }} +
+
+
+ + - + - -
- -
-
- ผลการพิจารณาของผู้มีอำนาจ -
+ +
+
+ ผลการพิจารณาการขอยกเลิกลาออก +
+ +
+ +
+ +
+
+ ผลการพิจารณาของผู้บังคับบัญชา +
+
+ +
+ + + + +
+
- -
-
-
-
ชื่อ - นามสกุล
-
- {{ - rowsApprover && - rowsApprover.approvers && - rowsApprover.approvers[0]?.firstName - ? `${rowsApprover?.approvers[0].prefix}${rowsApprover?.approvers[0].firstName} ${rowsApprover?.approvers[0].lastName}` - : "-" - }} + + +
+ +
+
+ ผลการพิจารณาของผู้มีอำนาจ
-
-
สถานะ
-
- {{ - rowsApprover && - rowsApprover.approvers && - rowsApprover.approvers[0]?.approveStatus - ? convertStatusText( - rowsApprover?.approvers[0].approveStatus - ) - : "-" - }} + +
+
+
+
ชื่อ - นามสกุล
+
+ {{ + rowsApprover && + rowsApprover.cancelApprovers && + rowsApprover.cancelApprovers[0]?.firstName + ? `${rowsApprover?.cancelApprovers[0].prefix}${rowsApprover?.cancelApprovers[0].firstName} ${rowsApprover?.cancelApprovers[0].lastName}` + : "-" + }} +
+
+
+
สถานะ
+
+ {{ + rowsApprover && + rowsApprover.cancelApprovers && + rowsApprover.cancelApprovers[0]?.approveStatus + ? convertStatusText( + rowsApprover?.cancelApprovers[0] + .approveStatus + ) + : "-" + }} +
+
+
+
+ วันสุดท้ายที่ยับยั้ง +
+
+ {{ + rowsApprover && + rowsApprover.cancelApprovers && + rowsApprover.cancelApprovers[0]?.rejectDate + ? date2Thai( + rowsApprover?.cancelApprovers[0].rejectDate + ) + : "-" + }} +
+
+
+
+ ความคิดเห็นและเหตุผล +
+
+ {{ + rowsApprover && + rowsApprover.cancelApprovers && + rowsApprover.cancelApprovers[0]?.comment + ? rowsApprover?.cancelApprovers[0].comment + : "-" + }} +
+
-
-
วันสุดท้ายที่ยับยั้ง
-
- {{ - rowsApprover && - rowsApprover.approvers && - rowsApprover.approvers[0]?.rejectDate - ? date2Thai(rowsApprover?.approvers[0].rejectDate) - : "-" - }} -
-
-
-
ความคิดเห็นและเหตุผล
-
- {{ - rowsApprover && - rowsApprover.approvers && - rowsApprover.approvers[0]?.comment - ? rowsApprover?.approvers[0].comment - : "-" - }} -
-
-
+
-
+
diff --git a/src/modules/05_leave/components/Calendar.vue b/src/modules/05_leave/components/Calendar.vue index 67c483e..7150f73 100644 --- a/src/modules/05_leave/components/Calendar.vue +++ b/src/modules/05_leave/components/Calendar.vue @@ -6,6 +6,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { tokenParsed } from "@/plugins/auth"; import { useCounterMixin } from "@/stores/mixin"; +import { useLeaveStore } from "@/modules/05_leave/store"; import FullCalendar from "@fullcalendar/vue3"; import dayGridPlugin from "@fullcalendar/daygrid"; @@ -23,6 +24,7 @@ import type { import DialogDetail from "@/modules/05_leave/components/DialogDetail.vue"; const $q = useQuasar(); +const store = useLeaveStore(); const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError, monthYear2Thai } = mixin; const emit = defineEmits(["update:dateYear"]); @@ -74,7 +76,6 @@ const dateMonth = ref({ /** function เรียกข้อมูล calendar*/ async function fetchDataCalendar() { - showLoader(); await http .post(config.API.leaveCalendar(), { year: dateMonth.value.year, @@ -118,9 +119,6 @@ async function fetchDataCalendar() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -128,7 +126,6 @@ async function fetchDataCalendar() { * fetch วันหยุดในปฏิทิน */ async function fetchData() { - showLoader(); await http .get( config.API.listHolidayHistoryYearMonth( @@ -138,7 +135,6 @@ async function fetchData() { ) .then((res) => { const dataNormal = res.data.result.normal; - const dataSixDays = res.data.result.sixDays; const data = dataNormal; const event = data.map((e: any) => ({ id: e.id, @@ -155,23 +151,9 @@ async function fetchData() { ...calendarOptions.value.events, ...event, ]; - // const dataSix = dataSixDays - // const eventSix = dataSix.map((e: any) => ({ - // id: e.id, - // title: `${e.name} `, - // start: e.holidayDate, - // end: new Date(new Date(e.holidayDate).setHours(23, 59, 59)).toISOString(), - // allDay: e.holidayDate === e.holidayDate ? true : false, - // color: "#FFE5CC", - // textColor: "#FF8000", - // })) - // calendarOptions.value.events = [...calendarOptions.value.events, ...eventSix] }) .catch((e) => { messageError($q, e); - }) - .finally(async () => { - hideLoader(); }); } @@ -184,14 +166,11 @@ function convertKeycloakId(id: any) { /** function เรียกประเภทการลา */ const leaveType = ref([]); async function fectOptionType() { - await http - .get(config.API.leaveType()) - .then(async (res) => { - leaveType.value = res.data.result; - }) - .catch((err) => { - messageError($q, err); - }); + const data = await store.fetchLeaveTypeData(); + if (!data) { + return; + } + leaveType.value = data; } /** @@ -205,11 +184,17 @@ function monthYearThai(val: DataDateMonthObject) { /** function อัปเดท Calendar */ async function updateMonth() { - await fetchDataCalendar(); - await fetchData(); - const calen = fullCalendar.value.getApi(); - const date = new Date(dateMonth.value.year, dateMonth.value.month); - calen.gotoDate(date); + try { + await fetchDataCalendar(); + await fetchData(); + const calen = fullCalendar.value.getApi(); + const date = new Date(dateMonth.value.year, dateMonth.value.month); + calen.gotoDate(date); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } } /** @@ -226,10 +211,11 @@ async function onClickClose() { modal.value = false; } -/**** ตรวจสอบว่ามีการส่งข้อมูลเข้ามาที่Calendar */ +/** ตรวจสอบว่ามีการส่งข้อมูลเข้ามาที่Calendar */ watch( () => filterVal.value, async () => { + showLoader(); const eventData = filterVal.value.map((item: any) => { return mainData.value .filter( @@ -250,24 +236,32 @@ watch( const allEventData = [].concat(...eventData); calendarOptions.value.events = allEventData; await fetchData(); + hideLoader(); } ); /**Hook */ onMounted(async () => { - const user = await tokenParsed(); - keycloakId.value = await (user ? user.sub : ""); - filterVal.value.push(keycloakId.value); - await fetchDataCalendar(); - await fetchData(); - await fectOptionType(); + try { + showLoader(); + // เรียกข้อมูล keycloakId + const user = await tokenParsed(); + keycloakId.value = await (user ? user.sub : ""); + filterVal.value.push(keycloakId.value); + await Promise.all([fetchDataCalendar(), fectOptionType()]); + await fetchData(); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } });