From 796c7e18cd781e08ced9244715589f325a14d3ac Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 10 Nov 2023 16:04:54 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=88=E0=B8=B1=E0=B8=94=E0=B9=82=E0=B8=84?= =?UTF-8?q?=E0=B9=89=E0=B8=94=20=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84?= =?UTF-8?q?=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87/=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/4_Order/MainPage.vue | 23 ++++---- .../components/4_Order/OrderPage.vue | 9 +-- .../components/4_Order/Step01.vue | 30 ++++++++-- .../components/4_Order/Step02.vue | 24 +++++++- .../components/4_Order/Step03.vue | 9 ++- .../components/4_Order/TableOrder.vue | 11 +++- .../components/5_Report/DetailPage.vue | 39 +++++++++---- .../components/5_Report/MainPage.vue | 56 +++++++++++-------- 8 files changed, 141 insertions(+), 60 deletions(-) diff --git a/src/modules/11_discipline/components/4_Order/MainPage.vue b/src/modules/11_discipline/components/4_Order/MainPage.vue index 59ac80fd3..15dfede0a 100644 --- a/src/modules/11_discipline/components/4_Order/MainPage.vue +++ b/src/modules/11_discipline/components/4_Order/MainPage.vue @@ -3,23 +3,15 @@ import { ref, onMounted } from "vue"; import { useRouter } from "vue-router"; import type { DataList, DataListRes } from "../../interface/response/order"; -// importStroe import { useOrderStore } from "@/modules/11_discipline/store/OrderStore"; -// importComponents import tableOrder from "@/modules/11_discipline/components/4_Order/TableOrder.vue"; const router = useRouter(); const OrderStore = useOrderStore(); const { fetchOrder } = OrderStore; // function จาก stores - -// filter ข้อมูลใน table const filterTable = ref(""); -onMounted(async () => { - await fetchListOrder(); -}); - -// เรียกรายการคำสั่ง จาก API +/** เรียกรายการคำสั่ง จาก API */ async function fetchListOrder() { const listData: DataListRes[] = [ { @@ -50,10 +42,15 @@ async function fetchListOrder() { await fetchOrder(listData); // ส่งข้อมูลไปยัง stores } -// redirect ไปยังการเพิ่มออกคำสั่งลงโทษทางวินัย +/** redirect ไปยังการเพิ่มออกคำสั่งลงโทษทางวินัย */ function redirectToPageadd() { router.push(`/discipline-order/add`); } + +/** โหลดข้อมูลเมื่อเข้าหน้านี้ */ +onMounted(async () => { + await fetchListOrder(); +}); + +
diff --git a/src/modules/11_discipline/components/4_Order/OrderPage.vue b/src/modules/11_discipline/components/4_Order/OrderPage.vue index 8b691c503..06860e637 100644 --- a/src/modules/11_discipline/components/4_Order/OrderPage.vue +++ b/src/modules/11_discipline/components/4_Order/OrderPage.vue @@ -2,20 +2,21 @@ import { ref } from "vue"; import { useRouter } from "vue-router"; -// import step +/** import step */ import step01 from "@/modules/11_discipline/components/4_Order/Step01.vue"; import step02 from "@/modules/11_discipline/components/4_Order/Step02.vue"; import step03 from "@/modules/11_discipline/components/4_Order/Step03.vue"; const router = useRouter(); - const step = ref(1); -// nextStep + +/** nextStep */ const nextStep = async () => { localStorage.setItem("currentStep", step.value.toString()); step.value++; }; -// previousStep + +/** previousStep */ const previousStep = async () => { localStorage.setItem("currentStep", step.value.toString()); step.value--; diff --git a/src/modules/11_discipline/components/4_Order/Step01.vue b/src/modules/11_discipline/components/4_Order/Step01.vue index 105c4b9c8..b02bcc619 100644 --- a/src/modules/11_discipline/components/4_Order/Step01.vue +++ b/src/modules/11_discipline/components/4_Order/Step01.vue @@ -14,6 +14,8 @@ const mixin = useCounterMixin(); const { date2Thai, dialogConfirm } = mixin; const $q = useQuasar(); + +/** รับ props มาจากหน้าหลัก */ const props = defineProps({ next: { type: Function, @@ -24,8 +26,8 @@ const props = defineProps({ default: () => console.log("not function"), }, }); -const next = () => props.next(); -// Options ต่างๆ + +/** Options ต่างๆ */ const orderTypeOptions = ref([ { id: "0", name: "ประเภทคำสั่ง 1" }, { id: "1", name: "ประเภทคำสั่ง 2" }, @@ -41,7 +43,8 @@ const listInvestigationOptions = ref([ { id: "1", name: "รายการสอบสวนความผิดทางวินัย 2" }, { id: "2", name: "รายการสอบสวนความผิดทางวินัย 3" }, ]); -// ตัวแปรทั้งหมด + +/** ข้อมูล v-model ของฟอร์ม */ const formData = reactive({ orderType: "", orderBy: "", @@ -55,7 +58,7 @@ const formData = reactive({ mistakeDetail: "", }); -// validateForm +/** ตัวแปร ref สำหรับแสดง validate */ const orderTypeRef = ref(null); const orderByRef = ref(null); const listInvestigationRef = ref(null); @@ -66,6 +69,8 @@ const dateRef = ref(null); const authorityPositionRef = ref(null); const subjectRef = ref(null); const mistakeDetailRef = ref(null); + +/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */ const myObjectRef: MyObjectRef = { orderType: orderTypeRef, orderBy: orderByRef, @@ -78,6 +83,13 @@ const myObjectRef: MyObjectRef = { subject: subjectRef, mistakeDetail: mistakeDetailRef, }; + +/**ฟังชั่น ไป step ต่อไป */ +function next() { + props.next(); +} + +/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */ function validateForm() { const hasError = []; for (const key in myObjectRef) { @@ -96,6 +108,7 @@ function validateForm() { } } +/** ฟังชั่น บันทึก */ function onSubmit() { console.log(formData); dialogConfirm( @@ -131,6 +144,7 @@ function onSubmit() { use-input /> +
คำสั่งโดย
+
เลือกรายการสอบสวนความผิดทางวินัย
+
ผู้มีอำนาจลงนาม
+
คำสั่งที่ @@ -197,6 +214,7 @@ function onSubmit() { >
+ @@ -229,6 +247,7 @@ function onSubmit() {
+
วันที่มีผลคำสั่ง
+
ตำแหน่งผู้มีอำนาจลงนาม
+
คำสั่งเรื่อง
+
รายละเอียดการกระทำความผิด import { ref } from "vue"; + +/** รับ props มาจากหน้าหลัก */ const props = defineProps({ next: { type: Function, @@ -10,21 +12,25 @@ const props = defineProps({ default: () => console.log("not function"), }, }); -const next = () => props.next(); -const previous = () => props.previous(); + const name = ref(""); const lastname = ref(""); const age = ref(""); +/** ตัวแปร ref สำหรับแสดง validate */ const nameRef = ref(null); const ageRef = ref(null); const lastnameRef = ref(null); + +/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */ const myObject: MyObject = { name: nameRef, lastname: lastnameRef, age: ageRef, }; + +/** กำหนด type */ interface MyObject { name: any; lastname: any; @@ -32,6 +38,17 @@ interface MyObject { [key: string]: any; } +/**ฟังชั่น ไป step ต่อไป */ +function next() { + props.next(); +} + +/**ฟังชั่น ไป step ก่อนหน้า */ +function previous() { + props.previous(); +} + +/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */ function onSubmit() { const hasError = []; for (const key in myObject) { @@ -63,6 +80,7 @@ function onSubmit() { lazy-rules :rules="[(val) => !!val || `${'Name and surname'}`]" /> + + + + +/** รับ props มาจากหน้าหลัก */ const props = defineProps({ next: { type: Function, @@ -9,8 +11,11 @@ const props = defineProps({ default: () => console.log("not function"), }, }); -const next = () => props.next(); -const previous = () => props.previous(); + +/**ฟังชั่น ไป step ก่อนหน้า */ +function previous() { + props.previous(); +} +
@@ -143,6 +155,7 @@ const backPage = () => {
+ { +
{ +
{ +
{ @click="backPage" :disable="page == 1" /> +
@@ -265,6 +282,7 @@ const backPage = () => { @click="nextPage" :disable="page === numOfPages" /> +
@@ -289,6 +307,7 @@ const backPage = () => { :disable="page == 1" /> +
หน้าที่ {{ page }} จาก {{ numOfPages }} diff --git a/src/modules/11_discipline/components/5_Report/MainPage.vue b/src/modules/11_discipline/components/5_Report/MainPage.vue index 6fbf0a194..2a6c3bd91 100644 --- a/src/modules/11_discipline/components/5_Report/MainPage.vue +++ b/src/modules/11_discipline/components/5_Report/MainPage.vue @@ -4,9 +4,14 @@ import { useRouter } from "vue-router"; const router = useRouter(); // const store = useInsigniaDataStore(); -const nextPage = (type: string, title: string) => { +/** + * เข้าสู้หน้าของรายการ เเต่ละ ประเภท + * @param type ประเภท + * @param title ชื่อประเภท + */ +function nextPage(type: string, title: string) { router.push(`/discipline/report/${type}`); -}; +}