updated ระบบลา

This commit is contained in:
Warunee Tamkoo 2025-04-29 22:07:31 +07:00
parent cab7450748
commit e4cb83a9b3
6 changed files with 51 additions and 28 deletions

View file

@ -10,6 +10,8 @@ import type {
ListLeave,
} from "@/modules/09_leave/interface/response/leave";
import type { FremData } from "@/modules/09_leave/interface/request/leave";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
@ -162,6 +164,19 @@ export const useLeavelistDataStore = defineStore("leave", () => {
}
}
/** function ข้อมูลประเภทการลา*/
async function leaveTypeList() {
if (leaveType.value.length == 0) {
await http.get(config.API.leaveType()).then((res) => {
leaveType.value = res.data.result;
leaveTypeOption(res.data.result);
return res.data.result;
});
} else {
return leaveType.value;
}
}
function colorType(val: string) {
const dataType = leaveType.value.find((item: any) => item.id === val);
switch (dataType.code) {
@ -191,7 +206,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
}
function leaveTypeOption(val: any) {
dataToobar.value = val.map((e: any) => ({
dataToobar.value = leaveType.value.map((e: any) => ({
id: e.id,
name: e.name,
code: e.code,
@ -214,5 +229,6 @@ export const useLeavelistDataStore = defineStore("leave", () => {
colorType,
converstType,
leaveTypeOption,
leaveTypeList,
};
});