From dd43268931dffc3a628c7c63f09e3f0f31be5f8f Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Thu, 19 Oct 2023 17:49:53 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B9=80=E0=B8=AD=E0=B8=B2=20columns=20=E0=B9=83=E0=B8=AA?= =?UTF-8?q?=E0=B9=88=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../3_InvestigateDisciplinary/AddPage.vue | 185 +++--------------- .../store/InvestigateDisStore.ts | 67 +++++++ 2 files changed, 89 insertions(+), 163 deletions(-) diff --git a/src/modules/11_discipline/components/3_InvestigateDisciplinary/AddPage.vue b/src/modules/11_discipline/components/3_InvestigateDisciplinary/AddPage.vue index 6e3840cc1..9a9b1d17c 100644 --- a/src/modules/11_discipline/components/3_InvestigateDisciplinary/AddPage.vue +++ b/src/modules/11_discipline/components/3_InvestigateDisciplinary/AddPage.vue @@ -3,109 +3,40 @@ import { ref, onMounted } from "vue"; import { useQuasar, QForm } from "quasar"; import { useRouter, useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; -import type { QTableProps } from "quasar"; -import http from "@/plugins/http"; -import config from "@/app.config"; import Dialogbody from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Dialogbody.vue"; import Table from "@/modules/11_discipline/components/3_InvestigateDisciplinary/DirectorTable.vue"; import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore"; -import type { directorType } from "@/modules/11_discipline/interface/index/Main"; const investigateDis = useInvestigateDisStore(); const { fecthDirector } = investigateDis; -const visibleColumns = ref([ - "no", - "name", - "position", - "duty", - "email", - "telephone", -]); -const columns = ref([ - { - name: "no", - align: "left", - label: "ลำดับ", - sortable: false, - field: "no", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "name", - align: "left", - label: "ชื่อ - นามสกุล", - sortable: true, - field: "name", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "position", - align: "left", - label: "ตำแหน่ง", - sortable: true, - field: "position", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "duty", - align: "left", - label: "หน้าที่", - sortable: true, - field: "duty", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "email", - align: "left", - label: "อีเมล", - sortable: true, - field: "email", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "telephone", - align: "left", - label: "เบอร์โทรศัพท์", - sortable: true, - field: "telephone", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, -]); - onMounted(async () => { - await fecthInvestigateDisDirector(); + await fecthDirector([ + { + nameDirector: "นาง เกสินี เจียรสุมัย", + position: "ครู", + duty: "ประธาน", + email: "e@email.com", + telephone: "0800808080", + }, + { + nameDirector: "นาย สรวิชญ์ พลสิทธิ์", + position: "ทดลองงาน", + duty: "เลขานุการ", + email: "g@gmail.com", + telephone: "0614565145", + }, + ]); await hideLoader(); }); -const selected = ref([]); - -const clickAdd = () => { - console.log("clickadd"); -}; const popup = () => { modal.value = true; filterKeyword2.value = ""; - fecthInvestigateDisDirector(); }; const mixin = useCounterMixin(); -const { - date2Thai, - dateToISO, - messageError, - showLoader, - hideLoader, - dialogConfirm, - success, - dialogMessageNotify, -} = mixin; +const { date2Thai, hideLoader } = mixin; const initialPagination = ref({ rowsPerPage: 0, @@ -126,7 +57,6 @@ const filterKeyword2 = ref(""); const typefault = ref(""); const faultLevel = ref(""); const type = ref(""); -const rows2 = ref([]); const Complaint = ref(""); const trueDetail = ref(""); const evidence = ref(""); @@ -149,26 +79,6 @@ const clickClose = () => { modal.value = false; }; -onMounted(async () => {}); -function fecthInvestigateDisDirector() { - const data = [ - { - nameDirector: "นาง เกสินี เจียรสุมัย", - position: "ครู", - duty: "ประธาน", - email: "e@email.com", - telephone: "0800808080", - }, - { - nameDirector: "นาย สรวิชญ์ พลสิทธิ์", - position: "ทดลองงาน", - duty: "เลขานุการ", - email: "g@gmail.com", - telephone: "0614565145", - }, - ]; - fecthDirector(data); // ส่งข้อมูลไป stores -} // เรียกข้อมูลของรอบการเสนอขอ const filter = ref(""); //search data table @@ -179,63 +89,12 @@ const fileUploadDoc = async (files: any) => { }); }; -// แก้ไขข้อมูล - // คลิกบันทึก -const checkSave = () => { - // if (myForm.value !== null) { - // myForm.value.validate().then(async (success) => { - // if (success) { - // dialogConfirm($q, () => SaveData()); - // } else if (Number(datelast.value) !== 0) { - // dialogMessageNotify($q, "กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ"); - // } - // }); - // } -}; +const checkSave = () => {}; const deleteData = async (id: string) => { console.log("delete"); }; -// บันทึกข้อมูล -const SaveData = async () => { - // if (edit.value) { - // await editData(id.value); - // } else { - // await addData(); - // clickBack(); - // } -}; -// เพิ่มข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ -const addData = async () => { - // const formData = new FormData(); - // const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${ - // roundInsig.value.value - // } ปี ${yearly.value + 543} `; - // formData.append("name", name); - // formData.append("year", yearly.value.toString()); - // formData.append("amount", datelast.value.toString()); - // formData.append("round", roundInsig.value.value); - // if (dateInvestigate.value !== null) { - // formData.append("startDate", dateToISO(dateInvestigate.value)); - // } - // if (dateAllegation.value !== null) { - // formData.append("endDate", dateToISO(dateAllegation.value)); - // } - // formData.append("file", files.value); - // showLoader(); - // await http - // .post(config.API.listRoundInsignia(), formData) - // .then(() => { - // success($q, "บันทึกข้อมูลสำเร็จ"); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // hideLoader(); - // }); -}; const clickBack = () => { router.push(`/discipline/disciplinary`); @@ -254,7 +113,7 @@ const clickBack = () => { class="q-mr-sm" @click="clickBack" /> - {{ edit ? "การสอบสวนความผิดทางวินัย" : "เพิ่มการสอบสวนความผิดทางวินัย" }} + {{ "เพิ่มการสอบสวนความผิดทางวินัย" }}
@@ -413,11 +272,11 @@ const clickBack = () => { ([ + "no", + "name", + "position", + "duty", + "email", + "telephone", + ]); + const columnsDirector = ref([ + { + name: "no", + align: "left", + label: "ลำดับ", + sortable: false, + field: "no", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "name", + align: "left", + label: "ชื่อ - นามสกุล", + sortable: true, + field: "name", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "position", + align: "left", + label: "ตำแหน่ง", + sortable: true, + field: "position", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "duty", + align: "left", + label: "หน้าที่", + sortable: true, + field: "duty", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "email", + align: "left", + label: "อีเมล", + sortable: true, + field: "email", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "telephone", + align: "left", + label: "เบอร์โทรศัพท์", + sortable: true, + field: "telephone", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + ]); return { fecthList, rows, @@ -201,6 +266,8 @@ export const useInvestigateDisStore = defineStore( fecthDirector, visibleColumns, columns, + visibleColumnsDirector, + columnsDirector, }; } );