แก้ไขฟอร์มสืบสวน และผู้ถูกร้องเรียนของวินัย

This commit is contained in:
Warunee Tamkoo 2023-12-01 16:15:33 +07:00
parent ab15f989cc
commit 7af8370b08
8 changed files with 153 additions and 200 deletions

View file

@ -10,7 +10,6 @@ import type { QTableProps } from "quasar";
import type {
FormData,
DisciplinaryRef,
Persons,
Director,
} from "@/modules/11_discipline/interface/request/disciplinary";
import type {
@ -199,6 +198,7 @@ function calEndDate(val: string) {
formData.disciplinaryDateEnd = new Date(
dateNew.setDate(date.getDate() + Number(val))
);
changeFormData();
}
/**
@ -210,6 +210,10 @@ function onSubmit() {
dialogConfirm(
$q,
async () => {
if (mainStore.rowsAdd) {
formData.persons = mainStore.rowsAdd;
}
emit("submit:disciplinary", formData);
},
"ยืนยันการบันทึกข้อมูล",
@ -273,6 +277,8 @@ async function fetchDatadetail() {
formData.disciplinaryCauseText = props.data.disciplinaryCauseText;
formData.disciplinaryResult = props.data.disciplinaryResult;
mainStore.rowsAdd = props.data.persons;
/** MAP รายชื่อกรรมการ หน้าหลัก */
const dataMap = props.data.director.map((item: any) => ({
id: item.directorId,
@ -291,36 +297,26 @@ async function fetchDatadetail() {
}
}
/**
* function add กรองเรยนใน table
* @param data รายช กรองเรยน
*/
async function addPerson(data: Persons[]) {
if (!data) {
return;
}
const newPerson: Persons[] = Array.from(data).map((e) => ({
personId: e.personId, //id profile
idcard: e.idcard, //
prefix: e.prefix, //
firstName: e.firstName, //
lastName: e.lastName, //
posNo: e.posNo, //
position: e.position, //
positionLevel: e.positionLevel, //
salary: e.salary, //
organization: e.organization, //
name: `${e.prefix}${e.firstName} ${e.lastName}`,
}));
const mergedArray = [...formData.persons, ...newPerson];
formData.persons = mergedArray;
investigateDis.rowSent = formData.persons;
async function addPerson(data: any) {
await mainStore.fetchData(data);
toggleModal();
}
/** function รับข้อมูลรายชื่อผู้ถูกร้องเรียน*/
/**
* งช บคาจาก คอมโพเเนน
* @param returnData าทไดนมา
*/
function handleSave(returnData: any) {
addPerson(returnData);
changeFormData();
toggleModal();
}
function deletePerson(id: string) {
changeFormData();
const dataRow = mainStore.rowsAdd;
const updatedRows = dataRow.filter((item: any) => item.personId !== id);
mainStore.rowsAdd = updatedRows;
}
/**
@ -413,10 +409,11 @@ async function updatePaging(rpp: number, p: number) {
* function return รายชอกรรมการทเลอก
* @param data รายชอกรรมการทเลอก
*/
async function returnDirector(data: any) {
function returnDirector(data: any) {
const dataList = data.map((item: any) => item.id);
formData.directors = dataList;
rows.value = data;
changeFormData();
clickClose();
}
@ -437,12 +434,24 @@ function changeFormData() {
/** Hook */
onMounted(async () => {
mainStore.rowsAdd = [];
await fetchOrganization();
});
</script>
<template>
<div class="row col-12 bg-white">
<div class="col-sm-12 col-md-9">
<div v-if="isSave" class="q-pa-sm q-gutter-sm">
<q-banner
inline-actions
bordered
class="bg-red-1 text-red border-orange"
>
<q-icon name="mdi-information-outline" size="20px" /> แจงเตอน
งไมไดนทกขอม
</q-banner>
</div>
<form @submit.prevent="validateForm">
<div class="col-12">
<q-card bordered>
@ -466,7 +475,8 @@ onMounted(async () => {
:rules="[(val) => !!val || `${'กรุณาเลือกผู้ร้องเรียน'}`]"
lazy-rules
@update:model-value="
selectComplainant(formData.respondentType)
selectComplainant(formData.respondentType);
changeFormData();
"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'filterrespondentType'
@ -502,6 +512,7 @@ onMounted(async () => {
label="เลือกสำนักงาน"
:rules="[(val) => !!val || `${'กรุณาเลือกสำนักงาน'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
</div>
<div class="col-xs-12 col-sm-3" id="consideredAgency">
@ -570,7 +581,7 @@ onMounted(async () => {
<d-table
ref="table"
:columns="mainStore.columnsRespondent"
:rows="formData.persons"
:rows="mainStore.rowsAdd"
row-key="personId"
flat
bordered
@ -590,6 +601,7 @@ onMounted(async () => {
col.label
}}</span>
</q-th>
<q-th auto-width></q-th>
</q-tr>
</template>
<template v-slot:body="props">
@ -630,6 +642,20 @@ onMounted(async () => {
{{ col.value }}
</div>
</q-td>
<q-td auto-width>
<q-btn
v-if="!isReadonly"
size="12px"
flat
round
dense
color="red"
class="q-ml-sm"
icon="mdi-delete-outline"
@click="deletePerson(props.row.personId)"
><q-tooltip>ลบผกรองเรยน</q-tooltip></q-btn
>
</q-td>
</q-tr>
</template>
</d-table>
@ -662,6 +688,7 @@ onMounted(async () => {
dense
class="text-weight-medium q-ml-sm"
keep-color
@update:model-value="changeFormData()"
/>
</div>
<div class="col-12"><q-separator /></div>
@ -676,6 +703,7 @@ onMounted(async () => {
autoApply
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
>
<template #year="{ year }">{{
year + 543
@ -761,6 +789,7 @@ onMounted(async () => {
autoApply
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
>
<template #year="{ year }">{{
year + 543
@ -818,6 +847,7 @@ onMounted(async () => {
borderless
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
>
<template #year="{ year }">
{{ year + 543 }}
@ -866,6 +896,7 @@ onMounted(async () => {
borderless
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
>
<template #year="{ year }">
{{ year + 543 }}
@ -913,6 +944,7 @@ onMounted(async () => {
borderless
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
>
<template #year="{ year }">
{{ year + 543 }}
@ -961,6 +993,7 @@ onMounted(async () => {
borderless
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
>
<template #year="{ year }">
{{ year + 543 }}
@ -1087,6 +1120,7 @@ onMounted(async () => {
hide-bottom-space
:rules="[(val) => !!val || `${'กรุณากรอกกรณีมีความผิด'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
<q-input
@ -1100,6 +1134,7 @@ onMounted(async () => {
label="สอบสวนที่"
:rules="[(val) => !!val || `${'กรุณากรอกสอบสวนที่'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
<q-select
@ -1120,6 +1155,7 @@ onMounted(async () => {
lazy-rules
group-label="group"
group-values="options"
@update:model-value="changeFormData()"
>
</q-select>
@ -1136,6 +1172,7 @@ onMounted(async () => {
(val) => !!val || `${'กรุณากรอกอ้างอิงมาตราตามกฎหมาย'}`,
]"
lazy-rules
@update:model-value="changeFormData()"
/>
<q-input
@ -1150,6 +1187,7 @@ onMounted(async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกสรุปพยานหลักฐานสนับสนุนข้อกล่าวหา'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
<q-input
@ -1164,6 +1202,7 @@ onMounted(async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกบันทึกถ้อยคำของผู้กล่าวหา'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
<q-input
@ -1178,6 +1217,7 @@ onMounted(async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกพยานและบันทึกถ้อยคำพยาน'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
<q-input
@ -1192,6 +1232,7 @@ onMounted(async () => {
type="textarea"
:rules="[(val:string) => !!val || `${'กรุณากรอกผลการสอบสวน'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
<div class="row col-12">
@ -1232,6 +1273,7 @@ onMounted(async () => {
@filter="(inputValue: any,
doneFn: Function) => investigateDis.filterFnOptionsType(inputValue, doneFn, 'offenseDetailsOps'
)"
@update:model-value="changeFormData()"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
@ -1265,6 +1307,7 @@ onMounted(async () => {
option-label="name"
option-value="id"
use-input
@update:model-value="changeFormData()"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
@ -1289,6 +1332,7 @@ onMounted(async () => {
hide-bottom-space
:label="`${'เหตุผล'}`"
type="textarea"
@update:model-value="changeFormData()"
/>
</div>
</div>
@ -1363,11 +1407,11 @@ onMounted(async () => {
<!-- Popup กรองเรยน -->
<DialogAddPersonal
title="ผู้ถูกร้องเรียน"
:checkId="formData.persons"
:modal="modalPerson"
btn-title="เพิ่มรายชื่อผู้ถูกสอบสวน"
:close="toggleModal"
:save="addPerson"
:selected-data="mainStore.rowsAdd"
@returnData="handleSave"
/>
@ -1387,4 +1431,4 @@ onMounted(async () => {
/>
<!-- :fecthlistappointment="fecthlistappointment" -->
</template>
@/modules/11_discipline/store/store
@/modules/11_discipline/store/store