calendar วินัย
This commit is contained in:
parent
eb08a9f209
commit
fd200ca7b3
2 changed files with 39 additions and 60 deletions
|
|
@ -14,26 +14,28 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="props.modal" persistent>
|
<q-dialog v-model="props.modal" persistent>
|
||||||
<q-card style="min-width: 60vw">
|
<q-card style="min-width: 60vw">
|
||||||
<q-toolbar>
|
<q-toolbar>
|
||||||
<q-toolbar-title class="text-subtitle2 text-bold">ปฎิทิน</q-toolbar-title>
|
<q-toolbar-title class="text-subtitle2 text-bold"
|
||||||
<q-btn
|
>ปฎิทิน</q-toolbar-title
|
||||||
icon="close"
|
>
|
||||||
unelevated
|
<q-btn
|
||||||
round
|
icon="close"
|
||||||
dense
|
unelevated
|
||||||
@click="props.close"
|
round
|
||||||
style="color: #ff8080; background-color: #ffdede"
|
dense
|
||||||
/>
|
@click="props.close"
|
||||||
</q-toolbar>
|
style="color: #ff8080; background-color: #ffdede"
|
||||||
<q-separator />
|
/>
|
||||||
<q-card-section class="q-pa-md bg-grey-1">
|
</q-toolbar>
|
||||||
<Calendar/>
|
<q-separator />
|
||||||
</q-card-section>
|
<q-card-section class="q-pa-md bg-grey-1">
|
||||||
<!-- <q-separator /> -->
|
<Calendar />
|
||||||
|
</q-card-section>
|
||||||
<!-- <div class="row justify-end q-px-md q-py-sm items-center">
|
<!-- <q-separator /> -->
|
||||||
|
|
||||||
|
<!-- <div class="row justify-end q-px-md q-py-sm items-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
dense
|
dense
|
||||||
color="public"
|
color="public"
|
||||||
|
|
@ -47,6 +49,6 @@ const props = defineProps({
|
||||||
<q-tooltip>{{ props.btnTitle }}</q-tooltip>
|
<q-tooltip>{{ props.btnTitle }}</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div> -->
|
</div> -->
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,14 @@ import listPlugin from "@fullcalendar/list";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||||
const { monthYear2Thai } = mixin;
|
const { monthYear2Thai, showLoader, hideLoader } = mixin;
|
||||||
|
|
||||||
import type { DataDateMonthObject } from "@/modules/09_leave/interface/response/leave";
|
import type { DataDateMonthObject } from "@/modules/09_leave/interface/response/leave";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Option ของปฏิทิน
|
* Option ของปฏิทิน
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fullCalendar = ref<any>(); //ref calendar
|
const fullCalendar = ref<any>(); //ref calendar
|
||||||
const calendarOptions = ref<CalendarOptions>({
|
const calendarOptions = ref<CalendarOptions>({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
@ -127,37 +128,33 @@ const modeCancel = ref(true);
|
||||||
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (fullCalendar !== undefined) {
|
showLoader();
|
||||||
const calen = fullCalendar.value.getApi();
|
setTimeout(() => {
|
||||||
const date = new Date(dateMonth.value.year, dateMonth.value.month);
|
if (fullCalendar !== undefined) {
|
||||||
calen.gotoDate(date);
|
const calen = fullCalendar.value.getApi();
|
||||||
}
|
const date = new Date(dateMonth.value.year, dateMonth.value.month);
|
||||||
|
calen.gotoDate(date);
|
||||||
|
}
|
||||||
|
hideLoader();
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** function เปลี่ยนปฎิทิน*/
|
||||||
function changCalendar() {
|
function changCalendar() {
|
||||||
const calen = fullCalendar.value.getApi();
|
const calen = fullCalendar.value.getApi();
|
||||||
const date = new Date(dateMonth.value.year, dateMonth.value.month);
|
const date = new Date(dateMonth.value.year, dateMonth.value.month);
|
||||||
calen.gotoDate(date);
|
calen.gotoDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ค่า props(วันเดือนปีที่เลือก) ตอนอัพเดท ค่าฏิทินให้อัพเดทใหม่
|
|
||||||
*/
|
|
||||||
// watch(props, async (count, prevCount) => {
|
|
||||||
// const calen = fullCalendar.value.getApi();
|
|
||||||
// const date = new Date(props.dateYear, props.dateMonth);
|
|
||||||
// calen.gotoDate(date);
|
|
||||||
// });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชั่นยกเลิก model
|
* ฟังก์ชั่นยกเลิก model
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
const cancel = async (text: string) => {
|
async function cancel(text: string) {
|
||||||
title.value = text;
|
title.value = text;
|
||||||
modalCancel.value = true;
|
modalCancel.value = true;
|
||||||
modeCancel.value = true;
|
modeCancel.value = true;
|
||||||
};
|
}
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชั่นเปิด model
|
* ฟังก์ชั่นเปิด model
|
||||||
* @param text
|
* @param text
|
||||||
|
|
@ -168,26 +165,6 @@ const view = async (text: string) => {
|
||||||
modeCancel.value = false;
|
modeCancel.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// filter calendar left
|
|
||||||
const filterLists = ref<any[]>([
|
|
||||||
{
|
|
||||||
id: "x1",
|
|
||||||
name: "นางสาววารุณี แต้มคู",
|
|
||||||
color: "green",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "x2",
|
|
||||||
name: "นางสาวสมศรี ใจดี",
|
|
||||||
color: "grey",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "x3",
|
|
||||||
name: "นายสมชาย สุขใจ",
|
|
||||||
color: "grey",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const filterVal = ref(["x1"]);
|
|
||||||
|
|
||||||
const dateMonth = ref<DataDateMonthObject>({
|
const dateMonth = ref<DataDateMonthObject>({
|
||||||
month: new Date().getMonth(),
|
month: new Date().getMonth(),
|
||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue