From 48f10f992de3d725457b0ea601471726e0f2819e Mon Sep 17 00:00:00 2001 From: Kittapath Date: Fri, 10 Nov 2023 17:00:46 +0700 Subject: [PATCH 1/2] no message --- src/modules/11_discipline/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/11_discipline/router.ts b/src/modules/11_discipline/router.ts index 7bb26dbda..f4e4a1721 100644 --- a/src/modules/11_discipline/router.ts +++ b/src/modules/11_discipline/router.ts @@ -47,7 +47,7 @@ const reportType = () => const InvestigateDisciplinaryAdd = () => import( - "@/modules/11_discipline/components/3_investigateDisciplinary/AddPage.vue" + "@/modules/11_discipline/components/3_InvestigateDisciplinary/AddPage.vue" ); const orderPage = () => import("@/modules/11_discipline/components/4_Order/OrderPage.vue"); From 206acc18c334ed8df81a4159f3d6573f61264776 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 10 Nov 2023 22:14:28 +0700 Subject: [PATCH 2/2] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=80?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=8A=E0=B8=AF>>=E0=B8=88=E0=B8=B1=E0=B8=94?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=84=E0=B8=B3=E0=B8=82=E0=B8=AD?= =?UTF-8?q?=20(=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B9=80=E0=B8=A5?= =?UTF-8?q?=E0=B8=82=20000)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/1_Proposals/addProposals.vue | 85 ++++++---- .../components/1_Proposals/listProposals.vue | 146 +++++++----------- .../components/2_Manage/listManage.vue | 2 +- .../07_insignia/interface/request/Main.ts | 8 +- src/modules/07_insignia/store.ts | 37 +++-- 5 files changed, 142 insertions(+), 136 deletions(-) diff --git a/src/modules/07_insignia/components/1_Proposals/addProposals.vue b/src/modules/07_insignia/components/1_Proposals/addProposals.vue index 2d7becceb..ff2887104 100644 --- a/src/modules/07_insignia/components/1_Proposals/addProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/addProposals.vue @@ -2,10 +2,12 @@ import { ref, onMounted } from "vue"; import { useQuasar, QForm } from "quasar"; import { useRouter, useRoute } from "vue-router"; -import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; +/** import Store*/ +import { useCounterMixin } from "@/stores/mixin"; +/** useStore*/ const mixin = useCounterMixin(); const { date2Thai, @@ -17,9 +19,12 @@ const { success, dialogMessageNotify, } = mixin; + +/** use */ const router = useRouter(); const route = useRoute(); const $q = useQuasar(); + const id = ref(route.params.id as string); const myForm = ref(null); //form data input const edit = ref(false); @@ -35,14 +40,8 @@ const options = ref([ { label: "รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ 2", value: 2 }, ]); -onMounted(async () => { - if (route.params.id) { - // มี params id ให้ เรียกข้อมูลของรอบการเสนอขอ - await fetchData(); - } -}); -// เรียกข้อมูลของรอบการเสนอขอ -const fetchData = async () => { +/** Function เรียกข้อมูลของรอบการเสนอขอ */ +async function fetchData() { edit.value = true; showLoader(); await http @@ -59,7 +58,7 @@ const fetchData = async () => { datelast.value = data.period_amount; dateStart.value = new Date(data.period_start); dateEnd.value = new Date(data.period_end); - files.value = data.period_doc; + // files.value = data.period_doc; }) .catch((e) => { messageError($q, e); @@ -67,22 +66,29 @@ const fetchData = async () => { .finally(() => { hideLoader(); }); -}; +} -const fileUploadDoc = async (files: any) => { +/** + * Function อัพโหลดไฟล์ + * @param files ไฟล์ + */ +function fileUploadDoc(files: any) { files.forEach((file: any) => { fileDocDataUpload.value.push(file); }); -}; +} -const updateYear = async (e: number) => { - yearly.value = e; +/** + * Function อัพเดทปี + * @param year รับค่าปี คศ + */ +async function updateYear(year: number) { + yearly.value = year; await updateDateRange(); -}; -// แก้ไขข้อมูล +} -// คลิกบันทึก -const checkSave = () => { +/** Function ตรวจสอบค่าว่างของ Input */ +function checkSave() { if (myForm.value !== null) { myForm.value.validate().then(async (success) => { if (success) { @@ -92,18 +98,20 @@ const checkSave = () => { } }); } -}; -// บันทึกข้อมูล -const SaveData = async () => { +} + +/** Function บันทึกข้อมูล */ +async function SaveData() { if (edit.value) { await editData(id.value); } else { await addData(); clickBack(); } -}; -// อัพเดทวันที่เริ่มต้น และ สิ้นสุด -const updateDateRange = () => { +} + +/** Function อัพเดทวันที่เริ่มต้น และ สิ้นสุด */ +function updateDateRange() { if (roundInsig.value.value == 1) { dateStart.value = new Date(yearly.value, 9, 1); dateEnd.value = new Date(yearly.value + 1, 3, 29); @@ -111,9 +119,10 @@ const updateDateRange = () => { dateStart.value = new Date(yearly.value + 1, 3, 29); dateEnd.value = new Date(yearly.value + 1, 4, 29); } -}; -// เพิ่มข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ -const addData = async () => { +} + +/** Function เพิ่มข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ */ +async function addData() { const formData = new FormData(); const name = `รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ ${ roundInsig.value.value @@ -141,9 +150,10 @@ const addData = async () => { .finally(async () => { hideLoader(); }); -}; -// แก้ไขข้อมูล -const editData = async (id: string) => { +} + +/** Function แก้ไขข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ */ +async function editData(id: string) { const formData = new FormData(); const name = `รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ ${ roundInsig.value.value @@ -172,11 +182,18 @@ const editData = async (id: string) => { hideLoader(); clickBack(); }); -}; +} -const clickBack = () => { +/** Function ย้อนกลับหน้า รอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์ */ +function clickBack() { router.push({ name: "insigniaProposals" }); -}; +} + +/** Hook */ +onMounted(async () => { + // มี params id ให้ เรียกข้อมูลของรอบการเสนอขอ + (await route.params?.id) && fetchData(); +});