2023-11-07 15:06:48 +07:00
|
|
|
<script setup lang="ts">
|
2023-12-01 16:56:43 +07:00
|
|
|
import { ref, onMounted, computed } from "vue"
|
|
|
|
|
import { useQuasar } from "quasar"
|
|
|
|
|
import { useRouter, useRoute } from "vue-router"
|
2023-11-07 15:06:48 +07:00
|
|
|
|
2023-12-14 13:09:33 +07:00
|
|
|
import FormPart2 from "@/modules/05_leave/components/Forms/Form.vue"
|
|
|
|
|
import SickForm from "@/modules/05_leave/components/Forms/01_SickForm.vue"
|
|
|
|
|
import FormBirth from "@/modules/05_leave/components/Forms/03_Birth.vue"
|
|
|
|
|
import HelpWifeBirthForm from "@/modules/05_leave/components/Forms/04_HelpWifeBirthForm.vue"
|
|
|
|
|
import VacationForm from "@/modules/05_leave/components/Forms/05_VacationForm.vue"
|
|
|
|
|
import OrdinationForm from "@/modules/05_leave/components/Forms/06_OrdinationForm.vue"
|
|
|
|
|
import HajjForm from "@/modules/05_leave/components/Forms/07_HajjForm.vue"
|
|
|
|
|
import MilitaryForm from "@/modules/05_leave/components/Forms/08_MilitaryForm.vue"
|
|
|
|
|
import StudyForm from "@/modules/05_leave/components/Forms/09_StudyForm.vue"
|
|
|
|
|
import TrainForm from "@/modules/05_leave/components/Forms/10_TrainForm.vue"
|
|
|
|
|
import WorkInternationalForm from "@/modules/05_leave/components/Forms/11_WorkInternationalForm.vue"
|
|
|
|
|
import FollowSpouseForm from "@/modules/05_leave/components/Forms/12_FollowSpouseForm.vue"
|
|
|
|
|
import RehabilitationForm from "@/modules/05_leave/components/Forms/13_RehabilitationForm.vue"
|
2023-12-01 16:56:43 +07:00
|
|
|
import { useLeaveStore } from "@/modules/05_leave/store"
|
|
|
|
|
import http from "@/plugins/http"
|
|
|
|
|
import config from "@/app.config"
|
|
|
|
|
import type { QForm } from "quasar"
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin"
|
2023-11-07 15:06:48 +07:00
|
|
|
|
2023-12-01 16:56:43 +07:00
|
|
|
const dataStore = useLeaveStore()
|
2023-12-07 18:43:52 +07:00
|
|
|
const { fetchLeaveType } = dataStore
|
2023-12-01 16:56:43 +07:00
|
|
|
const mixin = useCounterMixin()
|
|
|
|
|
const { date2Thai, dialogConfirm, success, messageError } = mixin
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const myform = ref<QForm | null>(null)
|
|
|
|
|
const $q = useQuasar()
|
2023-11-07 15:06:48 +07:00
|
|
|
|
2023-12-01 16:56:43 +07:00
|
|
|
const model = ref<string>("")
|
|
|
|
|
const modelSpecific = ref<string>("")
|
2023-11-07 15:06:48 +07:00
|
|
|
|
2023-12-07 18:43:52 +07:00
|
|
|
onMounted(async () => {
|
|
|
|
|
await fectOptionType()
|
|
|
|
|
})
|
2023-11-07 15:06:48 +07:00
|
|
|
|
2023-12-08 09:41:02 +07:00
|
|
|
/**
|
|
|
|
|
* ดึงค่าประเภทการลาจาก Api
|
|
|
|
|
*/
|
2023-12-07 18:43:52 +07:00
|
|
|
async function fectOptionType() {
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.leaveType())
|
|
|
|
|
.then(async res => {
|
|
|
|
|
const data = res.data.result
|
|
|
|
|
await fetchLeaveType(data)
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
messageError($q, err)
|
|
|
|
|
})
|
|
|
|
|
}
|
2023-12-18 18:09:59 +07:00
|
|
|
|
|
|
|
|
function inputEdit(val: boolean) {
|
|
|
|
|
return {
|
|
|
|
|
"full-width cursor-pointer ": val,
|
|
|
|
|
"full-width cursor-pointer inputgreen": !val,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-07 15:06:48 +07:00
|
|
|
</script>
|
2023-11-09 16:00:55 +07:00
|
|
|
|
2023-11-07 15:06:48 +07:00
|
|
|
<template>
|
2023-12-01 16:56:43 +07:00
|
|
|
<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 to="/leave" icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" />
|
|
|
|
|
<div>ยื่นใบลา</div>
|
|
|
|
|
</div>
|
2023-11-09 16:00:55 +07:00
|
|
|
|
2023-12-01 16:56:43 +07:00
|
|
|
<q-form ref="myform" class="col-12">
|
|
|
|
|
<q-card bordered>
|
|
|
|
|
<div class="col-12 row q-col-gutter-md q-pa-md">
|
|
|
|
|
<div class="col-xs-12 col-sm-12">
|
|
|
|
|
<div style="display: flex; align-items: center">
|
|
|
|
|
<q-icon name="mdi-numeric-1-circle" size="20px" color="primary" />
|
|
|
|
|
<div class="q-pl-sm text-weight-bold text-dark">เลือกประเภทการลา</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="q-py-sm q-px-lg">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<q-select
|
|
|
|
|
dense
|
2023-12-18 18:09:59 +07:00
|
|
|
class="col-12 col-sm-6 col-md-4 inputgreen"
|
2023-12-01 16:56:43 +07:00
|
|
|
outlined
|
|
|
|
|
v-model="model"
|
|
|
|
|
:options="dataStore.options"
|
2023-12-07 18:43:52 +07:00
|
|
|
option-value="code"
|
2023-12-01 16:56:43 +07:00
|
|
|
option-label="name"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
prefix="ประเภทใบลา :"
|
2023-12-07 18:43:52 +07:00
|
|
|
@update:model-value="dataStore.typeConvert(model, null), (modelSpecific = ''), dataStore.fetchProfile()"
|
2023-12-01 16:56:43 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row q-mt-sm">
|
2023-12-07 18:43:52 +07:00
|
|
|
<div class="col-12 col-sm-6 col-md-3" v-if="model === 'LV-006' || model === 'LV-008'">
|
2023-12-01 16:56:43 +07:00
|
|
|
<q-select
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model="modelSpecific"
|
2023-12-07 18:43:52 +07:00
|
|
|
:options="model === 'LV-006' ? dataStore.optionsOrdination : dataStore.optionsSpecific"
|
|
|
|
|
option-value="code"
|
2023-12-01 16:56:43 +07:00
|
|
|
option-label="name"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
prefix="ประเภทการลา :"
|
|
|
|
|
@update:model-value="dataStore.typeConvert(model, modelSpecific)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-11-08 15:30:31 +07:00
|
|
|
|
2023-12-08 15:41:18 +07:00
|
|
|
<!-- v-if (ลาอุปสมบทหรือลาประกอบพิธีฮัจญ์||ลาไปศึกษา ฝึกอบรม ปฎิบัติการวิจัย หรือดูงาน) -->
|
2023-12-01 16:56:43 +07:00
|
|
|
</div>
|
2023-11-09 16:00:55 +07:00
|
|
|
|
2023-12-01 16:56:43 +07:00
|
|
|
<div>
|
|
|
|
|
<div style="display: flex; align-items: center">
|
|
|
|
|
<q-icon name="mdi-numeric-2-circle" size="20px" color="primary" />
|
|
|
|
|
<div class="q-pl-sm text-weight-bold text-dark">ข้อมูลการลา</div>
|
|
|
|
|
</div>
|
|
|
|
|
<FormPart2 :model="model" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="model" class="col-12">
|
2023-12-08 09:41:02 +07:00
|
|
|
<SickForm v-if="model === 'LV-001' || model === 'LV-002'" />
|
|
|
|
|
<FormBirth v-if="model === 'LV-003'" />
|
|
|
|
|
<HelpWifeBirthForm v-if="model === 'LV-004'" />
|
|
|
|
|
<VacationForm v-if="model === 'LV-005'" />
|
|
|
|
|
<OrdinationForm v-if="model === 'LV-006' && modelSpecific === '0'" />
|
|
|
|
|
<HajjForm v-if="model === 'LV-006' && modelSpecific === '1'" />
|
|
|
|
|
<MilitaryForm v-if="model === 'LV-007'" style="width: 100%" />
|
|
|
|
|
<StudyForm v-if="model === 'LV-008' && modelSpecific === 's0'" style="width: 100%" />
|
|
|
|
|
<TrainForm v-if="model === 'LV-008' && modelSpecific != 's0' && modelSpecific != ''" />
|
|
|
|
|
<WorkInternationalForm v-if="model === 'LV-009'" />
|
|
|
|
|
<FollowSpouseForm v-if="model === 'LV-010'" />
|
|
|
|
|
<RehabilitationForm v-if="model === 'LV-011'" />
|
2023-12-01 16:56:43 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</q-form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-11-07 15:06:48 +07:00
|
|
|
</template>
|