update filter รอ api
ทำ store ,interface
This commit is contained in:
parent
ebbdec0478
commit
d642cf39bf
4 changed files with 84 additions and 43 deletions
62
src/modules/05_leave/store.ts
Normal file
62
src/modules/05_leave/store.ts
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import { defineStore } from "pinia"
|
||||
import { ref } from "vue"
|
||||
import type { QTableProps } from "quasar"
|
||||
import type { FormLeavetMainData, OptionData } from "@/modules/05_leave/interface/index/"
|
||||
|
||||
export const useLeaveStore = defineStore("Leave", () => {
|
||||
const DataMainOrig = ref<FormLeavetMainData[]>([]) // ข้อมูลหลักดั้งเดิม
|
||||
const DataMainUpdate = ref<FormLeavetMainData[]>([]) // ข้อมูลเปลี่ยนแปลง
|
||||
|
||||
const DataMain = (val: FormLeavetMainData[]) => {
|
||||
DataMainOrig.value = val
|
||||
}
|
||||
|
||||
const DataUpdate = (filter_1: string, filter_2: string) => {
|
||||
DataMainUpdate.value = []
|
||||
|
||||
if (filter_1 === "" && filter_2 === "ทั้งหมด") {
|
||||
DataMainUpdate.value = DataMainOrig.value
|
||||
} else if (filter_1 !== "" && filter_2 === "ทั้งหมด") {
|
||||
DataMainUpdate.value = DataMainOrig.value.filter(item => item.TypeValue === filter_1)
|
||||
} else if (filter_1 !== "" && filter_2 !== "ทั้งหมด") {
|
||||
DataMainUpdate.value = DataMainOrig.value.filter(item => item.TypeValue === filter_1 && item.Status === filter_2)
|
||||
} else if (filter_1 === "" && filter_2 !== "ทั้งหมด") {
|
||||
DataMainUpdate.value = DataMainOrig.value.filter(item => item.Status === filter_2)
|
||||
}
|
||||
}
|
||||
|
||||
const optionsSpecific = ref<OptionData[]>([
|
||||
{ id: "0", name: "ลาไปศึกษา" },
|
||||
{ id: "1", name: "ฝึกอบรม" },
|
||||
{ id: "2", name: "ปฎิบัติการวิจัย" },
|
||||
{ id: "2", name: "ดูงาน" },
|
||||
])
|
||||
const typeOptions = ref<OptionData[]>([
|
||||
{ id: "0", name: "ลาป่วย" },
|
||||
{ id: "1", name: "ลากิจส่วนตัว" },
|
||||
{ id: "2", name: "ลาคลอดบุตร" },
|
||||
{ id: "3", name: "ลาไปช่วยเหลือภริยาที่คลอดบุตร" },
|
||||
{ id: "4", name: "ลาอุปสมบทหรือลาประกอบพิธีฮัจย์ฯ" },
|
||||
{ id: "5", name: "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล" },
|
||||
{ id: "6", name: "ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน" },
|
||||
{ id: "7", name: "ลาไปปฎิบัติงานในองค์การระหว่างประเทศ" },
|
||||
{ id: "8", name: "ลาติดตามคู่สมรส" },
|
||||
{ id: "9", name: "ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ" },
|
||||
])
|
||||
|
||||
const statusOptions = ref<OptionData>([
|
||||
{ id: "0", name: "อนุมัติ" },
|
||||
{ id: "1", name: "ไม่อนุมัติ" },
|
||||
{ id: "2", name: "อยู่ระหว่างดำเนินการ" },
|
||||
{ id: "3", name: "ใหม่" },
|
||||
])
|
||||
return {
|
||||
typeOptions,
|
||||
optionsSpecific,
|
||||
statusOptions,
|
||||
DataMain,
|
||||
DataMainUpdate,
|
||||
DataUpdate,
|
||||
DataMainOrig,
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue