hrms-mgt/src/modules/22_issues/store.ts

53 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-01-28 18:25:18 +07:00
import { ref } from "vue";
import { defineStore } from "pinia";
2026-01-29 14:07:54 +07:00
import type { Options } from "@/modules/22_issues/interface/Main";
2026-01-28 18:25:18 +07:00
export const useIssueStore = defineStore("issue", () => {
2026-01-29 14:07:54 +07:00
const systemOptions = ref<Options[]>([
2026-01-28 18:25:18 +07:00
{ label: "ทั้งหมด", value: "" },
{ label: "ระบบบริหารจัดการ", value: "MGT" },
{ label: "ระบบผู้ใช้งาน", value: "USER" },
{ label: "ระบบลงเวลา", value: "CHECKIN" },
]);
2026-01-29 14:07:54 +07:00
const statusOptions = ref<Options[]>([
2026-01-28 18:25:18 +07:00
{ label: "ทั้งหมด", value: "" },
{ label: "ใหม่", value: "NEW" },
{ label: "กำลังดำเนินการ", value: "IN_PROGRESS" },
{ label: "แก้ไขแล้ว", value: "RESOLVED" },
{ label: "ปิดแล้ว", value: "CLOSED" },
]);
function convertStatus(status: string) {
let val = status.toUpperCase();
switch (val) {
case "NEW":
return "ใหม่";
case "IN_PROGRESS":
return "กำลังดำเนินการ";
case "RESOLVED":
return "แก้ไขแล้ว";
case "CLOSED":
return "ปิดแล้ว";
default:
2026-01-29 14:07:54 +07:00
return "-";
2026-01-28 18:25:18 +07:00
}
}
function convertSystem(system: string) {
let val = system.toUpperCase();
switch (val) {
case "MGT":
return "ระบบบริหารจัดการ";
case "USER":
return "ระบบผู้ใช้งาน";
case "CHECKIN":
return "ระบบลงเวลา";
2026-01-29 14:07:54 +07:00
default:
return "-";
2026-01-28 18:25:18 +07:00
}
}
return { systemOptions, statusOptions, convertStatus, convertSystem };
});