ผูก API สอบสวน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-27 16:30:14 +07:00
parent d3ec604478
commit b161f17a98
11 changed files with 708 additions and 882 deletions

View file

@ -1,6 +1,6 @@
import env from "../index";
const discipline = `${env.API_URI}/discipline`;
const investigate = `${env.API_URI}/discipline/investigate`
const investigate = `${env.API_URI}/discipline/investigate`;
export default {
directorList: (page: number, pageSize: number, keyword: string) =>
@ -14,33 +14,34 @@ export default {
/**
* @param id type
*/
complaintChannelbyId:(id:string) => `${discipline}/complaint_Channel/${id}`,
complaintAdd:() => `${discipline}/complaint`,
complaintbyId:(id:string) => `${discipline}/complaint/${id}`,
complaintReject:(id:string) => `${discipline}/complaint/reject/${id}`,
complaintResume:(id:string) => `${discipline}/complaint/resume/${id}`,
complaintList:(page:number,pageSize:number,keyword:string) => `${discipline}/complaint?page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
complaintFileUpload:(id:string) => `${discipline}/complaint/file/${id}`,
complaintFileDelete:(id:string,docId:string) => `${discipline}/complaint/file/${id}/${docId}`,
complaintApprove:(id:string) => `${discipline}/complaint/approve/${id}`,
complaintChannelbyId: (id: string) => `${discipline}/complaint_Channel/${id}`,
complaintAdd: () => `${discipline}/complaint`,
complaintbyId: (id: string) => `${discipline}/complaint/${id}`,
complaintReject: (id: string) => `${discipline}/complaint/reject/${id}`,
complaintResume: (id: string) => `${discipline}/complaint/resume/${id}`,
complaintList: (page: number, pageSize: number, keyword: string) =>
`${discipline}/complaint?page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
complaintFileUpload: (id: string) => `${discipline}/complaint/file/${id}`,
complaintFileDelete: (id: string, docId: string) =>
`${discipline}/complaint/file/${id}/${docId}`,
complaintApprove: (id: string) => `${discipline}/complaint/approve/${id}`,
/** API สืบสวนข้อเท็จจริง*/
investigateMain:(page:number,pageSize:number,keyword:string) =>`${investigate}?page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
investigateById:(id:string) => `${investigate}/${id}`,
investigateMain: (page: number, pageSize: number, keyword: string) =>
`${investigate}?page=${page}&pageSize=${pageSize}&keyword=${keyword}`,
investigateById: (id: string) => `${investigate}/${id}`,
investigateRelevantUploadFile: (id: string) =>
`${investigate}/relevant/file/${id}`,
investigateRelevantFileDelete: (id: string, docId: string) =>
`${investigate}/relevant/file/${id}/${docId}`,
investigateUploadFile: (id: string) => `${investigate}/file/${id}`,
investigateFileDelete: (id: string, docId: string) =>
`${investigate}/file/${id}/${docId}`,
investigateRelevantUploadFile:(id:string) => `${investigate}/relevant/file/${id}`,
investigateRelevantFileDelete:(id:string,docId:string) => `${investigate}/relevant/file/${id}/${docId}`,
investigateUploadFile:(id:string) => `${investigate}/file/${id}`,
investigateFileDelete:(id:string,docId:string) => `${investigate}/file/${id}/${docId}`,
investigateReject:(id:string) => `${investigate}/reject/${id}`,
investigateResume:(id:string) => `${investigate}/resume/${id}`,
investigateReject: (id: string) => `${investigate}/reject/${id}`,
investigateResume: (id: string) => `${investigate}/resume/${id}`,
/** ระบบวินัยเรื่องสอบสวน */
disciplineDisciplinary: () => `${discipline}/disciplinary`,
@ -50,4 +51,5 @@ export default {
`${discipline}/disciplinary/investigate/${id}`,
disciplineComplaintsById: (id: string) =>
`${discipline}/disciplinary/complaint/${id}`,
disciplineDirector: () => `${discipline}/director`,
};

View file

@ -1,13 +1,13 @@
<script setup lang="ts">
import { ref, computed, watchEffect, watch, onMounted } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { directorType } from "@/modules/11_discipline/interface/index/Main";
import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const selected = ref<directorType[]>([]);
@ -60,17 +60,7 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "duty",
align: "left",
label: "หน้าที่",
sortable: true,
field: "duty",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "email",
align: "left",
@ -93,17 +83,6 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "role",
align: "left",
label: "จำนวนเรื่องสืบสวน",
sortable: true,
field: "role",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
/** รับ props มาจากหน้าหลัก */
@ -139,7 +118,6 @@ const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
console.log(checkSelected.value);
});
/** popup ยืนยันส่งัว */
@ -154,14 +132,14 @@ function saveDirector() {
/** ส่งไปออกคำสั่ง */
async function DirectorSave() {
emit('returnDirector',selected.value);
emit("returnDirector", selected.value);
}
const emit = defineEmits([
"update:filterKeyword2",
"update:selected",
"update:pagination",
"returnDirector"
"returnDirector",
]);
function updateInput(value: any) {
@ -244,7 +222,17 @@ watch(
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
:rows-per-page-options="[10, 25, 50, 100]"
v-model:pagination="pagination"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>

View file

@ -13,49 +13,53 @@ import { useQuasar } from "quasar";
const $q = useQuasar();
const mixin = useCounterMixin();
const store = useInvestigateDisStore();
const { dialogConfirm } = mixin;
const { dialogConfirm, success } = mixin;
const router = useRouter();
const route = useRoute();
const id = ref<string>(route.params.id as string);
/** ข้อมูล v-model ของฟอร์ม */
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 = 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>();
/** function fetchData สอบสวนคาวมผิดทางวินัย*/
async function fetchDetailDisciplinary() {
await http
.get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => {
console.log(res);
data.value = res.data.result;
})
.catch((err) => {
console.log(err);
});
}
/** function fetchData สืบสวนข้อเท็จจริง*/
async function fetchDetailInvestigate() {
await http
.get(config.API.disciplineInvestigateById(id.value))
@ -67,6 +71,7 @@ async function fetchDetailInvestigate() {
});
}
/** function fetchData เรื่องร้องเรียน*/
async function fetchDetailComplaints() {
await http
.get(config.API.disciplineComplaintsById(id.value))
@ -78,28 +83,19 @@ async function fetchDetailComplaints() {
});
}
/** จำลองข้อมูลจาก api */
const fetchData = async () => {
data.complaint = "test1";
data.dateInvestigate = new Date("2023-11-08T14:58:00");
data.dateAllegation = new Date("2023-11-08T14:58:00");
data.dateEvident = new Date("2023-11-08T14:58:00");
data.casefault = "test1";
data.typefault = "2";
data.faultLevel = "2";
data.refLaw = "test";
data.detailComplaint = "รายละเอียด";
data.whereInvestigate = "ที่ไหน";
data.trueDetail = "รายละเอียด";
data.evidence = "รายละเอียด";
data.recordAccuser = "รายละเอียด";
data.witnesses = "รายละเอียด";
data.InvestResults = "รายละเอียด";
data.filesEvidence = null;
data.filesRecordAccuser = null;
data.filesWitnesses = null;
data.filesEtc = null;
};
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();
});
}
/**
* นทกขอมลทเเกไข
@ -157,7 +153,7 @@ function confirmCancelInvestigate() {
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(async () => {
store.tabMenu = 'disciplinary'
store.tabMenu = "disciplinary";
await fetchDetailDisciplinary();
});
@ -200,7 +196,7 @@ watch(
<div class="q-ma-none">แกไขการสอบสวนความผดทางว</div>
<q-space />
<div class="q-gutter-x-sm">
<q-btn
<!-- <q-btn
v-if="data.complaintStatus === 'NEW'"
label="ส่งไปสรุปผลการพิจารณา"
color="public"
@ -217,7 +213,7 @@ watch(
label="ยกเลิกการยุติเรื่อง"
color="red-7"
@click="cancelInvestigate"
/>
/> -->
</div>
</div>
<q-card flat class="col-12">
@ -244,7 +240,11 @@ watch(
<FormInvestigatefacts :on-submit="onSubmit" :data="data" />
</q-tab-panel>
<q-tab-panel name="disciplinary">
<FormDisciplinary :on-submit="onSubmit" :data="data" />
<FormDisciplinary
:on-submit="onSubmit"
:data="data"
@submit:disciplinary="onSubmitDisciplinary"
/>
</q-tab-panel>
</q-tab-panels>
</q-card>

View file

@ -40,7 +40,6 @@ async function fetchListDisciplinary() {
res.data.result.total / initialPagination.value.rowsPerPage
);
fetchList(data);
console.log(data);
})
.catch((err) => {
console.log(err);

View file

@ -34,6 +34,8 @@ const props = defineProps({
* ปโหลดหลกฐานสนบสนนขอกลาวหา
*/
function uploadFile() {
console.log("test");
// const Data = new FormData();
// Data.append("file", file.value);
// showLoader();
@ -96,7 +98,7 @@ function removeFile(id: string) {
</div>
</div>
<div class="col-xs-12 q-pa-sm row">
<div class="col-xs-12 q-pa-sm row" v-if="props.files">
<q-list
v-if="props.files.length > 0"
bordered

View file

@ -9,14 +9,14 @@ interface DataNumberOption {
}
interface InvestigatefactsDataRowType {
id:string,
id: string;
title: string;
respondentType: string;
offenseDetails: string,
investigationDetail: string,
dateInvestigate: string,
investigationStatusResult: string,
status: string
offenseDetails: string;
investigationDetail: string;
dateInvestigate: string;
investigationStatusResult: string;
status: string;
}
interface investigateDisDataRowType {
@ -32,23 +32,29 @@ interface investigateDisDataRowType {
}
interface directorType {
id:string
prefix:string
firstName:string
lastName:string
id: string;
directorId: string;
prefix: string;
firstName: string;
lastName: string;
position: string;
email: string;
phone: string;
total: number;
duty: string;
}
interface responseType {
id:string
name:string
prefix:string
firstName:string
lastName:string
position:string
email:string
phone:string
id: string;
directorId: string;
name: string;
prefix: string;
firstName: string;
lastName: string;
position: string;
email: string;
phone: string;
total: number;
duty: string;
}
interface FileLists {

View file

@ -1,50 +1,104 @@
interface Persons {
personId: string; //id อ้างอิง profile
idcard: string; //รหัสบัตรประชาชน
prefix: string; //คำนำหน้า
firstName: string; //ชื่อ
lastName: string; //นามสกุล
posNo: string; //เลขที่ตำแหน่ง
position: string; //ตำแหน่ง
positionLevel: string; //ระดับ
salary: number; //เงินเดือน
organization: string; //สังกัด
name: string;
}
interface Director {
directorId: string;
duty: string;
email: string;
firstName: string;
id: string;
lastName: string;
phone: string;
position: string;
prefix: string;
total: number;
}
// interface Persons {
// personId: string; //id อ้างอิง profile
// idcard: string; //รหัสบัตรประชาชน
// prefix: string; //คำนำหน้า
// firstName: string; //ชื่อ
// lastName: string; //นามสกุล
// posNo: string; //เลขที่ตำแหน่ง
// position: string; //ตำแหน่ง
// positionLevel: string; //ระดับ
// salary: number; //เงินเดือน
// organization: string; //สังกัด
// }
interface FormData {
complaint: string;
respondentType: string;
dateInvestigate: Date | null;
dateAllegation: Date | null;
dateEvident: Date | null;
filesEvidence: File | null;
filesRecordAccuser: File | null;
filesWitnesses: File | null;
filesEtc: File | null;
casefault: string;
typefault: string;
faultLevel: string;
refLaw: string;
detailComplaint: string;
whereInvestigate: string;
trueDetail: string;
evidence: string;
recordAccuser: string;
witnesses: string;
InvestResults: string;
complaintStatus: string;
organizationId: string;
consideredAgency: string;
disciplinaryDateAllegation: Date | null;
disciplinaryDateEvident: Date | null;
disciplinaryCaseFault: string;
disciplinaryInvestigateAt: string;
disciplinaryFaultLevel: string;
disciplinaryRefLaw: string;
disciplinarySummaryEvidence: string;
disciplinaryRecordAccuser: string;
disciplinaryWitnesses: string;
result: string;
directors: Director[];
persons: Persons[];
// filesWitnesses: File | null;
// filesEtc: File | null;
// casefault: string;
// typefault: string;
// faultLevel: string;
// refLaw: string;
// detailComplaint: string;
// whereInvestigate: string;
// trueDetail: string;
// evidence: string;
// recordAccuser: string;
// witnesses: string;
// InvestResults: string;
// complaintStatus: string;
// consideredAgency: string;
}
interface disciplinaryRef {
complaint: object | null;
dateInvestigate: object | null;
dateAllegation: object | null;
dateEvident: object | null;
filesEvidence: object | null;
filesRecordAccuser: object | null;
filesWitnesses: object | null;
filesEtc: object | null;
casefault: object | null;
typefault: object | null;
faultLevel: object | null;
refLaw: object | null;
detailComplaint: object | null;
whereInvestigate: object | null;
trueDetail: object | null;
evidence: object | null;
recordAccuser: object | null;
witnesses: object | null;
InvestResults: object | null;
interface DisciplinaryRef {
respondentType: object | null;
organizationId: object | null;
disciplinaryDateAllegation: object | null;
disciplinaryDateEvident: object | null;
disciplinaryCaseFault: object | null;
disciplinaryInvestigateAt: object | null;
disciplinaryFaultLevel: object | null;
disciplinaryRefLaw: object | null;
disciplinarySummaryEvidence: object | null;
disciplinaryRecordAccuser: object | null;
disciplinaryWitnesses: object | null;
result: object | null;
// filesRecordAccuser: object | null;
// filesWitnesses: object | null;
// filesEtc: object | null;
// casefault: object | null;
// typefault: object | null;
// faultLevel: object | null;
// refLaw: object | null;
// detailComplaint: object | null;
// whereInvestigate: object | null;
// trueDetail: object | null;
// evidence: object | null;
// recordAccuser: object | null;
// witnesses: object | null;
// InvestResults: object | null;
[key: string]: any;
}
export type { FormData, disciplinaryRef };
export type { FormData, DisciplinaryRef, Persons, Director };

View file

@ -0,0 +1,6 @@
interface DataOptionRes {
organizationId: string;
organizationName: string;
}
export type { DataOptionRes };

View file

@ -9,7 +9,7 @@ import type {
DataAdd,
ocListType,
} from "@/modules/11_discipline/interface/response/complaint";
import type { ArrayPerson } from '@/modules/11_discipline/interface/request/complaint'
import type { ArrayPerson } from "@/modules/11_discipline/interface/request/complaint";
import type { QTableProps } from "quasar";
const mixin = useCounterMixin();

View file

@ -5,7 +5,7 @@ import type {
investigateDisDataRowType,
DataOption,
directorType,
responseType
responseType,
} from "@/modules/11_discipline/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
@ -24,20 +24,20 @@ export const useInvestigateDisStore = defineStore(
{ id: "2", name: "ไม่ร้ายแรง" },
]);
const optionsfaultLevel = ref<DataOption[]>([
{ id: "0", name: "ไม่ร้ายแรง" },
{ id: "1", name: "ภาคทัณฑ์" },
{ id: "2", name: "ตัดเงินเดือน" },
{ id: "3", name: "ลดขั้นเงินเดือน" },
{ id: "4", name: "ร้ายแรง" },
{ id: "5", name: "ปลดออก" },
{ id: "6", name: "ไล่ออก" },
// { id: "0", name: "ไม่ร้ายแรง" },
// { id: "1", name: "ภาคทัณฑ์" },
// { id: "2", name: "ตัดเงินเดือน" },
// { id: "3", name: "ลดขั้นเงินเดือน" },
// { id: "4", name: "ร้ายแรง" },
// { id: "5", name: "ปลดออก" },
// { id: "6", name: "ไล่ออก" },
]);
async function fetchList(data: investigateDisDataRowType[]) {
let datalist: any[] = data.map((e: any) => ({
id: e.id,
title: e.title,
respondentType: e.respondentType,
offenseDetails: e.offenseDetails,
respondentType: convertRespondentType(e.respondentType),
offenseDetails: convertFault(e.offenseDetails),
disciplinaryFaultLevel: e.disciplinaryFaultLevel,
disciplinaryCaseFault: e.disciplinaryCaseFault,
status: e.status,
@ -46,28 +46,40 @@ export const useInvestigateDisStore = defineStore(
rows.value = datalist;
}
async function fecthDirector(data: directorType[]) {
let datalistDirector: responseType[] = data.map((e: directorType) => ({
id: e.id,
name: `${e.prefix}${e.firstName} ${e.lastName}`,
prefix:e.prefix,
firstName:e.firstName,
lastName:e.lastName,
position: e.position,
email: e.email,
phone: e.phone,
}));
rows2.value = datalistDirector;
selected.value = rows2.value;
// console.log(rows2.value);
// async function fecthDirector(data: directorType[]) {
// let datalistDirector: responseType[] = data.map((e: directorType) => ({
// id: e.id,
// name: `${e.prefix}${e.firstName} ${e.lastName}`,
// prefix: e.prefix,
// firstName: e.firstName,
// lastName: e.lastName,
// position: e.position,
// email: e.email,
// phone: e.phone,
// }));
// rows2.value = datalistDirector;
// selected.value = rows2.value;
// // console.log(rows2.value);
// }
function convertRespondentType(val: string) {
switch (val) {
case "PERSON":
return "บุคคล";
case "ORGANIZATION":
return "หน่วยงาน";
case "BANGKOK":
return "กรุงเทพมหานคร";
}
}
function convertFault(val: string) {
switch (val) {
case "0":
case "NOT_SPECIFIED":
return "ความผิดวินัยยังไม่ระบุ";
case "1":
case "NOT_DEADLY":
return "ความผิดวินัยไม่ร้ายแรง";
case "2":
case "DEADLY":
return "ความผิดวินัยร้ายแรง";
}
}
@ -208,8 +220,8 @@ export const useInvestigateDisStore = defineStore(
"position",
"duty",
"email",
"telephone",
"role",
"phone",
"total",
]);
const columnsDirector = ref<QTableProps["columns"]>([
{
@ -258,24 +270,25 @@ export const useInvestigateDisStore = defineStore(
style: "font-size: 14px",
},
{
name: "telephone",
name: "phone",
align: "left",
label: "เบอร์โทรศัพท์",
sortable: true,
field: "telephone",
field: "phone",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "role",
name: "total",
align: "left",
label: "จำนวนเรื่องสืบสวน",
sortable: true,
field: "role",
field: "total",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
return {
tabMenu,
fetchList,
@ -283,7 +296,7 @@ export const useInvestigateDisStore = defineStore(
rows2,
optionsTypefault,
optionsfaultLevel,
fecthDirector,
// fecthDirector,
visibleColumns,
columns,
visibleColumnsDirector,