แก้ไขการแสดงผลการลาในส่วน
This commit is contained in:
parent
b670ae3733
commit
1d624cd854
8 changed files with 233 additions and 13 deletions
|
|
@ -1,10 +1,43 @@
|
|||
<script setup lang="ts">
|
||||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { calculateDurationYmd } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
function convertDateToEng(dataThia: string) {
|
||||
const thaiDateParts: string[] = dataThia.split(" ");
|
||||
const thaiMonthAbbreviation: string = thaiDateParts[1];
|
||||
|
||||
const thaiMonths: { [key: string]: string } = {
|
||||
"ม.ค.": "Jan",
|
||||
"ก.พ.": "Feb",
|
||||
"มี.ค.": "Mar",
|
||||
"เม.ย.": "Apr",
|
||||
"พ.ค.": "May",
|
||||
"มิ.ย.": "Jun",
|
||||
"ก.ค.": "Jul",
|
||||
"ส.ค.": "Aug",
|
||||
"ก.ย.": "Sep",
|
||||
"ต.ค.": "Oct",
|
||||
"พ.ย.": "Nov",
|
||||
"ธ.ค.": "Dec",
|
||||
};
|
||||
const englishMonth: string = thaiMonths[thaiMonthAbbreviation];
|
||||
|
||||
if (englishMonth) {
|
||||
const englishDateString: string = `${englishMonth} ${thaiDateParts[0]} ${thaiDateParts[2]}`;
|
||||
const dateObject: Date = new Date(englishDateString);
|
||||
return dateObject.toString();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<q-card-section>
|
||||
|
|
@ -23,7 +56,14 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
<div class="col">
|
||||
{{
|
||||
calculateDurationYmd(
|
||||
convertDateToEng(props.data.leaveDateStart),
|
||||
convertDateToEng(props.data.leaveDateEnd)
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">วันเดือนปีเกิด</div>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const props = defineProps({
|
|||
<div class="col">{{ props.data.leaveDetail }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">เอกสารแนบ</div>
|
||||
<div class="col text-grey-8">เอกสารประกอบ</div>
|
||||
<div class="col" v-if="props.data.leaveDocument">
|
||||
<q-btn
|
||||
:href="props.data.leaveDocument"
|
||||
|
|
@ -41,6 +41,22 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="col" v-else>-</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">เอกสารแบบฟอร์ม</div>
|
||||
<div class="col" v-if="props.data.leaveDraftDocument">
|
||||
<q-btn
|
||||
:href="props.data.leaveDraftDocument"
|
||||
target="_blank"
|
||||
outline
|
||||
color="blue"
|
||||
label="ดาวน์โหลด"
|
||||
size="12px"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
<div class="col" v-else>-</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,43 @@
|
|||
<script setup lang="ts">
|
||||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { calculateDurationYmd } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
function convertDateToEng(dataThia: string) {
|
||||
const thaiDateParts: string[] = dataThia.split(" ");
|
||||
const thaiMonthAbbreviation: string = thaiDateParts[1];
|
||||
|
||||
const thaiMonths: { [key: string]: string } = {
|
||||
"ม.ค.": "Jan",
|
||||
"ก.พ.": "Feb",
|
||||
"มี.ค.": "Mar",
|
||||
"เม.ย.": "Apr",
|
||||
"พ.ค.": "May",
|
||||
"มิ.ย.": "Jun",
|
||||
"ก.ค.": "Jul",
|
||||
"ส.ค.": "Aug",
|
||||
"ก.ย.": "Sep",
|
||||
"ต.ค.": "Oct",
|
||||
"พ.ย.": "Nov",
|
||||
"ธ.ค.": "Dec",
|
||||
};
|
||||
const englishMonth: string = thaiMonths[thaiMonthAbbreviation];
|
||||
|
||||
if (englishMonth) {
|
||||
const englishDateString: string = `${englishMonth} ${thaiDateParts[0]} ${thaiDateParts[2]}`;
|
||||
const dateObject: Date = new Date(englishDateString);
|
||||
return dateObject.toString();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<q-card-section>
|
||||
|
|
@ -23,7 +56,14 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
<div class="col">
|
||||
{{
|
||||
calculateDurationYmd(
|
||||
convertDateToEng(props.data.leaveDateStart),
|
||||
convertDateToEng(props.data.leaveDateEnd)
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">วันเดือนปีเกิด</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,43 @@
|
|||
<script setup lang="ts">
|
||||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { calculateDurationYmd } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
function convertDateToEng(dataThia: string) {
|
||||
const thaiDateParts: string[] = dataThia.split(" ");
|
||||
const thaiMonthAbbreviation: string = thaiDateParts[1];
|
||||
|
||||
const thaiMonths: { [key: string]: string } = {
|
||||
"ม.ค.": "Jan",
|
||||
"ก.พ.": "Feb",
|
||||
"มี.ค.": "Mar",
|
||||
"เม.ย.": "Apr",
|
||||
"พ.ค.": "May",
|
||||
"มิ.ย.": "Jun",
|
||||
"ก.ค.": "Jul",
|
||||
"ส.ค.": "Aug",
|
||||
"ก.ย.": "Sep",
|
||||
"ต.ค.": "Oct",
|
||||
"พ.ย.": "Nov",
|
||||
"ธ.ค.": "Dec",
|
||||
};
|
||||
const englishMonth: string = thaiMonths[thaiMonthAbbreviation];
|
||||
|
||||
if (englishMonth) {
|
||||
const englishDateString: string = `${englishMonth} ${thaiDateParts[0]} ${thaiDateParts[2]}`;
|
||||
const dateObject: Date = new Date(englishDateString);
|
||||
return dateObject.toString();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -24,7 +57,14 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
<div class="col">
|
||||
{{
|
||||
calculateDurationYmd(
|
||||
convertDateToEng(props.data.leaveDateStart),
|
||||
convertDateToEng(props.data.leaveDateEnd)
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">วันเดือนปีเกิด</div>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const props = defineProps({
|
|||
<div class="col">{{ props.data.leaveDetail }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">เอกสารแนบ</div>
|
||||
<div class="col text-grey-8">เอกสารประกอบ</div>
|
||||
<div class="col" v-if="props.data.leaveDocument">
|
||||
<q-btn
|
||||
:href="props.data.leaveDocument"
|
||||
|
|
@ -41,6 +41,22 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="col" v-else>-</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">เอกสารแบบฟอร์ม</div>
|
||||
<div class="col" v-if="props.data.leaveDraftDocument">
|
||||
<q-btn
|
||||
:href="props.data.leaveDraftDocument"
|
||||
target="_blank"
|
||||
outline
|
||||
color="blue"
|
||||
label="ดาวน์โหลด"
|
||||
size="12px"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
<div class="col" v-else>-</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue