update ปฎิทิน

This commit is contained in:
AnandaTon 2023-11-03 14:53:02 +07:00
parent a00b9313ed
commit 83dc2d90a5
2 changed files with 62 additions and 5 deletions

View file

@ -80,7 +80,7 @@
</q-dialog>
</template>
<script setup lang="ts">
import { ref } from "vue"
import { ref, watch, onMounted } from "vue"
import FullCalendar from "@fullcalendar/vue3"
import dayGridPlugin from "@fullcalendar/daygrid"
import type { CalendarOptions } from "@fullcalendar/core"
@ -88,7 +88,7 @@ import timeGridPlugin from "@fullcalendar/timegrid"
import interactionPlugin from "@fullcalendar/interaction"
import allLocales from "@fullcalendar/core/locales-all"
import listPlugin from "@fullcalendar/list"
const fullCalendar = ref<InstanceType<typeof FullCalendar>>()
const fullCalendar = ref<any>() //ref calendar
const calendarOptions = ref<CalendarOptions>({
plugins: [
dayGridPlugin,
@ -140,7 +140,45 @@ const phone = ref("000-00000000")
const reason = ref("ยกเลิกการลา")
const model = ref(null)
const modeCancel = ref(true)
const props = defineProps({
dateYear: {
//filter
type: Number,
default: () => new Date().getFullYear(),
},
dateMonth: {
//filter
type: Number,
default: () => new Date().getMonth(),
},
refreshData: {
// main refresh data
type: Boolean,
required: true,
},
fetchDataSummaryCalendar: {
//
type: Function,
default: () => console.log("not function"),
},
})
/**
* เรยกฟงกนทงหมดตอนเรยกใชไฟล
*/
onMounted(async () => {
if (fullCalendar !== undefined) {
const calen = fullCalendar.value.getApi()
const date = new Date(props.dateYear, props.dateMonth)
calen.gotoDate(date)
}
})
/**
* props(นเดอนปเลอก) ตอนอพเดท าฏนใหพเดทใหม
*/
watch(props, async (count, prevCount) => {
const date = new Date(props.dateYear, props.dateMonth)
})
const cancel = async (text: string) => {
title.value = text
modalCancel.value = true