From f732b87763591bc8bf646438b44be3e6028a14a1 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 29 Jul 2025 10:48:24 +0700 Subject: [PATCH 1/4] =?UTF-8?q?=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=81?= =?UTF-8?q?=E0=B8=AA=E0=B8=94=E0=B8=87=20cursor=20pointer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/05_command/views/lists.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/05_command/views/lists.vue b/src/modules/05_command/views/lists.vue index 4ff20d52..e18444a0 100644 --- a/src/modules/05_command/views/lists.vue +++ b/src/modules/05_command/views/lists.vue @@ -303,13 +303,12 @@ onMounted(async () => { - { Date: Tue, 29 Jul 2025 11:12:06 +0700 Subject: [PATCH 2/4] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B9=81?= =?UTF-8?q?=E0=B8=AA=E0=B8=94=E0=B8=87=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/05_command/components/ViewPdf.vue | 156 +++++++++--------- 1 file changed, 77 insertions(+), 79 deletions(-) diff --git a/src/modules/05_command/components/ViewPdf.vue b/src/modules/05_command/components/ViewPdf.vue index 16cc27c8..85bf401d 100644 --- a/src/modules/05_command/components/ViewPdf.vue +++ b/src/modules/05_command/components/ViewPdf.vue @@ -17,12 +17,9 @@ const { dialogConfirm, success, showLoader, hideLoader, messageError } = mixin; const commandId = defineModel("commandId", { required: true }); // id คำสั่ง const type = defineModel("type", { required: true }); // แยก tab // รายละเอียดคำสั่ง -const dataTemplateDetail = defineModel( - "dataTemplateDetail", - { - required: true, - } -); +const dataTemplate = defineModel("dataTemplateDetail", { + required: true, +}); const documentFile = ref(null); // file อัปโหลด const isLoadPDF = ref(false); // Loading display pdf @@ -57,69 +54,71 @@ const { fetchDataTemplate } = defineProps({ * @param dataTemple รายละเอียดคำสั่ง */ async function fetchDocumentTemplate(dataTemple: DataTemplateDetail) { - showLoader(); - isLoadPDF.value = false; - pdfSrc.value = undefined; - page.value = 1; - const reportName = await `${dataTemplateDetail.value.code}_${type.value}`; - const body = { - template: reportName, - reportName: `${typeFile.value}-report`, - data: { - issue: "............", // - title: "......", // - commandNo: "......", - commandYear: "......", - commandTitle: dataTemple.name, - detailHeader: dataTemple.detailHeader, - detailBody: dataTemple.detailBody, - detailFooter: dataTemple.detailFooter, - commandDate: "..................", - commandAffectDate: "..................", - commandExcecuteDate: "..................", - name: "....................................", - name1: dataTemple.name1, - name2: dataTemple.name2, - name3: dataTemple.name3, - name4: dataTemple.name4, - position: "ผู้อำนวยการสำนัก/เขต", - authorizedUserFullName: "............", - authorizedPosition: "...................", - ...(dataTemple.persons ? { persons: dataTemple.persons } : {}), - }, - }; + if (dataTemple) { + showLoader(); + isLoadPDF.value = false; + pdfSrc.value = undefined; + page.value = 1; + const reportName = `${dataTemple.code}_${type.value}`; + const body = { + template: reportName, + reportName: `${typeFile.value}-report`, + data: { + issue: "............", // + title: "......", // + commandNo: "......", + commandYear: "......", + commandTitle: dataTemple.name, + detailHeader: dataTemple.detailHeader, + detailBody: dataTemple.detailBody, + detailFooter: dataTemple.detailFooter, + commandDate: "..................", + commandAffectDate: "..................", + commandExcecuteDate: "..................", + name: "....................................", + name1: dataTemple.name1, + name2: dataTemple.name2, + name3: dataTemple.name3, + name4: dataTemple.name4, + position: "ผู้อำนวยการสำนัก/เขต", + authorizedUserFullName: "............", + authorizedPosition: "...................", + ...(dataTemple.persons ? { persons: dataTemple.persons } : {}), + }, + }; - await axios - .post( - config.API.reportTemplate + `/${typeFile.value}?folder=command`, - body, - { - 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 = await usePDF(`${objectUrl}`); + await axios + .post( + config.API.reportTemplate + `/${typeFile.value}?folder=command`, + body, + { + 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 = await usePDF(`${objectUrl}`); - // แสดง PDF หลังจากโหลดเสร็จ - setTimeout(() => { - pdfSrc.value = pdfData.pdf.value; - numOfPages.value = pdfData.pages.value; - isLoadPDF.value = true; + // แสดง PDF หลังจากโหลดเสร็จ + setTimeout(() => { + pdfSrc.value = pdfData.pdf.value; + numOfPages.value = pdfData.pages.value; + isLoadPDF.value = true; + hideLoader(); + }, 1500); + }) + .catch((e) => { + // ไม่พบข้อมูล Template + messageError($q, "", "ไม่พบข้อมูล Template"); + isLoadPDF.value = false; hideLoader(); - }, 1500); - }) - .catch((e) => { - // ไม่พบข้อมูล Template - messageError($q, "", "ไม่พบข้อมูล Template"); - isLoadPDF.value = false; - hideLoader(); - }); + }); + } } /** @@ -130,7 +129,7 @@ async function uploadTemplate() { $q, async () => { showLoader(); - const reportName = await `${dataTemplateDetail.value.code}_${type.value}`; + const reportName = await `${dataTemplate.value.code}_${type.value}`; await axios .post( config.API.reportTemplate + @@ -150,7 +149,7 @@ async function uploadTemplate() { hideLoader(); // โหลดไฟล์ Template ที่แสดงในหน้า UI ใหม่ - fetchDocumentTemplate(dataTemplateDetail.value); + fetchDocumentTemplate(dataTemplate.value); fetchDataTemplate(commandId.value); }) .catch(async (e) => { @@ -170,8 +169,8 @@ async function uploadTemplate() { */ async function downloadTemplate() { const check = await (type.value == "cover" - ? dataTemplateDetail.value.fileCover - : dataTemplateDetail.value.fileAttachment); + ? dataTemplate.value.fileCover + : dataTemplate.value.fileAttachment); await axios .post( config.API.reportTemplate + `/${typeFile.value}/download?folder=command`, @@ -189,7 +188,7 @@ async function downloadTemplate() { .then(async (res) => { var a = document.createElement("a"); a.href = URL.createObjectURL(res.data); - a.download = `${dataTemplateDetail.value.code}_${type.value}.${typeFile.value}`; + a.download = `${dataTemplate.value.code}_${type.value}.${typeFile.value}`; a.click(); hideLoader(); }) @@ -217,17 +216,16 @@ async function updateReportName(name: string) { } // working on click command list -watch(dataTemplateDetail, () => { - fetchDocumentTemplate(dataTemplateDetail.value); -}); +watch( + () => dataTemplate.value, + async (newValue, oldValue) => { + await fetchDocumentTemplate(newValue); + } +); // working on change tab onMounted(() => { - fetchDocumentTemplate(dataTemplateDetail.value); -}); - -defineExpose({ - fetchDocumentTemplate, + fetchDocumentTemplate(dataTemplate.value); }); From ac167bf16a96351d30312acb4acc929106f6650a Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 29 Jul 2025 11:35:54 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=E0=B8=9B=E0=B8=B5=E0=B9=80=E0=B8=A3?= =?UTF-8?q?=E0=B8=B4=E0=B9=88=E0=B8=A1=E0=B8=95=E0=B9=89=E0=B8=99=E0=B8=95?= =?UTF-8?q?=E0=B8=B2=E0=B8=A1=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B9=80=E0=B8=A5?= =?UTF-8?q?=E0=B8=B7=E0=B8=AD=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../01_metadata/components/calendar/calendarMain.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/01_metadata/components/calendar/calendarMain.vue b/src/modules/01_metadata/components/calendar/calendarMain.vue index b144fc5c..177dfc7b 100644 --- a/src/modules/01_metadata/components/calendar/calendarMain.vue +++ b/src/modules/01_metadata/components/calendar/calendarMain.vue @@ -99,7 +99,13 @@ const updateYear = async (e: number) => { * ฟังก์ชันปุ่มเพิ่มวันหยุดแบบเลือกวันได้ */ const addCalendar = () => { - dateAdd.value = [new Date(), new Date()]; + const today = new Date(); + const { year } = dateMonth.value; + + dateAdd.value = [ + new Date(year, today.getMonth(), today.getDate()), + new Date(year, today.getMonth(), today.getDate()), + ]; name.value = ""; category.value = "all"; isSpecial.value = true; From 0a385408f2f5b515ceae8b8e1a8c7f8958c59e3a Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 29 Jul 2025 11:39:42 +0700 Subject: [PATCH 4/4] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=20Skeleton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RoleOrganization/DialogPersonal.vue | 125 ++++++++++-------- 1 file changed, 69 insertions(+), 56 deletions(-) diff --git a/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue b/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue index 7077acc7..28740568 100644 --- a/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue +++ b/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue @@ -15,12 +15,10 @@ import type { Avatar } from "@/components/information/interface/response/avatar" import { useCounterMixin } from "@/stores/mixin"; /** use*/ -const route = useRoute(); + const mixin = useCounterMixin(); -const router = useRouter(); const $q = useQuasar(); -const retireDate = ref(); -const { showLoader, hideLoader, messageError, date2Thai } = mixin; +const { messageError, date2Thai } = mixin; const isEmployee = defineModel("isEmployee", { type: String }); const empType = ref("officer"); @@ -42,6 +40,9 @@ const emit = defineEmits(["update:modal"]); /** ตัวแปร*/ const modal = ref(false); +const isloadInformation = ref(true); +const isloadGoverment = ref(true); +const retireDate = ref(); const avatar = reactive({ avatar: "", fullname: "", @@ -94,7 +95,7 @@ function calculateAge(birthDate: Date | null) { * @param id profileID */ async function fetchInformation(id: string) { - showLoader(); + isloadInformation.value = true; await http .get( config.API.orgProfileAdminById( @@ -111,9 +112,7 @@ async function fetchInformation(id: string) { imformation.birthDate = data.birthDate ? date2Thai(data.birthDate) : "-"; imformation.age = data.birthDate ? calculateAge(data.birthDate) : "-"; imformation.gender = data.gender ?? "-"; - avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`; - avatar.position = data.position ? data.position : "-"; if (data.avatarName) { await fetchProfile(data.id as string, data.avatarName); @@ -125,7 +124,7 @@ async function fetchInformation(id: string) { messageError($q, err); }) .finally(() => { - hideLoader(); + isloadInformation.value = false; }); } @@ -134,7 +133,7 @@ async function fetchInformation(id: string) { * @param id profileID */ async function fetchProfileGov(id: string) { - showLoader(); + isloadGoverment.value = true; await http .get( config.API.profileNewGovernmentCard( @@ -158,19 +157,21 @@ async function fetchProfileGov(id: string) { goverment.positionExecutiveSide = data.positionExecutiveField !== "" ? data.positionExecutiveField : "-"; }) - .catch((err) => { messageError($q, err); }) .finally(() => { - hideLoader(); + isloadGoverment.value = false; }); } -// function redirecToRegistry() { -// router.push(`/registry-${empType.value}/${props.id}`); -// modal.value = false; -// } +async function fetchProfile(id: string, avatarName: string) { + await http + .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName)) + .then(async (res) => { + avatar.avatar = await res.data.downloadUrl; + }); +} watch( () => props.modal, @@ -178,12 +179,6 @@ watch( modal.value = props.modal ? props.modal : false; if (modal.value) { if (props.id) { - // empType.value = - // route.name === "appoint-employee-detail" || - // isEmployee.value == "EMPLOYEE" - // ? "employee" - // : "officer"; - await Promise.all([ fetchInformation(props.id), fetchProfileGov(props.id), @@ -198,14 +193,6 @@ watch(modal, (newValue) => { emit("update:modal", false); } }); - -async function fetchProfile(id: string, avatarName: string) { - await http - .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName)) - .then(async (res) => { - avatar.avatar = await res.data.downloadUrl; - }); -}