update filter รอ api
ทำ store ,interface
This commit is contained in:
parent
ebbdec0478
commit
d642cf39bf
4 changed files with 84 additions and 43 deletions
|
|
@ -8,7 +8,7 @@ import config from "@/app.config"
|
|||
import type { QForm } from "quasar"
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader, fails } = mixin
|
||||
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } = mixin
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const myform = ref<QForm | null>(null)
|
||||
|
|
@ -17,8 +17,6 @@ const routeName = router.currentRoute.value.name
|
|||
const id = ref<string>("")
|
||||
const fileDocDataUpload = ref<File[]>([])
|
||||
const files = ref<any>()
|
||||
const tranferOrg = ref("")
|
||||
const dateCommand = ref<Date>(new Date())
|
||||
const locationAbsence = ref<string>("")
|
||||
const levelStudy = ref<string>("")
|
||||
const degree = ref<string>("")
|
||||
|
|
@ -77,24 +75,10 @@ const dataDetail = ref<any>({
|
|||
})
|
||||
|
||||
const clickBack = () => {
|
||||
router.push(`/retire`)
|
||||
router.push(`/leave`)
|
||||
}
|
||||
|
||||
const statusOrder = (val: boolean) => {
|
||||
switch (val) {
|
||||
case true:
|
||||
return "ยับยั้งการลาออก"
|
||||
case false:
|
||||
return "อนุมัติการลาออก"
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// if (route.params.id !== undefined) {
|
||||
// id.value = route.params.id.toString()
|
||||
// fectDataresign(id.value)
|
||||
// }
|
||||
})
|
||||
onMounted(() => {})
|
||||
|
||||
const saveAbsence = () => {
|
||||
$q.dialog({
|
||||
|
|
@ -118,21 +102,12 @@ const saveAbsence = () => {
|
|||
.onCancel(() => {})
|
||||
.onDismiss(() => {})
|
||||
}
|
||||
|
||||
// const saveData = () => {
|
||||
// if (model.value !== "ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน") {
|
||||
// console.log(1)
|
||||
// } else if (model.value === "ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน") {
|
||||
// console.log(2)
|
||||
// }
|
||||
// router.push(`/leave`)
|
||||
// }
|
||||
</script>
|
||||
<template>
|
||||
<div class="col-12 row justify-center">
|
||||
<div class="col-xs-12 col-sm-12 col-md-11">
|
||||
<div class="toptitle text-white col-12 row items-center">
|
||||
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="router.push(`/leave`)" />
|
||||
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="clickBack" />
|
||||
<div>ยื่นใบลา</div>
|
||||
</div>
|
||||
<q-form ref="myform" class="col-12">
|
||||
|
|
@ -370,20 +345,6 @@ const saveAbsence = () => {
|
|||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
|
||||
<!-- <div class="row col-12 q-pa-md" v-if="routeName != 'addAbsence'">
|
||||
<q-space />
|
||||
<q-btn
|
||||
v-if="dataDetail.status !== 'DELETE' && dataDetail.status !== 'DONE'"
|
||||
unelevated
|
||||
dense
|
||||
class="q-px-md items-center"
|
||||
color="orange"
|
||||
label="ยกเลิกการลา"
|
||||
@click="cancelResing"
|
||||
:disable="tranferOrg == '' && noteReason == ''"
|
||||
/>
|
||||
</div> -->
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="row col-12 q-pa-md">
|
||||
|
|
|
|||
17
src/modules/05_leave/interface/index/main.ts
Normal file
17
src/modules/05_leave/interface/index/main.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
interface OptionData {
|
||||
id: string | undefined
|
||||
name: string | undefined
|
||||
}
|
||||
|
||||
interface FormLeavetMainData {
|
||||
type: string
|
||||
numDate: string
|
||||
extend: string
|
||||
use: string
|
||||
numAll: string
|
||||
numDone: string
|
||||
numNot: string
|
||||
numCancel: string
|
||||
}
|
||||
|
||||
export type { OptionData, FormLeavetMainData }
|
||||
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,
|
||||
}
|
||||
})
|
||||
|
|
@ -155,6 +155,7 @@ const router = useRouter()
|
|||
const currentTab = ref<string>("calendar") //ระบุ tab ใช้งานอยู่ calendar=รายการ list=รายการ
|
||||
const dateMonth = ref<number>(new Date().getFullYear())
|
||||
const dateYear = ref<number>(new Date().getFullYear())
|
||||
|
||||
const mixin = useCounterMixin() //เรียกฟังก์ชันกลาง
|
||||
const { monthYear2Thai } = mixin
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue