จัดโค้ดวินัย

This commit is contained in:
setthawutttty 2023-12-25 16:31:24 +07:00
parent 71d3b54ef0
commit 7262000680
37 changed files with 492 additions and 697 deletions

View file

@ -3,7 +3,7 @@ import { ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { DataOption } from '@/modules/11_discipline/interface/index/Main'
import type { MainList, RowList,RowAddList } from '@/modules/11_discipline/interface/response/appealComplain'
import type { MainList, RowList, RowAddList } from '@/modules/11_discipline/interface/response/appealComplain'
export const useAppealComplainStore = defineStore(
"AppealComplainStore",
@ -15,48 +15,6 @@ export const useAppealComplainStore = defineStore(
const mixin = useCounterMixin()
const { date2Thai } = mixin
function fetchAppealComplain(data: MainList[]) {
let dataList: RowList[] = data.map((e: MainList) => ({
id: e.id,
profileId: e.profileId,
type: typeConvert(e.type),
title: e.title,
description: e.description,
year: e.year,
fullname: e.fullname,
citizenId: e.citizenId,
caseType: e.caseType,
caseNumber: e.caseNumber,
lastUpdatedAt: date2Thai(e.lastUpdatedAt),
status: statusTothai(e.status)
}));
rows.value = dataList;
}
function getRow(data:RowAddList[]){
if(data){
rowsAdd.value = data
}
}
function statusTothai(val: string){
switch (val) {
case "NEW":
return "ใหม่";
case "RECEIVE_DOC":
return "ได้รับเอกสารแล้ว";
case "RECEIVE_APPEAL":
return "รับอุทธรณ์/ร้องทุกข์";
case "NO_RECEIVE_APPEAL":
return "ไม่รับอุทธรณ์/ร้องทุกข์";
case "DIAGNOSTIC":
return "ตั้งองค์คณะวินิจฉัย";
case "SUMMARY":
return "สรุปผลการพิจารณา";
case "DONE":
return "ปิดคำร้อง";
default:
return "-";
}
};
const typeConvert = (val: string) => {
switch (val) {
case "APPEAL":
@ -96,6 +54,50 @@ export const useAppealComplainStore = defineStore(
{ id: "DONE", name: "ปิดคำร้อง" },
]);
function fetchAppealComplain(data: MainList[]) {
let dataList: RowList[] = data.map((e: MainList) => ({
id: e.id,
profileId: e.profileId,
type: typeConvert(e.type),
title: e.title,
description: e.description,
year: e.year,
fullname: e.fullname,
citizenId: e.citizenId,
caseType: e.caseType,
caseNumber: e.caseNumber,
lastUpdatedAt: date2Thai(e.lastUpdatedAt),
status: statusTothai(e.status)
}));
rows.value = dataList;
}
function getRow(data: RowAddList[]) {
if (data) {
rowsAdd.value = data
}
}
function statusTothai(val: string) {
switch (val) {
case "NEW":
return "ใหม่";
case "RECEIVE_DOC":
return "ได้รับเอกสารแล้ว";
case "RECEIVE_APPEAL":
return "รับอุทธรณ์/ร้องทุกข์";
case "NO_RECEIVE_APPEAL":
return "ไม่รับอุทธรณ์/ร้องทุกข์";
case "DIAGNOSTIC":
return "ตั้งองค์คณะวินิจฉัย";
case "SUMMARY":
return "สรุปผลการพิจารณา";
case "DONE":
return "ปิดคำร้อง";
default:
return "-";
}
};
return {
rows,

View file

@ -65,7 +65,11 @@ export const useComplainstDataStore = defineStore(
{ id: "URGENT", name: "ด่วน" },
{ id: "VERY_URGENT", name: "ด่วนมาก" },
]);
const agencytoptions = ref<DataOption[]>(consideredAgencytoptions.value);
const optionListNameMain = ref<DataOption[]>([]);
const optionListName = ref<DataOption[]>([]);
function levelConsiderationTran(val: string) {
return (
levelConsiderationtOptions.value.find((v: any) => v.id === val)?.name ??
@ -73,10 +77,6 @@ export const useComplainstDataStore = defineStore(
);
}
const agencytoptions = ref<DataOption[]>(consideredAgencytoptions.value);
const optionListNameMain = ref<DataOption[]>([]);
const optionListName = ref<DataOption[]>([]);
function selectComplainantTpye(list: any) {
optionListNameMain.value = list;
optionListName.value = list;

View file

@ -11,6 +11,7 @@ export const useDisciplineDirectorDataStore = defineStore(
"disciplineDirector",
() => {
//ค้นหา คอลัมน์ คอลัมน์ที่แสดง
const rows = ref<DirectorRowsResponse[]>([]);
const visibleColumns = ref<string[]>([
"no",
"fullName",
@ -89,7 +90,6 @@ export const useDisciplineDirectorDataStore = defineStore(
]);
// ข้อมูลในตาราง
const rows = ref<DirectorRowsResponse[]>([]);
function fetchData(data: DirectorRows[]) {
const dataList: DirectorRowsResponse[] = data.map(
(item: DirectorRows) => ({

View file

@ -67,66 +67,6 @@ export const useInvestigateDisStore = defineStore(
{ id: "ไม่ร้ายแรง", name: "ไม่ร้ายแรง" },
]);
function convertStatus(val: string) {
const result = statusOps.value.find((x: any) => x.id == val)?.name;
return result ? result : "-";
}
async function fetchList(data: investigateDisDataRowType[]) {
let datalist: any[] = data.map((e: any) => ({
id: e.id,
title: e.title,
respondentType: convertRespondentType(e.respondentType),
offenseDetails: convertFault(e.offenseDetails),
disciplinaryFaultLevel: e.disciplinaryFaultLevel ?? "-",
disciplinaryCaseFault: e.disciplinaryCaseFault ?? "-",
status: convertStatus(e.status) ?? "-",
createdAt: e.createdAt ? date2Thai(e.createdAt) : "-",
}));
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);
}
function convertRespondentType(val: string) {
switch (val) {
case "PERSON":
return "บุคคล";
case "ORGANIZATION":
return "หน่วยงาน";
case "BANGKOK":
return "กรุงเทพมหานคร";
}
}
function convertFault(val: string) {
switch (val) {
case "NOT_SPECIFIED":
return "ความผิดวินัยยังไม่ระบุ";
case "NOT_DEADLY":
return "ความผิดวินัยไม่ร้ายแรง";
case "DEADLY":
return "ความผิดวินัยร้ายแรง";
default:
return "-";
}
}
const visibleColumns = ref<String[]>([
"no",
"title",
@ -284,18 +224,69 @@ export const useInvestigateDisStore = defineStore(
field: "phone",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
// {
// name: "total",
// align: "left",
// label: "จำนวนเรื่องสืบสวน",
// sortable: true,
// field: "total",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
}
]);
function convertStatus(val: string) {
const result = statusOps.value.find((x: any) => x.id == val)?.name;
return result ? result : "-";
}
async function fetchList(data: investigateDisDataRowType[]) {
let datalist: any[] = data.map((e: any) => ({
id: e.id,
title: e.title,
respondentType: convertRespondentType(e.respondentType),
offenseDetails: convertFault(e.offenseDetails),
disciplinaryFaultLevel: e.disciplinaryFaultLevel ?? "-",
disciplinaryCaseFault: e.disciplinaryCaseFault ?? "-",
status: convertStatus(e.status) ?? "-",
createdAt: e.createdAt ? date2Thai(e.createdAt) : "-",
}));
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);
}
function convertRespondentType(val: string) {
switch (val) {
case "PERSON":
return "บุคคล";
case "ORGANIZATION":
return "หน่วยงาน";
case "BANGKOK":
return "กรุงเทพมหานคร";
}
}
function convertFault(val: string) {
switch (val) {
case "NOT_SPECIFIED":
return "ความผิดวินัยยังไม่ระบุ";
case "NOT_DEADLY":
return "ความผิดวินัยไม่ร้ายแรง";
case "DEADLY":
return "ความผิดวินัยร้ายแรง";
default:
return "-";
}
}
function filterFnOptionsType(
val: string | number,
update: any,

View file

@ -33,6 +33,10 @@ export const useInvestigateFactStore = defineStore(
"DisciplineInvestigateFact",
() => {
const tabMenu = ref<string>("investigatefacts");
const rows = ref<InvestigatefactsDataRowType[]>();
const respondentTypeOps = ref<DataOption[]>(
mainStore.complainantoptionsMain
);
const daysExtendOps = ref<DataNumberOption[]>([
{ id: 15, name: "15 วัน" },
@ -189,11 +193,7 @@ export const useInvestigateFactStore = defineStore(
});
}
const rows = ref<InvestigatefactsDataRowType[]>();
const respondentTypeOps = ref<DataOption[]>(
mainStore.complainantoptionsMain
);
function filterSelector(val: string, update: Function, type: string) {
console.log(val);
update(() => {
@ -206,6 +206,7 @@ export const useInvestigateFactStore = defineStore(
}
});
}
async function fecthList(data: ListData[]) {
rows.value = await data.map((e: ListData) => {
return {
@ -219,8 +220,8 @@ export const useInvestigateFactStore = defineStore(
dateInvestigate:
e.investigationDateStart && e.investigationDateEnd
? `${date2Thai(e.investigationDateStart)} - ${date2Thai(
e.investigationDateEnd
)}`
e.investigationDateEnd
)}`
: "-",
investigationStatusResult: mainStore.convertStatusResult(
e.investigationStatusResult

View file

@ -28,56 +28,6 @@ export const useDisciplineResultStore = defineStore(
storeMain.complainantoptionsMain
);
function filterSelector(val: string, update: Function, type: string) {
update(() => {
const needle = val.toLowerCase();
if (type === "filterrespondentType") {
complainantoptions.value = storeMain.complainantoptionsMain.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
}
async function fetchList(data: DataResult[]) {
const datalist: DataResultList[] = data.map((e: DataResult) => ({
id: e.id,
title: e.title,
respondentType: e.respondentType
? storeMain.convertComplaintType(e.respondentType)
: "-",
offenseDetails: e.offenseDetails
? storeMain.convertFault(e.offenseDetails)
: "-",
disciplinaryFaultLevel: e.disciplinaryFaultLevel
? e.disciplinaryFaultLevel
: "-",
disciplinaryCaseFault: e.disciplinaryCaseFault
? e.disciplinaryCaseFault
: "-",
status: e.status && convertStatus(e.status),
createdAt: e.createdAt && date2Thai(e.createdAt),
disciplineType: e.disciplineType ? e.disciplineType:'-' ,
titleType: e.titleType ? e.titleType:'-' ,
oc: e.oc ? e.oc:'-'
}));
rows.value = datalist;
}
/** function สถานะ*/
function convertStatus(val: string) {
switch (val) {
// case "NEW":
// return "กำลังสรุปผลการพิจารณา";
// case "STOP":
// return "ยุติเรื่อง";
case "DONE":
return "กำลังสรุปผลการพิจารณา";
case "REPORT":
return "ส่งไปออกคำสั่ง";
}
}
const visibleColumns = ref<String[]>([
"no",
"title",
@ -211,6 +161,7 @@ export const useDisciplineResultStore = defineStore(
"telephone",
"role",
]);
const columnsDirector = ref<QTableProps["columns"]>([
{
name: "no",
@ -276,6 +227,53 @@ export const useDisciplineResultStore = defineStore(
style: "font-size: 14px",
},
]);
function filterSelector(val: string, update: Function, type: string) {
update(() => {
const needle = val.toLowerCase();
if (type === "filterrespondentType") {
complainantoptions.value = storeMain.complainantoptionsMain.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
}
async function fetchList(data: DataResult[]) {
const datalist: DataResultList[] = data.map((e: DataResult) => ({
id: e.id,
title: e.title,
respondentType: e.respondentType
? storeMain.convertComplaintType(e.respondentType)
: "-",
offenseDetails: e.offenseDetails
? storeMain.convertFault(e.offenseDetails)
: "-",
disciplinaryFaultLevel: e.disciplinaryFaultLevel
? e.disciplinaryFaultLevel
: "-",
disciplinaryCaseFault: e.disciplinaryCaseFault
? e.disciplinaryCaseFault
: "-",
status: e.status && convertStatus(e.status),
createdAt: e.createdAt && date2Thai(e.createdAt),
disciplineType: e.disciplineType ? e.disciplineType:'-' ,
titleType: e.titleType ? e.titleType:'-' ,
oc: e.oc ? e.oc:'-'
}));
rows.value = datalist;
}
/** function สถานะ*/
function convertStatus(val: string) {
switch (val) {
case "DONE":
return "กำลังสรุปผลการพิจารณา";
case "REPORT":
return "ส่งไปออกคำสั่ง";
}
}
return {
tabMenu,
fetchList,

View file

@ -1,6 +1,6 @@
import { defineStore } from "pinia";
import { ref } from 'vue'
import type { listData, dataType ,DataOption} from '@/modules/11_discipline/interface/response/suspend'
import type { listData, dataType, DataOption } from '@/modules/11_discipline/interface/response/suspend'
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@ -13,7 +13,7 @@ export const useDisciplineSuspendStore = defineStore(
const mixin = useCounterMixin()
const { date2Thai } = mixin
const offenseDetailsOps = ref<DataOption[]>([
{ id: "NOT_SPECIFIED", name: "ยังไม่ระบุ" },
{ id: "NOT_DEADLY", name: "ไม่ร้ายแรง" },
@ -22,7 +22,7 @@ export const useDisciplineSuspendStore = defineStore(
function getData(data: listData[]) {
console.log(data)
const dataList: dataType[] = data.map((item: listData) => ({
const dataList: dataType[] = data.map((item: listData) => ({
id: item.id,
citizenId: item.citizenId,
name: `${item.prefix}${item.firstName} ${item.lastName}`,
@ -37,7 +37,7 @@ export const useDisciplineSuspendStore = defineStore(
status: statusTothai(item.status),
statusEn: item.status,
descriptionSuspend: item.descriptionSuspend,
dateTotal:item.startDateSuspend && item.endDateSuspend ? `${date2Thai(item.startDateSuspend)} - ${date2Thai(item.endDateSuspend)}`:'-',
dateTotal: item.startDateSuspend && item.endDateSuspend ? `${date2Thai(item.startDateSuspend)} - ${date2Thai(item.endDateSuspend)}` : '-',
startDateSuspend: item.startDateSuspend,
endDateSuspend: item.endDateSuspend,
title: item.title,
@ -63,7 +63,7 @@ export const useDisciplineSuspendStore = defineStore(
return "ส่งรายชื่อไปออกคำสั่ง";
case "DONE":
return "ออกคำสั่งเสร็จแล้ว";
default:
return "-";
}

View file

@ -12,41 +12,6 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
{ id: "BANGKOK", name: "กรุงเทพมหานคร" },
]);
function convertComplaintType(val: string) {
const result = complainantoptionsMain.value.find(
(x: any) => x.id == val
)?.name;
return result ? result : "-";
}
/** 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 "ส่งไปสอบสวน";
case "DONE":
return "ส่งไปสรุปผลการพิจารณาความผิดทางวินัย";
}
}
/** option ลักษณะความผิด */
const offenseDetailstOptions = ref<DataOption[]>([
{ id: "NOT_SPECIFIED", name: "ยังไม่ระบุ" },
@ -54,29 +19,18 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
{ id: "DEADLY", name: "ร้ายแรง" },
]);
function convertOffenseDetailst(val: string) {
return (
offenseDetailstOptions.value.find((x: any) => x.id == val)?.name ?? "-"
);
}
const statusResultOptions = ref<DataOption[]>([
{ id: "NOT_SPECIFIED", name: "ยังไม่ระบุ" },
{ id: "HAVE_CAUSE", name: "มีมูล" },
{ id: "NO_CAUSE", name: "ไม่มีมูล" },
]);
function convertStatusResult(val: string) {
const result = statusResultOptions.value.find(
(x: any) => x.id == val
)?.name;
return result ? result : "-";
}
const causeTextOptions = ref<DataOption[]>([
{ id: "ร้ายแรง", name: "ร้ายแรง" },
{ id: "ไม่ร้ายแรง", name: "ไม่ร้ายแรง" },
]);
const rowsAdd = ref<ArrayPersonAdd[]>([]);
const rowsCheck = ref<ArrayPersonAdd[]>([]);
/** หัวตารางผู้ถูกร้องเรียน */
const columnsRespondent = ref<QTableProps["columns"]>([
{
@ -273,8 +227,55 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
"organization",
]);
const rowsAdd = ref<ArrayPersonAdd[]>([]);
const rowsCheck = ref<ArrayPersonAdd[]>([]);
function convertComplaintType(val: string) {
const result = complainantoptionsMain.value.find(
(x: any) => x.id == val
)?.name;
return result ? result : "-";
}
/** 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 "ส่งไปสอบสวน";
case "DONE":
return "ส่งไปสรุปผลการพิจารณาความผิดทางวินัย";
}
}
function convertOffenseDetailst(val: string) {
return (
offenseDetailstOptions.value.find((x: any) => x.id == val)?.name ?? "-"
);
}
function convertStatusResult(val: string) {
const result = statusResultOptions.value.find(
(x: any) => x.id == val
)?.name;
return result ? result : "-";
}
function fetchData(data: ArrayPersonAdd[]) {
rowsAdd.value = data;
}