From eedab43e4ab1bc707bde8be8b383bc07dd903f94 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 17 Jan 2025 17:12:11 +0700 Subject: [PATCH 1/5] report insignia --- src/api/07_insignia/api.insignia.ts | 2 + .../components/DialogFormAgency.vue | 17 ++++ .../02_organization/interface/index/Main.ts | 1 + .../07_insignia/views/06_ReportMain.vue | 91 ++++++++++++++----- 4 files changed, 87 insertions(+), 24 deletions(-) diff --git a/src/api/07_insignia/api.insignia.ts b/src/api/07_insignia/api.insignia.ts index 9f75833b7..7569f1683 100644 --- a/src/api/07_insignia/api.insignia.ts +++ b/src/api/07_insignia/api.insignia.ts @@ -105,4 +105,6 @@ export default { // สกจ. ตีกลับให้หัวหน้าเขต rejectRequest: (id: string, ocId: string) => `${insignia}/request/head/reject/${id}/${ocId}`, + + reportInsigniaNew: `${insignia}/report`, }; diff --git a/src/modules/02_organization/components/DialogFormAgency.vue b/src/modules/02_organization/components/DialogFormAgency.vue index 500e38279..59972dc89 100644 --- a/src/modules/02_organization/components/DialogFormAgency.vue +++ b/src/modules/02_organization/components/DialogFormAgency.vue @@ -82,6 +82,7 @@ const formData = reactive({ responsibility: "", isOfficer: false, isDeputy: false, + orgMisId: "", }); /** @@ -120,6 +121,8 @@ function onSubmit() { ["org" + type + "Fax"]: formData.orgFax, ["org" + type + "Rank"]: formData.orgLevel, ["org" + type + "RankSub"]: formData.orgLevelSub, + misId: formData.orgMisId, + [nameId]: rootId, responsibility: formData.responsibility != null ? formData.responsibility : "", @@ -205,6 +208,7 @@ function closeClear() { formData.orgLevel = ""; formData.responsibility = ""; formData.isOfficer = false; + formData.orgMisId = ""; props.close?.(); } @@ -402,6 +406,7 @@ watch( formData.responsibility = props.dataNode.responsibility; formData.isOfficer = props.dataNode.isOfficer ?? false; formData.isDeputy = props.dataNode.isDeputy ?? false; + formData.orgMisId = props.dataNode.isDeputy; orgLevelOption.value = props.dataNode.orgTreeRank === "DEPARTMENT" ? orgLevelOptionMain.value @@ -596,6 +601,18 @@ watch( :class="classInput(false)" /> +
+ +
([ const typeReport = ref(""); const optionReport = ref([ { - id: "45", + id: "report1", name: "บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชอิสริยาภรณ์", }, - { id: "44", name: " บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี" }, - { id: "43", name: " บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" }, + { + id: "report2", + name: " บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี", + }, + { id: "report3", name: " บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ 5 ปี" }, ]); const roundId = ref(""); @@ -54,21 +60,11 @@ const pdfSrc = ref(); const isLoadPDF = ref(false); -// /** -// * ฟังก์ชัน Redirect ไปหน้ารายงานที่เลือก -// * @param type ประเภทรายงาน -// */ -// function nextPage(type: string) { -// router.push(`/insignia/report/${type}`); -// } - async function fetchDataTree() { node.value = await fetchStructureTree(route.meta.Key as string, true); } -/** - * ฟังก์ชันคึงข้อมูลรอบการเสนอขอ - */ +/** ฟังก์ชันคึงข้อมูลรอบการเสนอขอ*/ async function fecthlistRound() { showLoader(); await http @@ -106,12 +102,19 @@ function filterSelector(val: string, update: Function, name: string) { }); } +/** + * function เลือกหน่วยงาน + * @param id id หน่วยงาน + * @param level ระดับหน่วยงาน + */ function onSelectedNode(id: string, level: number) { nodeId.value = id; nodeLevel.value = level; onUpdateFilter(); } +const detailReport = ref(); + /** * ฟังก์ชันโหลดไฟล์ * @param type ประเภทไฟล์ @@ -123,16 +126,19 @@ async function onUpdateFilter() { pdfSrc.value = undefined; await http - .get(config.API.reportInsignia(typeReport.value, "pdf", roundId.value), { - responseType: "blob", - }) + .post( + config.API.reportInsigniaNew + + `/${typeReport.value}/${employeeClass.value}`, + { + roundId: roundId.value, + node: nodeLevel.value, + nodeId: nodeId.value, + } + ) .then(async (res) => { - const url = URL.createObjectURL(new Blob([res.data])); - const pdfData = await usePDF(url); - await setTimeout(() => { - pdfSrc.value = pdfData.pdf.value; - numOfPages.value = pdfData.pages.value; - }, 1000); + const data = await res.data.result; + detailReport.value = data; + await fetchDocumentTemplate(data); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -143,6 +149,34 @@ async function onUpdateFilter() { } } +/** + * function เรียกไฟล์ PDF + * @param data ข้อมูลบัญชีวันลา + */ +async function fetchDocumentTemplate(data: any) { + await axios + .post(`${config.API.reportTemplate}/docx`, data, { + headers: { + accept: "application/pdf", + "content-Type": "application/json", + }, + responseType: "blob", + }) + .then(async (res) => { + const blob = new Blob([res.data]); + const objectUrl = URL.createObjectURL(blob); + const pdfData = usePDF(`${objectUrl}`); + + setTimeout(() => { + pdfSrc.value = pdfData.pdf.value; + numOfPages.value = pdfData.pages.value; + }, 1500); + }) + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); + }); +} + /** ไปหน้าต่อไปของรายงาน */ function nextPage() { if (page.value < numOfPages.value) { @@ -157,7 +191,16 @@ function backPage() { } } -function downloadReport(type: string) {} +function downloadReport(type: string) { + const fileName = + optionReport.value.find((e) => e.id === typeReport.value)?.name || ""; + + if (type === "xlsx") { + genReportXLSX(detailReport.value, fileName, type); + } else { + genReport(detailReport.value, fileName, type); + } +} onMounted(async () => { await Promise.all([fetchDataTree(), fecthlistRound()]); From 5729625d802aa6c7e13d4f3b8f7a98ced9cd66db Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 17 Jan 2025 17:27:58 +0700 Subject: [PATCH 2/5] misId --- .../02_organization/components/DialogFormAgency.vue | 10 +++++----- src/modules/02_organization/interface/index/Main.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/02_organization/components/DialogFormAgency.vue b/src/modules/02_organization/components/DialogFormAgency.vue index 59972dc89..31963fbd6 100644 --- a/src/modules/02_organization/components/DialogFormAgency.vue +++ b/src/modules/02_organization/components/DialogFormAgency.vue @@ -82,7 +82,7 @@ const formData = reactive({ responsibility: "", isOfficer: false, isDeputy: false, - orgMisId: "", + misId: "", }); /** @@ -121,7 +121,7 @@ function onSubmit() { ["org" + type + "Fax"]: formData.orgFax, ["org" + type + "Rank"]: formData.orgLevel, ["org" + type + "RankSub"]: formData.orgLevelSub, - misId: formData.orgMisId, + misId: formData.misId, [nameId]: rootId, responsibility: @@ -208,7 +208,7 @@ function closeClear() { formData.orgLevel = ""; formData.responsibility = ""; formData.isOfficer = false; - formData.orgMisId = ""; + formData.misId = ""; props.close?.(); } @@ -406,7 +406,7 @@ watch( formData.responsibility = props.dataNode.responsibility; formData.isOfficer = props.dataNode.isOfficer ?? false; formData.isDeputy = props.dataNode.isDeputy ?? false; - formData.orgMisId = props.dataNode.isDeputy; + formData.misId = props.dataNode.misId; orgLevelOption.value = props.dataNode.orgTreeRank === "DEPARTMENT" ? orgLevelOptionMain.value @@ -603,7 +603,7 @@ watch(
Date: Mon, 20 Jan 2025 10:27:29 +0700 Subject: [PATCH 3/5] fix tooltip --- src/components/Dialogs/DialogOrgSelect.vue | 4 +++- src/components/Dialogs/DialogOrgSelectEmployee.vue | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Dialogs/DialogOrgSelect.vue b/src/components/Dialogs/DialogOrgSelect.vue index a491e8249..282bc25b4 100644 --- a/src/components/Dialogs/DialogOrgSelect.vue +++ b/src/components/Dialogs/DialogOrgSelect.vue @@ -726,7 +726,9 @@ onMounted(async () => { name="mdi-star" color="primary" v-if="props.row.isDirector" - /> + > + ผู้อำนวยการ/หัวหน้า +
diff --git a/src/components/Dialogs/DialogOrgSelectEmployee.vue b/src/components/Dialogs/DialogOrgSelectEmployee.vue index 50bdd1afa..88129e23c 100644 --- a/src/components/Dialogs/DialogOrgSelectEmployee.vue +++ b/src/components/Dialogs/DialogOrgSelectEmployee.vue @@ -701,7 +701,9 @@ onMounted(() => { name="mdi-star" color="primary" v-if="props.row.isDirector" - /> + > + ผู้อำนวยการ/หัวหน้า +
From 53d05ad09a93b4889b2f2a92ac26f476314451af Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 20 Jan 2025 11:32:28 +0700 Subject: [PATCH 4/5] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=20filter=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B6?= =?UTF-8?q?=E0=B8=81=E0=B9=80=E0=B8=A7=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B9=81?= =?UTF-8?q?=E0=B8=88=E0=B9=89=E0=B8=87=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=96?= =?UTF-8?q?=E0=B8=B6=E0=B8=87=E0=B9=81=E0=B8=81=E0=B9=88=E0=B8=81=E0=B8=A3?= =?UTF-8?q?=E0=B8=A3=E0=B8=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interface/response/Deceased.ts | 28 +++++++++++++ .../06_retirement/views/05_deceased.vue | 42 +++++++++++++++++-- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/modules/06_retirement/interface/response/Deceased.ts b/src/modules/06_retirement/interface/response/Deceased.ts index 191dd67e9..7a98298e1 100644 --- a/src/modules/06_retirement/interface/response/Deceased.ts +++ b/src/modules/06_retirement/interface/response/Deceased.ts @@ -108,6 +108,33 @@ interface TreeMain { totalRootPositionNextUse: number; totalRootPositionNextVacant: number; } + +interface ResponseDececased { + child1: string; + child1ShortName: string; + child2: string; + child2ShortName: string; + child3: string; + child3ShortName: string; + child4: string; + child4ShortName: string; + citizenId: string; + createdAt: string; + firstName: string; + id: string; + isActive: boolean; + lastName: string; + posLevelName: string; + posMasterNo: number; + posTypeName: string; + position: string; + prefix: string; + profileId: string; + profileType: string; + root: string; + rootShortName: string; +} + export type { requestSendNoti, DataCopyOrder, @@ -116,4 +143,5 @@ export type { FormActive, OrgTree, TreeMain, + ResponseDececased, }; diff --git a/src/modules/06_retirement/views/05_deceased.vue b/src/modules/06_retirement/views/05_deceased.vue index 2b47a9677..c7af1eae3 100644 --- a/src/modules/06_retirement/views/05_deceased.vue +++ b/src/modules/06_retirement/views/05_deceased.vue @@ -9,6 +9,9 @@ import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { checkPermission } from "@/utils/permissions"; +import type { DataOption } from "@/modules/06_retirement/interface/index/Main"; +import type { ResponseDececased } from "@/modules/06_retirement/interface/response/Deceased"; + /** Use */ const $q = useQuasar(); const router = useRouter(); @@ -23,8 +26,8 @@ const { } = mixin; /** คอลัมน์ */ -const rows = ref([]); -const rowsData = ref([]); +const rows = ref([]); +const rowsData = ref([]); const pagination = ref({ sortBy: "createdAt", descending: true, @@ -126,8 +129,6 @@ const columns = ref([ format: (val) => date2Thai(val), }, ]); - -/** คอลัมน์ที่แสดง */ const visibleColumns = ref([ "no", "fullname", @@ -140,6 +141,13 @@ const visibleColumns = ref([ "profileType", ]); +const employeeClass = ref(""); +const employeeClassOp = ref([ + { id: "", name: "ทั้งหมด" }, + { id: "OFFICER", name: "ขรก.กทม. สามัญ" }, + { id: "EMPLOYEE", name: "ลูกจ้างประจำ กทม." }, +]); + /**เรียกข้อมูลจาก APi */ async function fectListDecased() { showLoader(); @@ -147,6 +155,8 @@ async function fectListDecased() { .get(config.API.listDeceased()) .then((res) => { const data = res.data.result; + console.log(data); + rows.value = data; rowsData.value = data; }) @@ -172,6 +182,12 @@ function onSearch() { rowsData.value, columns.value ? columns.value : [] ); + + if (employeeClass.value) { + rows.value = rows.value.filter( + (e: ResponseDececased) => e.profileType === employeeClass.value + ); + } } /**Hook */ @@ -188,6 +204,24 @@ onMounted(() => {
+
+ + +
Date: Mon, 20 Jan 2025 11:46:58 +0700 Subject: [PATCH 5/5] =?UTF-8?q?fix=20=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87?= =?UTF-8?q?=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=AD=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=A3=E0=B8=B2=E0=B8=81=E0=B8=B3=E0=B8=A5=E0=B8=B1?= =?UTF-8?q?=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DialogFormAgency.vue | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/modules/02_organization/components/DialogFormAgency.vue b/src/modules/02_organization/components/DialogFormAgency.vue index 31963fbd6..53f3f93f5 100644 --- a/src/modules/02_organization/components/DialogFormAgency.vue +++ b/src/modules/02_organization/components/DialogFormAgency.vue @@ -121,28 +121,25 @@ function onSubmit() { ["org" + type + "Fax"]: formData.orgFax, ["org" + type + "Rank"]: formData.orgLevel, ["org" + type + "RankSub"]: formData.orgLevelSub, - misId: formData.misId, + misId: formData.misId ? formData.misId : "", + isDeputy: + type === "Root" + ? formData.isDeputy + ? formData.isDeputy + : false + : undefined, + isOfficer: + type === "Child1" + ? formData.isOfficer + ? formData.isOfficer + : false + : undefined, [nameId]: rootId, responsibility: formData.responsibility != null ? formData.responsibility : "", }; - if (type === "Root") { - body = { - ...body, - isDeputy: - formData.isDeputy !== undefined ? String(formData.isDeputy) : "", - }; - } - if (type === "Child1") { - body = { - ...body, - isOfficer: - formData.isOfficer !== undefined ? String(formData.isOfficer) : "", - }; - } - //เพิ่มข้อมูล if (actionType.value === "ADD") { await http @@ -208,6 +205,7 @@ function closeClear() { formData.orgLevel = ""; formData.responsibility = ""; formData.isOfficer = false; + formData.isDeputy = false; formData.misId = ""; props.close?.(); }