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}`); -}; +} diff --git a/src/modules/11_discipline/components/6_BasicInformation/Director/EditPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Director/EditPage.vue index a28ba42a2..f940eba04 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Director/EditPage.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Director/EditPage.vue @@ -1,22 +1,22 @@ \ No newline at end of file + diff --git a/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue b/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue index f670ac922..1a327ccf4 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue @@ -5,7 +5,9 @@ import type { FormRef, } from "@/modules/11_discipline/interface/request/director"; -// รับ props มาจาก page หลัก +/** + * รับ props มาจาก page หลัก + */ const props = defineProps({ data: { type: Object, @@ -17,11 +19,16 @@ const props = defineProps({ }, }); -// ข้อมูลรหัสบัตรประชาชน +/** + * ข้อมูลรหัสบัตรประชาชน + */ +// const idCard = ref(""); const idCardRef = ref(null); -// ข้อมูลทั้งก้อน form +/** + * ข้อมูลทั้งก้อน form + */ const formData = reactive({ prefix: "", firstname: "", @@ -29,8 +36,14 @@ const formData = reactive({ position: "", phone: "", email: "", + responsibilities: "", }); +/** + * เช็คข้อมูลจาก props + * เมื่อมีข้อมูล + * เก็บข้อมูลลง formData + */ watch(props.data, async () => { // console.log("data==>", props.data) formData.prefix = props.data.prefix; @@ -41,14 +54,18 @@ watch(props.data, async () => { formData.email = props.data.email; }); -// เพิ่มบุคลากร +/** + * เพิ่มบุคลากร + */ function addEmployee() { if (idCardRef.value.validate()) { console.log("idCard===>", idCard.value); } } -// ตรวจสอบข้อมูลก่อนส่งไปยัง api +/** + * ตรวจสอบข้อมูลก่อนส่งไปยัง api + */ const prefixRef = ref(null); const firstnameRef = ref(null); const lastnameRef = ref(null); @@ -64,6 +81,7 @@ const formRef: FormRef = { email: emailRef, }; +/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */ function onValidate() { const hasError = []; for (const key in formRef) { @@ -81,13 +99,19 @@ function onValidate() { } diff --git a/src/modules/11_discipline/components/6_BasicInformation/Director/MainPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Director/MainPage.vue index 80cf5442e..e63634fd0 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Director/MainPage.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Director/MainPage.vue @@ -4,22 +4,19 @@ import type { QTableProps } from "quasar"; import router from "@/router"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; -import { useDisciplineDirectorDataStore } from '@/modules/11_discipline/store/DirectorStore' - +import { useDisciplineDirectorDataStore } from "@/modules/11_discipline/store/DirectorStore"; import config from "@/app.config"; import http from "@/plugins/http"; const $q = useQuasar(); -const dataStore = useDisciplineDirectorDataStore() +const dataStore = useDisciplineDirectorDataStore(); const mixin = useCounterMixin(); -const { - messageError, - showLoader, - hideLoader, - dialogConfirm, - dialogRemove, -} = mixin; +const { messageError, showLoader, hideLoader, dialogConfirm, dialogRemove } = + mixin; +/**เมื่อเริ่มโหลดหน้า + * ส่งข้อมูลจำลองไปยัง store + */ onMounted(() => { // get ข้อมูลแล้วโยนใส่ store dataStore.fetchData([ @@ -35,10 +32,12 @@ onMounted(() => { email: "g@gmail.com", phone: "0614565145", }, - ]) + ]); }); -// ค้นหาในตาราง +/** + * ค้นหาในตาราง + */ const filterKeyword = ref(""); const filterRef = ref(null); function resetFilter() { @@ -46,9 +45,11 @@ function resetFilter() { if (filterRef.value) { filterRef.value.focus(); } -}; +} -// กำหนด pagination +/** + *pagination ของตาราง + */ const pagination = ref({ // sortBy: "desc", descending: false, @@ -56,84 +57,138 @@ const pagination = ref({ rowsPerPage: 25, }); +/** + * ลบข้อมูล + * @param id ของกรรมการแต่ละบุคคล + */ function clickDelete(id: string) { - dialogRemove( - $q, - async () => { - // ยืนยันการลบข้อมูล - // showLoader(); - // await http - // .delete(config.API.periodExamId(id)) - // .then((res) => { - // success($q, "ลบข้อมูลสำเร็จ"); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // hideLoader(); - // }); - } - ); -}; + dialogRemove($q, async () => { + // ยืนยันการลบข้อมูล + // showLoader(); + // await http + // .delete(config.API.periodExamId(id)) + // .then((res) => { + // success($q, "ลบข้อมูลสำเร็จ"); + // }) + // .catch((e) => { + // messageError($q, e); + // }) + // .finally(async () => { + // hideLoader(); + // }); + }); +} \ No newline at end of file +