基于FullCalendar日历插件实现演播室(会议室)使用情况查看

功能需求:

演播室预约申请后,以视图(日历)形式显示当天各个录课室的占用情况

实现过程:

安装插件(可能会出现版本问题,具体情况按项目选取对应版本运行命令)

npm install --save @fullcalendar/core 
npm install --save @fullcalendar/resource-timeline 
npm install --save @fullcalendar/timeline

引入

import FullCalendar from '@fullcalendar/vue'
import resourceTimelinePlugin from '@fullcalendar/resource-timeline'
import interactionPlugin from '@fullcalendar/interaction'
import '@fullcalendar/core/main.css'
import '@fullcalendar/timeline/main.css'
import '@fullcalendar/resource-timeline/main.css'

html部分

<FullCalendar ref="calendar" defaultView="resourceTimelineDay" locale="zh-cn"
			  slot-width="38"
			  :headerToolbar="header"
			  :button-text="buttonText"
			  aspect-ratio=" 1.5"
			  :now="currentDate"
			  scrollTime="08:00:00"
			  :plugins="calendarPlugins"
			  resource-area-width="350px"
			  :resources="resources"
			  :events="calendarEvents"
			  :resource-columns="resourceAreaColumns"
/>

 data部分

currentDate:"2020-09-10",
//日历头部
header: {
	left: 'prev,next',
	center: 'title',
	right: 'today prev,next'
},
resources: [
	{eventColor: "orange",id: 43,locationName: "安慧桥录课室(一区)",remark:"",roomName: "108"},
	{eventColor: "orange",id: 23,locationName: "石家庄",remark:"测试",roomName: "SJZ01(小)"},
	{eventColor: "orange",id: 37,locationName: "安慧桥录课室(一区)",remark:"",roomName: "102"},
	{eventColor: "orange",id: 37,locationName: "安慧桥录课室(一区)",remark:"",roomName: "102"},
	{eventColor: "orange",id: 23,locationName: "石家庄",remark:"测试",roomName: "SJZ01(小)"}
],
calendarEvents: [
	{end: "2020-09-10 11:00:00",id: 1,resourceId: 43,start: "2020-09-10 08:00:00",title: "测试"},
	{end: "2020-09-10 13:45:00",id: 2,resourceId: 23,start: "2020-09-10 13:45:00",title: "测试"},
	{end: "2020-09-10 18:00:00",id: 3,resourceId: 37,start: "2020-09-10 15:00:00",title: "测试"},
	{end: "2020-09-10 19:00:00",id: 4,resourceId: 37,start: "2020-09-10 18:00:00",title: "测试"},
	{end: "2020-09-10 18:00:00",id: 5,resourceId: 23,start: "2020-09-10 17:30:00",title: "测试"}
],
resourceAreaColumns:[
	{
		labelText: '录课室地点',
		field: 'locationName'
	},
	{
		labelText: '录课室',
		field: 'roomName'
	},
	{
		labelText: '备注',
		field: 'remark'
	}
],
buttonText: {day: '天',today: '今天'},
calendarPlugins: [
	resourceTimelinePlugin, interactionPlugin
],
//注册组件
components: {
	FullCalendar
},

实现效果:

本例参考以下网址:

https://github.com/fullcalendar/fullcalendar/blob/master/examples/timeline.html

https://fullcalendar.io/docs/timeline-standard-view-demo

https://blog.csdn.net/namaste_/article/details/106398247

拓展性功能开发可参考以下网址: https://www.cnblogs.com/czk1634798848/p/13386178.html

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值