2023-11-06 15:13:36 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, reactive, ref } from "vue";
|
2023-11-22 11:26:10 +07:00
|
|
|
import FormComplaints from "@/modules/11_discipline/components/1_Complaint/Form.vue"; //เรื่องร้องเรียน
|
|
|
|
|
import FormInvestigatefacts from "@/modules/11_discipline/components/2_InvestigateFacts/Form.vue"; //สืบสวนข้อเท็จจริง
|
2023-11-06 15:13:36 +07:00
|
|
|
import { useRouter, useRoute } from "vue-router";
|
2023-11-21 12:53:05 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
2023-11-22 11:26:10 +07:00
|
|
|
import { useInvestigateFactStore } from "@/modules/11_discipline/store/InvestigateFactStore";
|
2023-11-21 10:29:11 +07:00
|
|
|
import { useQuasar } from "quasar";
|
2023-11-23 15:47:14 +07:00
|
|
|
import Popup from "@/modules/11_discipline/components/1_Complaint/Popup.vue";
|
|
|
|
|
import type { FormData } from "@/modules/11_discipline/interface/request/investigateFact";
|
2023-11-24 17:49:25 +07:00
|
|
|
import config from "@/app.config";
|
|
|
|
|
import http from "@/plugins/http";
|
2023-11-06 15:13:36 +07:00
|
|
|
|
2023-11-21 12:53:05 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
const mixin = useCounterMixin();
|
2023-11-22 11:26:10 +07:00
|
|
|
const store = useInvestigateFactStore();
|
2023-11-24 17:49:25 +07:00
|
|
|
const { dialogConfirm, showLoader, success, hideLoader, messageError } = mixin;
|
2023-11-06 15:13:36 +07:00
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const id = ref<string>(route.params.id as string);
|
|
|
|
|
|
2023-11-10 13:35:26 +07:00
|
|
|
/** ข้อมูล v-model ของฟอร์ม */
|
2023-11-06 15:13:36 +07:00
|
|
|
const data = reactive<FormData>({
|
2023-11-24 17:49:25 +07:00
|
|
|
id: "",
|
|
|
|
|
idComplaint: "",
|
|
|
|
|
investigationDetail: "",
|
2023-11-06 15:13:36 +07:00
|
|
|
complaint: "",
|
|
|
|
|
complaintdetail: "",
|
2023-11-24 17:49:25 +07:00
|
|
|
investigationDescription: "",
|
2023-11-06 15:13:36 +07:00
|
|
|
fault: "",
|
2023-11-24 17:49:25 +07:00
|
|
|
investigationDetailOther: "",
|
2023-11-06 15:13:36 +07:00
|
|
|
evidenceFiles: null,
|
|
|
|
|
fileComplaint: null,
|
|
|
|
|
clickTime: false,
|
2023-11-24 17:49:25 +07:00
|
|
|
investigationDateStart: null,
|
|
|
|
|
investigationDateEnd: null,
|
2023-11-08 15:25:01 +07:00
|
|
|
daysExtend: null,
|
2023-11-24 17:49:25 +07:00
|
|
|
investigationStatusResult: "",
|
|
|
|
|
investigationCauseText: "",
|
2023-11-23 15:47:14 +07:00
|
|
|
complaintStatus: "",
|
2023-11-24 17:49:25 +07:00
|
|
|
result: "",
|
|
|
|
|
directors: [],
|
|
|
|
|
disciplineInvestigateDocs: [],
|
|
|
|
|
disciplineInvestigateRelevantDocs: [],
|
|
|
|
|
status: "",
|
|
|
|
|
documentFile: null,
|
|
|
|
|
respondentType: "",
|
|
|
|
|
organizationId: "",
|
|
|
|
|
persons:[]
|
2023-11-06 15:13:36 +07:00
|
|
|
});
|
2023-11-08 15:25:01 +07:00
|
|
|
|
2023-11-24 17:49:25 +07:00
|
|
|
function getData() {
|
|
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(config.API.investigateById(id.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res.data.result);
|
|
|
|
|
const dataList = res.data.result;
|
|
|
|
|
data.id = dataList.id;
|
|
|
|
|
data.idComplaint = dataList.idComplaint;
|
|
|
|
|
data.respondentType = dataList.respondentType
|
|
|
|
|
data.persons = dataList.persons
|
|
|
|
|
data.investigationDetail = dataList.investigationDetail;
|
|
|
|
|
data.investigationDetailOther = dataList.investigationDetailOther;
|
|
|
|
|
data.investigationDateStart = dataList.investigationDateStart;
|
|
|
|
|
data.investigationDateEnd = dataList.investigationDateEnd;
|
|
|
|
|
data.investigationDescription = dataList.investigationDescription;
|
|
|
|
|
data.investigationCauseText = dataList.investigationCauseText;
|
|
|
|
|
data.status = dataList.status;
|
|
|
|
|
data.result = dataList.result;
|
|
|
|
|
data.directors = dataList.director;
|
|
|
|
|
data.disciplineInvestigateDocs = dataList.disciplineInvestigateDocs;
|
|
|
|
|
data.disciplineInvestigateRelevantDocs =
|
|
|
|
|
dataList.disciplineInvestigateRelevantDocs;
|
|
|
|
|
data.investigationStatusResult = dataList.investigationStatusResult;
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-11-06 15:13:36 +07:00
|
|
|
|
2023-11-10 13:35:26 +07:00
|
|
|
/**
|
|
|
|
|
* บันทึกข้อมูลที่เเก้ไข
|
|
|
|
|
* @param id ระบุ บุคคล
|
|
|
|
|
*/
|
2023-11-24 17:49:25 +07:00
|
|
|
async function onSubmit(data: any) {
|
2023-11-06 15:13:36 +07:00
|
|
|
// put
|
2023-11-24 17:49:25 +07:00
|
|
|
console.log("edit", data);
|
|
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.put(config.API.investigateById(id.value), data)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
|
|
|
// router.push(`/discipline/complaints`);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(async () => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
// router.push(`/discipline/investigatefacts`);
|
2023-11-21 12:53:05 +07:00
|
|
|
}
|
2023-11-10 13:35:26 +07:00
|
|
|
|
2023-11-23 15:47:14 +07:00
|
|
|
const modalPopup = ref<boolean>(false);
|
2023-11-21 10:29:11 +07:00
|
|
|
/** ยืนยัน ส่งไปสอบสวน */
|
2023-11-21 12:53:05 +07:00
|
|
|
function sentInvestigate() {
|
2023-11-23 15:47:14 +07:00
|
|
|
modalPopup.value = true;
|
|
|
|
|
// dialogConfirm(
|
|
|
|
|
// $q,
|
|
|
|
|
// () => confirmSentInvestigate(),
|
|
|
|
|
// "ยืนยันส่งไปสอบสวน",
|
|
|
|
|
// "ต้องการยืนยันส่งไปสอบสวนใช่หรือไม่?"
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closePopup() {
|
|
|
|
|
modalPopup.value = false;
|
2023-11-21 12:53:05 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ยืนยัน ยุติเรื่อง */
|
|
|
|
|
function endInvestigate() {
|
|
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
() => confirmEndInvestigate(),
|
|
|
|
|
"ยืนยันยุติเรื่อง",
|
|
|
|
|
"ต้องการยืนยันยุติเรื่องใช่หรือไม่?"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ยืนยัน ยกเลิกการยุติเรื่อง */
|
|
|
|
|
function cancelInvestigate() {
|
|
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
() => confirmCancelInvestigate(),
|
|
|
|
|
"ยืนยันยกเลิกการยุติเรื่อง",
|
|
|
|
|
"ต้องการยืนยันยกเลิกการยุติเรื่องใช่หรือไม่?"
|
|
|
|
|
);
|
2023-11-21 10:29:11 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ฟังชั่น ส่งไปสอบสวน*/
|
2023-11-21 12:53:05 +07:00
|
|
|
function confirmSentInvestigate() {
|
|
|
|
|
console.log("sent");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ฟังชั่น ยุติเรื่อง*/
|
|
|
|
|
function confirmEndInvestigate() {
|
2023-11-24 17:49:25 +07:00
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(config.API.investigateReject(id.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(async () => {
|
|
|
|
|
await getData();
|
|
|
|
|
});
|
2023-11-21 12:53:05 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ฟังชั่น ยกเลิกการยุติเรื่อง*/
|
|
|
|
|
function confirmCancelInvestigate() {
|
2023-11-24 17:49:25 +07:00
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(config.API.investigateResume(id.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
getData();
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
2023-11-21 10:29:11 +07:00
|
|
|
}
|
|
|
|
|
|
2023-11-24 17:49:25 +07:00
|
|
|
|
2023-11-10 13:35:26 +07:00
|
|
|
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
|
|
|
|
|
onMounted(() => {
|
2023-11-24 17:49:25 +07:00
|
|
|
getData();
|
2023-11-10 13:35:26 +07:00
|
|
|
});
|
2023-11-06 15:13:36 +07:00
|
|
|
</script>
|
2023-11-08 15:25:01 +07:00
|
|
|
|
2023-11-06 15:13:36 +07:00
|
|
|
<template>
|
|
|
|
|
<div class="col-xs-12 col-sm-12 col-md-11">
|
|
|
|
|
<div class="toptitle col-12 row items-center">
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-arrow-left"
|
|
|
|
|
unelevated
|
|
|
|
|
round
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
color="primary"
|
|
|
|
|
class="q-mr-sm"
|
|
|
|
|
@click="$router.push(`/discipline/investigatefacts`)"
|
|
|
|
|
/>
|
2023-11-24 17:49:25 +07:00
|
|
|
<div class="q-ma-none">แก้ไขรายการสืบสวนข้อเท็จจริง</div>
|
2023-11-16 16:02:18 +07:00
|
|
|
<q-space />
|
|
|
|
|
<div class="q-gutter-x-sm">
|
|
|
|
|
<q-btn
|
2023-11-24 17:49:25 +07:00
|
|
|
v-if="data.status === 'NEW'"
|
2023-11-21 10:29:11 +07:00
|
|
|
label="ส่งไปสอบสวน"
|
2023-11-16 16:02:18 +07:00
|
|
|
color="public"
|
2023-11-21 10:29:11 +07:00
|
|
|
@click="sentInvestigate"
|
2023-11-16 16:02:18 +07:00
|
|
|
/>
|
2023-11-21 12:53:05 +07:00
|
|
|
|
|
|
|
|
<q-btn
|
2023-11-24 17:49:25 +07:00
|
|
|
v-if="data.status === 'NEW'"
|
2023-11-21 12:53:05 +07:00
|
|
|
label="ยุติเรื่อง"
|
|
|
|
|
color="red-7"
|
|
|
|
|
@click="endInvestigate"
|
|
|
|
|
/>
|
|
|
|
|
<q-btn
|
2023-11-24 17:49:25 +07:00
|
|
|
v-if="data.status === 'STOP'"
|
2023-11-21 12:53:05 +07:00
|
|
|
label="ยกเลิกการยุติเรื่อง"
|
|
|
|
|
color="red-7"
|
|
|
|
|
@click="cancelInvestigate"
|
|
|
|
|
/>
|
2023-11-16 16:02:18 +07:00
|
|
|
</div>
|
2023-11-06 15:13:36 +07:00
|
|
|
</div>
|
2023-11-22 16:22:53 +07:00
|
|
|
<q-card flat class="col-12">
|
2023-11-22 11:26:10 +07:00
|
|
|
<q-tabs
|
|
|
|
|
v-model="store.tabMenu"
|
|
|
|
|
dense
|
|
|
|
|
align="left"
|
|
|
|
|
inline-label
|
|
|
|
|
class="rounded-borders"
|
|
|
|
|
indicator-color="primary"
|
|
|
|
|
active-bg-color="teal-1"
|
|
|
|
|
active-class="text-primary"
|
|
|
|
|
>
|
|
|
|
|
<q-tab name="complaints" label="เรื่องร้องเรียน" />
|
|
|
|
|
<q-tab name="investigatefacts" label="สืบสวนข้อเท็จจริง" />
|
|
|
|
|
</q-tabs>
|
|
|
|
|
<q-separator />
|
|
|
|
|
<q-tab-panels v-model="store.tabMenu" animated>
|
|
|
|
|
<q-tab-panel name="complaints">
|
|
|
|
|
<FormComplaints :on-submit="onSubmit" />
|
|
|
|
|
</q-tab-panel>
|
|
|
|
|
<q-tab-panel name="investigatefacts">
|
2023-11-24 17:49:25 +07:00
|
|
|
<FormInvestigatefacts
|
|
|
|
|
:on-submit="onSubmit"
|
|
|
|
|
:data="data"
|
|
|
|
|
:get-data="getData"
|
|
|
|
|
/>
|
2023-11-22 11:26:10 +07:00
|
|
|
</q-tab-panel>
|
|
|
|
|
</q-tab-panels>
|
|
|
|
|
</q-card>
|
2023-11-06 15:13:36 +07:00
|
|
|
|
2023-11-24 17:49:25 +07:00
|
|
|
<Popup :modal="modalPopup" :close="closePopup" title="ส่งไปสอบสวน" />
|
2023-11-06 15:13:36 +07:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-11-22 16:22:53 +07:00
|
|
|
<style scoped>
|
|
|
|
|
.q-tab-panel {
|
|
|
|
|
padding: 0;
|
|
|
|
|
background-color: #f0f3f3;
|
|
|
|
|
}
|
|
|
|
|
</style>
|