import { defineStore } from "pinia"; import { ref } from "vue"; export const useInvestigateFactStore = defineStore("InvestigateFact", () => { const rows = ref([]) async function fecthList(data: any) { let datalist = data.map((e: any) => ({ subject: e.subject, interrogated: e.interrogated, fault: convertFault(e.fault), status: convertSatatus(e.status), active: activeStatus(e.active) })) rows.value = datalist console.log(rows.value) } function convertFault(val: string) { switch (val) { case "0": return "ความผิดวินัยยังไม่ระบุ" case "1": return "ความผิดวินัยไม่ร้ายแรง" case "2": return "ความผิดวินัยร้ายแรง" } } function convertSatatus(val: string) { switch (val) { case "0": return "ยังไม่ระบุ" case "1": return "ร้ายแรง" case "2": return "ไม่ร้ายแรง" case "3": return "ยุติเรื่อง" } } function activeStatus(val: string) { switch (val) { case "0": return "ยังไม่ได้ยืนยันผล" case "1": return "ยืนยันผลเเล้ว" } } return { fecthList, rows, }; })