scheduling.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. {extend name="common/common2" /}
  2. {block name="css"}
  3. <link rel="stylesheet" href="/static/fullcalendar-3.10.2/fullcalendar.css">
  4. {/block}
  5. {block name="main"}
  6. <div class="row">
  7. <div class="col-sm-12">
  8. <div class="ibox float-e-margins">
  9. <div class="ibox-title">
  10. <h5>排班表</h5>
  11. <div class="ibox-tools">
  12. <a class="toback" href="{:url('index')}">
  13. 返回上一页
  14. </a>
  15. </div>
  16. </div>
  17. <div class="ibox-content">
  18. <div id="calendar"></div>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. {/block}
  24. {block name="script"}
  25. <script src='/static/fullcalendar-3.10.2/lib/moment.min.js'></script>
  26. <script src='/static/fullcalendar-3.10.2/fullcalendar.js'></script>
  27. <script src='/static/fullcalendar-3.10.2/locale-all.js'></script>
  28. <script src="/static/fullcalendar-3.10.2/locale/zh-cn.js"></script>
  29. <script src="/static/form.js"></script>
  30. <script src="/static/study/js/base.js"></script>
  31. <script>
  32. var url = "{:url('AttendanceGroup/pbjson',['id'=>$id])}";
  33. var date = new Date();
  34. var d = date.getDate();
  35. var m = date.getMonth();
  36. var y = date.getFullYear();
  37. $(function (){
  38. var calendar = $('#calendar').fullCalendar({
  39. firstDay: 1,
  40. locale:'zh-cn',
  41. currentTimezone: 'Asia/Shanghai',
  42. eventLimit: false, //多个记录,显示更多查看
  43. buttonText: {
  44. prev: '<',
  45. next: '>',
  46. prevYear: '去年',
  47. nextYear: '明年',
  48. today: '今天',
  49. month: '月',
  50. week: '周',
  51. day: '日'
  52. },
  53. header: {
  54. left: 'prev,next today',
  55. center: 'title',
  56. right: 'month,agendaWeek,agendaDay'
  57. },
  58. events: url,
  59. loading: function(bool) {
  60. if (bool) {
  61. var layerIndex = layer.load(1);
  62. } else {
  63. layer.closeAll('loading');
  64. }
  65. },
  66. eventRender: function(event, element) {
  67. element.html(event.title);
  68. },
  69. editable: false,
  70. selectable: true,
  71. selectHelper: true,
  72. select: function(start, end, allDay) {
  73. var start = formatDateTime(new Date(start));
  74. var end = formatDateTime(new Date(end));
  75. console.log(allDay)
  76. var addurl = "{:url('addGroupClass',['id'=>$id])}?start=" + start + "&end=" + end;
  77. jFlyer.show_dialog_form("添加修改", addurl);
  78. calendar.fullCalendar('unselect');
  79. }
  80. ,
  81. eventClick: function(calEvent, jsEvent, view) {
  82. var start = formatDateTime(new Date(calEvent.start));
  83. var end = formatDateTime(new Date(calEvent.end));
  84. // var addurl = "addGroupClass?id=<?=$id?>&start=" + start + "&end=" + end;
  85. console.log(calEvent)
  86. var addurl = "{:url('addGroupClass',['id'=>$id])}?start=" + start + "&end=" + end+'&group_id='+calEvent.taskid
  87. jFlyer.show_dialog_form("添加修改", addurl);
  88. calendar.fullCalendar('unselect');
  89. }
  90. });
  91. })
  92. var formatDateTime = function(date) {
  93. date = new Date(date.getTime() + date.getTimezoneOffset() * 60000);
  94. var y = date.getFullYear();
  95. var m = date.getMonth() + 1;
  96. m = m < 10 ? ('0' + m) : m;
  97. var d = date.getDate();
  98. d = d < 10 ? ('0' + d) : d;
  99. var h = date.getHours();
  100. h = h < 10 ? ('0' + h) : h;
  101. var minute = date.getMinutes();
  102. minute = minute < 10 ? ('0' + minute) : minute;
  103. var second = date.getSeconds();
  104. second = second < 10 ? ('0' + second) : second;
  105. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  106. };
  107. </script>
  108. {/block}