vue-fullcalendar插件

------------恢复内容开始------------

参考 :

https://blog.csdn.net/w3chhhhhh/article/details/90256252

https://blog.csdn.net/ju__ju/article/details/103117790

https://blog.csdn.net/ju__ju/article/details/103117790

https://blog.csdn.net/qq_33594380/article/details/79738423

 

复制代码
<template>
  <div class="container" style="width:60%; margin: 0 auto;">
    <FullCalendar
      :plugins="calendarPlugins"
      :slotEventOverlap="false"
      :allDaySlot="false"
      :header="{
        left:'prev',
        center:'title',
        right: 'today ,next'
      }"
      :events="[
        {
          title: '计算机学院小组会议',
          start: '2020-04-01 10:00:00',
          end: '2020-04-01 16:00:00',
          color:'orange'
        },
        {
          start: '2020-04-02 10:00:00',
          end: '2020-04-02 14:00:00',
          title: '东南大学计算机学术会议',
          color:'green'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        },
        {
          start: '2020-03-31 10:00:00',
          end: '2020-03-31 14:00:00',
          title: '东南大学计算机学术会议',
          color:'red'
        }

      ]"
      :button-text="{
        today: '今天'
      }"
      :slotLabelFormat="{ // 周,日视图时,左侧的显示的时间格式,以下为:00:00,00:30...5:30
        hour: 'numeric',
        minute: '2-digit',
        omitZeroMinute: false,
        meridiem: 'short',
        hour12: false
      }"
      :columnHeaderHtml="columnHeaderHtml"
      default-view="timeGridWeek"
      :unselect-auto="false"
      :select-overlap="false"
      :select-allow="handlerSeelctAllow"
      select-mirror="false"
      selectable="true"
      slot-duration="00:15:00"
      slot-label-interval="01:00"
      locale="zh-cn"
      @dateClick="handleDateClick"
      @select="handleSelect"
    />
  </div>
</template>
 
<script>
import FullCalendar from '@fullcalendar/vue'
import dayGridPlugin from '@fullcalendar/daygrid'
import timeGridPlulgin from '@fullcalendar/timegrid'
import '@fullcalendar/core/locales/zh-cn' // 支持中文
//import momentPlugin from '@fullcalendar/moment'
import interactionPlugin from '@fullcalendar/interaction'
import { get, post } from "@/api/ylapi"
import { mapGetters } from "vuex"

export default {
  components: {
    FullCalendar
  },
  data () {
    return {
      calendarPlugins: [dayGridPlugin, timeGridPlulgin, interactionPlugin],
      // 随时判断时间是否合法,通过返回true/false来判断是否能够选择
      handlerSeelctAllow: info => {
        const currentDate = new Date()
        const start = info.start
        const end = info.end
        return (start <= end && start >= currentDate)
      },
      columnHeaderHtml: function (date) {
        let map = {
          0: '周日',
          1: '周一',
          2: '周二',
          3: '周三',
          4: '周四',
          5: '周五',
          6: '周六'
        }
        let month = date.getMonth() + 1
        let day = date.getDate()
        let week = date.getDay()
        return map[week]
          + '<br>'
          + (month < 10 ? ('0' + month) : month)
          + '/'
          + (day < 10 ? ('0' + day) : day)
      },
    }
  },
  created () {
    this.getConferenceRecord()
  },
  computed: {
    ...mapGetters(["staffId"])
  },
  methods: {
    //获取当前周的所有会议
    async getConferenceRecord () {
      let reqStr = {
        "autoCount": true,
        "confTypes": ["NC", "VGCP"],
        "data": null,
        "limit": 1000,
        "orderbys": [
          {
            "field": "conferenceTimePattern.conferenceTime.startDateTimeStamp",
            "order": 1
          }
        ],
        "role": null,
        "skip": 0,
        "states": ["ready", "create", "ongoing", "end"],
        "total": 0
      }
      const res = await post(`/conference/record/${this.staffId}/pagedList`, reqStr)
      if (res.ret > 0) {

      }
    },
    // 当点击时候
    handleDateClick (arg) {
      console.log(arg)
    },
    // 当选择结束的时候获取开始和结束时间
    handleSelect (info) {
      console.log('form' + info.startStr + ' to ' + info.endStr)
    }
  }
}
</script>
 
<style lang="scss" scope>
@import '~@fullcalendar/core/main.css';
@import '~@fullcalendar/daygrid/main.css';
@import '~@fullcalendar/timegrid/main.css';
</style>
复制代码

 

------------恢复内容结束------------

posted on   朝颜陌  阅读(3028)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示