diff --git a/src/api/06_retirement/api.retirement.ts b/src/api/06_retirement/api.retirement.ts index fd0149446..d0991a12f 100644 --- a/src/api/06_retirement/api.retirement.ts +++ b/src/api/06_retirement/api.retirement.ts @@ -108,4 +108,6 @@ export default { // แก้ไขข้อมูลการลาออก updateResign: (path: string, id: string) => `${retirement}/${path}/admin-update/resign-info/${id}`, + + exRetirement: `${env.API_URI}/org/ex/retirement`, }; diff --git a/src/api/15_development/api.development.ts b/src/api/15_development/api.development.ts index 0ea20d574..98a2fdedf 100644 --- a/src/api/15_development/api.development.ts +++ b/src/api/15_development/api.development.ts @@ -57,6 +57,8 @@ export default { `${developmentOrg}/profile/development/registry/OFFICER/${id}`, developmentIDP: (id: string) => `${development}/main/registry/OFFICER/${id}`, - devStrategySort:`${devStrategy}/sort`, - developmentScholarshipReport + devStrategySort: `${devStrategy}/sort`, + developmentScholarshipReport, + + developmentProfile: `${developmentOrg}/profile/development`, }; diff --git a/src/components/information/Train.vue b/src/components/information/Train.vue index cf6661128..d8b98f615 100644 --- a/src/components/information/Train.vue +++ b/src/components/information/Train.vue @@ -394,6 +394,7 @@ + - - - - - - - + + + + + + + + + + filterSelector(inputValue, doneFn ) " - > - - - ไม่มีข้อมูล - - - - - - - ส่งรายชื่อไปยังหน่วยงาน - - + > + + + + ไม่มีข้อมูล + + + + + + + + + + ส่งรายชื่อไปยังหน่วยงาน + + + + + ส่งไปออกคำสั่ง + + + + + + - - ส่งไปออกคำสั่ง - + - - - - - - - - - + + + + + + + + + + + + + + + - - - ทั้งหมด {{ attrs.rows.length.toLocaleString() }} รายการ - - - - - - - {{ col.label }} - - - - - - - + + + + ทั้งหมด {{ attrs.rows.length.toLocaleString() }} รายการ + + + + + + + {{ col.label }} + + + + + + + + diff --git a/src/modules/05_placement/components/Transfer/DialogOrders.vue b/src/modules/05_placement/components/Transfer/DialogOrders.vue index f761663da..502f3a5c9 100644 --- a/src/modules/05_placement/components/Transfer/DialogOrders.vue +++ b/src/modules/05_placement/components/Transfer/DialogOrders.vue @@ -189,40 +189,49 @@ watch( - - - - - - - - - + + + + + + + + + diff --git a/src/modules/05_placement/components/probation/MainSurvey.vue b/src/modules/05_placement/components/probation/MainSurvey.vue index 24947a245..6290b910e 100644 --- a/src/modules/05_placement/components/probation/MainSurvey.vue +++ b/src/modules/05_placement/components/probation/MainSurvey.vue @@ -14,7 +14,7 @@ const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { pagination, params, onRequest } = usePagination("", getData); -const year = ref(new Date().getFullYear()); //ปีงบประมาณ +const year = ref(new Date().getFullYear()); const rows = ref([]); const filterKeyword = ref(""); diff --git a/src/modules/05_placement/views/01_Main.vue b/src/modules/05_placement/views/01_Main.vue index b461d5fbb..b0ab311a1 100644 --- a/src/modules/05_placement/views/01_Main.vue +++ b/src/modules/05_placement/views/01_Main.vue @@ -385,147 +385,163 @@ onMounted(() => { - - - - ไม่มีข้อมูล - - - - - - - - - - - - - + + + + + + + + + ไม่มีข้อมูล + + + + + + + + + + + + + + + + + + + + + + + - - - - ไม่มีข้อมูล - - - - + + + + + ไม่มีข้อมูล + + + + + - - - - - ไม่มีข้อมูล - - - - + + + + + + ไม่มีข้อมูล + + + + + - + + + diff --git a/src/modules/05_placement/views/02_transferMain.vue b/src/modules/05_placement/views/02_transferMain.vue index 259d0e0f3..efd36dc90 100644 --- a/src/modules/05_placement/views/02_transferMain.vue +++ b/src/modules/05_placement/views/02_transferMain.vue @@ -205,145 +205,160 @@ onMounted(async () => { รายการขอโอน - - - - - - filterOption(inputValue, doneFn) " - @update:model-value="(value:string)=>{(status = value),fetchData()}" - > - - - - ไม่มีข้อมูล - - - - - - - + + + + + + + + filterOption(inputValue, doneFn) " + @update:model-value="(value:string)=>{(status = value),fetchData()}" + > + + + + ไม่มีข้อมูล + + + + + + + + + + + + ส่งไปออกคำสั่ง + + + - - ส่งไปออกคำสั่ง - - - - - - - + - + + + + + + + + + + + + + + + + + - - - - - - - {{ col.label }} - - - - - - - - รายละเอียด - - - - - {{ props.rowIndex + 1 }} - + + + + + + + {{ col.label }} + + + + + + + + รายละเอียด + + + + + {{ props.rowIndex + 1 }} + - - {{ props.row.organizationPositionOld ?? "-" }} - + + {{ props.row.organizationPositionOld ?? "-" }} + - - {{ - col.value == null ? "" : col.value == "" ? "-" : col.value - }} - - - - - - + + {{ + col.value == null ? "" : col.value == "" ? "-" : col.value + }} + + + + + diff --git a/src/modules/05_placement/views/09_reportMain.vue b/src/modules/05_placement/views/09_reportMain.vue index 0031a4dc4..faa55bb04 100644 --- a/src/modules/05_placement/views/09_reportMain.vue +++ b/src/modules/05_placement/views/09_reportMain.vue @@ -7,6 +7,7 @@ import axios from "axios"; import { useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useStructureTree } from "@/stores/structureTree"; +import { calculateFiscalYear } from "@/utils/function"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -56,7 +57,7 @@ const optionReport = ref([ type: "probation", }, ]); -const year = ref(new Date().getFullYear()); +const year = ref(calculateFiscalYear(new Date())); const dateStart = ref(new Date(year.value - 1, 9, 1)); const dateEnd = ref(new Date(year.value + 1, 8, 30)); @@ -188,7 +189,7 @@ function clearFilter() { detailReport.value = undefined; pdfSrc.value = undefined; - year.value = new Date().getFullYear(); + year.value = calculateFiscalYear(new Date()); dateStart.value = new Date(year.value - 1, 9, 1); dateEnd.value = new Date(year.value + 1, 8, 30); } diff --git a/src/modules/06_retirement/interface/request/Main.ts b/src/modules/06_retirement/interface/request/Main.ts index d0c05ec40..b4a6e3d88 100644 --- a/src/modules/06_retirement/interface/request/Main.ts +++ b/src/modules/06_retirement/interface/request/Main.ts @@ -20,4 +20,17 @@ interface QuestionDesc { question10Desc: string; } -export type { OptionQuestions, OptionQuestions2,QuestionDesc }; +interface FilterRetirementOld { + type: string; + retireYear: number; + citizenID: string; + firstNameTH: string; + lastNameTH: string; +} + +export type { + OptionQuestions, + OptionQuestions2, + QuestionDesc, + FilterRetirementOld, +}; diff --git a/src/modules/06_retirement/interface/response/Main.ts b/src/modules/06_retirement/interface/response/Main.ts index 758fbb842..4e7c72bb4 100644 --- a/src/modules/06_retirement/interface/response/Main.ts +++ b/src/modules/06_retirement/interface/response/Main.ts @@ -68,7 +68,33 @@ interface SeqTypeRow { keycloakId: string; approveStatus: string; comment: string; - rejectDate: Date|null; + rejectDate: Date | null; +} + +interface RetirementOld { + dataRecords: DataRecords[]; + rowPerPage: number; + startRecord: number; + totalRecords: number; +} + +interface DataRecords { + citizenID: string; + firstNameTH: string; + lastNameTH: string; + organizeID: string; + organizeNameTH: string; + positionID: string; + positionLevelID: string; + positionLevelNameTH: string; + positionNameTH: string; + positionTypeID: string; + positionTypeNameTH: string; + recordRow: number; + retireDate: string; + retireTypeID: string; + retireTypeNameTH: string; + retireYear: string; } export type { @@ -79,5 +105,7 @@ export type { FileList, CheckBoxType, RowsType, - SeqTypeRow + SeqTypeRow, + RetirementOld, + DataRecords, }; diff --git a/src/modules/06_retirement/router.ts b/src/modules/06_retirement/router.ts index 5ad3f78fc..4e8a35b82 100644 --- a/src/modules/06_retirement/router.ts +++ b/src/modules/06_retirement/router.ts @@ -66,9 +66,11 @@ const outDetailOnlyEmp = () => import("@/modules/06_retirement/components/06_dismissOrder/DetailEMP.vue"); /** รายงาน*/ - const ReportView = () => import("@/modules/06_retirement/views/07_report.vue"); +const RetirementOld = () => + import("@/modules/06_retirement/views/09_retirementOld.vue"); + export default [ { path: "/retirement", @@ -356,4 +358,15 @@ export default [ Role: "STAFF", }, }, + + { + path: "retire-old", + name: "retireOld", + component: RetirementOld, + meta: { + Auth: true, + Key: "SYS_RETIRE_OLD", + Role: "STAFF", + }, + }, ]; diff --git a/src/modules/06_retirement/views/01_retirement.vue b/src/modules/06_retirement/views/01_retirement.vue index 60007ace4..a3483f52a 100644 --- a/src/modules/06_retirement/views/01_retirement.vue +++ b/src/modules/06_retirement/views/01_retirement.vue @@ -7,6 +7,7 @@ import { useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useDataStoreRetirement } from "@/modules/06_retirement/store/storeRetirement"; import { checkPermission } from "@/utils/permissions"; +import { calculateFiscalYear } from "@/utils/function"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -24,10 +25,7 @@ const { clickTab } = useStoreRetire; const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } = mixin; -const fiscalyear = ref(); // ปี -const yearOptionsFilter = ref({ - yearOptions: [], -}); +const fiscalyear = ref(calculateFiscalYear(new Date())); // ปี const actionOption = ref([]); const pagination = ref({ @@ -90,10 +88,9 @@ const columns = ref([ ]); // ข้อมูลตาราง (จำลอง) -const currentYear = new Date().getFullYear(); +const currentYear = calculateFiscalYear(new Date()); const rows = ref([]); const rowsData = ref([]); -const yearOptions = ref([{ id: "", year: "ทั้งหมด" }]); // ประกาศเกษียณอายุราชการ async function fetchRetirement(type: string, year: any) { @@ -103,52 +100,30 @@ async function fetchRetirement(type: string, year: any) { .get(config.API.retirement(type, year)) .then((res) => { let data = res.data.result; - const listData = data.map((items: any) => ({ - id: items.id, - signDate: date2Thai(items.signDate) ?? "-", - Date: date2Thai(items.createdAt), - year: items.year + 543, - retireNumber: items.round, - total: items.total, - round: items.round, - typeReport: typeReportChangeName(items.typeReport), // เปลี่ยนสถานะ - json: items.json, - document: items.document, - })); - rows.value = listData; - rowsData.value = listData; - - let option: any[] = []; - data.map((items: any) => { - option.push({ - id: items.year, - year: (items.year + 543).toString(), + if (data.length !== 0) { + const listData = data.map((items: any) => ({ + id: items.id, + signDate: date2Thai(items.signDate) ?? "-", + Date: date2Thai(items.createdAt), + year: items.year + 543, + retireNumber: items.round, + total: items.total, + round: items.round, typeReport: typeReportChangeName(items.typeReport), // เปลี่ยนสถานะ - }); - }); - yearOptions.value = [{ id: 0, year: "ทั้งหมด" }]; - // yearOptions.value.push(...option); - if (option.length !== 0) { - const double_name = [...new Set(option.map((item: any) => item.id))]; - for (let i = 1; i <= double_name.length; i++) { - const type = double_name[i - 1]; - const listtype = { - id: type, - year: (Number(type) + 543).toString(), - }; - yearOptions.value.push(listtype); - } - } - yearOptionsFilter.value = yearOptions.value; - if (yearOptionsFilter.value.length == 1) { - fiscalyear.value = yearOptionsFilter.value[0].id; + json: items.json, + document: items.document, + })); + rows.value = listData; + rowsData.value = listData; + actionOption.value = rows.value; + rows.value.sort((a, b) => a.round - b.round); // เรียงรอบมากไปน้อย + checkststus(rows.value); } else { - fiscalyear.value = year; + rows.value = []; + rowsData.value = []; + actionOption.value = []; + checkjson.value = false; } - actionOption.value = rows.value; - - rows.value.sort((a, b) => a.round - b.round); // เรียงรอบมากไปน้อย - checkststus(rows.value); }) .catch((e) => { messageError($q, e); @@ -171,25 +146,6 @@ function checkststus(data: any) { const filterKeyword = ref(""); const filterRef = ref(null); -/** reset ฟิลเตอร์ */ -function resetFilter() { - filterKeyword.value = ""; - filterRef.value.focus(); -} - -/** - * ฟังชั่นฟิลเตอร์ input - * @param val input - * @param update Function quasar - */ -function filterSelector(val: any, update: Function) { - update(() => { - yearOptions.value = yearOptionsFilter.value.filter( - (v: any) => v.year.indexOf(val) > -1 - ); - }); -} - /** * ไปหน้าแก้ไขรายละเอียด * @param prop ข้อมูล @@ -270,40 +226,41 @@ onMounted(async () => { - filterSelector(inputValue, doneFn - ) " - :hide-dropdown-icon="false" - style="min-width: 150px" + style="width: 150px" + :locale="'th'" + autoApply + year-picker + :enableTimePicker="false" + :max-date="`${calculateFiscalYear(new Date())}, 12, 31`" + @update:model-value="fetchRetirement(type, fiscalyear)" > - - - - ไม่มีข้อมูล - - + {{ year + 543 }} + {{ + parseInt(value + 543) + }} + + + - + - + { ([ { id: "MONTH", name: "รายเดือน" }, { id: "YEAR", name: "รายปี" }, ]); -const year = ref(new Date().getFullYear()); +const year = ref(calculateFiscalYear(new Date())); const dateMonth = ref({ month: new Date().getMonth(), year: new Date().getFullYear(), @@ -203,7 +204,7 @@ function clearFilter() { reportType.value = ""; filterType.value = "MONTH"; - year.value = new Date().getFullYear(); + year.value = calculateFiscalYear(new Date()); dateMonth.value = { month: new Date().getMonth(), year: new Date().getFullYear(), diff --git a/src/modules/06_retirement/views/09_retirementOld.vue b/src/modules/06_retirement/views/09_retirementOld.vue new file mode 100644 index 000000000..4cc07ed80 --- /dev/null +++ b/src/modules/06_retirement/views/09_retirementOld.vue @@ -0,0 +1,384 @@ + + + + + {{ titlePage }} + + + + + + + + + + + + + filterOption(inputValue, doneFn)" + class="full-width" + > + + + + ไม่มีข้อมูล + + + + + + + + + + {{ year + 543 }} + {{ + parseInt(value + 543) + }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ col.label }} + + + + + + + + {{ props.rowIndex + 1 }} + + + + {{ col.value ?? "-" }} + + + + + + + + + + diff --git a/src/modules/08_registryEmployee/components/DialogSelectPos.vue b/src/modules/08_registryEmployee/components/DialogSelectPos.vue index dbbc22e75..ad6072d71 100644 --- a/src/modules/08_registryEmployee/components/DialogSelectPos.vue +++ b/src/modules/08_registryEmployee/components/DialogSelectPos.vue @@ -58,15 +58,6 @@ const expanded = ref([]); const filters = ref(""); // ค้นหาตำแหน่ง const rowsPosition = ref([]); //รายการตำแหน่ง const columns = ref([ - { - name: "isPosition", - align: "left", - label: "", - sortable: true, - field: "isPosition", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, { name: "no", align: "left", @@ -203,7 +194,6 @@ const columnsPostition = ref([ // }, ]); const visibleColumns = ref([ - "isPosition", "no", "posMasterNo", "positionName", @@ -661,6 +651,7 @@ onBeforeMount(async () => { > + { + + + + ตรงตามตำแหน่ง + + + { ผู้อำนวยการ/หัวหน้า - - - - ตรงตามตำแหน่ง - - - {{ col.value ? col.value : "-" }} diff --git a/src/modules/09_leave/components/02_WorkList/DialogReport.vue b/src/modules/09_leave/components/02_WorkList/DialogReport.vue deleted file mode 100644 index eddf37943..000000000 --- a/src/modules/09_leave/components/02_WorkList/DialogReport.vue +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - - - - - - - - filterFnOptions(inputValue, doneFn,)" - > - - - - ไม่มีข้อมูล - - - - - - - - {{ year + 543 }} - {{ - parseInt(value + 543) - }} - - - - - - - - - - - - - {{ year + 543 }} - {{ - parseInt(value + 543) - }} - - - - - - - - - - - - ดาวน์โหลดรายงาน - - - - - - - - - - diff --git a/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue b/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue index c266a250c..70621f169 100644 --- a/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue +++ b/src/modules/09_leave/components/07_LeaveHistory/DialogForm.vue @@ -7,6 +7,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useLeaveHistoryDataStore } from "@/modules/09_leave/stores/LeaveHistoryStore"; +import { calculateFiscalYear } from "@/utils/function"; import type { QTableColumn } from "quasar"; import type { @@ -19,6 +20,7 @@ import type { } from "@/modules/09_leave/interface/response/leaveHistory"; import DialogHeader from "@/components/DialogHeader.vue"; +import { max } from "moment"; /** useStore*/ const $q = useQuasar(); @@ -78,7 +80,7 @@ const profileId = ref(""); const rowId = ref(""); const formData = reactive({ leaveTypeId: "", //ประเภทการลา - leaveYear: findYear(new Date()), //ปี + leaveYear: calculateFiscalYear(new Date()), //ปี leaveDays: "", //วันลาที่ยกมา leaveDaysUsed: "", //วันลาที่ใช้ไป }); @@ -191,7 +193,7 @@ function onClose() { formFilter.page = 1; formFilter.pageSize = 10; formData.leaveTypeId = ""; - formData.leaveYear = new Date().getFullYear(); + formData.leaveYear = calculateFiscalYear(new Date()); formData.leaveDays = ""; formData.leaveDaysUsed = ""; rows.value = []; @@ -399,8 +401,7 @@ watch(modal, async (val) => { autoApply year-picker :enableTimePicker="false" - @update:model-value="onSearchData" - readonly + :max-date="`${calculateFiscalYear(new Date())}, 12, 31`" > {{ year + 543 }} {{ @@ -408,7 +409,6 @@ watch(modal, async (val) => { }} { const tabView = ref("list"); /** filter*/ const filter = reactive({ - year: new Date().getFullYear(), //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.) + year: calculateFiscalYear(new Date()), //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.) type: "00000000-0000-0000-0000-000000000000", //*Id ประเภทการลา status: "ALL", //*สถานะการของลา keyword: "", //keyword ค้นหา diff --git a/src/modules/09_leave/views/!07_ReportCheckin.vue b/src/modules/09_leave/views/!07_ReportCheckin.vue deleted file mode 100644 index d5fa6d21f..000000000 --- a/src/modules/09_leave/views/!07_ReportCheckin.vue +++ /dev/null @@ -1,676 +0,0 @@ - - - - - รายงานสถิติการลงเวลา - - - - - - - - - - - - - - - - - - - - ไฟล์ .pdf - - - - - ไฟล์ .xlsx - - - - - - - - - - - - - - - filterFnOptions(inputValue, doneFn,)" - > - - - - ไม่มีข้อมูล - - - - - - - - - {{ year + 543 }} - {{ - parseInt(value + 543) - }} - - - - - - - - - - - - - - {{ year + 543 }} - {{ - parseInt(value + 543) - }} - - - - - - - - - - - - - {{ year + 543 }} - {{ - parseInt(value + 543) - }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{ prop.node.orgTreeName }} - - - {{ prop.node.orgCode == null ? null : prop.node.orgCode }} - {{ - prop.node.orgTreeShortName == null - ? null - : prop.node.orgTreeShortName - }} - - - - - - - - - - - - - - - - - - - - หน้าที่ {{ page }} จาก {{ numOfPages }} - - - - - - - - - - - - - - - - - - - - - - - - หน้าที่ {{ page }} จาก {{ numOfPages }} - - - - - - - - - - - - - - - - diff --git a/src/modules/09_leave/views/02_WorkingMain.vue b/src/modules/09_leave/views/02_WorkingMain.vue index d28f5b1ab..5294527d8 100644 --- a/src/modules/09_leave/views/02_WorkingMain.vue +++ b/src/modules/09_leave/views/02_WorkingMain.vue @@ -4,7 +4,6 @@ import { ref } from "vue"; /** import Components */ import Tab1 from "@/modules/09_leave/components/02_WorkList/Tab1.vue"; import Tab2 from "@/modules/09_leave/components/02_WorkList/Tab2.vue"; -// import DialogReport from "@/modules/09_leave/components/02_WorkList/DialogReport.vue"; const tab = ref("1"); diff --git a/src/modules/09_leave/views/06_ReportMain.vue b/src/modules/09_leave/views/06_ReportMain.vue index 5dd4c3f23..f87fd32f2 100644 --- a/src/modules/09_leave/views/06_ReportMain.vue +++ b/src/modules/09_leave/views/06_ReportMain.vue @@ -8,6 +8,7 @@ import { useRoute } from "vue-router"; import { checkPermission } from "@/utils/permissions"; import { useCounterMixin } from "@/stores/mixin"; import { useStructureTree } from "@/stores/structureTree"; +import { calculateFiscalYear } from "@/utils/function"; import genReportXLSX from "@/plugins/genreportxlsx"; import http from "@/plugins/http"; @@ -15,6 +16,7 @@ import config from "@/app.config"; import type { DataStructureTree } from "@/interface/main"; import type { DataOption, + DataOption2, DataDateMonthObject, } from "@/modules/09_leave/interface/index/Main"; @@ -39,7 +41,7 @@ const { hideLoader, } = useCounterMixin(); -const year = ref(new Date().getFullYear()); +const year = ref(calculateFiscalYear(new Date())); const dateStart = ref(new Date(year.value - 1, 9, 1)); const dateEnd = ref(new Date(year.value + 1, 8, 30)); @@ -53,43 +55,28 @@ const pageName = ref(route.name as string); const dateWeek = ref(getCurrentWeek()); const date = ref(new Date()); -const typeReport = ref(""); -const optionReport = ref([]); -const optionReportMain = ref( +const typeReport = ref(null); +const optionReport = ref([ + { + id: 3, + name: "รายงานการเข้างาน", + }, + { + id: 4, + name: "รายงานการเข้างานสาย", + }, + { id: 1, name: "รายงานการลางานตามประเภทการลา" }, + { + id: 2, + name: "รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ", + }, +]); +const optionReportMain = ref( route.name?.toString() === "reportLeave" - ? [ - { - id: "3", - name: "รายงานการเข้างาน", - }, - { - id: "4", - name: "รายงานการเข้างานสาย", - }, - { id: "1", name: "รายงานการลางานตามประเภทการลา" }, - { - id: "2", - name: "รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ", - }, - ] + ? optionReport.value : route.name?.toString() === "leaveReport" - ? [ - { id: "1", name: "รายงานการลางานตามประเภทการลา" }, - { - id: "2", - name: "รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ", - }, - ] - : [ - { - id: "3", - name: "รายงานการเข้างาน", - }, - { - id: "4", - name: "รายงานการเข้างานสาย", - }, - ] + ? optionReport.value.filter((item) => item.id === 1 || item.id === 2) + : optionReport.value.filter((item) => item.id === 3 || item.id === 4) ); const employeeClass = ref("officer"); @@ -157,7 +144,7 @@ function onSelectedNode(data: any) { */ async function updateLeaveday() { const list = - typeReport.value == "3" || typeReport.value == "4" + typeReport.value == 3 || typeReport.value == 4 ? leaveType.value : yearType.value; switch (list) { @@ -250,11 +237,11 @@ async function fetchLeaveday( }; const pathAPI = - typeReport.value === "1" + typeReport.value === 1 ? config.API.leaveReportLeaveday(type) - : typeReport.value === "2" + : typeReport.value === 2 ? config.API.leaveReportLeave2(type) - : typeReport.value === "3" + : typeReport.value === 3 ? config.API.leaveReportTimeRecords(type) : config.API.leaveReportTimeLate(type); @@ -348,13 +335,13 @@ function clearData() { nodeId.value = ""; nodeLevel.value = 0; org.value = ""; - typeReport.value = ""; + typeReport.value = null; yearType.value = "FULL"; leaveType.value = "DAY"; pdfSrc.value = undefined; detailReport.value = undefined; - year.value = new Date().getFullYear(); + year.value = calculateFiscalYear(new Date()); dateMonth.value = { month: new Date().getMonth(), year: new Date().getFullYear(), @@ -369,7 +356,7 @@ function onSearch() { updateLeaveday(); fetchLeaveday( employeeClass.value, - typeReport.value == "3" || typeReport.value == "4" + typeReport.value == 3 || typeReport.value == 4 ? leaveType.value : yearType.value, dateStart.value, @@ -388,7 +375,7 @@ function getCurrentWeek() { } function updateValue(val: string) { - if (typeReport.value == "3" || typeReport.value == "4") { + if (typeReport.value == 3 || typeReport.value == 4) { leaveType.value = val; } else { yearType.value = val; @@ -408,7 +395,7 @@ const isLoad = ref(false); * @param isName ชื่อไฟล์ * @param fileType pdf/xlsx */ -function getReport(isName: string) { +function getReport() { showLoader(); const body = { type: @@ -448,7 +435,7 @@ function getReport(isName: string) { // สร้างลิงก์เพื่อดาวน์โหลดไฟล์ const link = document.createElement("a"); link.href = url; - link.download = `${isName}.xlsx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด + link.download = `${reportName()}.xlsx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด document.body.appendChild(link); link.click(); @@ -463,6 +450,19 @@ function getReport(isName: string) { hideLoader(); }); } + +const reportName = () => { + const employeeClassName = + employeeClass.value === "officer" + ? " (ข้าราชการ กทม. สามัญ)" + : " (ลูกจ้างประจำ กทม.)"; + + const reportNameVal = + optionReportMain.value.find((item) => item.id === typeReport.value)?.name || + ""; + return reportNameVal + employeeClassName; +}; + onMounted(() => { fetchDataTree(); }); @@ -508,7 +508,7 @@ onMounted(() => { round color="primary" icon="download" - v-if="checkPermission($route)?.attrIsGet && typeReport !== '3'" + v-if="checkPermission($route)?.attrIsGet && typeReport !== 3" > @@ -516,23 +516,7 @@ onMounted(() => { clickable v-close-popup @click=" - genReportXLSX( - detailReport, - `${ - typeReport === '1' - ? `รายงานการลางานตามประเภทการลา (${ - employeeClass === 'officer' - ? 'ข้าราชการ กทม. สามัญ' - : 'ลูกจ้างประจำ กทม.' - })` - : `รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ (${ - employeeClass === 'officer' - ? 'ข้าราชการ กทม. สามัญ' - : 'ลูกจ้างประจำ กทม.' - })` - }`, - 'pdf' - ) + genReportXLSX(detailReport, `${reportName()}`, 'pdf') " > { { round color="primary" icon="download" - v-if="checkPermission($route)?.attrIsGet && typeReport == '3'" - @click=" - getReport( - `${`รายงานการลางาน จำแนกตามเพศ ประเภทการลา หน่วยงาน/ส่วนราชการ (${ - employeeClass === 'officer' - ? 'ข้าราชการ กทม. สามัญ' - : 'ลูกจ้างประจำ กทม.' - })`}` - ) - " + v-if="checkPermission($route)?.attrIsGet && typeReport == 3" + @click="getReport()" > @@ -743,12 +702,12 @@ onMounted(() => { class="bg-white" dense :model-value=" - typeReport == '3' || typeReport == '4' + typeReport == 3 || typeReport == 4 ? leaveType : yearType " :options=" - typeReport == '3' || typeReport == '4' + typeReport == 3 || typeReport == 4 ? leaveTypeOptionOption : yearTypeOptionOption " @@ -764,8 +723,8 @@ onMounted(() => { class="col-12" v-if=" yearType !== 'MONTH' && - typeReport !== '3' && - typeReport !== '4' + typeReport !== 3 && + typeReport !== 4 " > { class="col-12" v-if=" yearType !== 'MONTH' && - typeReport !== '3' && - typeReport !== '4' + typeReport !== 3 && + typeReport !== 4 " > { class="col-12" v-if=" yearType !== 'MONTH' && - typeReport !== '3' && - typeReport !== '4' + typeReport !== 3 && + typeReport !== 4 " > { - + { - + { { { type="submit" :disable=" typeReport && - (typeReport == '2' || - typeReport == '3' || - typeReport == '4') && + (typeReport == 2 || typeReport == 3 || typeReport == 4) && org " /> @@ -1027,7 +968,7 @@ onMounted(() => { ({ oc: "", file: null, disciplineDisciplinary_DocResults: [], - year: new Date().getFullYear(), + year: calculateFiscalYear(new Date()), }); /** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */ @@ -826,10 +827,7 @@ watch( @update:modal="updatemodalPersonal" /> - +