hrms-mgt/src/modules/07_insignia/storeResult.ts
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 18b4c85857 no message
2023-08-24 17:11:43 +07:00

55 lines
1.4 KiB
TypeScript

import { defineStore } from "pinia";
import { ref, } from "vue";
export const useResultDataStore = defineStore("insigniaResult", () => {
const insignia = ref<string>('')
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "" }])
const insigniaOp2 = ref<any[]>([])
const insigniaType = ref<any>()
const fetchDatainsignia = async (data: any) => {
data.forEach((e: any) => {
insigniaOp.value.push({ name: e.name, id: e.id })
});
data.forEach((e: any) => {
insigniaOp2.value.push({ name: e.name, id: e.id })
});
}
const fetchDatainsigniaType = async (data: any) => {
insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name }))
}
const status = (val: string) => {
switch (val) {
case "PENDING":
return "รอบันทึกข้อมูล";
case "REJECT":
return "ยกเลิก";
case "DELETE":
return "ลบ";
case "DONE":
return "บันทึกลง ก.พ. 7 แล้ว";
}
}
const profileType = (val: string) => {
switch (val) {
case "officer":
return "ข้าราชการ กทม.สามัญ";
case "employee":
return "ลูกจ้างประจำ";
}
}
return {
insignia,
insigniaOp,
insigniaOp2,
insigniaType,
fetchDatainsignia,
fetchDatainsigniaType,
status,
profileType,
};
});