2023-11-07 09:52:03 +07:00
|
|
|
<script setup lang="ts">
|
2023-11-24 14:49:51 +07:00
|
|
|
import { onMounted, reactive, ref, watch } from "vue";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
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"; //สืบสวนข้อเท็จจริง
|
|
|
|
|
import FormDisciplinary from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue"; // สอบสวนความผิดทางวินัย
|
2023-11-07 09:52:03 +07:00
|
|
|
import type { FormData } from "@/modules/11_discipline/interface/request/disciplinary";
|
|
|
|
|
import { useRouter, useRoute } from "vue-router";
|
2023-11-21 10:29:11 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
2023-11-22 11:26:10 +07:00
|
|
|
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
|
2023-11-21 10:29:11 +07:00
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
const $q = useQuasar();
|
|
|
|
|
const mixin = useCounterMixin();
|
2023-11-22 11:26:10 +07:00
|
|
|
const store = useInvestigateDisStore();
|
2023-11-27 16:30:14 +07:00
|
|
|
const { dialogConfirm, success } = mixin;
|
2023-11-07 09:52:03 +07:00
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const id = ref<string>(route.params.id as string);
|
|
|
|
|
|
2023-11-10 15:32:11 +07:00
|
|
|
/** ข้อมูล v-model ของฟอร์ม */
|
2023-11-27 16:30:14 +07:00
|
|
|
// const data = reactive<FormData>({
|
|
|
|
|
// complaint: "",
|
|
|
|
|
// respondentType: "",
|
|
|
|
|
// dateInvestigate: null,
|
|
|
|
|
// dateAllegation: null,
|
|
|
|
|
// dateEvident: null,
|
|
|
|
|
// casefault: "",
|
|
|
|
|
// typefault: "",
|
|
|
|
|
// faultLevel: "",
|
|
|
|
|
// refLaw: "",
|
|
|
|
|
// detailComplaint: "",
|
|
|
|
|
// whereInvestigate: "",
|
|
|
|
|
// trueDetail: "",
|
|
|
|
|
// evidence: "",
|
|
|
|
|
// recordAccuser: "",
|
|
|
|
|
// witnesses: "",
|
|
|
|
|
// InvestResults: "",
|
|
|
|
|
// filesEvidence: null,
|
|
|
|
|
// filesRecordAccuser: null,
|
|
|
|
|
// filesWitnesses: null,
|
|
|
|
|
// filesEtc: null,
|
|
|
|
|
// complaintStatus: "NEW",
|
|
|
|
|
// organizationId: "",
|
|
|
|
|
// consideredAgency: "",
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
const data = ref<object>();
|
2023-11-10 15:32:11 +07:00
|
|
|
|
2023-11-27 16:30:14 +07:00
|
|
|
/** function fetchData สอบสวนคาวมผิดทางวินัย*/
|
2023-11-24 14:49:51 +07:00
|
|
|
async function fetchDetailDisciplinary() {
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.disciplineDisciplinaryById(id.value))
|
|
|
|
|
.then((res) => {
|
2023-11-27 16:30:14 +07:00
|
|
|
data.value = res.data.result;
|
2023-11-24 14:49:51 +07:00
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-27 16:30:14 +07:00
|
|
|
/** function fetchData สืบสวนข้อเท็จจริง*/
|
2023-11-24 14:49:51 +07:00
|
|
|
async function fetchDetailInvestigate() {
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.disciplineInvestigateById(id.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-27 16:30:14 +07:00
|
|
|
/** function fetchData เรื่องร้องเรียน*/
|
2023-11-24 14:49:51 +07:00
|
|
|
async function fetchDetailComplaints() {
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.disciplineComplaintsById(id.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-27 16:30:14 +07:00
|
|
|
async function onSubmitDisciplinary(data: any) {
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
|
|
await http
|
|
|
|
|
.put(config.API.disciplineDisciplinaryById(id.value), data)
|
|
|
|
|
.then(() => {
|
|
|
|
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {})
|
|
|
|
|
.finally(async () => {
|
|
|
|
|
await fetchDetailDisciplinary();
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-11-07 09:52:03 +07:00
|
|
|
|
2023-11-10 15:32:11 +07:00
|
|
|
/**
|
|
|
|
|
* บันทึกข้อมูลที่เเก้ไข
|
|
|
|
|
* @param id ระบุ บุคคล
|
|
|
|
|
*/
|
2023-11-21 10:29:11 +07:00
|
|
|
const onSubmit = async (id: string) => {
|
2023-11-07 09:52:03 +07:00
|
|
|
console.log("edit");
|
|
|
|
|
router.push(`/discipline/disciplinary`);
|
|
|
|
|
};
|
2023-11-10 15:32:11 +07:00
|
|
|
|
2023-11-21 10:29:11 +07:00
|
|
|
/** ยืนยัน ส่งไปออกคำสั่ง */
|
|
|
|
|
function sentIssue() {
|
|
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
() => confirmSentIssue(),
|
|
|
|
|
"ยืนยันส่งไปออกคำสั่ง",
|
|
|
|
|
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-21 13:02:34 +07:00
|
|
|
/** ยืนยัน ยุติเรื่อง */
|
|
|
|
|
function endInvestigate() {
|
|
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
() => confirmEndInvestigate(),
|
|
|
|
|
"ยืนยันยุติเรื่อง",
|
|
|
|
|
"ต้องการยืนยันยุติเรื่องใช่หรือไม่?"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ยืนยัน ยกเลิกการยุติเรื่อง */
|
|
|
|
|
function cancelInvestigate() {
|
|
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
() => confirmCancelInvestigate(),
|
|
|
|
|
"ยืนยันยกเลิกการยุติเรื่อง",
|
|
|
|
|
"ต้องการยืนยันยกเลิกการยุติเรื่องใช่หรือไม่?"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-21 10:29:11 +07:00
|
|
|
/** ฟังชั่น ส่งไปออกคำสั่ง*/
|
|
|
|
|
function confirmSentIssue() {
|
|
|
|
|
console.log("sent");
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-21 13:02:34 +07:00
|
|
|
/** ฟังชั่น ยุติเรื่อง*/
|
|
|
|
|
function confirmEndInvestigate() {
|
|
|
|
|
console.log("sent");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ฟังชั่น ยกเลิกการยุติเรื่อง*/
|
|
|
|
|
function confirmCancelInvestigate() {
|
|
|
|
|
console.log("sent");
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-10 15:32:11 +07:00
|
|
|
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
|
2023-11-22 11:26:10 +07:00
|
|
|
onMounted(async () => {
|
2023-11-27 16:30:14 +07:00
|
|
|
store.tabMenu = "disciplinary";
|
2023-11-24 14:49:51 +07:00
|
|
|
await fetchDetailDisciplinary();
|
2023-11-10 15:32:11 +07:00
|
|
|
});
|
2023-11-24 14:49:51 +07:00
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => store.tabMenu,
|
|
|
|
|
async () => {
|
|
|
|
|
const fetchFunction =
|
|
|
|
|
store.tabMenu === "disciplinary"
|
|
|
|
|
? fetchDetailDisciplinary
|
|
|
|
|
: store.tabMenu === "investigatefacts"
|
|
|
|
|
? fetchDetailInvestigate
|
|
|
|
|
: store.tabMenu === "complaints"
|
|
|
|
|
? fetchDetailComplaints
|
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
if (fetchFunction) {
|
|
|
|
|
await fetchFunction();
|
|
|
|
|
}
|
|
|
|
|
// if (store.tabMenu === "disciplinary") {
|
|
|
|
|
// await fetchDetailDisciplinary();
|
|
|
|
|
// } else if (store.tabMenu === "investigatefacts") {
|
|
|
|
|
// await fetchDetailInvestigate();
|
|
|
|
|
// } else if (store.tabMenu === "complaints") await fetchDetailComplaints();
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-11-07 09:52:03 +07:00
|
|
|
</script>
|
|
|
|
|
<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/disciplinary`)"
|
|
|
|
|
/>
|
2023-11-24 16:52:10 +07:00
|
|
|
<div class="q-ma-none">แก้ไขการสอบสวนความผิดทางวินัย</div>
|
2023-11-21 10:29:11 +07:00
|
|
|
<q-space />
|
|
|
|
|
<div class="q-gutter-x-sm">
|
2023-11-27 16:30:14 +07:00
|
|
|
<!-- <q-btn
|
2023-11-22 11:26:10 +07:00
|
|
|
v-if="data.complaintStatus === 'NEW'"
|
2023-11-24 16:52:10 +07:00
|
|
|
label="ส่งไปสรุปผลการพิจารณา"
|
2023-11-22 11:26:10 +07:00
|
|
|
color="public"
|
|
|
|
|
@click="sentIssue"
|
|
|
|
|
/>
|
2023-11-21 13:02:34 +07:00
|
|
|
<q-btn
|
|
|
|
|
v-if="data.complaintStatus === 'NEW'"
|
|
|
|
|
label="ยุติเรื่อง"
|
|
|
|
|
color="red-7"
|
|
|
|
|
@click="endInvestigate"
|
|
|
|
|
/>
|
|
|
|
|
<q-btn
|
|
|
|
|
v-if="data.complaintStatus === 'STOP'"
|
|
|
|
|
label="ยกเลิกการยุติเรื่อง"
|
|
|
|
|
color="red-7"
|
|
|
|
|
@click="cancelInvestigate"
|
2023-11-27 16:30:14 +07:00
|
|
|
/> -->
|
2023-11-21 10:29:11 +07:00
|
|
|
</div>
|
2023-11-07 09:52:03 +07:00
|
|
|
</div>
|
2023-11-24 14:49:51 +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-tab name="disciplinary" label="สอบสวนความผิดทางวินัย" />
|
|
|
|
|
</q-tabs>
|
|
|
|
|
<q-separator />
|
|
|
|
|
<q-tab-panels v-model="store.tabMenu" animated>
|
|
|
|
|
<q-tab-panel name="complaints">
|
2023-11-22 15:23:21 +07:00
|
|
|
<FormComplaints :on-submit="onSubmit" :data="data" />
|
2023-11-22 11:26:10 +07:00
|
|
|
</q-tab-panel>
|
|
|
|
|
<q-tab-panel name="investigatefacts">
|
2023-11-22 15:23:21 +07:00
|
|
|
<FormInvestigatefacts :on-submit="onSubmit" :data="data" />
|
2023-11-22 11:26:10 +07:00
|
|
|
</q-tab-panel>
|
|
|
|
|
<q-tab-panel name="disciplinary">
|
2023-11-27 16:30:14 +07:00
|
|
|
<FormDisciplinary
|
|
|
|
|
:on-submit="onSubmit"
|
|
|
|
|
:data="data"
|
|
|
|
|
@submit:disciplinary="onSubmitDisciplinary"
|
2023-11-27 17:34:51 +07:00
|
|
|
:fetchData="fetchDetailDisciplinary"
|
2023-11-27 16:30:14 +07:00
|
|
|
/>
|
2023-11-22 11:26:10 +07:00
|
|
|
</q-tab-panel>
|
|
|
|
|
</q-tab-panels>
|
|
|
|
|
</q-card>
|
|
|
|
|
<!-- <Form :on-submit="onSubmit" :data="data" /> -->
|
2023-11-07 09:52:03 +07:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-11-22 15:23:21 +07:00
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.q-tab-panel {
|
|
|
|
|
padding: 0;
|
|
|
|
|
background-color: #f0f3f3;
|
|
|
|
|
}
|
|
|
|
|
</style>
|