This commit is contained in:
setthawutttty 2023-11-07 17:28:47 +07:00
parent 5c4fd87033
commit 7aa2782a86
4 changed files with 96 additions and 190 deletions

View file

@ -5,6 +5,7 @@ import type { FormLeavetMainData, OptionData, formListLeaveData } from "@/module
import { useCounterMixin } from "@/stores/mixin"
export const useLeaveStore = defineStore("Leave", () => {
const typeLeave = ref<string|undefined>('')
const mixin = useCounterMixin()
const { date2Thai } = mixin
const LeaveType = ref<string | null>("0")
@ -244,6 +245,53 @@ export const useLeaveStore = defineStore("Leave", () => {
style: "font-size: 14px; width:10%;",
},
])
function typeConvert(item: string,subitem:any) {
console.log('first',item)
if (item !== '5' && item !== '7') {
typeLeave.value = convertSubtitle(item);
}else if(item === '5'){
typeLeave.value = convertSubtitleInfo(subitem);
}else if(item === '7'){
typeLeave.value = convertSubtitleInfo2(subitem);
}
}
function convertSubtitle(val: string) {
if (val) {
switch (val) {
case "0": return "ลาป่วย";
case "1": return "ลากิจส่วนตัว";
case "2": return "ลาคลอดบุตร";
case "3": return "ลาไปช่วยเหลือภริยาที่คลอดบุตร";
case "4": return "ลาพักผ่อน";
case "5": return "ลาอุปสมบทหรือลาประกอบพิธีฮัจย์ฯ";
case "6": return "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล";
case "7": return "ลาไปศึกษา";
case "8": return "ลาไปปฎิบัติงานในองค์การระหว่างประเทศ";
case "9": return "ลาติดตามคู่สมรส";
case "10": return "ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ";
}
}
}
function convertSubtitleInfo(val: string) {
if (val) {
switch (val) {
case "0": return "ลาอุปสมบท";
case "1": return "ลาประกอบพิธีฮัจย์";
}
}
}
function convertSubtitleInfo2(val: string) {
if (val) {
switch (val) {
case "0": return "ลาไปศึกษา";
case "1": return "ฝึกอบรม";
case "2": return "ปฎิบัติการวิจัย";
case "3": return "ดูงาน";
}
}
}
return {
typeOptions,
@ -264,6 +312,8 @@ export const useLeaveStore = defineStore("Leave", () => {
fiscalyearOP,
fiscalYearyear,
options,
optionsOrdination
optionsOrdination,
typeConvert,
typeLeave
}
})