ผูก API สรุปผลการพิจารณา

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-29 13:48:07 +07:00
parent e0fa2d9632
commit 4dac59a781
11 changed files with 467 additions and 117 deletions

View file

@ -14,7 +14,7 @@ export default {
/** /**
* @param id type * @param id type
*/ */
complaintListOp:()=>`${discipline}/complaint_Channel`, complaintListOp: () => `${discipline}/complaint_Channel`,
complaintChannelbyId: (id: string) => `${discipline}/complaint_Channel/${id}`, complaintChannelbyId: (id: string) => `${discipline}/complaint_Channel/${id}`,
complaintAdd: () => `${discipline}/complaint`, complaintAdd: () => `${discipline}/complaint`,
complaintbyId: (id: string) => `${discipline}/complaint/${id}`, complaintbyId: (id: string) => `${discipline}/complaint/${id}`,
@ -58,4 +58,8 @@ export default {
`${discipline}/disciplinary/${type}/file/${id}`, `${discipline}/disciplinary/${type}/file/${id}`,
disciplineByIdDoc: (type: string, id: string, docId: string) => disciplineByIdDoc: (type: string, id: string, docId: string) =>
`${discipline}/disciplinary/${type}/file/${id}/${docId}`, `${discipline}/disciplinary/${type}/file/${id}/${docId}`,
/** รายการผลการพิจารณาทางวินัย*/
listResult: () => `${discipline}/result`,
listResultById: (id: string) => `${discipline}/result/${id}`,
}; };

View file

@ -28,7 +28,7 @@ const $q = useQuasar(); //ใช้ noti quasar
/** ตัวแปร querySting*/ /** ตัวแปร querySting*/
const keyword = ref<string>(""); const keyword = ref<string>("");
const page = ref<number>(1); const page = ref<number>(1);
const rowsPerPage = ref<number>(10); const rowsPerPage = ref<number>(3);
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
const filetStatus = ref<string>("ALL"); const filetStatus = ref<string>("ALL");

View file

@ -1,10 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import FormComplaints from "@/modules/11_discipline/components/1_Complaint/Form.vue"; // import FormComplaints from "@/modules/11_discipline/components/1_Complaint/Form.vue"; //
import FormInvestigatefacts from "@/modules/11_discipline/components/2_InvestigateFacts/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 FormDisciplinary from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue"; //
import FormResult from "@/modules/11_discipline/components/4_Result/Form.vue"; // import FormResult from "@/modules/11_discipline/components/4_Result/Form.vue"; //
import type { FormData } from "@/modules/11_discipline/interface/request/result"; import type { FormData } from "@/modules/11_discipline/interface/request/result";
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 { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore"; import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
@ -14,7 +22,7 @@ import DialogSendToCommand from "@/modules/11_discipline/components/4_Result/Dia
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const store = useDisciplineResultStore(); const store = useDisciplineResultStore();
const { dialogConfirm } = mixin; const { dialogConfirm, 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);
@ -61,11 +69,201 @@ function sentIssue() {
// ); // );
} }
const dataResult = ref<Object[]>([]);
/** function เรียกรายละเอียดผลการพิจารณาทางวินัย*/
async function fetchDetailResult() {
showLoader();
await http
.get(config.API.listResultById(id.value))
.then((res) => {
dataResult.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const dataDisciplinary = ref<object>([]);
/** function เรียกรายละเอียดสอบสวนความผิดทางวินัย*/
async function fetchDetailDisciplinary() {
showLoader();
await http
.get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => {
dataDisciplinary.value = res.data.result;
// status.value = res.data.result.status;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const dataInvestigatefacts = reactive<FormInvestigateFact>({
id: "",
idComplaint: "",
investigationDetail: "",
complaint: "",
complaintdetail: "",
investigationDescription: "",
fault: "",
investigationDetailOther: "",
evidenceFiles: null,
fileComplaint: null,
clickTime: false,
investigationDateStart: null,
investigationDateEnd: null,
daysExtend: null,
investigationStatusResult: "",
investigationCauseText: "",
complaintStatus: "",
result: "",
directors: [],
disciplineInvestigateDocs: [],
disciplineInvestigateRelevantDocs: [],
status: "",
documentFile: null,
respondentType: "",
organizationId: "",
persons: [],
});
/** function เรียกรายละเอียดสืบสวนข้อเท็จจริง*/
async function fetchDetailInvestigate() {
showLoader();
await http
.get(config.API.disciplineInvestigateById(id.value))
.then((res) => {
const dataList = res.data.result;
dataInvestigatefacts.id = dataList.id;
dataInvestigatefacts.idComplaint = dataList.idComplaint;
dataInvestigatefacts.respondentType = dataList.respondentType;
dataInvestigatefacts.persons = dataList.persons;
dataInvestigatefacts.investigationDetail = dataList.investigationDetail;
dataInvestigatefacts.investigationDetailOther =
dataList.investigationDetailOther;
dataInvestigatefacts.investigationDateStart =
dataList.investigationDateStart;
dataInvestigatefacts.investigationDateEnd = dataList.investigationDateEnd;
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.disciplineInvestigateRelevantDocs =
dataList.disciplineInvestigateRelevantDocs;
dataInvestigatefacts.investigationStatusResult =
dataList.investigationStatusResult;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const personObjComplaint = reactive<ArrayPerson>({
personId: "",
idcard: "",
name: "",
prefix: "",
firstName: "",
lastName: "",
posNo: "",
position: "",
positionLevel: "",
salary: null,
organization: "",
});
const fileListObjComplaint = reactive<ArrayFileList>({
id: "",
pathName: "",
fileName: "",
});
const dataComplaints = reactive<FormDataComplaint>({
id: "",
respondentType: "",
organizationId: "",
consideredAgency: "",
title: "",
description: "",
dateReceived: null,
dateConsideration: null,
offenseDetails: "",
levelConsideration: "",
dateNotification: null,
complaintFrom: "",
appellant: "",
documentFile: null,
status: "",
persons: [personObjComplaint],
result: "",
disciplineComplaintDocs: [fileListObjComplaint],
});
/** function เรียกรายละเอียดเรื่องร้องเรียน*/
async function fetchDetailComplaints() {
showLoader();
await http
.get(config.API.disciplineComplaintsById(id.value))
.then((res) => {
const dataList = res.data.result;
dataComplaints.id = dataList.id;
dataComplaints.respondentType = dataList.respondentType;
dataComplaints.organizationId = dataList.organizationId;
dataComplaints.consideredAgency = dataList.consideredAgency;
dataComplaints.title = dataList.title;
dataComplaints.description = dataList.description;
dataComplaints.dateReceived = dataList.dateReceived;
dataComplaints.levelConsideration = dataList.levelConsideration;
dataComplaints.dateConsideration = dataList.dateConsideration;
dataComplaints.offenseDetails = dataList.offenseDetails;
dataComplaints.dateNotification = dataList.dateNotification;
dataComplaints.complaintFrom = dataList.complaintFrom;
dataComplaints.appellant = dataList.appellant;
dataComplaints.status = dataList.status;
dataComplaints.persons = dataList.persons;
dataComplaints.result = dataList.result;
dataComplaints.disciplineComplaintDocs = dataList.disciplineComplaintDocs;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */ /** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(async () => { onMounted(async () => {
store.tabMenu = "result"; await fetchDetailResult();
await fetchData();
}); });
watch(
() => store.tabMenu,
async () => {
const fetchFunction =
store.tabMenu === "disciplinary"
? fetchDetailDisciplinary
: store.tabMenu === "investigatefacts"
? fetchDetailInvestigate
: store.tabMenu === "complaints"
? fetchDetailComplaints
: store.tabMenu === "result"
? fetchDetailResult
: null;
fetchFunction && (await fetchFunction());
}
);
</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">
@ -105,16 +303,23 @@ onMounted(async () => {
<q-separator /> <q-separator />
<q-tab-panels v-model="store.tabMenu" animated> <q-tab-panels v-model="store.tabMenu" animated>
<q-tab-panel name="complaints"> <q-tab-panel name="complaints">
<FormComplaints :on-submit="onSubmit" :data="data" /> <FormComplaints :on-submit="onSubmit" :data="dataComplaints" />
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="investigatefacts"> <q-tab-panel name="investigatefacts">
<FormInvestigatefacts :on-submit="onSubmit" :data="data" /> <FormInvestigatefacts
:on-submit="onSubmit"
:data="dataInvestigatefacts"
/>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="disciplinary"> <q-tab-panel name="disciplinary">
<FormDisciplinary :on-submit="onSubmit" :data="data" /> <FormDisciplinary :on-submit="onSubmit" :data="dataDisciplinary" />
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="result"> <q-tab-panel name="result">
<FormResult :on-submit="onSubmit" :data="data" /> <FormResult
:on-submit="onSubmit"
:data="dataResult"
:fetchData="fetchDetailResult"
/>
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
</q-card> </q-card>

View file

@ -1,7 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue"; import { ref, onMounted, reactive, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar, QForm } from "quasar"; import { useQuasar, QForm } from "quasar";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
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";
@ -14,7 +17,7 @@ const investigateDis = useInvestigateDisStore();
const { fecthDirector } = investigateDis; const { fecthDirector } = investigateDis;
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai, hideLoader, dialogConfirm } = mixin; const { date2Thai, hideLoader, dialogConfirm, success, messageError } = mixin;
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
@ -34,16 +37,20 @@ const props = defineProps({
type: Function, type: Function,
default: () => "", default: () => "",
}, },
fetchData: {
type: Function,
default: () => "",
},
}); });
/** ข้อมูล v-model ของฟอร์ม */ /** ข้อมูล v-model ของฟอร์ม */
const formData = reactive<FormData>({ const formData = reactive<FormData>({
detail: "", resultDescription: "",
}); });
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */ /** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
const objectdisciplinary: FormRef = { const objectdisciplinary: FormRef = {
detail: detailRef, resultDescription: detailRef,
}; };
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */ /** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
@ -74,8 +81,17 @@ function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
console.log(formData); await http
props.onSubmit(); .put(config.API.listResultById(id.value), formData)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
await props.fetchData();
});
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -83,23 +99,24 @@ function onSubmit() {
} }
async function fetchDatadetail() { async function fetchDatadetail() {
formData.detail = props.data.detail; formData.resultDescription = props.data.resultDescription;
} }
/** /**
* เชคขอมลจาก props * เชคขอมลจาก props
* เมอมอม * เมอมอม
* เกบขอมลลง formData * เกบขอมลลง formData
*/ */
watch(props.data, async () => { watch(
fetchDatadetail(); () => props.data,
}); async () => {
await fetchDatadetail();
}
);
/** /**
* งขอมลจำลองไปย store * งขอมลจำลองไปย store
*/ */
onMounted(async () => { onMounted(async () => {});
await fetchDatadetail();
});
</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">
@ -114,7 +131,7 @@ onMounted(async () => {
dense dense
outlined outlined
ref="detailRef" ref="detailRef"
v-model="formData.detail" v-model="formData.resultDescription"
for="#detail" for="#detail"
label="สรุปผลการพิจารณา" label="สรุปผลการพิจารณา"
hide-bottom-space hide-bottom-space

View file

@ -2,6 +2,9 @@
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import Table from "@/modules/11_discipline/components/4_Result/Table.vue"; import Table from "@/modules/11_discipline/components/4_Result/Table.vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore"; import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
@ -9,16 +12,51 @@ import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
const $q = useQuasar(); // show dialog const $q = useQuasar(); // show dialog
const router = useRouter(); const router = useRouter();
const filter = ref<string>(""); //search data table //search data table
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const dataInvestigateDis = useDisciplineResultStore(); const store = useDisciplineResultStore();
const { showLoader, hideLoader } = mixin; const { showLoader, hideLoader, messageError } = mixin;
const { fecthList } = dataInvestigateDis; const { fetchList } = store;
const initialPagination = ref<Pagination>({ const initialPagination = ref<Pagination>({
rowsPerPage: 0, rowsPerPage: 0,
}); });
const page = ref<number>(1);
const pageSize = ref<number>(5);
const maxPage = ref<number>(1);
const filter = ref<string>("");
/** function เรียกรายการผลการพิจารณาทางวินัย*/
async function fetchListResult() {
showLoader();
await http
.get(
config.API.listResult() +
`?page=${page.value}&pageSize=${pageSize.value}&keyword=${filter.value}`
)
.then(async (res) => {
const data = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / pageSize.value);
await fetchList(data);
console.log(res);
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function updateQueryString(p: number, pS: number, key: string) {
page.value = pS === pageSize.value ? p : 1;
pageSize.value = pS;
filter.value = key;
await fetchListResult();
}
/** /**
* ไปหนาแกไข * ไปหนาแกไข
* @param id ไอดเฉพาะ รายบคคล * @param id ไอดเฉพาะ รายบคคล
@ -32,43 +70,7 @@ function openEdit(id: string) {
* งขอมลจำลองไปย store * งขอมลจำลองไปย store
*/ */
onMounted(async () => { onMounted(async () => {
showLoader(); await fetchListResult();
fecthList([
{
id: "001",
subject: "ทุจริตในหน้าที่",
interrogated: "ศิรินภา คงน้อยี่",
fault: "1",
penaltyLevel: "7",
caseFault: "ทุจริตในหน้าที่",
dateInvestigate: "2023-12-01",
status: "0",
active: "2",
},
{
id: "002",
subject: "ทุจริตในหน้าที่",
interrogated: "ภัทรานุช คงน้อย",
fault: "1",
penaltyLevel: "7",
caseFault: "ทุจริตในหน้าที่",
dateInvestigate: "2023-11-30",
status: "0",
active: "0",
},
{
id: "003",
subject: "กระทำทุจริตเงินกองทุน",
interrogated: "ปรมาพร ศรีมี",
fault: "2",
penaltyLevel: "1",
caseFault: "พบการทุจริต",
dateInvestigate: "2023-09-14",
status: "1",
active: "1",
},
]);
await hideLoader();
}); });
</script> </script>
@ -80,16 +82,19 @@ onMounted(async () => {
<div> <div>
<Table <Table
style="max-height: 80vh" style="max-height: 80vh"
:rows="dataInvestigateDis.rows" :rows="store.rows"
:columns="dataInvestigateDis.columns" :columns="store.columns"
:filter="filter" :visible-columns="store.visibleColumns"
:visible-columns="dataInvestigateDis.visibleColumns"
v-model:inputfilter="filter" v-model:inputfilter="filter"
v-model:inputvisible="dataInvestigateDis.visibleColumns" v-model:inputvisible="store.visibleColumns"
:pagination="initialPagination" :pagination="initialPagination"
:nornmalData="true" :nornmalData="true"
:paging="true" :paging="true"
:titleText="''" :titleText="''"
:page="page"
:pageSize="pageSize"
:maxPage="maxPage"
@update:queryString="updateQueryString"
> >
<template #columns="props"> <template #columns="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">

View file

@ -1,17 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, useAttrs } from "vue"; import { ref, useAttrs, watch } from "vue";
import type { Pagination } from "@/modules/04_registry/interface/index/Main"; import type { Pagination } from "@/modules/04_registry/interface/index/Main";
const table = ref<any>(null); const table = ref<any>(null);
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
const attrs = ref<any>(useAttrs()); const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true); const paging = ref<boolean>(true);
const pagination = ref({
// sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
/** รับ props มาจากหน้าหลัก */ /** รับ props มาจากหน้าหลัก */
const props = defineProps({ const props = defineProps({
@ -35,19 +29,32 @@ const props = defineProps({
type: Boolean, type: Boolean,
defualt: false, defualt: false,
}, },
page: {
type: Number,
},
pageSize: {
type: Number,
},
maxPage: {
type: Number,
},
});
const currentPage = ref<number>(1);
const filter = ref<string>("");
const pagination = ref({
descending: false,
page: props.page,
rowsPerPage: props.pageSize,
}); });
const emit = defineEmits([ const emit = defineEmits([
"update:inputfilter", "update:inputfilter",
"update:inputvisible", "update:inputvisible",
"update:editvisible", "update:editvisible",
"update:queryString",
]); ]);
function paginationLabel(start: string, end: string, total: string) {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
}
function updateInput(value: string | number | null) { function updateInput(value: string | number | null) {
emit("update:inputfilter", value); emit("update:inputfilter", value);
} }
@ -61,6 +68,22 @@ function resetFilter() {
emit("update:inputfilter", ""); emit("update:inputfilter", "");
filterRef.value.focus(); filterRef.value.focus();
} }
function filterFn() {
updatePaging(
currentPage.value,
Number(pagination.value.rowsPerPage),
filter.value
);
}
function updatePaging(p: number, pS: number, key: string) {
emit("update:queryString", p, pS, key);
}
watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
filterFn();
});
</script> </script>
<template> <template>
@ -82,9 +105,9 @@ function resetFilter() {
<q-input <q-input
standout standout
dense dense
:model-value="inputfilter" v-model="filter"
ref="filterRef" ref="filterRef"
@update:model-value="updateInput" @keydown.enter.prevent="filterFn"
outlined outlined
debounce="300" debounce="300"
placeholder="ค้นหา" placeholder="ค้นหา"
@ -92,9 +115,9 @@ function resetFilter() {
class="col-xs-12 col-sm-3 col-md-2" class="col-xs-12 col-sm-3 col-md-2"
> >
<template v-slot:append> <template v-slot:append>
<q-icon v-if="inputfilter == ''" name="search" /> <q-icon v-if="filter == ''" name="search" />
<q-icon <q-icon
v-if="inputfilter !== ''" v-if="filter !== ''"
name="clear" name="clear"
class="cursor-pointer" class="cursor-pointer"
@click="resetFilter" @click="resetFilter"
@ -125,8 +148,8 @@ function resetFilter() {
virtual-scroll virtual-scroll
:virtual-scroll-sticky-size-start="48" :virtual-scroll-sticky-size-start="48"
dense dense
:pagination-label="paginationLabel"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
@ -138,6 +161,17 @@ function resetFilter() {
<template #body="props"> <template #body="props">
<slot v-bind="props" name="columns"></slot> <slot v-bind="props" name="columns"></slot>
</template> </template>
<template v-slot:pagination="scope">
<q-pagination
v-model="currentPage"
active-color="primary"
color="dark"
:max="Number(props.maxPage)"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table> </d-table>
</template> </template>

View file

@ -1,9 +1,9 @@
interface FormData { interface FormData {
detail: string; resultDescription: string;
} }
interface FormRef { interface FormRef {
detail: object | null; resultDescription: object | null;
[key: string]: any; [key: string]: any;
} }

View file

@ -0,0 +1,22 @@
interface DataResult {
id: string; //id รายการ
title: string; //เรื่องที่ร้องเรียน
respondentType: string; //ผู้ถูกร้องเรียน
offenseDetails: string; //ลักษณะความผิดครั้งแรกจะเป็น
disciplinaryFaultLevel: string; //ระดับโทษความผิด
disciplinaryCaseFault: string; //กรณีความผิด
status: string; //สถานะ
createdAt: Date | null; //วันที่ส่งเรื่องสอบสวน
}
interface DataResultList {
id: string; //id รายการ
title: string; //เรื่องที่ร้องเรียน
respondentType: string | undefined; //ผู้ถูกร้องเรียน
offenseDetails: string | undefined; //ลักษณะความผิดครั้งแรกจะเป็น
disciplinaryFaultLevel: string; //ระดับโทษความผิด
disciplinaryCaseFault: string; //กรณีความผิด
status: string | undefined; //สถานะ
createdAt: string | null; //วันที่ส่งเรื่องสอบสวน
}
export type { DataResult, DataResultList };

View file

@ -0,0 +1,42 @@
import { defineStore } from "pinia";
export const useStoreResultMain = defineStore("resultMain", () => {
/** function ผู้ถูกสอบสวน*/
function convertRespondentType(val: string) {
switch (val) {
case "PERSON":
return "บุคคล";
case "ORGANIZATION":
return "หน่วยงาน";
case "BANGKOK":
return "กรุงเทพมหานคร";
}
}
/** function ลักษณะความผิด*/
function convertFault(val: string) {
switch (val) {
case "NOT_SPECIFIED":
return "ความผิดวินัยยังไม่ระบุ";
case "NOT_DEADLY":
return "ความผิดวินัยไม่ร้ายแรง";
case "DEADLY":
return "ความผิดวินัยร้ายแรง";
default:
return "-";
}
}
/** function ลักษณะความผิด*/
function convertStatus(val: string) {
switch (val) {
case "NEW":
return "กำลังสอบสวน";
case "STOP":
return "ยุติเรื่อง";
case "SEND_DISCIPLINARY":
return "ส่งไปสอบสวน";
}
}
return { convertRespondentType, convertFault, convertStatus };
});

View file

@ -7,7 +7,7 @@ import type {
directorType, directorType,
responseType, responseType,
DataOptioGroup, DataOptioGroup,
DataNumberOption DataNumberOption,
} from "@/modules/11_discipline/interface/index/Main"; } from "@/modules/11_discipline/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -32,7 +32,7 @@ export const useInvestigateDisStore = defineStore(
{ id: "NOT_SPECIFIED", name: "ยังไม่ระบุ" }, { id: "NOT_SPECIFIED", name: "ยังไม่ระบุ" },
{ id: "HAVE_CAUSE", name: "มีมูล" }, { id: "HAVE_CAUSE", name: "มีมูล" },
{ id: "NO_CAUSE", name: "ไม่มีมูล" }, { id: "NO_CAUSE", name: "ไม่มีมูล" },
]); ]);
const optionsfaultLevel = ref<DataOptioGroup[]>([ const optionsfaultLevel = ref<DataOptioGroup[]>([
{ id: "0", name: "ไม่ร้ายแรง", disable: true }, { id: "0", name: "ไม่ร้ายแรง", disable: true },
@ -357,7 +357,10 @@ export const useInvestigateDisStore = defineStore(
daysExtendOps, daysExtendOps,
filterFnOptionsType, filterFnOptionsType,
causeTextOptions causeTextOptions,
convertRespondentType,
convertFault,
}; };
} }
); );

View file

@ -6,25 +6,43 @@ import type {
DataOption, DataOption,
directorType, directorType,
} from "@/modules/11_discipline/interface/index/Main"; } from "@/modules/11_discipline/interface/index/Main";
import type {
DataResult,
DataResultList,
} from "@/modules/11_discipline/interface/response/result";
import { useStoreResultMain } from "@/modules/11_discipline/store";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const storeMain = useStoreResultMain();
const { date2Thai } = mixin; const { date2Thai } = mixin;
export const useDisciplineResultStore = defineStore( export const useDisciplineResultStore = defineStore(
"disciplineResultStore", "disciplineResultStore",
() => { () => {
const tabMenu = ref<string>("result"); const tabMenu = ref<string>("result");
const rows = ref<investigateDisDataRowType[]>([]); const rows = ref<DataResultList[]>([]);
const rows2 = ref<directorType[]>([]); const rows2 = ref<directorType[]>([]);
const selected = ref<directorType[]>([]); const selected = ref<directorType[]>([]);
async function fecthList(data: investigateDisDataRowType[]) { async function fetchList(data: DataResult[]) {
let datalist: investigateDisDataRowType[] = data.map((e: any) => ({ const datalist: DataResultList[] = data.map((e: DataResult) => ({
id: e.id, id: e.id,
subject: e.subject, title: e.title,
interrogated: e.interrogated, respondentType: e.respondentType
caseFault: e.caseFault, ? storeMain.convertRespondentType(e.respondentType)
dateInvestigate: date2Thai(new Date(e.dateInvestigate)), : "-",
offenseDetails: e.offenseDetails
? storeMain.convertFault(e.offenseDetails)
: "-",
disciplinaryFaultLevel: e.disciplinaryFaultLevel
? e.disciplinaryFaultLevel
: "-",
disciplinaryCaseFault: e.disciplinaryCaseFault
? e.disciplinaryCaseFault
: "-",
status: e.status && storeMain.convertStatus(e.status),
createdAt: e.createdAt && date2Thai(e.createdAt),
})); }));
rows.value = datalist; rows.value = datalist;
} }
@ -45,12 +63,12 @@ export const useDisciplineResultStore = defineStore(
const visibleColumns = ref<String[]>([ const visibleColumns = ref<String[]>([
"no", "no",
"subject", "title",
"interrogated", "respondentType",
"fault", "offenseDetails",
"penaltyLevel", "disciplinaryFaultLevel",
"caseFault", "disciplinaryCaseFault",
"dateInvestigate", "createdAt",
"status", "status",
]); ]);
@ -65,64 +83,64 @@ export const useDisciplineResultStore = defineStore(
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "subject", name: "title",
align: "left", align: "left",
label: "เรื่อง", label: "เรื่อง",
sortable: true, sortable: true,
field: "subject", field: "title",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "interrogated", name: "respondentType",
align: "left", align: "left",
label: "ผู้ถูกสืบสวน", label: "ผู้ถูกสืบสวน",
sortable: true, sortable: true,
field: "interrogated", field: "respondentType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "fault", name: "offenseDetails",
align: "left", align: "left",
label: "ลักษณะความผิด", label: "ลักษณะความผิด",
sortable: true, sortable: true,
field: "fault", field: "offenseDetails",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "penaltyLevel", name: "disciplinaryFaultLevel",
align: "left", align: "left",
label: "ระดับโทษความผิด", label: "ระดับโทษความผิด",
sortable: true, sortable: true,
field: "penaltyLevel", field: "disciplinaryFaultLevel",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "caseFault", name: "disciplinaryCaseFault",
align: "left", align: "left",
label: "กรณีความผิด", label: "กรณีความผิด",
sortable: true, sortable: true,
field: "caseFault", field: "disciplinaryCaseFault",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "dateInvestigate", name: "createdAt",
align: "left", align: "left",
label: "วันที่สอบสวน", label: "วันที่สอบสวน",
sortable: true, sortable: true,
field: "dateInvestigate", field: "createdAt",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
@ -213,7 +231,7 @@ export const useDisciplineResultStore = defineStore(
]); ]);
return { return {
tabMenu, tabMenu,
fecthList, fetchList,
rows, rows,
rows2, rows2,
fecthDirector, fecthDirector,