api สอบสวน

This commit is contained in:
setthawutttty 2023-11-29 11:42:53 +07:00
parent a211c3dabb
commit a27f1e450c
7 changed files with 482 additions and 208 deletions

View file

@ -2,23 +2,25 @@
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 Popup from "@/modules/11_discipline/components/1_Complaint/Popup.vue";
/**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 { FormData } from "@/modules/11_discipline/interface/request/disciplinary";
import type {
FormData,
PersonsArray,
} from "@/modules/11_discipline/interface/request/disciplinary";
import type {
FormData as FormDataComplaint,
ArrayPerson,
ArrayFileList,
} from "@/modules/11_discipline/interface/request/complaint";
import type {
FormData as FormInvestigateFact,
} from "@/modules/11_discipline/interface/request/investigateFact";
import type { FormData as FormInvestigateFact } from "@/modules/11_discipline/interface/request/investigateFact";
/**import store*/
import { useCounterMixin } from "@/stores/mixin";
@ -31,9 +33,10 @@ const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin;
const router = useRouter();
const route = useRoute();
const modalPopup = ref<boolean>(false);
const id = ref<string>(route.params.id as string);
const data = ref<object>();
const status = ref<string>("")
const status = ref<string>("");
/** function fetchData สอบสวนความผิดทางวินัย*/
async function fetchDetailDisciplinary() {
@ -42,7 +45,7 @@ async function fetchDetailDisciplinary() {
.get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => {
data.value = res.data.result;
status.value = res.data.result.status
status.value = res.data.result.status;
})
.catch((err) => {
messageError($q, err);
@ -64,18 +67,24 @@ async function fetchDetailInvestigate() {
dataInvestigatefacts.respondentType = dataList.respondentType;
dataInvestigatefacts.persons = dataList.persons;
dataInvestigatefacts.investigationDetail = dataList.investigationDetail;
dataInvestigatefacts.investigationDetailOther = dataList.investigationDetailOther;
dataInvestigatefacts.investigationDateStart = dataList.investigationDateStart;
dataInvestigatefacts.investigationDetailOther =
dataList.investigationDetailOther;
dataInvestigatefacts.investigationDateStart =
dataList.investigationDateStart;
dataInvestigatefacts.investigationDateEnd = dataList.investigationDateEnd;
dataInvestigatefacts.investigationDescription = dataList.investigationDescription;
dataInvestigatefacts.investigationCauseText = dataList.investigationCauseText;
dataInvestigatefacts.investigationDescription =
dataList.investigationDescription;
dataInvestigatefacts.investigationCauseText =
dataList.investigationCauseText;
dataInvestigatefacts.status = dataList.status;
dataInvestigatefacts.result = dataList.result;
dataInvestigatefacts.directors = dataList.director;
dataInvestigatefacts.disciplineInvestigateDocs = dataList.disciplineInvestigateDocs;
dataInvestigatefacts.disciplineInvestigateDocs =
dataList.disciplineInvestigateDocs;
dataInvestigatefacts.disciplineInvestigateRelevantDocs =
dataList.disciplineInvestigateRelevantDocs;
dataInvestigatefacts.investigationStatusResult = dataList.investigationStatusResult;
dataInvestigatefacts.investigationStatusResult =
dataList.investigationStatusResult;
})
.catch((err) => {
messageError($q, err);
@ -155,12 +164,25 @@ const onSubmit = async (id: string) => {
/** ยืนยัน ส่งไปออกคำสั่ง */
function sentIssue() {
dialogConfirm(
$q,
() => confirmSentIssue(),
"ยืนยันส่งไปสรุปผลการพิจารณา",
"ต้องการยืนยันส่งไปสรุปผลการพิจารณาใช่หรือไม่?"
);
console.log("sent");
modalPopup.value = true;
}
function sentIssueGate() {
dialogConfirm($q, () => confirmSentIssueGate(),'ยืนยันส่งไปสรุปผลการพิจารณา','ต้องการยืนยันส่งไปสรุปผลการพิจารณาใช่หรือไม่?');
}
function confirmSentIssueGate() {
showLoader()
http
.get(config.API.disciplinaryApprove(id.value))
.then((res) => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fetchDetailDisciplinary();
});
}
/** ยืนยัน ยุติเรื่อง */
@ -186,16 +208,41 @@ function cancelInvestigate() {
/** ฟังชั่น ส่งไปออกคำสั่ง*/
function confirmSentIssue() {
console.log("sent");
modalPopup.value = true;
}
/** ฟังชั่น ยุติเรื่อง*/
function confirmEndInvestigate() {
console.log("sent");
showLoader();
http
.get(config.API.disciplinaryReject(id.value))
.then((res) => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fetchDetailDisciplinary();
});
}
/** ฟังชั่น ยกเลิกการยุติเรื่อง*/
function confirmCancelInvestigate() {
console.log("sent");
showLoader();
http
.get(config.API.disciplinaryResume(id.value))
.then((res) => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fetchDetailDisciplinary();
});
}
function closePopup() {
modalPopup.value = false;
}
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
@ -243,6 +290,125 @@ const fileListObjComplaint = reactive<ArrayFileList>({
fileName: "",
});
function emitPerson(data: PersonsArray[]) {
console.log(data);
// const dataMapId = data.map((item: PersonsArray) => item.id);
// console.log(dataMapId);
// showLoader();
// http
// .put(config.API.investigateApprove(id.value), {
// persons: dataMapId,
// })
// .then((res) => {
// // router.push(`/discipline/investigatefacts`);
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// fetchDetailDisciplinary();
// });
}
/** หัวตาราง */
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: "",
@ -314,7 +480,7 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
v-if="status === 'NEW'"
label="ส่งไปสรุปผลการพิจารณา"
color="public"
@click="sentIssue"
@click="sentIssueGate"
/>
<q-btn
v-if="status === 'NEW'"
@ -358,7 +524,10 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
<FormComplaints :on-submit="onSubmit" :data="dataComplaints" />
</q-tab-panel>
<q-tab-panel name="investigatefacts">
<FormInvestigatefacts :on-submit="onSubmit" :data="dataInvestigatefacts" />
<FormInvestigatefacts
:on-submit="onSubmit"
:data="dataInvestigatefacts"
/>
</q-tab-panel>
<q-tab-panel name="disciplinary">
<FormDisciplinary
@ -371,6 +540,16 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
</q-tab-panels>
</q-card>
</div>
<Popup
:modal="modalPopup"
:close="closePopup"
title="ส่งไปพักราชการ"
:rows="store.rowSent"
:columns="columns"
:visibleColumns="visibleColumns"
@return-person="emitPerson"
/>
</template>
<style scoped>