แก้ไขเรื่องร้องเรียน, สืบสวน, สอบสวน
This commit is contained in:
parent
76594a2359
commit
f247167e9a
20 changed files with 1356 additions and 1714 deletions
|
|
@ -6,11 +6,12 @@ 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 { ArrayPerson } from "@/modules/11_discipline/interface/request/complaint";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useDisciplineMainStore } from "@/modules/11_discipline/store";
|
||||
const mainStore = useDisciplineMainStore();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai } = mixin;
|
||||
|
|
@ -19,27 +20,17 @@ 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;
|
||||
}
|
||||
|
||||
function addCommas(salaryString: string): string {
|
||||
const salaryNumber = parseFloat(salaryString.replace(/,/g, ""));
|
||||
return salaryNumber.toLocaleString();
|
||||
}
|
||||
|
||||
function fetchComplainst(data: 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),
|
||||
respondentType: mainStore.convertComplaintType(e.respondentType),
|
||||
offenseDetails: mainStore.convertOffenseDetailst(e.offenseDetails),
|
||||
createdAt: date2Thai(e.createdAt)!,
|
||||
levelConsideration: levelConsiderationTran(e.levelConsideration),
|
||||
dateConsideration: e.dateConsideration
|
||||
|
|
@ -50,21 +41,9 @@ export const useComplainstDataStore = defineStore(
|
|||
rows.value = dataList;
|
||||
}
|
||||
|
||||
// filter options
|
||||
const complainantoptionsMain = ref<DataOption[]>([
|
||||
{ id: "PERSON", name: "บุคคล" },
|
||||
{ id: "ORGANIZATION", name: "หน่วยงาน" },
|
||||
{ id: "BANGKOK", name: "กรุงเทพมหานคร" },
|
||||
]);
|
||||
|
||||
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 complainantoptions = ref<DataOption[]>(
|
||||
mainStore.complainantoptionsMain
|
||||
);
|
||||
const consideredAgencytoptions = ref<DataOption[]>([]);
|
||||
const organizationIdOp = ref<DataOption[]>([]);
|
||||
|
||||
|
|
@ -81,29 +60,17 @@ export const useComplainstDataStore = defineStore(
|
|||
}
|
||||
};
|
||||
|
||||
function offenseDetailsTran(val: string) {
|
||||
switch (val) {
|
||||
case "NOT_SPECIFIED":
|
||||
return "ยังไม่ระบุ";
|
||||
case "NOT_DEADLY":
|
||||
return "ร้ายแรง";
|
||||
case "DEADLY":
|
||||
return "ไม่ร้ายแรง";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
const levelConsiderationtOptions = ref<DataOption[]>([
|
||||
{ id: "NORMAL", name: "ปกติ" },
|
||||
{ id: "URGENT", name: "ด่วน" },
|
||||
{ id: "VERY_URGENT", name: "ด่วนมาก" },
|
||||
]);
|
||||
|
||||
function levelConsiderationTran(val: string) {
|
||||
switch (val) {
|
||||
case "NORMAL":
|
||||
return "ปกติ";
|
||||
case "URGENT":
|
||||
return "ด่วน";
|
||||
case "VERT_URGENT":
|
||||
return "ด่วนมาก";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
return (
|
||||
levelConsiderationtOptions.value.find((v: any) => v.id === val)?.name ??
|
||||
"-"
|
||||
);
|
||||
}
|
||||
|
||||
const agencytoptions = ref<DataOption[]>(consideredAgencytoptions.value);
|
||||
|
|
@ -119,7 +86,7 @@ export const useComplainstDataStore = defineStore(
|
|||
update(() => {
|
||||
const needle = val.toLowerCase();
|
||||
if (type === "filterrespondentType") {
|
||||
complainantoptions.value = complainantoptionsMain.value.filter(
|
||||
complainantoptions.value = mainStore.complainantoptionsMain.filter(
|
||||
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
|
||||
);
|
||||
} else if (type === "filteragencytoptions") {
|
||||
|
|
@ -144,7 +111,6 @@ export const useComplainstDataStore = defineStore(
|
|||
}
|
||||
return {
|
||||
rows,
|
||||
rowsAdd,
|
||||
visibleColumns,
|
||||
columns,
|
||||
fetchComplainst,
|
||||
|
|
@ -153,9 +119,9 @@ export const useComplainstDataStore = defineStore(
|
|||
complainantoptions,
|
||||
consideredAgencytoptions,
|
||||
optionListName,
|
||||
fetchComplainstAdd,
|
||||
organizationIdOp,
|
||||
ocListFn,
|
||||
levelConsiderationtOptions,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue