calendar.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <script src="/static/fullcalendar-3.10.2/lib/jquery.min.js"></script>
  4. <script src='/static/fullcalendar-3.10.2/lib/moment.min.js'></script>
  5. <script src="/static/fullcalendar-3.10.2/fullcalendar.min.js"></script>
  6. <script src="/static/fullcalendar-3.10.2/locale/zh-cn.js"></script>
  7. <link rel="stylesheet" href="/static/fullcalendar-3.10.2/fullcalendar.min.css" />
  8. <link href='/static/fullcalendar-3.10.2/fullcalendar.print.min.css' rel='stylesheet' media='print' />
  9. <style>
  10. .bgstatus{
  11. display: inline-block;
  12. width: 60px;
  13. height: 20px;
  14. line-height: 20px;
  15. color: #fff;
  16. border-radius: 3px;
  17. text-align: center;
  18. }
  19. .bgs0{
  20. background-color: #777777;
  21. }
  22. .bgs1{
  23. background-color: #478fca;
  24. }
  25. .bgs2{
  26. background-color: #69aa46;
  27. }
  28. .bgs3{
  29. background-color: #dd5a43;
  30. }
  31. </style>
  32. <div class="ibox">
  33. <div class="alert alert-info">
  34. 不同颜色的背景代表不同的任务状态:
  35. <span class="bgstatus bgs0">审核中</span>
  36. <!-- <span class="bgstatus bgs1">同意</span>-->
  37. <span class="bgstatus bgs2">同意</span>
  38. <!-- <span class="bgstatus bgs3">未完成</span>-->
  39. </div>
  40. <div class="ibox-content">
  41. <div class="row">
  42. <div class="col-xs-8">
  43. <a href="{:url('index')}" class="btn btn-sm btn-warning">表格显示</a>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="ibox-content">
  48. <div class="panel-group">
  49. <div class="panel panel-default">
  50. <div class="panel-heading clearfix">
  51. <div class="btn-group pull-left">
  52. {$m_title}
  53. </div>
  54. </div>
  55. <div class="panel-body">
  56. <div id="calendar"></div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. {/block}
  63. {block name="script"}
  64. <script>
  65. var meetingId = '{$meetingId}';
  66. var url = "{:url('MeetingApply/taskjson')}?meetingId="+meetingId;
  67. var date = new Date();
  68. var d = date.getDate();
  69. var m = date.getMonth();
  70. var y = date.getFullYear();
  71. var calendar = $('#calendar').fullCalendar({
  72. firstDay: 1,
  73. locale:'zh-cn',
  74. currentTimezone: 'Asia/Shanghai',
  75. eventLimit: false, //多个记录,显示更多查看
  76. buttonText: {
  77. prev: '<',
  78. next: '>',
  79. prevYear: '去年',
  80. nextYear: '明年',
  81. today: '今天',
  82. month: '月',
  83. week: '周',
  84. day: '日'
  85. },
  86. header: {
  87. left: 'prev,next today',
  88. center: 'title',
  89. right: 'month,agendaWeek,agendaDay'
  90. },
  91. events: url,
  92. loading: function(bool) {
  93. if (bool) {
  94. var layerIndex = layer.load(1);
  95. } else {
  96. layer.closeAll('loading');
  97. }
  98. },
  99. eventRender: function(event, element) {
  100. element.html(event.title);
  101. },
  102. editable: false,
  103. selectable: true,
  104. selectHelper: true,
  105. // select: function(start, end, allDay) {
  106. // var start = formatDateTime(new Date(start));
  107. // var end = formatDateTime(new Date(end));
  108. // var addurl = "{:url('DeviceTask/add',[],'')}/id/0?type=1&start=" + start + "&end=" + end;
  109. // lay_open("添加计划任务", addurl);
  110. // calendar.fullCalendar('unselect');
  111. // }
  112. // ,
  113. // eventClick: function(calEvent, jsEvent, view) {
  114. // layer.confirm('请选择您想做的操作', {
  115. // icon: 3,
  116. // btn: ['添加', '编辑', '删除'],
  117. // skin: 'layer-ext-moon',
  118. // btn1: function(index) {
  119. // layer.close(index);
  120. // var start = formatDateTime(new Date(calEvent.start));
  121. // var end = formatDateTime(new Date(calEvent.end));
  122. // var addurl = "{:url('DeviceTask/add',[],'')}/id/0?type=1&start=" + start + "&end=" + end;
  123. // lay_open("添加计划任务", addurl);
  124. // calendar.fullCalendar('unselect');
  125. // },
  126. // btn2: function(index) {
  127. // layer.close(index);
  128. // var editurl = "{:url('DeviceTask/add',[],'')}/id/"+calEvent.taskid+"?type=1";
  129. // lay_open("编辑/查看", editurl);
  130. // },
  131. // btn3: function(index) {
  132. // layer.close(index);
  133. // layer.confirm('您确定要删除?', {
  134. // icon: 3,
  135. // btn: ['删除', '取消'],
  136. // skin: 'layer-ext-moon',
  137. // yes: function (index2) {
  138. // layer.close(index2);
  139. // $.ajax({
  140. // url: '{:url("DeviceTask/del",[],"")}/id/' + calEvent.taskid,
  141. // type: "GET",
  142. // success: function (result) {
  143. // if (result.code == 1) {
  144. // calendar.fullCalendar('removeEvents', function (ev) {
  145. // return (ev._id == calEvent._id);
  146. // });
  147. // } else {
  148. // layer.alert(result.msg, {
  149. // icon: 2,
  150. // skin: 'layer-ext-moon',
  151. // yes: function (index3) {
  152. // layer.close(index3);
  153. // }
  154. // });
  155. // }
  156. // },
  157. // error: function (result) {
  158. // layer.alert('请求出错,请重试', {
  159. // icon: 2,
  160. // skin: 'layer-ext-moon',
  161. // yes: function (index3) {
  162. // layer.close(index3);
  163. // }
  164. // });
  165. // }
  166. // });
  167. // }
  168. // });
  169. // }
  170. // });
  171. // }
  172. });
  173. var formatDateTime = function(date) {
  174. date = new Date(date.getTime() + date.getTimezoneOffset() * 60000);
  175. var y = date.getFullYear();
  176. var m = date.getMonth() + 1;
  177. m = m < 10 ? ('0' + m) : m;
  178. var d = date.getDate();
  179. d = d < 10 ? ('0' + d) : d;
  180. var h = date.getHours();
  181. h = h < 10 ? ('0' + h) : h;
  182. var minute = date.getMinutes();
  183. minute = minute < 10 ? ('0' + minute) : minute;
  184. var second = date.getSeconds();
  185. second = second < 10 ? ('0' + second) : second;
  186. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  187. };
  188. function lay_open (title,url) {
  189. layer.open({
  190. type: 2,
  191. title: title,
  192. shadeClose: true,
  193. shade: 0.3,
  194. maxmin: true,
  195. area: ['90%', '90%'],
  196. content: url,
  197. end: function () {
  198. }
  199. });
  200. }
  201. </script>
  202. {/block}