no message

This commit is contained in:
setthawutttty 2023-11-24 17:56:41 +07:00
commit d3ec604478
35 changed files with 2452 additions and 729 deletions

View file

@ -3,142 +3,160 @@ import { ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import type { DataOption } from "@/modules/11_discipline/interface/index/Main";
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
DataList,
DataListRow,
DataAdd,
ocListType,
} from "@/modules/11_discipline/interface/response/complaint";
import type { ArrayPerson } from '@/modules/11_discipline/interface/request/complaint'
import type { QTableProps } from "quasar";
// id
// cardId
// prefix
// firstName
// lastName
// position
// level
// oc
export const useComplainstDataStore = defineStore("DisciplineComplainst", () => {
const rows = ref<DataListRow[]>([])
const rowsAdd = ref<ArrayPerson[]>([])
const mixin = useCounterMixin();
const { date2Thai } = mixin;
export const useComplainstDataStore = defineStore(
"DisciplineComplainst",
() => {
const rows = ref<DataListRow[]>([]);
const rowsAdd = ref<ArrayPerson[]>([]);
const visibleColumns = ref<string[]>([]);
const columns = ref<QTableProps["columns"]>([]);
function fetchComplainstAdd(data: ArrayPerson[]) {
rowsAdd.value = data
rowsAdd.value = data;
}
function addCommas(salaryString: string): string {
const salaryNumber = parseFloat(salaryString.replace(/,/g, ''));
return salaryNumber.toLocaleString();
const salaryNumber = parseFloat(salaryString.replace(/,/g, ""));
return salaryNumber.toLocaleString();
}
function fetchComplainst(data: DataList[]) {
let datalist: DataListRow[] = data.map((e: DataList) => ({
id: e.id,
title: e.title,
description: e.description,
appellant: e.appellant,
offenseDetails: offenseDetailsTran(e.offenseDetails),
createdAt: date2Thai(e.createdAt)!,
levelConsideration: levelConsiderationTran(e.levelConsideration),
dateConsideration: date2Thai(e.dateConsideration)!,
status: statusTothai(e.status),
}));
rows.value = datalist;
}
let dataList: DataListRow[] = data.map((e: DataList) => ({
id: e.id,
personId: e.personId,
title: e.title,
dateReceived: e.dateReceived ? date2Thai(e.dateReceived) : "-",
respondentType: convertComplaintType(e.respondentType),
offenseDetails: offenseDetailsTran(e.offenseDetails),
createdAt: date2Thai(e.createdAt)!,
levelConsideration: levelConsiderationTran(e.levelConsideration),
dateConsideration: e.dateConsideration
? date2Thai(e.dateConsideration)
: "-",
status: statusTothai(e.status),
}));
rows.value = dataList;
}
// filter options
const complainantoptionsMain = ref<DataOption[]>([
{ id: "PERSON", name: "บุคคล" },
{ id: "ORGANIZATION", name: "หน่วยงาน" },
{ id: "BANGKOK", name: "กรุงเทพมหานคร" },
{ id: "PERSON", name: "บุคคล" },
{ id: "ORGANIZATION", name: "หน่วยงาน" },
{ id: "BANGKOK", name: "กรุงเทพมหานคร" },
]);
const complainantoptions = ref<DataOption[]>(complainantoptionsMain.value)
function convertComplaintType(val: string) {
const result = complainantoptionsMain.value.find(
(x: any) => x.id == val
)?.name;
return result ? result : "-";
}
const complainantoptions = ref<DataOption[]>(complainantoptionsMain.value);
const consideredAgencytoptions = ref<DataOption[]>([]);
const organizationIdOp = ref<DataOption[]>([]);
const statusTothai = (val: string) => {
switch (val) {
case 'NEW': return "ใหม่";
case 'STOP': return "ยุติเรื่อง";
case 'SEND_INVESTIGATE': return "มีมูลส่งไปสืบสวนแล้ว";
default: return "-";
}
switch (val) {
case "NEW":
return "ใหม่";
case "STOP":
return "ยุติเรื่อง";
case "SEND_INVESTIGATE":
return "มีมูลส่งไปสืบสวนแล้ว";
default:
return "-";
}
};
function offenseDetailsTran(val: string){
switch (val) {
case 'NOT_SPECIFIED': return "ยังไม่ระบุ";
case 'NOT_DEADLY': return "ร้ายแรง";
case 'DEADLY': return "ไม่ร้ายแรง";
default: return "-";
}
function offenseDetailsTran(val: string) {
switch (val) {
case "NOT_SPECIFIED":
return "ยังไม่ระบุ";
case "NOT_DEADLY":
return "ร้ายแรง";
case "DEADLY":
return "ไม่ร้ายแรง";
default:
return "-";
}
}
function levelConsiderationTran(val: string){
switch (val) {
case 'NORMAL': return "ปกติ";
case 'URGENT': return "ด่วน";
case 'VERT_URGENT': return "ด่วนมาก";
default: return "-";
}
function levelConsiderationTran(val: string) {
switch (val) {
case "NORMAL":
return "ปกติ";
case "URGENT":
return "ด่วน";
case "VERT_URGENT":
return "ด่วนมาก";
default:
return "-";
}
}
const agencytoptions = ref<DataOption[]>(consideredAgencytoptions.value)
const optionListNameMain = ref<DataOption[]>([])
const optionListName = ref<DataOption[]>([])
const agencytoptions = ref<DataOption[]>(consideredAgencytoptions.value);
const optionListNameMain = ref<DataOption[]>([]);
const optionListName = ref<DataOption[]>([]);
function selectComplainantTpye(list: any) {
optionListNameMain.value = list
optionListName.value = list
optionListNameMain.value = list;
optionListName.value = list;
}
function filterSelector(val: string, update: Function, type: string) {
update(() => {
const needle = val.toLowerCase();
update(() => {
const needle = val.toLowerCase();
if (type === "filtercomplainantType") {
complainantoptions.value = complainantoptionsMain.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (type === "filteragencytoptions") {
agencytoptions.value = consideredAgencytoptions.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (type === "filtercomplainantOP") {
optionListName.value = optionListNameMain.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
if (type === "filtercomplainantType") {
complainantoptions.value = complainantoptionsMain.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (type === "filteragencytoptions") {
agencytoptions.value = consideredAgencytoptions.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (type === "filtercomplainantOP") {
optionListName.value = optionListNameMain.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
}
function ocListFn(data:ocListType[]){
let dataList:DataOption[] = data.map((item:ocListType)=>({
id:item.organizationId,
name:item.organizationName
}))
consideredAgencytoptions.value = dataList
organizationIdOp.value = dataList
function ocListFn(data: ocListType[]) {
let dataList: DataOption[] = data.map((item: ocListType) => ({
id: item.organizationId,
name: item.organizationName,
}));
consideredAgencytoptions.value = dataList;
organizationIdOp.value = dataList;
}
return {
rows,
rowsAdd,
visibleColumns,
columns,
fetchComplainst,
selectComplainantTpye,
filterSelector,
complainantoptions,
consideredAgencytoptions,
optionListName,
fetchComplainstAdd,
organizationIdOp,
ocListFn
}
})
rows,
rowsAdd,
visibleColumns,
columns,
fetchComplainst,
selectComplainantTpye,
filterSelector,
complainantoptions,
consideredAgencytoptions,
optionListName,
fetchComplainstAdd,
organizationIdOp,
ocListFn,
};
}
);

View file

@ -32,18 +32,18 @@ export const useInvestigateDisStore = defineStore(
{ id: "5", name: "ปลดออก" },
{ id: "6", name: "ไล่ออก" },
]);
async function fecthList(data: investigateDisDataRowType[]) {
let datalist: investigateDisDataRowType[] = data.map((e: any) => ({
async function fetchList(data: investigateDisDataRowType[]) {
let datalist: any[] = data.map((e: any) => ({
id: e.id,
subject: e.subject,
interrogated: e.interrogated,
fault: convertFault(e.fault),
penaltyLevel: convertPenaltyLevel(e.penaltyLevel),
caseFault: e.caseFault,
dateInvestigate: date2Thai(new Date(e.dateInvestigate)),
status: convertSatatus(e.status),
active: activeStatus(e.active),
title: e.title,
respondentType: e.respondentType,
offenseDetails: e.offenseDetails,
disciplinaryFaultLevel: e.disciplinaryFaultLevel,
disciplinaryCaseFault: e.disciplinaryCaseFault,
status: e.status,
createdAt: date2Thai(e.createdAt),
}));
rows.value = datalist;
}
async function fecthDirector(data: directorType[]) {
@ -59,7 +59,7 @@ export const useInvestigateDisStore = defineStore(
}));
rows2.value = datalistDirector;
selected.value = rows2.value;
console.log(rows2.value);
// console.log(rows2.value);
}
function convertFault(val: string) {
switch (val) {
@ -110,12 +110,12 @@ export const useInvestigateDisStore = defineStore(
const visibleColumns = ref<String[]>([
"no",
"subject",
"interrogated",
"fault",
"penaltyLevel",
"caseFault",
"dateInvestigate",
"title",
"respondentType",
"offenseDetails",
"disciplinaryFaultLevel",
"disciplinaryCaseFault",
"createdAt",
"status",
]);
@ -130,64 +130,64 @@ export const useInvestigateDisStore = 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: "fault",
name: "offenseDetails",
align: "left",
label: "ลักษณะความผิด",
sortable: true,
field: "fault",
field: "offenseDetails",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "penaltyLevel",
name: "disciplinaryFaultLevel",
align: "left",
label: "ระดับโทษความผิด",
sortable: true,
field: "penaltyLevel",
field: "disciplinaryFaultLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "caseFault",
name: "disciplinaryCaseFault",
align: "left",
label: "กรณีความผิด",
sortable: true,
field: "caseFault",
field: "disciplinaryCaseFault",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateInvestigate",
name: "createdAt",
align: "left",
label: "วันที่สอบสวน",
sortable: true,
field: "dateInvestigate",
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -278,7 +278,7 @@ export const useInvestigateDisStore = defineStore(
]);
return {
tabMenu,
fecthList,
fetchList,
rows,
rows2,
optionsTypefault,

View file

@ -0,0 +1,226 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type { QTableProps } from "quasar";
import type {
investigateDisDataRowType,
DataOption,
directorType,
} from "@/modules/11_discipline/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
export const useDisciplineResultStore = defineStore(
"disciplineResultStore",
() => {
const tabMenu = ref<string>("result");
const rows = ref<investigateDisDataRowType[]>([]);
const rows2 = ref<directorType[]>([]);
const selected = ref<directorType[]>([]);
async function fecthList(data: investigateDisDataRowType[]) {
let datalist: investigateDisDataRowType[] = data.map((e: any) => ({
id: e.id,
subject: e.subject,
interrogated: e.interrogated,
caseFault: e.caseFault,
dateInvestigate: date2Thai(new Date(e.dateInvestigate)),
}));
rows.value = datalist;
}
async function fecthDirector(data: directorType[]) {
let datalistDirector: directorType[] = data.map((e: directorType) => ({
nameDirector: e.nameDirector,
position: e.position,
duty: e.duty,
email: e.email,
telephone: e.telephone,
role: e.role,
}));
rows2.value = datalistDirector;
selected.value = rows2.value;
console.log(rows2.value);
}
const visibleColumns = ref<String[]>([
"no",
"subject",
"interrogated",
"fault",
"penaltyLevel",
"caseFault",
"dateInvestigate",
"status",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "center",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "subject",
align: "left",
label: "เรื่อง",
sortable: true,
field: "subject",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "interrogated",
align: "left",
label: "ผู้ถูกสืบสวน",
sortable: true,
field: "interrogated",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "fault",
align: "left",
label: "ลักษณะความผิด",
sortable: true,
field: "fault",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "penaltyLevel",
align: "left",
label: "ระดับโทษความผิด",
sortable: true,
field: "penaltyLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "caseFault",
align: "left",
label: "กรณีความผิด",
sortable: true,
field: "caseFault",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateInvestigate",
align: "left",
label: "วันที่สอบสวน",
sortable: true,
field: "dateInvestigate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumnsDirector = ref<String[]>([
"no",
"name",
"position",
"duty",
"email",
"telephone",
"role",
]);
const columnsDirector = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
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: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "duty",
align: "left",
label: "หน้าที่",
sortable: true,
field: "duty",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "email",
align: "left",
label: "อีเมล",
sortable: true,
field: "email",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "telephone",
align: "left",
label: "เบอร์โทรศัพท์",
sortable: true,
field: "telephone",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "role",
align: "left",
label: "จำนวนเรื่องสืบสวน",
sortable: true,
field: "role",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
return {
tabMenu,
fecthList,
rows,
rows2,
fecthDirector,
visibleColumns,
columns,
visibleColumnsDirector,
columnsDirector,
};
}
);