293 lines
8.5 KiB
Vue
293 lines
8.5 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from "vue";
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
|
const router = useRouter();
|
|
const mixin = useCounterMixin();
|
|
const routeName = router.currentRoute.value.name;
|
|
const id = ref<string>("");
|
|
const fileDocDataUpload = ref<File[]>([]);
|
|
const files = ref<any>();
|
|
const locationAbsence = ref<string>("");
|
|
const levelStudy = ref<string>("");
|
|
const degree = ref<string>("");
|
|
const major = ref<string>("");
|
|
const educational = ref<string>("");
|
|
const studyPeriod = ref<string>("");
|
|
const country = ref<string>("");
|
|
const capital = ref<string>("");
|
|
const tel = ref<number>();
|
|
const detail = ref<string>();
|
|
const Writeat = ref<string>();
|
|
const dateLeaveStart = ref<Date>(new Date());
|
|
const dateLeaveEnd = ref<Date>(new Date());
|
|
const dateTotal = ref<number>();
|
|
const noteReason = ref("");
|
|
const nameFile = ref<string>("");
|
|
const model = ref(null);
|
|
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } =
|
|
mixin;
|
|
|
|
const props = defineProps({
|
|
type: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
data: {
|
|
type: Object,
|
|
default: null,
|
|
},
|
|
onSubmit: {
|
|
type: Function,
|
|
default: () => "",
|
|
},
|
|
});
|
|
</script>
|
|
<template>
|
|
<q-card bordered class="q-pa-md bg-grey-1">
|
|
<div class="col-12 row q-pa-sm q-col-gutter-sm">
|
|
<datepicker
|
|
class="col-2"
|
|
menu-class-name="modalfix"
|
|
v-model="dateLeaveStart"
|
|
:locale="'th'"
|
|
autoApply
|
|
borderless
|
|
:enableTimePicker="false"
|
|
week-start="0"
|
|
:readonly="routeName != 'addAbsence'"
|
|
>
|
|
<template #year="{ year }">
|
|
{{ year + 543 }}
|
|
</template>
|
|
<template #year-overlay-value="{ value }">
|
|
{{ parseInt(value + 543) }}
|
|
</template>
|
|
<template #trigger>
|
|
<q-input
|
|
outlined
|
|
dense
|
|
hide-bottom-space
|
|
:readonly="routeName != 'addAbsence'"
|
|
class="full-width datepicker"
|
|
:model-value="
|
|
dateLeaveStart != null ? date2Thai(dateLeaveStart) : null
|
|
"
|
|
:label="`${'วันที่เริ่ม'}`"
|
|
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่มลา'}`]"
|
|
>
|
|
<template v-slot:prepend>
|
|
<q-icon
|
|
name="event"
|
|
class="cursor-pointer"
|
|
style="color: var(--q-primary)"
|
|
>
|
|
</q-icon>
|
|
</template>
|
|
</q-input>
|
|
</template>
|
|
</datepicker>
|
|
<datepicker
|
|
class="col-2"
|
|
menu-class-name="modalfix"
|
|
v-model="dateLeaveEnd"
|
|
:locale="'th'"
|
|
autoApply
|
|
borderless
|
|
:enableTimePicker="false"
|
|
week-start="0"
|
|
:readonly="routeName != 'addAbsence'"
|
|
>
|
|
<template #year="{ year }">
|
|
{{ year + 543 }}
|
|
</template>
|
|
<template #year-overlay-value="{ value }">
|
|
{{ parseInt(value + 543) }}
|
|
</template>
|
|
<template #trigger>
|
|
<q-input
|
|
outlined
|
|
dense
|
|
hide-bottom-space
|
|
:readonly="routeName != 'addAbsence'"
|
|
class="full-width datepicker"
|
|
:model-value="dateLeaveEnd != null ? date2Thai(dateLeaveEnd) : null"
|
|
:label="`${'จนถึงวันที่'}`"
|
|
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่่สิ้นสุดการลา'}`]"
|
|
>
|
|
<template v-slot:prepend>
|
|
<q-icon
|
|
name="event"
|
|
class="cursor-pointer"
|
|
style="color: var(--q-primary)"
|
|
>
|
|
</q-icon>
|
|
</template>
|
|
</q-input>
|
|
</template>
|
|
</datepicker>
|
|
<q-input
|
|
class="col-2"
|
|
dense
|
|
outlined
|
|
type="number"
|
|
v-model="dateTotal"
|
|
label="จำนวนวัน(บันทึกลง ก.พ.7)"
|
|
:readonly="routeName != 'addAbsence'"
|
|
:rules="[(val) => !!val || `${'กรุณากรอกจำนวนวัน'}`]"
|
|
/>
|
|
<q-input
|
|
class="col-3"
|
|
dense
|
|
outlined
|
|
v-model="Writeat"
|
|
label="เขียนที่"
|
|
:readonly="routeName != 'addAbsence'"
|
|
:rules="[(val) => !!val || `${'เขียนที่'}`]"
|
|
/>
|
|
<q-input
|
|
class="col-3"
|
|
dense
|
|
outlined
|
|
v-model="tel"
|
|
mask="(###)-###-####"
|
|
unmasked-value
|
|
label="หมายเลขโทรศัพท์ที่ติดต่อได้"
|
|
:readonly="routeName != 'addAbsence'"
|
|
:rules="[(val) => !!val || `${'กรุณากรอกหมายเลขโทรศัพท์ที่ติดต่อได้'}`]"
|
|
/>
|
|
<q-input
|
|
class="col-6"
|
|
dense
|
|
outlined
|
|
v-model="detail"
|
|
label="รายละเอียด"
|
|
:readonly="routeName != 'addAbsence'"
|
|
:rules="[(val) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
|
|
/>
|
|
<q-input
|
|
class="col-6"
|
|
dense
|
|
outlined
|
|
v-model="locationAbsence"
|
|
label="สถาที่ติดต่อขณะลา"
|
|
:readonly="routeName != 'addAbsence'"
|
|
:rules="[(val) => !!val || `${'กรุณากรอกสถาที่ติดต่อขณะลา'}`]"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-4"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="levelStudy"
|
|
label="ระดับที่ขอลาศึกษา"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-4"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="degree"
|
|
label="ชื่อปริญญา/ประกาศนียบัตร"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-4"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="major"
|
|
label="สาขาวิชาเอก/หลักสูตร/วิชา"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-4"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="educational"
|
|
label="ณ สถานศึกษา"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-4"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="studyPeriod"
|
|
label="ระยะเวลาในการศึกษาตลอดหลักสูตร"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-4"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="country"
|
|
label="ประเทศ"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-4"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="capital"
|
|
label="ด้วยทุน"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-input
|
|
class="col-8"
|
|
v-if="props.type === '7'"
|
|
dense
|
|
outlined
|
|
v-model="noteReason"
|
|
label="ที่มาของหลักสูตร"
|
|
:readonly="routeName != 'addAbsence'"
|
|
/>
|
|
|
|
<q-file
|
|
v-model="files"
|
|
dense
|
|
label="เอกสารประกอบ"
|
|
outlined
|
|
use-chips
|
|
multiple
|
|
class="q-pl-sm col-6"
|
|
>
|
|
<template v-slot:prepend>
|
|
<q-icon name="attach_file" color="primary" />
|
|
</template>
|
|
</q-file>
|
|
|
|
<div class="col-12 row" v-if="routeName != 'addAbsence'">
|
|
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
|
|
<div class="q-pl-sm text-weight-bold text-dark">เอกสารเพิ่มเติม</div>
|
|
</div>
|
|
<q-card bordered flat class="full-width">
|
|
<q-list separator>
|
|
<q-item v-for="file in files" :key="file.key" class="q-my-xs">
|
|
<q-item-section>
|
|
<q-item-label class="full-width ellipsis">
|
|
{{ file.fileName }}
|
|
</q-item-label>
|
|
|
|
<q-item-label caption> </q-item-label>
|
|
</q-item-section>
|
|
</q-item>
|
|
</q-list>
|
|
</q-card>
|
|
</div>
|
|
</div>
|
|
</q-card>
|
|
</template>
|