function showCardTimeline(listid){ // console.log('=========='); // console.log(listid); var html = T( $('#tmpl-card_timeline').html() ); $('body').append( html ); $('#cardListTimelineMask').fadeIn(100).css('width',$(document).width()); // $('.card-details-title').text('项目集成'); // $.get('?app=api&apiact=finishcount&boardid='+DATA.boardid,function(txt){ $.get('./?app=api&apiact=getsettingcardinfo&boardid=' + DATA.boardid + '&cardtitle='+ 'hearderleft',function(text){ // console.log(text); var j = JSON.parse(text); // console.log(j); var cardid = Object.keys(j)[0]; cardData = j[cardid]; // console.log(cardData); if (cardData){ html = cardData['description']; } else { html = "添加标题为
__setting.hearderleft 的卡片
" } html += listid; // $('#cardListTimelineData').append(html); var calendarEl = document.getElementById('cardListTimelineData'); var calendar = new FullCalendar.Calendar(calendarEl, { plugins: ['interaction', 'resourceTimeline'], schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source', timeZone: '+8', locale: 'zh-cn', defaultView: 'resourceTimelineMonth', aspectRatio: 2.4, header: { left: 'prev,next', // center: 'title', center: 'title', right: 'resourceTimelineDay,resourceTimelineWeek,resourceTimelineMonth' }, editable: false, resourceLabelText: '单子', // resourceGroupField: 'group', resourceAreaWidth: "300px", resources: './?app=api&apiact=get_timeline_list_card&list=' + listid, // resources11: [ // {"id":"5cd52386c5363","title":"

fasd

"},{"id":"3qCRNfNDywDcvfhxJ","group":"\u7f8e\u672f1\u90e8","title":"\u9648\u9752"},{"id":"5aeab9d8e8ab3","group":"\u6d4b\u8bd5\u90e8","title":"\u5218\u601d\u79cb"},{"id":"5aebf6e46df68","group":"H5\u5ba2\u6237\u7aef","title":"\u675c\u6052\u665f"},{"id":"5aeff82ec323d","group":"\u670d\u52a1\u7aef","title":"\u5f90\u671d"},{"id":"5b42d28a3df35","group":"UI\u7ec4","title":"\u738b\u4f73\u4f1f"}, // ], resourceRender: function(renderInfo) { // console.log("==-==-="); // console.log(renderInfo); var labels = renderInfo.resource.extendedProps.labels; var board = DATA.boards[ DATA.boardid]; // console.log(labels); // console.log(board.labels); var html = `
`; labels.forEach(function (ele) { var label = getLabelsData(ele,board.labels); html += ` ${label.name} `; }); if(renderInfo.resource.extendedProps.isyanqi){ html += ` 延期 `; } html += `
`; // $(info.el).data('id',info.event.extendedProps.id); $(renderInfo.el).children('div').append(html); }, events: './?app=api&apiact=get_timeline_list_card_events&list=' + listid, // events11: [ // {allDay: true, // boardid: "5bbdbf66031d2", // end: "2019-05-11", // resourceId: "5cd52386c5363", // start: "2019-05-09", // title: "地牢冒险", // isyanqi: "延期了", // url: "./?app=list&boardid=5bbdbf66031d2#cardid=5c63af7623239"} // ], eventRender: function(info) { // console.log("==-==-="); // console.log(info); $(info.el).data('id',info.event.extendedProps.cardid); $(info.el).addClass('card-list-timeline-event-open'); if (info.event.extendedProps.isyanqi){ var txt = rtime2txt(yqrt); if (txt){ var yqtxt = `延期${txt}`; } // var yqtxt = `延期${info.event.extendedProps.yanqiday}天 ${info.event.extendedProps.yanqiRt}`; $(info.el).prepend(yqtxt); } // var tooltip = new Tooltip(info.el, { // title: info.event.extendedProps.description, // placement: 'top', // trigger: 'hover', // container: 'body' // }); } // events: function(info,success,failure){ // console.log('=========='); // console.log(info); // success(function () { // return [ // {allDay: true, // boardid: "5bbdbf66031d2", // end: "2019-05-11", // resourceId: "5cd52386c5363", // start: "2019-05-09", // title: "地牢冒险", // url: "./?app=list&boardid=5bbdbf66031d2#cardid=5c63af7623239"} // ] // }); // // }, }); calendar.render(); // setTimeout(function () { // $('.fc-expander').click(); // }, 100); }) } function closeCardListTimeline(){ $('#cardListTimelineMask').remove(); $('#cardListTimeline').remove(); } function getLabelsData(labelsId,labels){ var res = ''; labels.forEach(function (ele) { if (ele._id == labelsId){ res = ele } }); return res } // 时间转字符串 天 小时 分钟 function rtime2txt(rt) { var txt = ''; // 天 if (rt > 24*3600){ txt = parseInt(rt/(24*3600)) + '天'; // 小时 }else if (rt > 3600){ txt = parseInt(rt/3600) + '小时' // 分钟 }else if(rt > 60){ txt = parseInt(rt/60) + '分钟' }else { txt = rt + '秒' } return txt } $(function(){ $('body').on("click","#cardListTimelineMask",function(){ closeCardListTimeline(); }); $('body').on("click","#cardTimelineClose",function(){ closeCardListTimeline(); }); $('body').on('click','.card-list-timeline-event-open',function () { showCard( $(this).data('id') ); // closeCardListTimeline(); }); $('body').on('click','#cardListTimeline',function () { closeCardInfo(); }) });