ปรับหน้าเรื่องร้องเรียนของวินัย
This commit is contained in:
parent
bb8f96c78a
commit
e18386db65
7 changed files with 221 additions and 305 deletions
|
|
@ -3,140 +3,158 @@ 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,
|
||||
ArrayPerson,
|
||||
ocListType,
|
||||
} from "@/modules/11_discipline/interface/response/complaint";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
const { date2Thai } = mixin
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai } = mixin;
|
||||
|
||||
// id
|
||||
// cardId
|
||||
// prefix
|
||||
// firstName
|
||||
// lastName
|
||||
// position
|
||||
// level
|
||||
// oc
|
||||
export const useComplainstDataStore = defineStore("DisciplineComplainst", () => {
|
||||
const rows = ref<DataListRow[]>([])
|
||||
const rowsAdd = ref<ArrayPerson[]>([])
|
||||
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 ? e.dateReceived : "-",
|
||||
respondentType: convertComplaintType(e.respondentType),
|
||||
offenseDetails: offenseDetailsTran(e.offenseDetails),
|
||||
createdAt: date2Thai(e.createdAt)!,
|
||||
levelConsideration: levelConsiderationTran(e.levelConsideration),
|
||||
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,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue