fullcalendar调度程序中的营业时间和标签

时间:2017-10-20 12:20:03

标签: fullcalendar fullcalendar-scheduler

我正在尝试使用调度程序来显示一整天的课程时间。问题是课堂时间是50分钟,某些课程之间有间隔。

我使用营业时间这样做,但它在标签中有一种奇怪的行为。标签不尊重营业时间,我唯一能做的就是显示50到50分钟的标签,但由于间隔时间不够。

见下文显示:

fullcalendar scheduler

现在,我希望如何:

desired fullcalendar scheduler

这是我的代码:

<script>
$(function(){
    var todayDate = moment().startOf('day');
    var YESTERDAY = todayDate.clone().subtract(1, 'day').format('YYYY-MM-DD');
    var TODAY = todayDate.format('YYYY-MM-DD');
    var TOMORROW = todayDate.clone().add(1, 'day').format('YYYY-MM-DD');

    $('#calendar').fullCalendar({
        resourceAreaWidth: 230,
        editable: true,
        aspectRatio: 1.5,
        scrollTime: '07:25',
        slotLabelInterval: '00:50:00',
        slotDuration: '00:50:00',
        slotLabelFormat: 'HH:mm',
        defaultView: 'timelineDay',
        resourceLabelText: 'Turma / Sub-turma',
        businessHours: [
            { id: 'a1', start: '07:25:00', end: '08:15:00', dow: [0,1,2,3,4,5] },
            { id: 'a2', start: '08:15:00', end: '09:05:00', dow: [0,1,2,3,4,5] },
            { id: 'a3', start: '09:20:00', end: '10:10:00', dow: [0,1,2,3,4,5] },
            { id: 'a4', start: '10:10:00', end: '11:00:00', dow: [0,1,2,3,4,5] },
            { id: 'a5', start: '11:10:00', end: '12:00:00', dow: [0,1,2,3,4,5] },
            { id: 'a6', start: '12:00:00', end: '12:50:00', dow: [0,1,2,3,4,5] },
            { id: 'a7', start: '13:15:00', end: '14:05:00', dow: [0,1,2,3,4,5] },
            { id: 'a8', start: '14:05:00', end: '14:55:00', dow: [0,1,2,3,4,5] },
            { id: 'a9', start: '15:10:00', end: '16:00:00', dow: [0,1,2,3,4,5] },
            { id: 'a10', start: '16:00:00', end: '16:50:00', dow: [0,1,2,3,4,5] },
            { id: 'a11', start: '17:00:00', end: '17:50:00', dow: [0,1,2,3,4,5] },
            { id: 'a12', start: '17:50:00', end: '18:40:00', dow: [0,1,2,3,4,5] },
            { id: 'a13', start: '19:00:00', end: '19:50:00', dow: [0,1,2,3,4,5] },
            { id: 'a14', start: '19:50:00', end: '20:40:00', dow: [0,1,2,3,4,5] },
            { id: 'a15', start: '20:55:00', end: '21:45:00', dow: [0,1,2,3,4,5] },
            { id: 'a16', start: '21:45:00', end: '22:35:00', dow: [0,1,2,3,4,5] }
        ],
        minTime: '07:25:00',
        maxTime: '22:35:00',
        resources: [
            { id: 'd', title: '1º Semestre', children: [
                { id: 'd1', title: 'Turma A', children: [
                    { id: 'd11', title: 'Sub-turma A' },
                    { id: 'd12', title: 'Sub-turma B' },
                ] },
                { id: 'd2', title: 'Turma B' }
            ] },
        ],
        events: [
            { id: 'e1', resourceId: 'd2', start: TODAY + 'T07:25:00', end: TODAY + 'T08:15:00', title: 'event ' },
            { id: 'e2', resourceId: 'd2', start: TODAY + 'T08:15:00', end: TODAY + 'T09:05:00', title: 'event ' },
            { id: 'e3', resourceId: 'd2', start: TODAY + 'T09:20:00', end: TODAY + 'T10:10:00', title: 'event ' },
            { id: 'e4', resourceId: 'd2', start: TODAY + 'T10:10:00', end: TODAY + 'T11:00:00', title: 'event ' },
            { id: 'e5', resourceId: 'd2', start: TODAY + 'T11:10:00', end: TODAY + 'T12:00:00', title: 'event ' },
            { id: 'e6', resourceId: 'd2', start: TODAY + 'T12:00:00', end: TODAY + 'T12:50:00', title: 'event ' },
            { id: 'e7', resourceId: 'd2', start: TODAY + 'T13:15:00', end: TODAY + 'T14:05:00', title: 'event ' },
            { id: 'e8', resourceId: 'd2', start: TODAY + 'T14:05:00', end: TODAY + 'T14:55:00', title: 'event ' },
            { id: 'e9', resourceId: 'd2', start: TODAY + 'T15:10:00', end: TODAY + 'T16:00:00', title: 'event ' },
            { id: 'e10', resourceId: 'd2', start: TODAY + 'T16:00:00', end: TODAY + 'T16:50:00', title: 'event ' },
            { id: 'e11', resourceId: 'd2', start: TODAY + 'T17:00:00', end: TODAY + 'T17:50:00', title: 'event ' },
            { id: 'e12', resourceId: 'd2', start: TODAY + 'T17:50:00', end: TODAY + 'T18:40:00', title: 'event ' },
            { id: 'e13', resourceId: 'd2', start: TODAY + 'T19:00:00', end: TODAY + 'T19:50:00', title: 'event ' },
            { id: 'e14', resourceId: 'd2', start: TODAY + 'T19:50:00', end: TODAY + 'T20:40:00', title: 'event ' },
            { id: 'e15', resourceId: 'd2', start: TODAY + 'T20:55:00', end: TODAY + 'T21:45:00', title: 'event ' },
            { id: 'e16', resourceId: 'd2', start: TODAY + 'T21:45:00', end: TODAY + 'T22:35:00', title: 'event ' },
        ]
    });
});
</script>

请帮助我!!

祝你好运

0 个答案:

没有答案