用户登录
用户注册

分享至

fullCalendar日程控件使用

  • 作者: 哟嚯嚯嚯oo
  • 来源: 51数据库
  • 2022-09-22
function getCalendarData() {
    $('#calendar').fullCalendar({
        weekMode: {fixed: 5},
        header: {left: '', center: 'title', right: 'prev,today,next'},
        titleFormat: "YYYY年MM月",
        handleWindowResize: false,
        eventLimit: true, // allow "more" link when too many events  monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        dayNamesShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
        firstDay: 1,
        buttonText: {
            today: '今天',
            prev: '上一月',
            next: '下一月'  },
        firstDay: 1,
        editable: false,
        events: function (start, end, timezone, callback) {
            $.ajax({
                type: "GET",
                url: '/routine/myschedules',
                dataType: 'json',
                data: {start: "" + start, end: "" + end, filter: $("#hid").val()},
                success: function (doc) { var events = []; for (var i = 0; i < doc.meeting.length; i++) { var m = doc.meeting[i];
                        events.push({
                            key: "meeting",
                            id: m.id,
                            typeId: m.meetingType.typeId,
                            title: m.title,
                            content: "时间:" + ameutils.convertTime(m.meetingDate, "yyyy-MM-dd hh:mm:ss") + "  类型:" + m.meetingType.typeName,
                            start: ameutils.convertTime(m.meetingDate, "yyyy-MM-dd"),
                            time: ameutils.convertTime(m.meetingDate, "yyyy-MM-dd hh:mm:ss"),
                            backgroundColor: '#E0FFFF',
                            textColor: '#000000',
                            borderColor: '#E0FFFF',
                        });
                    } for (var i = 0; i < doc.outgoing.length; i++) { var o = doc.outgoing[i];
                        events.push({
                            key: "outgoing",
                            id: o.id,
                            typeId: o.outgoingType.type,
                            title: o.title,
                            content: "时间:" + ameutils.convertTime(o.startTime, "yyyy-MM-dd") + "  类型:" + o.outgoingType.typeName,
                            start: ameutils.convertTime(o.startTime, "yyyy-MM-dd"),
                            time: ameutils.convertTime(o.startTime, "yyyy-MM-dd"),
                            backgroundColor: '#E0FFFF',
                            textColor: '#000000',
                            borderColor: '#E0FFFF',
                            constraint: 'availableForMeeting'  }); if (o.outgoingType.type == 10)
                            outgoingnum2 = outgoingnum2 + 1; else  outgoingnum1 = outgoingnum1 + 1;
                    } var neihtml = ""; for (var i = 0; i < doc.bulletins.length; i++) { var b = doc.bulletins[i];
                        neihtml += '<dl>';
                        neihtml += '<dt>';
                        neihtml += '<h4>' + b.title + '</h4>';
                        neihtml += '<span >2015-05-18 07:13</span> </dt>';
                        neihtml += '<dd>';
                        neihtml += '<p>' + b.content + '</p>';
                        neihtml += '</dd>';
                        neihtml += '</dl>';
                    } var waihtml = ""; for (var i = 0; i < doc.announcements.length; i++) { var a = doc.announcements[i];
                        waihtml += '<dl>';
                        waihtml += '<dt>';
                        waihtml += '<h4>' + a.title + '</h4>';
                        waihtml += '<span >2015-05-18 07:13</span> </dt>';
                        waihtml += '<dd>';
                        waihtml += '<p>' + a.type + '</p>';
                        waihtml += '</dd>';
                        waihtml += '</dl>';
                    }
                    $("#meetingnum").html(doc.meetingnum);
                    $("#outgoingnum1").html(doc.outgoingnum1);
                    $("#outgoingnum2").html(doc.outgoingnum2);
                    $("#nei").html(neihtml);
                    $("#wai").html(waihtml);
                    callback(events);
                }
            });
        },
        loading: function (isLoading, view) { if (isLoading == false) {
                $(".fc-more").parent("div").css("text-align", "center");
            }
        },
        eventRender: function (calEvent, element, view) {
            element.attr("id", calEvent.id);
            element.attr("tabindex", "0");
            element.attr("role", "button");
            element.attr("data-toggle", "popover");
            element.attr("data-trigger", "focus");
            element.attr("data-content", calEvent.content); if (calEvent.key == "meeting") {
                element.attr("data-original-title", calEvent.title);
                element.find("div").prepend('<i ></i>');
            } if (calEvent.key == "outgoing") {
                element.attr("data-original-title", calEvent.title); if (calEvent.typeId == 10) {//请假  element.find("div").prepend('<i ></i>');
                } else {
                    element.find("div").prepend('<i ></i>');
                }
            }
        },
        selectable: true  });
}
软件
前端设计
程序设计
Java相关