จัดโค้ด รายการการสอบสวนความผิดทางวินัย

This commit is contained in:
setthawutttty 2023-11-10 15:32:11 +07:00
parent f4ee2b89fc
commit c216c29abe
7 changed files with 167 additions and 132 deletions

View file

@ -3,51 +3,18 @@ import { ref, onMounted, reactive, watch } from "vue";
import { useQuasar, QForm } from "quasar";
import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
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 {
FormData,
disciplinaryRef,
} from "@/modules/11_discipline/interface/request/disciplinary";
const investigateDis = useInvestigateDisStore();
const { fecthDirector } = investigateDis;
const props = defineProps({
data: {
type: Object,
default: null,
},
onSubmit: {
type: Function,
default: () => "",
},
});
onMounted(async () => {
await fecthDirector([
{
nameDirector: "นาง เกสินี เจียรสุมัย",
position: "ครู",
duty: "ประธาน",
email: "e@email.com",
telephone: "0800808080",
role: "4",
},
{
nameDirector: "นาย สรวิชญ์ พลสิทธิ์",
position: "ทดลองงาน",
duty: "เลขานุการ",
email: "g@gmail.com",
telephone: "0614565145",
role: "6",
},
]);
await hideLoader();
});
const popup = () => {
modal.value = true;
filterKeyword2.value = "";
};
const mixin = useCounterMixin();
const { date2Thai, hideLoader, dialogConfirm } = mixin;
@ -64,6 +31,9 @@ const dateInvestigate = ref<Date>(new Date());
const dateAllegation = ref<Date>(new Date());
const dateEvident = ref<Date>(new Date());
const filterKeyword2 = ref<string>("");
const fileDocDataUpload = ref<File[]>([]);
/** ตัวแปร ref สำหรับแสดง validate */
const complaintRef = ref<Object | null>(null);
const dateInvestigateRef = ref<Object | null>(null);
const dateAllegationRef = ref<Object | null>(null);
@ -85,11 +55,23 @@ const evidenceRef = ref<Object | null>(null);
const recordAccuserRef = ref<Object | null>(null);
const complaintsOptions = ref<any>([]);
const fileDocDataUpload = ref<File[]>([]);
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
data: {
type: Object,
default: null,
},
onSubmit: {
type: Function,
default: () => "",
},
});
const initialPagination = ref<any>({
rowsPerPage: 0,
});
/** ข้อมูล v-model ของฟอร์ม */
const formData = reactive<FormData>({
complaint: "",
dateInvestigate: null,
@ -112,6 +94,7 @@ const formData = reactive<FormData>({
filesEtc: null,
});
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
const objectdisciplinary: disciplinaryRef = {
complaint: complaintRef,
dateInvestigate: dateInvestigateRef,
@ -134,6 +117,13 @@ const objectdisciplinary: disciplinaryRef = {
filesEtc: filesEtcRef,
};
/** เปิด dialog */
function popup(){
modal.value = true;
filterKeyword2.value = "";
};
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
function validateForm() {
const hasError = [];
for (const key in objectdisciplinary) {
@ -152,24 +142,26 @@ function validateForm() {
console.log(hasError);
}
}
/** search data table*/
const filter = ref<string>("");
const routeName = router.currentRoute.value.name;
const clickClose = () => {
/** ฟังชั่นปิด dialog */
function clickClose() {
modal.value = false;
};
}
//
const filter = ref<string>(""); //search data table
const fileUploadDoc = async (files: any) => {
async function fileUploadDoc(files: any) {
files.forEach((file: any) => {
fileDocDataUpload.value.push(file);
});
};
}
//
/**
* งกนสำหรบบนทกขอม ระบบจะแสดง dialog ใหนยนการบนท
* หากยนยนจะสงขอมลไปบนทกท api
* หากยกเลกจะกลบไปหนาฟอร
*/
function onSubmit() {
dialogConfirm(
$q,
@ -182,13 +174,16 @@ function onSubmit() {
);
}
const deleteData = async (id: string) => {
/** ฟังชั่น delect */
async function deleteData(id: string) {
console.log("delete");
};
}
const clickBack = () => {
router.push(`/discipline/disciplinary`);
};
/**
* เชคขอมลจาก props
* เมอมอม
* เกบขอมลลง formData
*/
watch(props.data, async () => {
formData.complaint = props.data.complaint;
formData.dateInvestigate = props.data.dateInvestigate;
@ -210,6 +205,31 @@ watch(props.data, async () => {
formData.filesWitnesses = props.data.filesWitnesses;
formData.filesEtc = props.data.filesEtc;
});
/**
* งขอมลจำลองไปย store
*/
onMounted(async () => {
await fecthDirector([
{
nameDirector: "นาง เกสินี เจียรสุมัย",
position: "ครู",
duty: "ประธาน",
email: "e@email.com",
telephone: "0800808080",
role: "4",
},
{
nameDirector: "นาย สรวิชญ์ พลสิทธิ์",
position: "ทดลองงาน",
duty: "เลขานุการ",
email: "g@gmail.com",
telephone: "0614565145",
role: "6",
},
]);
await hideLoader();
});
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-11">
@ -375,7 +395,7 @@ watch(props.data, async () => {
</q-input>
</template>
</datepicker>
<div class="row col-12">
<q-card
bordered
@ -465,6 +485,7 @@ watch(props.data, async () => {
:rules="[(val) => !!val || `${'กรุณากรอกกรณีมีความผิด'}`]"
lazy-rules
/>
<q-input
class="col-xs-12 col-sm-6"
dense
@ -477,6 +498,7 @@ watch(props.data, async () => {
:rules="[(val) => !!val || `${'กรุณากรอกสอบสวนที่'}`]"
lazy-rules
/>
<q-select
dense
class="col-xs-12 col-sm-3"
@ -492,6 +514,7 @@ watch(props.data, async () => {
:options="investigateDis.optionsTypefault"
label="ลักษณะความผิด"
/>
<q-select
dense
class="col-xs-12 col-sm-3"
@ -507,6 +530,7 @@ watch(props.data, async () => {
:options="investigateDis.optionsfaultLevel"
label="ระดับโทษความผิด"
/>
<q-input
class="col-xs-12 col-sm-6"
dense
@ -521,6 +545,7 @@ watch(props.data, async () => {
]"
lazy-rules
/>
<q-input
class="col-12"
dense
@ -533,6 +558,7 @@ watch(props.data, async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกรายละเอียดเรื่องร้องเรียน'}`]"
/>
<q-input
class="col-12"
dense
@ -545,6 +571,7 @@ watch(props.data, async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกรายละเอียดสืบสวนข้อเท็จจริง'}`]"
/>
<div class="row col-12">
<q-card
bordered
@ -570,6 +597,7 @@ watch(props.data, async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกสรุปพยานหลักฐานสนับสนุนข้อกล่าวหา'}`]"
/>
<q-file
class="col-12 q-mt-sm"
outlined
@ -615,6 +643,7 @@ watch(props.data, async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกบันทึกถ้อยคำของผู้กล่าวหา'}`]"
/>
<q-file
class="col-12 q-mt-sm"
outlined
@ -660,6 +689,7 @@ watch(props.data, async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกพยานและการบันทึกถ้อยคำ'}`]"
/>
<q-file
class="col-12 q-mt-sm"
outlined
@ -692,6 +722,7 @@ watch(props.data, async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกผลการสอบสวน'}`]"
/>
<q-file
class="col-12"
outlined