郑州第一人民医院UI

WorkTimeMg.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. var bl = false;
  2. var flag = true;
  3. blur();
  4. $(document).ready(function() {
  5. blur();
  6. function blur() {
  7. var rl = $('#RoleCode', top.document).val();
  8. var gcode = $('#GroupCode', top.document).val();
  9. $('#calendar').html("");
  10. var dates = new Date();
  11. var time = dates.getFullYear() + "-" + (dates.getMonth() + 1) + '-' + dates.getDate();
  12. var date = new Date();
  13. var d = date.getDate();
  14. var m = date.getMonth();
  15. var y = date.getFullYear();
  16. $('#calendar').fullCalendar({
  17. //height: 660,//设置日历的高度,包括header日历头部,默认未设置,高度根据aspectRatio值自适应。
  18. contentHeight: 650,//设置日历主体内容的高度,不包括header部分,默认未设置,高度根据aspectRatio值自适应。
  19. //aspectRatio: ,//设置日历单元格宽度与高度的比例。默认1.35
  20. header: {
  21. //left: 'month,agendaWeek,agendaDay',
  22. left: 'month',
  23. center: 'title',
  24. right: 'today, prev, next'
  25. },
  26. monthNames: ['年1月', '年2月', '年3月', '年4月', '年5月', '年6月', '年7月', '年8月', '年9月', '年10月', '年11月', '年12月'],
  27. monthNamesShort: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  28. dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  29. dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
  30. titleFormat: {
  31. month: "yyyy MMMM"
  32. },
  33. firstDay: "1",
  34. editable: false,
  35. droppable: bl,
  36. weekMode: 'liquid',
  37. events: function(start, end, callback) {
  38. var st = $.fullCalendar.formatDate(start, "yyyy-MM-dd");
  39. var ed = $.fullCalendar.formatDate(end, "yyyy-MM-dd");
  40. console.log(ed);
  41. $.ajax({
  42. type: "get",
  43. url: huayi.config.callcenter_url + "callcenterapi/api/sysworkoffdays/getlist",
  44. dataType: 'json',
  45. async: true,
  46. data: {
  47. "token": window.localStorage.getItem("token")
  48. },
  49. success: function(data) {
  50. /*验证请求*/
  51. //工作日
  52. var arr = [];
  53. //console.log(data.data);
  54. var time;
  55. // $(data.data).each(function(i, n) {
  56. // time = n.offdate.substring(0, n.offdate.indexOf(' '))
  57. // arr.push(time);
  58. // });
  59. $(".fc-day").each(function(i, n) {
  60. var state = '<font class="redFont" style="font-weight: bold;background: #FFAB3D;color: #fff;padding: 4px;font-size: 15px;border-radius: 5px;">班</font>';
  61. $(n).children().find('.fc-day-content').append(state);
  62. // $(n).attr('id', n.);
  63. var a = $(this).attr("data-date")
  64. $(data.data).each(function(j, k) {
  65. time = k.offdate.substring(0, k.offdate.indexOf(' '))
  66. $(n).attr("id", k.id);
  67. if(time == a) {
  68. if($(n).children().find('.redFont')) {
  69. $(n).children().find('.redFont').text('休');
  70. $(n).children().find('.redFont').css('background-color', 'red');
  71. $(n).children().find('.redFont').addClass("offday");
  72. }
  73. }
  74. //arr.push(time);
  75. });
  76. // $(arr).each(function(j, k) {
  77. // if(k == a) {
  78. // if($(n).children().find('.redFont')) {
  79. // $(n).children().find('.redFont').text('休');
  80. // $(n).children().find('.redFont').css('background-color', 'red');
  81. // $(n).children().find('.redFont').addClass("offday");
  82. //
  83. // }
  84. // }
  85. //
  86. // })
  87. })
  88. callback(data.data);
  89. }
  90. });
  91. },
  92. dayClick: function(date, allDay, jsEvent, view) {
  93. $(this).children().children().find('.redFont').text();
  94. var Time = $(this).attr("data-date");
  95. var ID = $(this).attr("ID");
  96. var type = 1;
  97. if($(this).children().children().find('.redFont').text() != "休") {
  98. layer.confirm('确定休息日吗?', {
  99. btn: ['是', '否'] //按钮
  100. }, function() {
  101. $.ajax({
  102. type: "post",
  103. url: huayi.config.callcenter_url + "callcenterapi/api/sysworkoffdays/setofforon",
  104. dataType: 'json',
  105. async: true,
  106. data: {
  107. offdate: Time,
  108. token: window.localStorage.getItem("token"),
  109. type: 0,
  110. id: ID
  111. },
  112. success: function(data) {
  113. /*验证请求*/
  114. if(data.state.toLowerCase() == "success") {
  115. layer.msg("修改成功");
  116. blur();
  117. }
  118. }
  119. });
  120. });
  121. } else {
  122. layer.confirm('确定设为工作日吗?', {
  123. btn: ['是', '否'] //按钮
  124. }, function() {
  125. $.ajax({
  126. type: "post",
  127. url: huayi.config.callcenter_url + "callcenterapi/api/sysworkoffdays/setofforon",
  128. dataType: 'json',
  129. async: true,
  130. data: {
  131. offdate: Time,
  132. token: window.localStorage.getItem("token"),
  133. type: 1,
  134. id: ID
  135. },
  136. success: function(data) {
  137. /*验证请求*/
  138. if(data.state.toLowerCase() == "success") {
  139. layer.msg("修改成功");
  140. blur();
  141. }
  142. }
  143. });
  144. });
  145. }
  146. }
  147. });
  148. }
  149. });