var bl = false; var flag = true; var startDays, endDays, clickDay; $(document).ready(function() { helper.getDropList.getProlistDrop($('#sc_pro')) // helper.getDropList.getProlistDrop($('#sc_pro')).then(function(){ // blur(); // }); blur(); getPeopleList(); $('#sc_btns').click(function() { blur(); getPeopleList(); }) }); function blur(userCode) { var rl = $('#RoleCode', top.document).val(); var gcode = $('#GroupCode', top.document).val(); $('#calendar').html(""); var dates = new Date(); var time = dates.getFullYear() + "-" + (dates.getMonth() + 1) + '-' + dates.getDate(); var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $('#calendar').fullCalendar({ //height: 660,//设置日历的高度,包括header日历头部,默认未设置,高度根据aspectRatio值自适应。 contentHeight: 650, //设置日历主体内容的高度,不包括header部分,默认未设置,高度根据aspectRatio值自适应。 //aspectRatio: ,//设置日历单元格宽度与高度的比例。默认1.35 header: { //left: 'month,agendaWeek,agendaDay', left: 'month', center: 'title', right: 'today, prev, next' }, monthNames: ['年1月', '年2月', '年3月', '年4月', '年5月', '年6月', '年7月', '年8月', '年9月', '年10月', '年11月', '年12月'], monthNamesShort: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], titleFormat: { month: "yyyy MMMM" }, firstDay: "1", editable: false, droppable: bl, weekMode: 'liquid', events: function(start, end, callback) { var st = $.fullCalendar.formatDate(start, "yyyy-MM-dd"); var ed = $.fullCalendar.formatDate(end, "yyyy-MM-dd"); startDays = $.fullCalendar.formatDate(start, "yyyy-MM-dd"); endDays = $.fullCalendar.formatDate(end, "yyyy-MM-dd"); console.log(st); console.log(ed); changeWorkType(userCode,st,ed) }, dayClick: function(date, allDay, jsEvent, view) { $(this).addClass('fc-state-highlight'); $(this).siblings().removeClass('fc-state-highlight'); $(this).parent().siblings().children('td').removeClass('fc-state-highlight'); var mydate = new Date(date); clickDay = formatterDate(mydate); getPeopleList(formatterDate(mydate), formatterDate(mydate)) } }); } //日历班别显示 function changeWorkType(userCode,sd,ed){ $.ajax({ type: "get", url: huayi.config.callcenter_url + "signtokenapi/api/UserGroup/getusergrouplist", dataType: 'json', async: true, data: { usercode: userCode, projectid: $('#sc_pro').val(), startdate: sd, enddate: ed }, success: function(data) { /*验证请求*/ //工作日 if(data.data && data.data.length > 0) { $(".fc-day").each(function(i, n) { var a = $(this).attr("data-date") $(data.data[0].dates).each(function(j, k) { $(n).attr("id", k.id); if(k == a) { if($(n).children().find('.fc-day-content').find('.redFont').length>0){ if(data.data[0].groups[j] == '白班') { $(n).children().find('.fc-day-content').find('font').html('白'); $(n).children().find('.fc-day-content').find('font').css('background','#5cb85c'); } else if(data.data[0].groups[j] == '夜班') { $(n).children().find('.fc-day-content').find('font').html('夜'); $(n).children().find('.fc-day-content').find('font').css('background','#249fea'); } else if(data.data[0].groups[j] == '休息') { $(n).children().find('.fc-day-content').find('font').html('休'); $(n).children().find('.fc-day-content').find('font').css('background','#d9534f'); } else if(data.data[0].groups[j] == '全天') { $(n).children().find('.fc-day-content').find('font').html('天'); $(n).children().find('.fc-day-content').find('font').css('background','#f8ac59'); }else{ $(n).children().find('.fc-day-content').find('font').remove() } }else{ if(data.data[0].groups[j] == '白班') { var state = '白'; $(n).children().find('.fc-day-content').append(state); } else if(data.data[0].groups[j] == '夜班') { var state = '夜'; $(n).children().find('.fc-day-content').append(state); } else if(data.data[0].groups[j] == '休息') { var state = '休'; $(n).children().find('.fc-day-content').append(state); } else if(data.data[0].groups[j] == '全天') { var state = '天'; $(n).children().find('.fc-day-content').append(state); } } } }); }) } // callback(data.data); } }); } //初始化日期 function formatterDate(date) { var datetime = date.getFullYear() + "-" // "年" + ((date.getMonth() + 1) < 10 ? "0" + (date.getMonth() + 1) : (date.getMonth() + 1)) + "-" // "月" + (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()); return datetime; } //获取人员列表及班别 function getPeopleList(sd, ed) { $.ajax({ type: "get", url: huayi.config.callcenter_url + "signtokenapi/api/UserGroup/getusergrouplist", dataType: 'json', async: true, data: { usercode: '', projectid: $('#sc_pro').val(), startdate: sd, enddate: ed, }, success: function(data) { if(data.state.toLowerCase() == 'success') { $('.peopleList').html(''); if(data.data.length > 0) { //人员列表 $.each(data.data, function(i, n) { var strs = '
'
strs += '
'
// strs += '
'
}
strs += ' ' +
'' +
'