layer的使用笔记

时间:2022-12-31 06:10:45

$('#calendar').fullCalendar({
lang:"zh-cn",
buttonText:{
today: '今天'
},
eventLimit: true,
events:"/device/calibrationPlan/task/load",
//fullcalendar在dayclick事件中获取当前点击日期中的events数组
    dayClick: function(date, jsEvent, view) {
var events = $('#calendar').fullCalendar('clientEvents', function(event) {
            var eventStart = event.start.format('YYYY-MM-DD');
            var eventEnd = event.end ? event.end.format('YYYY-MM-DD') : null;
            var theDate = date.format('YYYY-MM-DD');
            // Make sure the event starts on or before date and ends afterward
            // Events that have no end date specified (null) end that day, so check if start = date
            return (eventStart <= theDate && (eventEnd >= theDate) && !(eventStart < theDate && (eventEnd == theDate))) || (eventStart == theDate && (eventEnd === null));
        });
if(events.length>0){
layer.open({
type: 2,
title: '',
shadeClose: true,
shade: 0.8,
area: ['900px', '600px'],
content: "/device/views/calibrationPlan/calibrationList.html",
success:function(layero, index){

console.log(events)
var body = layer.getChildFrame('body', 1);
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
body.find("#openTbody").empty();
for(var i=0;i<events.length;i++){
body.find("#openTbody").append("<tr>"
+"<td>"+events[i].data.calibrationName+"</td>"
+"<td>"+events[i].data.classification+"</td>"
+"<td>"+events[i].data.useDepartment+"</td>"
+"<td>"+1+"</td>"
+"<td>"+events[i].data.calibrationMonth+"</td>"
+"<td>"+events[i].data.remarks+"</td>"
+"</tr>");
}

}
});
}
},
});