แก้ไขฟอร์มสรุปผลการพิจารณา

This commit is contained in:
Warunee Tamkoo 2023-12-01 17:52:59 +07:00
parent 2c295dbd03
commit d026e7c615
5 changed files with 219 additions and 200 deletions

View file

@ -372,6 +372,7 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
persons: [], persons: [],
}); });
</script> </script>
<template> <template>
<div class="col-xs-12 col-sm-12 col-md-11"> <div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle col-12 row items-center"> <div class="toptitle col-12 row items-center">

View file

@ -24,7 +24,7 @@ const mainStore = useDisciplineMainStore();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const store = useDisciplineResultStore(); const store = useDisciplineResultStore();
const { dialogConfirm, showLoader, hideLoader, messageError } = mixin; const { showLoader, hideLoader, messageError } = mixin;
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const id = ref<string>(route.params.id as string); const id = ref<string>(route.params.id as string);
@ -51,16 +51,12 @@ function getData() {}
/** ยืนยัน ส่งไปออกคำสั่ง */ /** ยืนยัน ส่งไปออกคำสั่ง */
function sentIssue() { function sentIssue() {
modal.value = true; modal.value = true;
// dialogConfirm(
// $q,
// () => {
// console.log("sent api ");
// },
// "",
// "?"
// );
} }
const idInvestigate = ref<string>("");
const idComplaint = ref<string>("");
const status = ref<string>("");
const dataResult = ref<DataListRow[]>([]); const dataResult = ref<DataListRow[]>([]);
/** function เรียกรายละเอียดผลการพิจารณาทางวินัย*/ /** function เรียกรายละเอียดผลการพิจารณาทางวินัย*/
async function fetchDetailResult() { async function fetchDetailResult() {
@ -69,6 +65,9 @@ async function fetchDetailResult() {
.get(config.API.listResultById(id.value)) .get(config.API.listResultById(id.value))
.then((res) => { .then((res) => {
dataResult.value = res.data.result; dataResult.value = res.data.result;
status.value = res.data.result.status;
idComplaint.value = res.data.result.idComplaint;
idInvestigate.value = res.data.result.idInvestigate;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -86,7 +85,6 @@ async function fetchDetailDisciplinary() {
.get(config.API.disciplineDisciplinaryById(id.value)) .get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => { .then((res) => {
dataDisciplinary.value = res.data.result; dataDisciplinary.value = res.data.result;
// status.value = res.data.result.status;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -107,10 +105,10 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
investigationDetailOther: "", investigationDetailOther: "",
evidenceFiles: null, evidenceFiles: null,
fileComplaint: null, fileComplaint: null,
extendStatus: false, investigationExtendStatus: false,
investigationDateStart: null, investigationDateStart: null,
investigationDateEnd: null, investigationDateEnd: null,
daysExtend: null, investigationDaysExtend: null,
investigationStatusResult: "", investigationStatusResult: "",
investigationCauseText: "", investigationCauseText: "",
complaintStatus: "", complaintStatus: "",
@ -128,7 +126,7 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
async function fetchDetailInvestigate() { async function fetchDetailInvestigate() {
showLoader(); showLoader();
await http await http
.get(config.API.disciplineInvestigateById(id.value)) .get(config.API.investigateById(idInvestigate.value))
.then((res) => { .then((res) => {
const dataList = res.data.result; const dataList = res.data.result;
dataInvestigatefacts.id = dataList.id; dataInvestigatefacts.id = dataList.id;
@ -154,6 +152,10 @@ async function fetchDetailInvestigate() {
dataList.disciplineInvestigateRelevantDocs; dataList.disciplineInvestigateRelevantDocs;
dataInvestigatefacts.investigationStatusResult = dataInvestigatefacts.investigationStatusResult =
dataList.investigationStatusResult; dataList.investigationStatusResult;
dataInvestigatefacts.investigationExtendStatus =
dataList.investigationExtendStatus;
dataInvestigatefacts.investigationDaysExtend =
dataList.investigationDaysExtend;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -206,7 +208,7 @@ const dataComplaints = reactive<FormDataComplaint>({
async function fetchDetailComplaints() { async function fetchDetailComplaints() {
showLoader(); showLoader();
await http await http
.get(config.API.disciplineComplaintsById(id.value)) .get(config.API.complaintbyId(idComplaint.value))
.then((res) => { .then((res) => {
const dataList = res.data.result; const dataList = res.data.result;
dataComplaints.id = dataList.id; dataComplaints.id = dataList.id;
@ -237,6 +239,7 @@ async function fetchDetailComplaints() {
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */ /** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(async () => { onMounted(async () => {
store.tabMenu = "result";
await fetchDetailResult(); await fetchDetailResult();
}); });

View file

@ -3,10 +3,10 @@ div
import { ref, onMounted, reactive, watch } from "vue"; import { ref, onMounted, reactive, watch } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useQuasar, QForm } from "quasar"; import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import DialogAddPersonal from "@/components/Dialogs/AddPersonal.vue"; // import DialogAddPersonal from "@/components/Dialogs/AddPersonal.vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore"; import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore"; import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
@ -23,7 +23,7 @@ const mainStore = useDisciplineMainStore();
const modalPerson = ref<boolean>(false); const modalPerson = ref<boolean>(false);
const toggleModal = () => (modalPerson.value = !modalPerson.value); const toggleModal = () => (modalPerson.value = !modalPerson.value);
const investigateDis = useInvestigateDisStore(); const investigateDis = useInvestigateDisStore();
const { fecthDirector } = investigateDis; // const { fecthDirector } = investigateDis;
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
const dataStore = useDisciplineResultStore(); const dataStore = useDisciplineResultStore();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -70,7 +70,7 @@ const organizationOption = ref<DataOption[]>([]);
async function addPerson(data: any) { async function addPerson(data: any) {
await mainStore.fetchData(data); await mainStore.fetchData(data);
console.log(mainStore.rowsAdd) console.log(mainStore.rowsAdd);
toggleModal(); toggleModal();
} }
@ -114,8 +114,6 @@ function validateForm() {
} }
if (hasError.every((result) => result === true)) { if (hasError.every((result) => result === true)) {
onSubmit(); onSubmit();
} else {
console.log(hasError);
} }
} }
@ -131,6 +129,7 @@ function onSubmit() {
await http await http
.put(config.API.listResultById(id.value), formData) .put(config.API.listResultById(id.value), formData)
.then(() => { .then(() => {
isSave.value = false;
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
}) })
.catch((err) => { .catch((err) => {
@ -156,7 +155,6 @@ async function fetchDatadetail() {
watch( watch(
() => props.data, () => props.data,
async () => { async () => {
console.log('pros',props.data);
respondentType.value = props.data.respondentType; respondentType.value = props.data.respondentType;
mainStore.rowsAdd = props.data.persons; mainStore.rowsAdd = props.data.persons;
await fetchDatadetail(); await fetchDatadetail();
@ -169,12 +167,12 @@ function changeFormData() {
isSave.value = true; isSave.value = true;
} }
function deletePerson(id: string) { // function deletePerson(id: string) {
changeFormData(); // changeFormData();
const dataRow = mainStore.rowsAdd; // const dataRow = mainStore.rowsAdd;
const updatedRows = dataRow.filter((item: any) => item.id !== id); // const updatedRows = dataRow.filter((item: any) => item.id !== id);
mainStore.rowsAdd = updatedRows; // mainStore.rowsAdd = updatedRows;
} // }
/** /**
* งขอมลจำลองไปย store * งขอมลจำลองไปย store
@ -182,75 +180,88 @@ function deletePerson(id: string) {
onMounted(async () => {}); onMounted(async () => {});
</script> </script>
<template> <template>
<form @submit.prevent="validateForm"> <div class="row col-12">
<q-card> <div class="col-12">
<div class="q-pa-md"> <div v-if="isSave" class="q-pa-sm q-gutter-sm">
<div class="row col-12 q-gutter-sm"> <q-banner
<div class="col-xs-12 col-sm-2"> inline-actions
<q-select bordered
for="SelectrespondentType" class="bg-red-1 text-red border-orange"
v-model="respondentType" >
ref="respondentTypeRef" <q-icon name="mdi-information-outline" size="20px" /> แจงเตอน
dense งไมไดนทกขอม
outlined </q-banner>
label="ผู้ถูกร้องเรียน" </div>
option-value="id" <form @submit.prevent="validateForm">
option-label="name" <q-card>
emit-value <div class="q-pa-md">
use-input <div class="row col-12 q-gutter-sm">
map-options <div class="col-xs-12 col-sm-2">
hide-bottom-space <q-select
:options="dataStore.complainantoptions" readonly
:rules="[(val) => !!val || `${'กรุณาเลือกผู้ร้องเรียน'}`]" for="SelectrespondentType"
lazy-rules v-model="respondentType"
@update:model-value="selectComplainant(respondentType)" ref="respondentTypeRef"
@filter="(inputValue: any, dense
outlined
label="ผู้ถูกร้องเรียน"
option-value="id"
option-label="name"
emit-value
use-input
map-options
hide-bottom-space
:options="dataStore.complainantoptions"
:rules="[(val) => !!val || `${'กรุณาเลือกผู้ร้องเรียน'}`]"
lazy-rules
@update:model-value="selectComplainant(respondentType)"
@filter="(inputValue: any,
doneFn: Function) => dataStore.filterSelector(inputValue, doneFn, 'filterrespondentType' doneFn: Function) => dataStore.filterSelector(inputValue, doneFn, 'filterrespondentType'
)" )"
> >
<template v-slot:no-option> <template v-slot:no-option>
<q-item> <q-item>
<q-item-section class="text-grey"> <q-item-section class="text-grey">
ไมอม ไมอม
</q-item-section> </q-item-section>
</q-item> </q-item>
</template> </template>
</q-select> </q-select>
</div> </div>
<div
class="col-xs-12 col-sm-3"
v-if="respondentType === 'ORGANIZATION'"
id="organizationId"
>
<q-select
for="inputOffice"
name="organizationId"
ref="organizationIdRef"
dense
hide-bottom-space
outlined
option-label="name"
option-value="id"
emit-value
map-options
v-model="organizationId"
:options="organizationOption"
label="เลือกสำนักงาน"
:rules="[(val) => !!val || `${'กรุณาเลือกสำนักงาน'}`]"
lazy-rules
/>
</div>
<div class="row col-12" v-if="respondentType === 'PERSON'">
<q-card
bordered
class="row col-12"
style="border: 1px solid #d6dee1"
>
<div <div
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md" class="col-xs-12 col-sm-3"
v-if="respondentType === 'ORGANIZATION'"
id="organizationId"
> >
กรองเรยน <q-select
<q-btn for="inputOffice"
name="organizationId"
ref="organizationIdRef"
dense
hide-bottom-space
outlined
option-label="name"
option-value="id"
emit-value
map-options
v-model="organizationId"
:options="organizationOption"
label="เลือกสำนักงาน"
:rules="[(val) => !!val || `${'กรุณาเลือกสำนักงาน'}`]"
lazy-rules
/>
</div>
<div class="row col-12" v-if="respondentType === 'PERSON'">
<q-card
bordered
class="row col-12"
style="border: 1px solid #d6dee1"
>
<div
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
>
กรองเรยน
<!-- <q-btn
v-if="!isReadonly" v-if="!isReadonly"
size="12px" size="12px"
flat flat
@ -262,72 +273,74 @@ onMounted(async () => {});
icon="mdi-plus" icon="mdi-plus"
> >
<q-tooltip>เพมผกรองเรยน</q-tooltip> <q-tooltip>เพมผกรองเรยน</q-tooltip>
</q-btn> </q-btn> -->
</div> </div>
<div class="col-12"><q-separator /></div> <div class="col-12"><q-separator /></div>
<div class="col-xs-12 q-pa-sm"> <div class="col-xs-12 q-pa-sm">
<d-table <d-table
ref="table" ref="table"
:columns="mainStore.columnsRespondent" :columns="mainStore.columnsRespondent"
:rows="mainStore.rowsAdd" :rows="mainStore.rowsAdd"
row-key="idcard" row-key="idcard"
flat flat
bordered bordered
:paging="true" :paging="true"
dense dense
class="custom-header-table" class="custom-header-table"
:visible-columns="mainStore.visibleColumnsRespondent" :visible-columns="mainStore.visibleColumnsRespondent"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
<q-th <q-th
v-for="col in props.cols" v-for="col in props.cols"
:key="col.name" :key="col.name"
:props="props" :props="props"
style="color: #000000; font-weight: 500" style="color: #000000; font-weight: 500"
>
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width></q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'info'">
<q-btn
size="14px"
flat
round
dense
color="info"
icon="info"
@click="
router.push(`/registry/${props.row.personId}`)
"
><q-tooltip
>อมลในทะเบยนประว</q-tooltip
></q-btn
> >
</div> <span class="text-weight-medium">{{
<div col.label
v-else-if="col.name === 'organization'" }}</span>
class="table_ellipsis" </q-th>
> <!-- <q-th auto-width></q-th> -->
{{ props.row.organization }} </q-tr>
</div> </template>
<div v-else> <template v-slot:body="props">
{{ col.value }} <q-tr :props="props" class="cursor-pointer">
</div> <q-td
</q-td> v-for="col in props.cols"
<q-td auto-width> :key="col.name"
:props="props"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'info'">
<q-btn
size="14px"
flat
round
dense
color="info"
icon="info"
@click="
router.push(`/registry/${props.row.personId}`)
"
><q-tooltip
>อมลในทะเบยนประว</q-tooltip
></q-btn
>
</div>
<div
v-else-if="col.name === 'organization'"
class="table_ellipsis"
>
{{ props.row.organization }}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
<!-- <q-td auto-width>
<q-btn <q-btn
v-if="!isReadonly" v-if="!isReadonly"
size="12px" size="12px"
@ -340,42 +353,43 @@ onMounted(async () => {});
@click="deletePerson(props.row.id)" @click="deletePerson(props.row.id)"
><q-tooltip>ลบผกรองเรยน</q-tooltip></q-btn ><q-tooltip>ลบผกรองเรยน</q-tooltip></q-btn
> >
</q-td> </q-td> -->
</q-tr> </q-tr>
</template> </template>
</d-table> </d-table>
</div>
</q-card>
</div> </div>
</q-card> <q-input
type="textarea"
class="col-12"
dense
outlined
ref="detailRef"
v-model="formData.resultDescription"
for="#detail"
label="สรุปผลการพิจารณา"
hide-bottom-space
:rules="[(val) => !!val || `${'กรุณากรอกกรณีมีความผิด'}`]"
lazy-rules
@update:model-value="changeFormData()"
/>
</div>
</div> </div>
<q-input <q-separator />
type="textarea" <div class="row col-12 q-pa-sm">
class="col-12" <q-space />
dense <q-btn
outlined for="ButtonOnSubmit"
ref="detailRef" id="formSubmit"
v-model="formData.resultDescription" color="secondary"
for="#detail" label="บันทึก"
label="สรุปผลการพิจารณา" type="submit"
hide-bottom-space ><q-tooltip>บทกขอม</q-tooltip></q-btn
:rules="[(val) => !!val || `${'กรุณากรอกกรณีมีความผิด'}`]" >
lazy-rules </div>
/> </q-card>
</div> <!-- <DialogAddPersonal
</div>
<q-separator />
<div class="row col-12 q-pa-sm">
<q-space />
<q-btn
for="ButtonOnSubmit"
id="formSubmit"
color="secondary"
label="บันทึก"
type="submit"
><q-tooltip>บทกขอม</q-tooltip></q-btn
>
</div>
</q-card>
<DialogAddPersonal
title="ผู้ถูกร้องเรียน" title="ผู้ถูกร้องเรียน"
:mainData="mainStore.rowsAdd" :mainData="mainStore.rowsAdd"
:modal="modalPerson" :modal="modalPerson"
@ -383,6 +397,8 @@ onMounted(async () => {});
:close="toggleModal" :close="toggleModal"
:save="addPerson" :save="addPerson"
@returnData="handleSave" @returnData="handleSave"
/> /> -->
</form> </form>
</div>
</div>
</template> </template>

View file

@ -125,12 +125,12 @@ const updateInput = (value: any) => {
const Reset = () => { const Reset = () => {
emit("update:filterKeyword2", ""); emit("update:filterKeyword2", "");
}; };
watch([()=>props.modal],() => { // watch([()=>props.modal],() => {
selected.value = props.modal ? [] : []; // selected.value = props.modal ? [] : [];
if (props.modal === true) { // if (props.modal === true) {
selected.value = props.rows2; // selected.value = props.rows2;
} // }
}); // });
</script> </script>
<template> <template>
<q-dialog v-model="props.modal"> <q-dialog v-model="props.modal">

View file

@ -9,7 +9,6 @@ import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import DialogSendToCommand from "@/modules/11_discipline/components/7_ListSuspend/DialogSendToCommand.vue"; import DialogSendToCommand from "@/modules/11_discipline/components/7_ListSuspend/DialogSendToCommand.vue";
import type { dataType } from '@/modules/11_discipline/interface/response/suspend' import type { dataType } from '@/modules/11_discipline/interface/response/suspend'
import type { ResponseData } from "@/modules/06_retirement/interface/response/out";
import { useDisciplineSuspendStore } from "@/modules/11_discipline/store/SuspendStore"; import { useDisciplineSuspendStore } from "@/modules/11_discipline/store/SuspendStore";
/** use */ /** use */