商丘12345 前端

GroupClassManage.html 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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.min.js"></script>
  8. <link rel="stylesheet" href="../css/init.css" />
  9. <link href="../js/fullcalendar/fullcalendar.css" rel="stylesheet" />
  10. <script src="../js/fullcalendar/fullcalendar.min.js"></script>
  11. <title>系统管理-->排班管理</title>
  12. <style>
  13. .fc-event-title {
  14. color:white;
  15. }
  16. .group {
  17. margin-bottom:5px;
  18. }
  19. .seatuser {
  20. color: black;
  21. padding: 5px 10px;
  22. border-radius: 2px;
  23. cursor: pointer;
  24. margin-bottom: 5px;
  25. background-color: #f3f3f4;
  26. }
  27. .active {
  28. background-color: #1ab394;
  29. color: #fff;
  30. }
  31. .lable {
  32. display: none;
  33. background-color: #d1dade;
  34. color: #5e5e5e;
  35. font-size: 10px;
  36. padding: 3px 8px;
  37. text-shadow: none;
  38. font-size: 75%;
  39. font-weight: 700;
  40. line-height: 1;
  41. text-align: center;
  42. white-space: nowrap;
  43. vertical-align: baseline;
  44. border-radius: .25em;
  45. margin:3px;
  46. float:left;
  47. cursor: pointer;
  48. }
  49. .active ~ .lable {
  50. display: inline;
  51. }
  52. </style>
  53. </head>
  54. <body class="gray-bg">
  55. <div class="container-fluid wrapper-content animated fadeInRight">
  56. <div class="daoHang clearfix">
  57. <div class="dhLeft">
  58. <sapn><i class="syIcon"></i>位置:<a id="ReIndex" href="javaScript:;">首页</a>&gt;<a href="javaScript:;">系统管理</a>&gt;<a href="" class="nowPosition">排班管理</a></sapn>
  59. </div>
  60. <div class="dhRight">
  61. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  62. </div>
  63. </div>
  64. <div class="col-sm-2">
  65. <div class="ibox float-e-margins">
  66. <div class="ibox-content">
  67. <div id='external-events'>
  68. <p>班别</p>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="ibox float-e-margins zxarea" style="display:none;">
  73. <div class="ibox-content">
  74. <div style="margin-bottom:10px;">
  75. <p>班组</p>
  76. <div id="bzlist" >
  77. <div class='seatuser' code=''>全部</div>
  78. </div>
  79. <div class="clearfix"></div>
  80. </div>
  81. <div class="wfz" style="display:none;">
  82. <p>未分组坐席</p>
  83. <div id="zxlist" >
  84. </div>
  85. <div class="clearfix" ></div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="col-sm-10">
  91. <div id="calendar"></div>
  92. </div>
  93. </div>
  94. <script>
  95. var bl = false;
  96. $(document).ready(function () {
  97. var rl = $('#RoleCode', top.document).val();
  98. var gcode = $('#GroupCode', top.document).val();
  99. if (rl == "GLY") {
  100. bl = true;
  101. //$(".zxarea").show();
  102. }
  103. $(".zxarea").show();
  104. $.getJSON(huayi.config.callcenter_url + 'Class/GetClassList', {
  105. "token": $.cookie("token")
  106. }, function (result) {
  107. if (result.state.toLowerCase() == "success") {
  108. $(result.data).each(function (i, n) {
  109. var html = "<div class='external-event navy-bg' code='" + n.F_Code + "' intime='" + n.F_InTime
  110. + "' outtime='" + n.F_OutTime + "'>" + n.F_Name + "[" + n.F_InTime + "-" + n.F_OutTime + "]" + "</div>";
  111. $("#external-events").append(html);
  112. })
  113. if (bl) {
  114. $("#external-events div.external-event").each(function () {
  115. var d = { title: $.trim($(this).text()), classcode: $(this).attr("code"), intime: $(this).attr("intime"), outtime: $(this).attr("outtime") };
  116. $(this).data("eventObject", d);
  117. $(this).draggable({ zIndex: 999, revert: true, revertDuration: 0, helper: 'clone' })
  118. });
  119. }
  120. }
  121. });
  122. //获取班组列表
  123. $.getJSON(huayi.config.callcenter_url + 'Group/GetGroupList', { "token": $.cookie("token") }, function (result) {
  124. if (result.state.toLowerCase() == "success") {
  125. var num = 0;
  126. $(result.data).each(function (i, n) {
  127. var html = "<div class='group drag' code='" + n.F_GroupCode + "'>";
  128. html += "<div class='seatuser ' code='" + n.F_GroupCode + "'>" + n.F_GroupName + "</div>";
  129. $(n.Users).each(function (j, m) {
  130. html += "<span class='lable' code='" + m.F_UserCode + "'>" + m.F_UserName + "</span>";
  131. })
  132. html += '<div class="clearfix"></div></div>';
  133. $("#bzlist").append(html);
  134. if (gcode == n.F_GroupCode) {
  135. num = i+1;
  136. }
  137. })
  138. $(".seatuser").click(function (i, n) {
  139. $(".seatuser").removeClass("active");
  140. $(this).addClass("active");
  141. bind();
  142. })
  143. if (bl) {
  144. $(".group span.lable").each(function () {
  145. var d = { code: $(this).attr("code"), name: $(this).text() };
  146. $(this).data("eventObject", d);
  147. $(this).draggable({ zIndex: 999, revert: "invalid", helper: 'clone' })
  148. });
  149. $(".drag").droppable({
  150. drop: function (event, ui) {
  151. var dragobj = $(ui.draggable[0]);
  152. var dropobj = $(this);
  153. var dragdata = dragobj.data("eventObject");
  154. if (dragdata.code) {
  155. $.post(huayi.config.callcenter_url + 'GroupClass/GroupSeat', {
  156. groupcode: dropobj.attr("code"), usercode: dragdata.code,
  157. "token": $.cookie("token")
  158. }, function (result) {
  159. result = JSON.parse(result);
  160. if (result.state.toLowerCase() == "success") {
  161. var html = "<span class='lable' code='" + dragdata.code + "'>" + dragdata.name + "</span>";
  162. $(html).insertBefore(dropobj.find(".clearfix")).data("eventObject", dragdata).draggable({
  163. zIndex: 999, revert: "invalid", helper: 'clone'
  164. });
  165. dragobj.remove();
  166. }
  167. })
  168. }
  169. }
  170. })
  171. }
  172. $($(".seatuser")[num]).trigger("click");
  173. }
  174. });
  175. $.getJSON(huayi.config.callcenter_url + 'GroupClass/GetNoGroupSeatList', { "token": $.cookie("token") }, function (result) {
  176. if (result.state.toLowerCase() == "success") {
  177. if (result.data.length > 0) {
  178. $(".wfz").show();
  179. $(result.data).each(function (i, n) {
  180. var html = "<span class='lable' style='display: inline;' code='" + n.F_UserCode + "'>" + n.F_UserName + "</span>";
  181. $("#zxlist").append(html);
  182. })
  183. if (bl) {
  184. $("#zxlist span.lable").each(function () {
  185. var d = { code: $(this).attr("code"), name: $(this).text() };
  186. $(this).data("eventObject", d);
  187. $(this).draggable({
  188. zIndex: 999, revert: "invalid", helper: 'clone'
  189. })
  190. });
  191. }
  192. }
  193. }
  194. });
  195. });
  196. function bind() {
  197. $('#calendar').html("");
  198. $('#calendar').fullCalendar({
  199. header: {
  200. //left: 'month,agendaWeek,agendaDay',
  201. left: 'month',
  202. center: 'title',
  203. right: 'today, prev, next'
  204. },
  205. monthNames: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  206. monthNamesShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  207. titleFormat: {
  208. month: "yyyy MMMM "
  209. },
  210. firstDay: "1",
  211. editable: bl,
  212. droppable: bl,
  213. drop: function (g, h) {
  214. var f = $(this).data("eventObject");
  215. var d = $.extend({}, f);
  216. if (f.classcode) {
  217. var groupcode = $(".active").attr("code");
  218. if (groupcode) {
  219. d.start = g;
  220. //d.allDay = false;
  221. d.title = $(".active").text() + " " + d.title;
  222. var c = g.getDate();
  223. var a = g.getMonth() + 1;
  224. var e = g.getFullYear();
  225. //var sdate = new Date(e + '-' + a + '-' + c + ' ' + f.intime);
  226. //var edate = new Date(e + '-' + a + '-' + c + ' ' + f.outtime);
  227. //d.start = sdate;
  228. //d.end = edate;
  229. d.groupcode = groupcode;
  230. //if (sdate > edate) {
  231. // d.end = new Date(e + '-' + a + '-' + (c + 1) + ' ' + f.outtime);;
  232. //}
  233. $.post(huayi.config.callcenter_url + 'GroupClass/AddGroupClass', {
  234. date: e + '-' + a + '-' + c, groupcode: groupcode, classcode: f.classcode,
  235. "token": $.cookie("token")
  236. }, function (result) {
  237. result = JSON.parse(result);
  238. if (result.state.toLowerCase() == "success") {
  239. d.id = result.data;
  240. $("#calendar").fullCalendar("renderEvent", d, true);
  241. }
  242. })
  243. }
  244. else {
  245. layer.confirm('请选择一个班组', {
  246. btn: ['确定'] //按钮
  247. });
  248. }
  249. }
  250. },
  251. //eventDragStart: function (event, jsEvent, ui, view) {
  252. // if (!$(".active").attr("code")) {
  253. // layer.confirm('请选择一个班组', {
  254. // btn: ['确定'] //按钮
  255. // });
  256. // }
  257. //},
  258. eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
  259. var g = event.start;
  260. var c = g.getDate();
  261. var a = g.getMonth() + 1;
  262. var e = g.getFullYear();
  263. $.post(huayi.config.callcenter_url + 'GroupClass/AddGroupClass', {
  264. id: event.id, date: e + '-' + a + '-' + c, groupcode: event.groupcode, classcode: event.classcode,
  265. "token": $.cookie("token")
  266. }, function (result) {
  267. result = JSON.parse(result);
  268. if (result.state.toLowerCase() != "success") {
  269. revertFunc();
  270. }
  271. })
  272. },
  273. events: function (start, end, callback) {
  274. var st = $.fullCalendar.formatDate(start, "yyyy-MM-dd");
  275. var ed = $.fullCalendar.formatDate(end, "yyyy-MM-dd");
  276. $.getJSON(huayi.config.callcenter_url + "GroupClass/GetRLList", { "starttime": st, "endtime": ed, "groupcode": $(".active").attr("code"), "token": $.cookie("token") }, function (r) {
  277. $(r).each(function (i, n) {
  278. n.end = false;
  279. })
  280. callback(r);
  281. })
  282. },
  283. eventClick: function (calEvent, jsEvent, view) {
  284. if (bl) {
  285. var id = calEvent.id;
  286. layer.confirm('确定删除吗?', {
  287. btn: ['是', '否'] //按钮
  288. }, function () {
  289. /*发送请求*/
  290. $.post(huayi.config.callcenter_url + "GroupClass/DelGroupClass", {
  291. id: id,
  292. token: $.cookie("token")
  293. }, function (result) {
  294. result = JSON.parse(result);
  295. if (result.state.toLowerCase() == "success") {
  296. layer.msg("删除成功");
  297. $('#calendar').fullCalendar('removeEvents', id);
  298. }
  299. })
  300. });
  301. }
  302. },
  303. eventMouseover: function (calEvent, jsEvent, view) {
  304. var id = calEvent.id;
  305. }
  306. });
  307. }
  308. </script>
  309. </body>
  310. </html>