refactor code (ยังไม่หมด)
This commit is contained in:
parent
ab4189e6ed
commit
32d4de7075
21 changed files with 309 additions and 109 deletions
|
|
@ -253,11 +253,20 @@ export const useInvestigateDisStore = defineStore(
|
|||
}
|
||||
]);
|
||||
|
||||
/**
|
||||
* แปลง status จาก id
|
||||
* @param val id ที่รับมาจาก API เเล้วมาทำการ find จาก id
|
||||
* @returns name
|
||||
*/
|
||||
function convertStatus(val: string) {
|
||||
const result = statusOps.value.find((x: any) => x.id == val)?.name;
|
||||
return result ? result : "-";
|
||||
}
|
||||
|
||||
/**
|
||||
* จัดเรียงข้อมูลจาก API
|
||||
* @param data ข้อมูลจาก API
|
||||
*/
|
||||
async function fetchList(data: investigateDisDataRowType[]) {
|
||||
let datalist: any[] = data.map((e: any) => ({
|
||||
id: e.id,
|
||||
|
|
@ -274,6 +283,10 @@ export const useInvestigateDisStore = defineStore(
|
|||
rows.value = datalist;
|
||||
}
|
||||
|
||||
/**
|
||||
* จัดเรียงข้อมูล กรรมการ จาก API
|
||||
* @param data ข้อมูลจาก API
|
||||
*/
|
||||
async function fecthDirector(data: directorType[]) {
|
||||
let datalistDirector: responseType[] = data.map((e: directorType) => ({
|
||||
id: e.id,
|
||||
|
|
@ -290,6 +303,11 @@ export const useInvestigateDisStore = defineStore(
|
|||
// console.log(rows2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* แปลง status เป็น text
|
||||
* @param val status
|
||||
* @returns text
|
||||
*/
|
||||
function convertRespondentType(val: string) {
|
||||
switch (val) {
|
||||
case "PERSON":
|
||||
|
|
@ -301,6 +319,11 @@ export const useInvestigateDisStore = defineStore(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* แปลง status เป็น text
|
||||
* @param val status
|
||||
* @returns text
|
||||
*/
|
||||
function convertFault(val: string) {
|
||||
switch (val) {
|
||||
case "NOT_SPECIFIED":
|
||||
|
|
@ -314,6 +337,12 @@ export const useInvestigateDisStore = defineStore(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟิลเตอร์ข้อมูลจาก input
|
||||
* @param val ค่าที่ป้อนให้ input
|
||||
* @param update function จาก quasar
|
||||
* @param type type ที่กำหนด ของ input นั้นๆ
|
||||
*/
|
||||
function filterFnOptionsType(
|
||||
val: string | number,
|
||||
update: any,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue