refactor code (ยังไม่หมด)
This commit is contained in:
parent
ab4189e6ed
commit
32d4de7075
21 changed files with 309 additions and 109 deletions
|
|
@ -217,6 +217,11 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
|||
"organization",
|
||||
]);
|
||||
|
||||
/**
|
||||
* แปลง option ที่รับมาเป็น ไทย
|
||||
* @param val ค่าที่ได้จาก API
|
||||
* @returns ส่ง name ที่ id ตรงกันออกไป
|
||||
*/
|
||||
function convertComplaintType(val: string) {
|
||||
const result = complainantoptionsMain.value.find(
|
||||
(x: any) => x.id == val
|
||||
|
|
@ -224,7 +229,11 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
|||
return result ? result : "-";
|
||||
}
|
||||
|
||||
/** function ลักษณะความผิด*/
|
||||
/**
|
||||
* แปลง status เป็น text
|
||||
* @param val status
|
||||
* @returns text
|
||||
*/
|
||||
function convertFault(val: string) {
|
||||
switch (val) {
|
||||
case "NOT_SPECIFIED":
|
||||
|
|
@ -238,7 +247,11 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
|||
}
|
||||
}
|
||||
|
||||
/** function สถานะ*/
|
||||
/**
|
||||
* แปลง status เป็น text
|
||||
* @param val status
|
||||
* @returns text
|
||||
*/
|
||||
function convertStatus(val: string) {
|
||||
switch (val) {
|
||||
case "NEW":
|
||||
|
|
@ -252,12 +265,22 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* แปลง option ที่รับมาเป็น ไทย
|
||||
* @param val ค่าที่ได้จาก API
|
||||
* @returns ส่ง name ที่ id ตรงกันออกไป
|
||||
*/
|
||||
function convertOffenseDetailst(val: string) {
|
||||
return (
|
||||
offenseDetailstOptions.value.find((x: any) => x.id == val)?.name ?? "-"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* แปลง option ที่รับมาเป็น ไทย
|
||||
* @param val ค่าที่ได้จาก API
|
||||
* @returns ส่ง name ที่ id ตรงกันออกไป
|
||||
*/
|
||||
function convertStatusResult(val: string) {
|
||||
const result = statusResultOptions.value.find(
|
||||
(x: any) => x.id == val
|
||||
|
|
@ -265,7 +288,10 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
|
|||
return result ? result : "-";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* จัดเก็บข้อมูลไว้ เพื่อใช้ใน POPUP
|
||||
* @param data ข้อมูลรายการบุคคล
|
||||
*/
|
||||
function fetchData(data: ArrayPersonAdd[]) {
|
||||
rowsAdd.value = data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue