You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ScheduleIndex.cshtml 7.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width" />
  5. <title>日程管理</title>
  6. <script src="~/Content/jquery/plugin/fullcalendar/js/jquery-1.7.2.min.js"></script>
  7. <script src="~/Content/jquery/plugin/jquery-ui/jquery-ui.min.js"></script>
  8. <script src="~/Content/jquery/plugin/fullcalendar/js/fullcalendar.min.js"></script>
  9. <link href="~/Content/jquery/plugin/fullcalendar/css/fullcalendar.css" rel="stylesheet" />
  10. @Html.AppendCssFile(
  11. "/Views/LR_Content/style/lr-common.css",
  12. "/Views/LR_Content/style/lr-iframe-index.css"
  13. )
  14. <script type='text/javascript'>
  15. var search = (window.location.search).split('?')[1];
  16. var type = search.split('=')[1];
  17. //type=1 校历查看;type=2 校历管理(日历模式)
  18. $(document).ready(function () {
  19. resize();
  20. $('.calendar').fullCalendar({
  21. header: {
  22. left: 'prev,next',
  23. center: 'title',
  24. right: 'agendaDay,agendaWeek,month'
  25. },
  26. monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
  27. dayNamesShort: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
  28. buttonText: {
  29. prev: '上一页',
  30. next: '下一页',
  31. month: '月视图',
  32. week: '周视图',
  33. day: '日视图'
  34. },
  35. titleFormat: "yyyy年MM月",
  36. columnFormat: {
  37. month: 'ddd',
  38. week: 'MM月dd日 ddd',
  39. day: 'MM月dd日 ddd'
  40. },
  41. allDayText: '今天',
  42. axisFormat: "HH:00",
  43. height: $(window).height() - 55,
  44. dayClick: function (date, allDay, jsEvent, view) {
  45. if (type == 2) {
  46. btn_add();
  47. }
  48. },
  49. editable: true,
  50. eventLimit: true,
  51. eventAfterRender: function (event, element, view) {//数据绑定上去后添加相应信息在页面上
  52. //var fstart = $.fullCalendar.formatDate(event.start, "HH:mm");
  53. //var fend = $.fullCalendar.formatDate(event.end, "HH:mm");
  54. if (view.name == "month") {//按月份
  55. var evtcontent = '<div class="fc-event-inner fc-event-skin" data-id="' + event.id + '">';
  56. //evtcontent += '<span class="fc-event-time">' + fstart + " - " + fend + '</span>';
  57. evtcontent += '<span class="fc-event-time">' + event.academicYearNo + '</span>';
  58. evtcontent += '<span class="fc-event-title">: ' + event.title + '</span>';
  59. evtcontent += '</div><div class="ui-resizable-handle ui-resizable-e">&nbsp;&nbsp;&nbsp;</div>';
  60. if (type == 2) {
  61. evtcontent += '<div class="fc-event-delete" style="width:100%;height:100%;background-color:#000;" data-id="' + event.id + '">删除</div>';
  62. }
  63. element.html(evtcontent);
  64. } else {
  65. var evtcontent = '<div class="fc-event-inner fc-event-skin" data-id="' + event.id + '" style="height:98%">';
  66. evtcontent += '<div class="fc-event-head fc-event-skin">';
  67. evtcontent += '<span class="fc-event-time">' + event.academicYearNo + '</span>';
  68. //evtcontent += '<div class="fc-event-time">' + fstart + " - " + fend + event.title + '</div>';
  69. evtcontent += '<div class="fc-event-title">' + event.title + '</div>';
  70. evtcontent += '</div>';
  71. evtcontent += '<div class="fc-event-content"></div>';
  72. evtcontent += '<div class="fc-event-bg"></div>';
  73. evtcontent += '</div>';
  74. if (type == 2) {
  75. evtcontent += '<div class="fc-event-delete" style="width:100%;height:2%;background-color:#000;" data-id="' + event.id + '">删除</div>';
  76. }
  77. element.html(evtcontent);
  78. }
  79. },
  80. events: (function () {
  81. var _data = [];
  82. $.ajax({
  83. url: top.$.rootUrl + '/EducationalAdministration/SchoolCalendar/GetListForSchedule',
  84. type: "get",
  85. dataType: "json",
  86. async: false,
  87. success: function (data) {
  88. _data = data;
  89. }
  90. });
  91. return _data;
  92. })()
  93. });
  94. });
  95. function resize() {
  96. $('#pageayout').height($(window).height() - 20);
  97. $(window).resize(function (e) {
  98. window.setTimeout(function () {
  99. $('#pageayout').height($(window).height() - 20);
  100. }, 200);
  101. e.stopPropagation();
  102. });
  103. }
  104. //添加校历
  105. function btn_add() {
  106. if (type == 2) {
  107. top.learun.layerForm({
  108. id: 'form',
  109. title: '添加校历',
  110. url: '/EducationalAdministration/SchoolCalendar/Form',
  111. width: 600,
  112. height: 400,
  113. callBack: function (id) {
  114. return top[id].acceptClick();
  115. }
  116. });
  117. }
  118. };
  119. //编辑校历
  120. $(document).on('click', '.fc-event-inner', function () {
  121. if (type == 2) {
  122. var keyValue = $(this).attr('data-id');
  123. top.learun.layerForm({
  124. id: 'form',
  125. title: '编辑校历',
  126. url: '/EducationalAdministration/SchoolCalendar/Form?keyValue=' + keyValue,
  127. width: 600,
  128. height: 400,
  129. callBack: function (id) {
  130. return top[id].acceptClick();
  131. }
  132. });
  133. }
  134. });
  135. //删除日程
  136. $(document).on('click', '.fc-event-delete', function () {
  137. if (type == 2) {
  138. var keyValue = $(this).attr('data-id');
  139. if (!keyValue) {
  140. learun.alert.warning("请选择日程!");
  141. return false;
  142. }
  143. top.learun.layerConfirm('是否确认删除该项!', function (res) {
  144. if (res) {
  145. top.learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/SchoolCalendar/DeleteForm', { keyValue: keyValue }, function () {
  146. callback();
  147. });
  148. }
  149. });
  150. }
  151. });
  152. function callback() {
  153. location.reload();
  154. }
  155. </script>
  156. </head>
  157. <body>
  158. <div id="pageayout" class="border" style="overflow: auto; padding: 0px;">
  159. <div id='calendar' class="calendar" style="margin: 10px;background: #fff; "></div>
  160. </div>
  161. </body>
  162. </html>