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

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

@ -1,11 +1,10 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponsePreson } from "@/interface/response/listPerson";
import { useDisciplineMainStore } from "@/modules/11_discipline/store/main";
@ -220,7 +219,7 @@ watch(()=>props.selectedData,()=>{
ref="table"
:columns="mainStore.columnsRespondent"
:rows="rows"
row-key="idcard"
row-key="personId"
flat
bordered
:paging="true"

View file

@ -171,10 +171,9 @@ function onSubmit() {
async () => {
if (mainStore.rowsAdd) {
formData.persons = mainStore.rowsAdd;
props.onSubmit(formData);
isSave.value = false;
} else props.onSubmit(formData);
// props.onSubmit(formData);
}
props.onSubmit(formData);
isSave.value = false;
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -242,7 +241,7 @@ watch(props.data, async () => {
mainStore.rowsAdd = props.data.persons;
const dataMap = props.data.directors.map((item: any) => ({
id: item.directorId,
id: item.id,
name: `${item.prefix}${item.firstName} ${item.lastName}`,
prefix: item.prefix,
firstName: item.firstName,
@ -381,6 +380,7 @@ async function addPerson(data: any) {
*/
function handleSave(returnData: any) {
addPerson(returnData);
changeFormData();
toggleModal();
}
@ -425,13 +425,14 @@ function returnDirector(data: any) {
const dataList = data.map((item: any) => item.id);
formData.directors = dataList;
rows.value = data;
changeFormData();
clickClose();
}
function deletePerson(id: string) {
changeFormData();
const dataRow = mainStore.rowsAdd;
const updatedRows = dataRow.filter((item: any) => item.id !== id);
const updatedRows = dataRow.filter((item: any) => item.personId !== id);
mainStore.rowsAdd = updatedRows;
}
@ -451,6 +452,7 @@ function changeFormData() {
}
onMounted(async () => {
mainStore.rowsAdd = [];
getOc();
});
</script>
@ -635,7 +637,7 @@ onMounted(async () => {
color="red"
class="q-ml-sm"
icon="mdi-delete-outline"
@click="deletePerson(props.row.id)"
@click="deletePerson(props.row.personId)"
><q-tooltip>ลบผกรองเรยน</q-tooltip></q-btn
>
</q-td>
@ -1302,11 +1304,11 @@ onMounted(async () => {
<DialogAddPersonal
title="ผู้ถูกร้องเรียน"
:mainData="mainStore.rowsAdd"
:modal="modalPerson"
btn-title="เพิ่มรายชื่อผู้ถูกร้องเรียน"
:close="toggleModal"
:save="addPerson"
:selected-data="mainStore.rowsAdd"
@returnData="handleSave"
/>
@ -1332,4 +1334,4 @@ onMounted(async () => {
min-height: 25px;
}
</style>
@/modules/11_discipline/store/store
@/modules/11_discipline/store/store

View file

@ -2,14 +2,16 @@
import { onMounted, reactive, ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/**import component*/
import FormComplaints from "@/modules/11_discipline/components/1_Complaint/Form.vue"; //
import FormInvestigatefacts from "@/modules/11_discipline/components/2_InvestigateFacts/Form.vue"; //
import FormDisciplinary from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue"; //
import type { PersonsArray } from "@/modules/11_discipline/interface/request/disciplinary";
import type {
PersonsArray,
Persons,
} from "@/modules/11_discipline/interface/request/disciplinary";
import type {
FormData as FormDataComplaint,
ArrayPerson,
@ -22,6 +24,9 @@ import type { FormData as FormInvestigateFact } from "@/modules/11_discipline/in
/**import store*/
import { useCounterMixin } from "@/stores/mixin";
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
import { useDisciplineMainStore } from "@/modules/11_discipline/store/main";
const mainStore = useDisciplineMainStore();
const $q = useQuasar();
const mixin = useCounterMixin();
@ -86,7 +91,8 @@ async function fetchDetailInvestigate() {
dataList.disciplineInvestigateRelevantDocs;
dataInvestigatefacts.investigationStatusResult =
dataList.investigationStatusResult;
dataInvestigatefacts.investigationExtendStatus = dataList.investigationExtendStatus;
dataInvestigatefacts.investigationExtendStatus =
dataList.investigationExtendStatus;
dataInvestigatefacts.investigationDaysExtend =
dataList.investigationDaysExtend;
})
@ -167,8 +173,9 @@ const onSubmit = async (id: string) => {
};
/** ยืนยัน ส่งไปออกคำสั่ง */
function sentIssue() {
console.log("sent");
const respondentRows = ref<Persons[]>();
async function sentIssue() {
respondentRows.value = await store.rowSent.filter((x) => !x.report); //x.report === false
modalPopup.value = true;
}
@ -214,12 +221,6 @@ function cancelInvestigate() {
);
}
/** ฟังชั่น ส่งไปออกคำสั่ง*/
function confirmSentIssue() {
console.log("sent");
modalPopup.value = true;
}
/** ฟังชั่น ยุติเรื่อง*/
function confirmEndInvestigate() {
console.log("sent");
@ -303,7 +304,6 @@ const fileListObjComplaint = reactive<ArrayFileList>({
function emitPerson(data: PersonsArray[]) {
console.log(data);
const dataMapId = data.map((item: PersonsArray) => item.id);
console.log(dataMapId);
showLoader();
http
.put(config.API.disciplinarySuspend(id.value), {
@ -321,104 +321,6 @@ function emitPerson(data: PersonsArray[]) {
});
}
/** หัวตาราง */
const columns = ref<QTableProps["columns"]>([
{
name: "info",
align: "left",
label: "",
sortable: false,
field: "info",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "idcard",
align: "left",
label: "เลขบัตรประชาชน",
sortable: true,
field: "idcard",
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: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posNo",
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: "positionLevel",
align: "left",
label: "ระดับ",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "salary",
align: "left",
label: "เงินเดือน",
sortable: true,
field: "salary",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organization",
align: "left",
label: "หน่วยงาน",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/** หัวข้อที่เเสดงในตาราง */
const visibleColumns = ref<string[]>([
"info",
"no",
"idcard",
"name",
"posNo",
"position",
"positionLevel",
"salary",
"organization",
]);
const dataComplaints = reactive<FormDataComplaint>({
id: "",
respondentType: "",
@ -555,9 +457,10 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
:modal="modalPopup"
:close="closePopup"
title="ส่งไปพักราชการ"
:rows="store.rowSent"
:columns="columns"
:visibleColumns="visibleColumns"
:rows="respondentRows"
:columns="mainStore.columnsRespondent"
:visibleColumns="mainStore.visibleColumnsRespondent"
:checked-val="false"
@return-person="emitPerson"
/>
</template>

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

View file

@ -40,12 +40,15 @@ const props = defineProps({
type: Array,
default: [],
},
checkedVal: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(["returnPerson"]);
/** หัวตาราง */
const selected = ref<any>([]);
const inspectionResults = ref<string>("");
const filter = ref<string>("");
@ -57,17 +60,16 @@ const initialPagination = ref<any>({
});
function onclickSend() {
dialogConfirm(
$q,
async () => {
// success($q, `${props.title}`);
emit("returnPerson", selected.value);
props.close?.();
},
`ยืนยันการส่ง${props.title}`,
`ต้องการยืนยันการส่ง${props.title}หรือไม่`
);
dialogConfirm(
$q,
async () => {
// success($q, `${props.title}`);
emit("returnPerson", selected.value);
props.close?.();
},
`ยืนยันการส่ง${props.title}`,
`ต้องการยืนยันการส่ง${props.title}หรือไม่`
);
}
function onClickClose() {
@ -78,7 +80,7 @@ watch([() => props.modal], () => {
inspectionResults.value = props.modal ? "" : "";
selected.value = props.modal ? [] : [];
if (props.modal === true) {
selected.value = props.rows;
selected.value = props.checkedVal ? props.rows : [];
}
});
</script>

View file

@ -10,6 +10,7 @@ interface Persons {
salary: number; //เงินเดือน
organization: string; //สังกัด
name: string;
report?: boolean;
}
interface PersonsArray {
id: string; //id อ้างอิง profile
@ -23,6 +24,7 @@ interface PersonsArray {
salary: number; //เงินเดือน
organization: string; //สังกัด
name: string;
report?: boolean;
}
interface Director {
directorId?: string;
@ -128,4 +130,4 @@ interface DisciplinaryRef {
[key: string]: any;
}
export type { FormData, DisciplinaryRef, Persons, Director,PersonsArray };
export type { FormData, DisciplinaryRef, Persons, Director, PersonsArray };

View file

@ -8,39 +8,40 @@ interface ListData {
investigationDateEnd: Date | null;
investigationStatusResult: string;
status: string;
createdAt: Date|null;
createdAt: Date | null;
}
interface ArrayPerson {
id:string
idcard:string
name:string
prefix:string
firstName:string
lastName:string
posNo:string
position:string
positionLevel:string
salary:number|null
organization:string
personId: string;
idcard: string;
name: string;
prefix: string;
firstName: string;
lastName: string;
posNo: string;
position: string;
positionLevel: string;
salary: number | null;
organization: string;
}
interface ArrayPersonAdd {
personId:string
idcard:string
name:string
prefix:string
firstName:string
lastName:string
posNo:string
position:string
positionLevel:string
salary:number|null
organization:string
personId: string; //id อ้างอิง profile
idcard: string; //รหัสบัตรประชาชน
prefix: string; //คำนำหน้า
firstName: string; //ชื่อ
lastName: string; //นามสกุล
posNo: string; //เลขที่ตำแหน่ง
position: string; //ตำแหน่ง
positionLevel: string; //ระดับ
salary: number; //เงินเดือน
organization: string; //สังกัด
name: string;
report?: boolean;
}
interface ocListType{
organizationId:string
organizationName:string
interface ocListType {
organizationId: string;
organizationName: string;
}
export type { ListData,ArrayPerson,ocListType,ArrayPersonAdd };
export type { ListData, ArrayPerson, ocListType, ArrayPersonAdd };

View file

@ -2,7 +2,7 @@ import { defineStore } from "pinia";
import type { QTableProps } from "quasar";
import { ref } from "vue";
import type { DataOption } from "@/modules/11_discipline/interface/index/Main";
import type { ArrayPerson, ArrayPersonAdd } from "@/modules/11_discipline/interface/response/investigate";
import type { ArrayPersonAdd } from "@/modules/11_discipline/interface/response/investigate";
export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
/** option ผู้ถูกสอบสวน*/
@ -273,8 +273,8 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
"organization",
]);
const rowsAdd = ref<ArrayPerson[]>([]);
function fetchData(data: ArrayPerson[]) {
const rowsAdd = ref<ArrayPersonAdd[]>([]);
function fetchData(data: ArrayPersonAdd[]) {
rowsAdd.value = data;
}