api รายการสืบสวนข้อเท็จจริง

This commit is contained in:
setthawutttty 2023-11-24 17:49:25 +07:00
parent 691a989c16
commit 3c5fcc029b
14 changed files with 1025 additions and 383 deletions

View file

@ -3,9 +3,11 @@ import { ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import type { DataOption } from "@/modules/11_discipline/interface/index/Main";
import type { DataList, DataListRow, DataAdd, ArrayPerson,ocListType } from "@/modules/11_discipline/interface/response/complaint"
import type { DataList, DataListRow, DataAdd,ocListType } from "@/modules/11_discipline/interface/response/complaint"
import type { QTableProps } from "quasar";
import type {
ArrayPerson,
} from "@/modules/11_discipline/interface/request/complaint";
const mixin = useCounterMixin()
const { date2Thai } = mixin

View file

@ -5,6 +5,7 @@ import type {
investigateDisDataRowType,
DataOption,
directorType,
responseType
} from "@/modules/11_discipline/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
@ -46,13 +47,15 @@ export const useInvestigateDisStore = defineStore(
rows.value = datalist;
}
async function fecthDirector(data: directorType[]) {
let datalistDirector: directorType[] = data.map((e: directorType) => ({
nameDirector: e.nameDirector,
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,
duty: e.duty,
email: e.email,
telephone: e.telephone,
role: e.role,
phone: e.phone,
}));
rows2.value = datalistDirector;
selected.value = rows2.value;

View file

@ -8,10 +8,21 @@ import type {
DataOption,
DataNumberOption,
} from "@/modules/11_discipline/interface/index/Main";
import type { ListData } from "@/modules/11_discipline/interface/response/investigate";
import type { ListData, ArrayPerson, ocListType } from "@/modules/11_discipline/interface/response/investigate";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const organizationIdOp = ref<DataOption[]>([]);
const consideredAgencytoptions = ref<DataOption[]>([]);
function ocListFn(data: ocListType[]) {
let dataList: DataOption[] = data.map((item: ocListType) => ({
id: item.organizationId,
name: item.organizationName
}))
consideredAgencytoptions.value = dataList
organizationIdOp.value = dataList
}
/*** store ของข้อมูลสืบสวนข้อเท็จจริง */
export const useInvestigateFactStore = defineStore(
@ -31,37 +42,43 @@ export const useInvestigateFactStore = defineStore(
{ id: "NOT_DEADLY", name: "ไม่ร้ายแรง" },
{ id: "DEADLY", name: "ร้ายแรง" },
]);
const investigationOps = ref<DataOption[]>([
{ id: "appoint_directors", name: "แต่งตั้งกรรมการสืบสวน" },
{ id: "secret_investigation", name: "สืบสวนทางลับ" },
{ id: "other", name: "อื่นๆ" },
const investigationDetailOps = ref<DataOption[]>([
{ id: "APPOINT_DIRECTORS", name: "แต่งตั้งกรรมการสืบสวน" },
{ id: "SECRET_INVESTIGATION", name: "สืบสวนทางลับ" },
{ id: "OTHER", name: "อื่นๆ" },
]);
const faultOps = ref<DataOption[]>([
{ id: "new", name: "กำลังสืบสวน" },
{ id: "stop", name: "ยุติเรื่อง" },
{ id: "complete", name: "ส่งไปสอบสวน" },
{ id: "NEW", name: "กำลังสืบสวน" },
{ id: "STOP", name: "ยุติเรื่อง" },
{ id: "COMPLETE", name: "ส่งไปสอบสวน" },
]);
const statusResultOptions = ref<DataOption[]>([
{ id: "not_specified", name: "ยังไม่ระบุ" },
{ id: "have_cause", name: "มีมูล" },
{ id: "no_cause", name: "ไม่มีมูล" },
const investigationStatusResultOptions = ref<DataOption[]>([
{ id: "NOT_SPECIFIED", name: "ยังไม่ระบุ" },
{ id: "HAVE_CAUSE", name: "มีมูล" },
{ id: "NO_CAUSE", name: "ไม่มีมูล" },
]);
const causeTextOptions = ref<DataOption[]>([
const investigationCauseTextOptions = ref<DataOption[]>([
{ id: "ร้ายแรง", name: "ร้ายแรง" },
{ id: "ไม่ร้ายแรง", name: "ไม่ร้ายแรง" },
]);
const respondentTypeOp = ref<DataOption[]>([
{ id: "PERSON", name: "บุคคล" },
{ id: "ORGANIZATION", name: "หน่วยงาน" },
{ id: "BANGKOK", name: "กรุงเทพมหานคร" },
])
const daysExtendOp = ref<DataNumberOption[]>(daysExtendOps.value);
const investigationOp = ref<DataOption[]>(investigationOps.value);
const investigationDetailOp = ref<DataOption[]>(investigationDetailOps.value);
const faultOp = ref<DataOption[]>(faultOps.value);
const visibleColumnsPerson = ref<string[]>([]);
const columnsPerson = ref<QTableProps["columns"]>([]);
const visibleColumns = ref<string[]>([
"no",
"subject",
"interrogated",
"complaintOffenseDetails",
"title",
"respondentType",
"offenseDetails",
"investigationDetail",
"dateInvestigate",
"statusResult",
"investigationStatusResult",
"status",
]);
@ -77,31 +94,31 @@ export const useInvestigateFactStore = defineStore(
style: "font-size: 14px",
},
{
name: "subject",
name: "title",
align: "left",
label: "เรื่องร้องเรียน",
sortable: true,
field: "subject",
field: "title",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "interrogated",
name: "respondentType",
align: "left",
label: "ผู้ถูกสอบสวน",
sortable: true,
field: "interrogated",
field: "respondentType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "complaintOffenseDetails",
name: "offenseDetails",
align: "left",
label: "ลักษณะความผิด",
sortable: true,
field: "complaintOffenseDetails",
field: "offenseDetails",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -130,11 +147,11 @@ export const useInvestigateFactStore = defineStore(
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "statusResult",
name: "investigationStatusResult",
align: "left",
label: "ผลการสืบสวน",
sortable: true,
field: "statusResult",
field: "investigationStatusResult",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -162,7 +179,7 @@ export const useInvestigateFactStore = defineStore(
(v: any) => v.name.toLowerCase().indexOf(val) > -1
);
} else if (type === "investigationOp") {
investigationOp.value = investigationOps.value.filter(
investigationDetailOp.value = investigationDetailOps.value.filter(
(v: any) => v.name.toLowerCase().indexOf(val) > -1
);
} else if (type === "daysExtendOp") {
@ -174,27 +191,51 @@ export const useInvestigateFactStore = defineStore(
}
const rows = ref<InvestigatefactsDataRowType[]>();
const rowsAdd = ref<ArrayPerson[]>([])
function fetchInvestigateAdd(data: ArrayPerson[]) {
rowsAdd.value = data
}
const respondentTypeOps = ref<DataOption[]>(respondentTypeOp.value)
function filterSelector(val: string, update: Function, type: string) {
console.log(val)
update(() => {
const needle = val.toLowerCase();
if (type === "filtercomplainantType") {
respondentTypeOps.value = respondentTypeOp.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
}
async function fecthList(data: ListData[]) {
rows.value = await data.map((e: ListData) => {
return {
id: e.id,
subject: e.subject,
interrogated: e.interrogated,
complaintOffenseDetails: convertOffenseDetails(
e.complaintOffenseDetails
title: e.title,
respondentType: convertRespondentType(e.respondentType),
offenseDetails: convertOffenseDetails(
e.offenseDetails
),
investigationDetail: convertInvestigationDetail(
e.investigationDetail
),
dateInvestigate:
e.startDate && e.endDate
? `${date2Thai(e.startDate)} - ${date2Thai(e.endDate)}`
e.investigationDateStart && e.investigationDateEnd
? `${date2Thai(e.investigationDateStart)} - ${date2Thai(e.investigationDateEnd)}`
: "-",
statusResult: activeStatusResult(e.statusResult),
investigationStatusResult: activeStatusResult(e.investigationStatusResult),
status: convertStatus(e.status),
};
});
}
function convertRespondentType(val: string) {
const result = respondentTypeOp.value.find((x: any) => x.id == val)?.name;
return result ? result : "-";
}
function convertOffenseDetails(val: string) {
const result = offenseDetailsOps.value.find((x: any) => x.id == val)?.name;
@ -202,7 +243,7 @@ export const useInvestigateFactStore = defineStore(
}
function convertInvestigationDetail(val: string) {
const result = investigationOps.value.find((x: any) => x.id == val)?.name;
const result = investigationDetailOps.value.find((x: any) => x.id == val)?.name;
return result ? result : "-";
}
@ -211,7 +252,7 @@ export const useInvestigateFactStore = defineStore(
return result ? result : "-";
}
function activeStatusResult(val: string) {
const result = statusResultOptions.value.find(
const result = investigationStatusResultOptions.value.find(
(x: any) => x.id == val
)?.name;
return result ? result : "-";
@ -222,16 +263,26 @@ export const useInvestigateFactStore = defineStore(
fecthList,
rows,
daysExtendOps,
investigationOps,
investigationDetailOps,
faultOps,
filterFnOptionsType,
faultOp,
daysExtendOp,
investigationOp,
investigationDetailOp,
visibleColumns,
columns,
statusResultOptions,
causeTextOptions,
investigationStatusResultOptions,
investigationCauseTextOptions,
fetchInvestigateAdd,
rowsAdd,
respondentTypeOp,
filterSelector,
respondentTypeOps,
organizationIdOp,
ocListFn,
columnsPerson,
visibleColumnsPerson,
};
}
);