商丘12345 前端

UserClassManage.html 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="../Script/Common/huayi.load.js"></script>
  6. <script src="../Script/Common/huayi.config.js"></script>
  7. <script src="../js/jquery-ui.custom.min.js"></script>
  8. <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
  9. <link rel="stylesheet" href="../css/init.css" />
  10. <link href="../js/fullcalendar/fullcalendar.css" rel="stylesheet" />
  11. <script src="../js/fullcalendar/fullcalendar.min.js"></script>
  12. <title>系统管理-->排班管理</title>
  13. <style>
  14. .fc-event-title {
  15. color:white;
  16. }
  17. .seatuser {
  18. color: black;
  19. padding: 5px 10px;
  20. border-radius: 2px;
  21. cursor: pointer;
  22. margin-bottom: 5px;
  23. background-color: #f3f3f4;
  24. }
  25. .active {
  26. background-color: #1ab394;
  27. color: #fff;
  28. }
  29. </style>
  30. </head>
  31. <body class="gray-bg">
  32. <div class="container-fluid wrapper-content animated fadeInRight">
  33. <div class="daoHang clearfix">
  34. <div class="dhLeft">
  35. <sapn><i class="syIcon"></i>位置:<a id="ReIndex" href="javaScript:;">首页</a>&gt;<a href="javaScript:;">系统管理</a>&gt;<a href="" class="nowPosition">排班管理</a></sapn>
  36. </div>
  37. <div class="dhRight">
  38. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  39. </div>
  40. </div>
  41. <div class="col-sm-2">
  42. <div class="ibox float-e-margins">
  43. <div class="ibox-content">
  44. <div id='external-events'>
  45. <p>班别</p>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="ibox float-e-margins zxarea" style="display:none;">
  50. <div class="ibox-content">
  51. <div >
  52. <p>坐席</p>
  53. <div id="zxlist" style="height:500px;overflow:auto;"></div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="col-sm-10">
  59. <div id="calendar"></div>
  60. </div>
  61. </div>
  62. <script>
  63. var bl = false;
  64. $(document).ready(function () {
  65. var rl = $('#RoleCode', top.document).val();
  66. if (rl == "GLY") {
  67. bl = true;
  68. $(".zxarea").show();
  69. }
  70. $.getJSON(huayi.config.callcenter_url + 'Class/GetClassList', {
  71. "token": $.cookie("token")
  72. }, function (result) {
  73. if (result.state.toLowerCase() == "success") {
  74. $(result.data).each(function (i, n) {
  75. var html = "<div class='external-event navy-bg' code='" + n.F_Code + "' intime='" + n.F_InTime
  76. + "' outtime='" + n.F_OutTime + "'>" + n.F_Name + "[" + n.F_InTime + "-" + n.F_OutTime + "]" + "</div>";
  77. $("#external-events").append(html);
  78. })
  79. $("#external-events div.external-event").each(function () {
  80. var d = { title: $.trim($(this).text()), code: $(this).attr("code"), intime: $(this).attr("intime"), outtime: $(this).attr("outtime") };
  81. $(this).data("eventObject", d);
  82. $(this).draggable({ zIndex: 999, revert: true, revertDuration: 0 })
  83. });
  84. }
  85. });
  86. //获取坐席列表
  87. if (bl) {
  88. $.getJSON(huayi.config.callcenter_url + 'SeatMonitoring/getlist', { "token": $.cookie("token") }, function (result) {
  89. if (result.state.toLowerCase() == "success") {
  90. $(result.data).each(function (i, n) {
  91. $("#zxlist").append("<div class='seatuser' code='" + n.F_UserCode + "'>" + n.F_UserName + "</div>");
  92. })
  93. $(".seatuser").click(function (i, n) {
  94. $(".seatuser").removeClass("active");
  95. $(this).addClass("active");
  96. bind();
  97. })
  98. $($(".seatuser")[0]).trigger("click");
  99. }
  100. });
  101. }
  102. else {
  103. bind();
  104. }
  105. })
  106. function bind() {
  107. $('#calendar').html("");
  108. $('#calendar').fullCalendar({
  109. header: {
  110. //left: 'month,agendaWeek,agendaDay',
  111. left: 'month',
  112. center: 'title',
  113. right: 'today, prev, next'
  114. },
  115. monthNames: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  116. monthNamesShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  117. titleFormat: {
  118. month: "yyyy MMMM "
  119. },
  120. firstDay: "1",
  121. editable: bl,
  122. droppable: bl,
  123. drop: function (g, h) {
  124. var f = $(this).data("eventObject");
  125. var d = $.extend({}, f);
  126. //d.start = g;
  127. //d.allDay = false;
  128. var c = g.getDate();
  129. var a = g.getMonth() + 1;
  130. var e = g.getFullYear();
  131. var sdate = new Date(e + '-' + a + '-' + c + ' ' + f.intime);
  132. var edate = new Date(e + '-' + a + '-' + c + ' ' + f.outtime);
  133. d.start = sdate;
  134. d.end = edate;
  135. if (sdate > edate) {
  136. d.end = new Date(e + '-' + a + '-' + (c + 1) + ' ' + f.outtime);;
  137. }
  138. $.post(huayi.config.callcenter_url + 'UserClass/AddUserClass', {
  139. date: e + '-' + a + '-' + c, usercode: $(".active").attr("code"), classcode: f.code,
  140. "token": $.cookie("token")
  141. }, function (result) {
  142. result = JSON.parse(result);
  143. if (result.state.toLowerCase() == "success") {
  144. d.id = result.data;
  145. $("#calendar").fullCalendar("renderEvent", d, true);
  146. }
  147. })
  148. },
  149. eventDragStop: function (event, jsEvent, ui, view) {
  150. var e = event;
  151. },
  152. eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
  153. var g = event.start;
  154. var c = g.getDate();
  155. var a = g.getMonth() + 1;
  156. var e = g.getFullYear();
  157. $.post(huayi.config.callcenter_url + 'UserClass/AddUserClass', {
  158. id: event.id, date: e + '-' + a + '-' + c, usercode: $(".active").attr("code"), classcode: event.code,
  159. "token": $.cookie("token")
  160. }, function (result) {
  161. result = JSON.parse(result);
  162. if (result.state.toLowerCase() != "success") {
  163. revertFunc();
  164. }
  165. })
  166. },
  167. events: function (start, end, callback) {
  168. var st = $.fullCalendar.formatDate(start, "yyyy-MM-dd");
  169. var ed = $.fullCalendar.formatDate(end, "yyyy-MM-dd");
  170. $.getJSON(huayi.config.callcenter_url + "UserClass/GetRLList", { "starttime": st, "endtime": ed, "usercode": $(".active").attr("code"), "token": $.cookie("token") }, function (r) {
  171. //$(r).each(function (i, n) {
  172. // n.allDay = false;
  173. //})
  174. callback(r);
  175. })
  176. },
  177. eventClick: function (calEvent, jsEvent, view) {
  178. if (bl) {
  179. var id = calEvent.id;
  180. layer.confirm('确定删除吗?', {
  181. btn: ['是', '否'] //按钮
  182. }, function () {
  183. /*发送请求*/
  184. $.post(huayi.config.callcenter_url + "UserClass/DelUserClass", {
  185. id: id,
  186. token: $.cookie("token")
  187. }, function (result) {
  188. result = JSON.parse(result);
  189. if (result.state.toLowerCase() == "success") {
  190. layer.msg("删除成功");
  191. $('#calendar').fullCalendar('removeEvents', id);
  192. }
  193. })
  194. });
  195. }
  196. },
  197. eventMouseover: function (calEvent, jsEvent, view) {
  198. var id = calEvent.id;
  199. }
  200. });
  201. }
  202. </script>
  203. </body>
  204. </html>