diff --git a/src/modules/07_insignia/interface/index/Main.ts b/src/modules/07_insignia/interface/index/Main.ts index d911dcfaa..26edbd14d 100644 --- a/src/modules/07_insignia/interface/index/Main.ts +++ b/src/modules/07_insignia/interface/index/Main.ts @@ -3,6 +3,12 @@ interface OptionData { name: string; } +interface OptionDataList { + id:string + val: string | number; + name: string; +} + interface OptionDataYear { id: string; name: string; @@ -225,5 +231,6 @@ export type { DataProfileOtherSystem, Pagination, DataManageList, - ResOrg + ResOrg, + OptionDataList }; diff --git a/src/modules/07_insignia/views/06_ReportMain.vue b/src/modules/07_insignia/views/06_ReportMain.vue index cea18c819..af628457b 100644 --- a/src/modules/07_insignia/views/06_ReportMain.vue +++ b/src/modules/07_insignia/views/06_ReportMain.vue @@ -14,7 +14,10 @@ import genReport from "@/plugins/genreport"; import genReportXLSX from "@/plugins/genreportxlsx"; import type { DataStructureTree } from "@/interface/main"; -import type { OptionData } from "@/modules/07_insignia/interface/index/Main"; +import type { + OptionData, + OptionDataList, +} from "@/modules/07_insignia/interface/index/Main"; import LoadView from "@/components/LoadView.vue"; @@ -29,32 +32,38 @@ const employeeClassOption = ref([ { id: "employee", name: "ลูกจ้างประจำ กทม." }, ]); -const typeReport = ref(""); -const optionReport = ref([ +const typeReport = ref(); +const optionReport = ref([ { - id: "report1", + id: "1", + val: "report1", name: "บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชอิสริยาภรณ์", }, { - id: "report2", + id: "2", + val: "report2", name: "บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี", }, - { id: "report3", name: "บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" }, + { id: "3", val: "report3", name: "บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" }, { - id: "report4", + id: "4", + val: "report4", name: "รายชื่อข้าราชการฯ ที่ได้รับ/ไม่ได้รับการจ่ายใบกำกับฯ", }, { - id: "report5", + id: "5", + val: "report5", name: "รายงานสถิติการได้รับเครื่องราชอิสริยาภรณ์ข้าราชการฯ", }, { - id: "report6", + id: "6", + val: "report6", name: "รายงานผลการจ่ายประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์ แยกรายหน่วยงาน", }, { - id: "report7", - name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไมได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)", + id: "7", + val: "report4", + name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไม่ได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)", }, ]); @@ -137,6 +146,23 @@ const detailReport = ref(); * @param download */ async function onUpdateFilter() { + if ( + (employeeClass.value == "employee" && typeReport.value.id == "4") || + (employeeClass.value == "officer" && typeReport.value.id == "7") + ) { + typeReport.value = + employeeClass.value == "officer" + ? { + id: "4", + val: "report4", + name: "รายชื่อข้าราชการฯ ที่ได้รับ/ไม่ได้รับการจ่ายใบกำกับฯ", + } + : { + id: "7", + val: "report4", + name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไม่ได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)", + }; + } if (typeReport.value && roundId.value && nodeId.value) { isLoadPDF.value = true; pdfSrc.value = undefined; @@ -144,7 +170,7 @@ async function onUpdateFilter() { await http .post( config.API.reportInsigniaNew + - `/${typeReport.value}/${employeeClass.value}`, + `/${typeReport.value.val}/${employeeClass.value}`, { roundId: roundId.value, node: nodeLevel.value, @@ -155,10 +181,9 @@ async function onUpdateFilter() { const data = await res.data.result; detailReport.value = data; const type = - typeReport.value === "report4" || - typeReport.value === "report5" || - typeReport.value === "report6" || - typeReport.value === "report7" + typeReport.value.val === "report4" || + typeReport.value.val === "report5" || + typeReport.value.val === "report6" ? "xlsx" : "docx"; await fetchDocumentTemplate(data, type); @@ -216,7 +241,7 @@ function backPage() { function downloadReport(type: string) { const fileName = - optionReport.value.find((e) => e.id === typeReport.value)?.name || ""; + optionReport.value.find((e) => e.id === typeReport.value.id)?.name || ""; if (type === "xlsx") { genReportXLSX(detailReport.value, fileName, type); @@ -282,7 +307,7 @@ onMounted(async () => { clickable v-close-popup @click="downloadReport('xlsx')" - v-if="typeReport !== 'report1'" + v-if="typeReport.val !== 'report1'" > { borderless v-model="typeReport" :label="`${'รายงาน'}`" - emit-value map-options - :options="optionReport" + :options="employeeClass == 'officer' ? optionReport.filter((item:any)=>item.id !== '7'):optionReport.filter((item:any)=>item.id !== '4')" option-value="id" option-label="name" @update:model-value="onUpdateFilter" @@ -377,7 +401,7 @@ onMounted(async () => { @click.stop=" onSelectedNode(prop.node.orgTreeDnaId, prop.node.orgLevel) " - :active="nodeId === prop.node.orgTreeId" + :active="nodeId === prop.node.orgTreeDnaId" clickable active-class="my-list-link text-primary text-weight-medium" class="row col-12 items-center text-dark q-py-xs q-pl-sm rounded-borders my-list" diff --git a/src/modules/21_report/views/03_reportDevelopment.vue b/src/modules/21_report/views/03_reportDevelopment.vue index 5f7eb8988..ceed1a3f9 100644 --- a/src/modules/21_report/views/03_reportDevelopment.vue +++ b/src/modules/21_report/views/03_reportDevelopment.vue @@ -87,7 +87,14 @@ async function getReport() { loadingBtn.value = true; pdfSrc.value = undefined; await http - .get(config.API.developmentReport() + `${typeReport.value}${typeReport.value == 'main' || typeReport.value == 'report3' ? `?rootId=${organization.value}`:``}`) + .get( + config.API.developmentReport() + + `${typeReport.value}${ + typeReport.value == "main" || typeReport.value == "report3" + ? `?rootId=${organization.value}&year=${year.value}` + : `?year=${year.value}` + }` + ) .then(async (res) => { const data = res.data.result; detailReport.value = data;