暂无描述

GroupClassManage.html 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>排班管理</title>
  6. <script src="../Script/Common/huayi.load.js"></script>
  7. <script src="../Script/Common/huayi.config.js"></script>
  8. <link rel="stylesheet" href="../css/init.css" />
  9. <link rel="stylesheet" href="../css/Table/table1.css" />
  10. <link href="../js/bootstrap-select/css/bootstrap-select.css" rel="stylesheet" />
  11. <link href="../css/style.min862f.css" rel="stylesheet" />
  12. <link rel="stylesheet" href="../js/fullcalendar/fullcalendar.css" />
  13. <style>
  14. .fc-event-title {
  15. color: white;
  16. }
  17. .group {
  18. margin-bottom: 5px;
  19. }
  20. .seatuser {
  21. color: black;
  22. padding: 5px 10px;
  23. border-radius: 2px;
  24. cursor: pointer;
  25. margin-bottom: 5px;
  26. background-color: #f3f3f4;
  27. }
  28. .zxlist span.active {
  29. background-color: #1ab394;
  30. color: #fff;
  31. }
  32. .active {
  33. background-color: #1ab394;
  34. color: #fff;
  35. }
  36. .lable {
  37. display: none;
  38. background-color: #d1dade;
  39. color: #5e5e5e;
  40. font-size: 10px;
  41. padding: 3px 8px;
  42. text-shadow: none;
  43. font-size: 75%;
  44. font-weight: 700;
  45. line-height: 1;
  46. text-align: center;
  47. white-space: nowrap;
  48. vertical-align: baseline;
  49. border-radius: .25em;
  50. margin: 3px;
  51. float: left;
  52. cursor: pointer;
  53. }
  54. .active~.lable {
  55. display: inline;
  56. }
  57. .fc-content .fc-widget-header {
  58. padding: 11px 0;
  59. }
  60. </style>
  61. </head>
  62. <body class="gray-bg">
  63. <div class="daoHang clearfix">
  64. <div class="dhLeft">
  65. <sapn><i class="syIcon"></i>位置:
  66. <a id="ReIndex" href="javaScript:;" class="indexreturn">首页</a>&gt;
  67. <a href="javaScript:;">设备运维</a>&gt;
  68. <a href="javascript:location.reload()" class="now_position">新排班管理</a>
  69. </sapn>
  70. </div>
  71. </div>
  72. <div class="wrapper wrapper-content animated fadeInRight">
  73. <div class="th-box">
  74. <div class="form-inline th-bar clearfix">
  75. <div class="form-group time-box">
  76. <select id="sc_pro" class="form-control selectpicker" data-live-search="true">
  77. <option value="">请选择项目名称</option>
  78. </select>
  79. </div>
  80. <!--<div class="form-group time-box">
  81. <i class="tub fa fa-search"></i>
  82. <input type="text" class="form-control" style="width: 248px;" id="sc_keyWords" placeholder="请输入坐席组编号">
  83. </div>
  84. <div class="form-group tool_bars pull-right">
  85. <input type="button" class="btn_gray" id="sc_btns" value="搜索" />
  86. <input type="button" class="btn_gray" authorize="yes" id="HY_add" onclick="btn_add()" value="添加" />
  87. <input type="button" class="btn_gray" authorize="yes" id="HY_deletes" onclick="btn_deletes()" value="批量删除" />
  88. </div>-->
  89. </div>
  90. </div>
  91. <div class="tab_contents" id="tab_contents">
  92. <div class="col-sm-2" id="classAndUserList">
  93. <!--<div class="ibox float-e-margins">
  94. <div class="ibox-content">
  95. <div id='external-events'>
  96. <p>班别</p>
  97. </div>
  98. <div class="wfz" style="display:none;">
  99. <p class="GroupName">未分组坐席</p>
  100. <div id="zxlist">
  101. </div>
  102. <div class="clearfix"></div>
  103. </div>
  104. </div>
  105. </div>-->
  106. <!--<div class="ibox float-e-margins zxarea" style="display:none;">
  107. <div class="ibox-content">
  108. <div style="margin-bottom:10px;">
  109. <p>班组</p>
  110. <div id="bzlist">
  111. <div class='seatuser' code=''>全部</div>
  112. </div>
  113. <div class="clearfix"></div>
  114. </div>
  115. <div class="wfz" style="display:none;">
  116. <p>未分组坐席</p>
  117. <div id="zxlist">
  118. </div>
  119. <div class="clearfix"></div>
  120. </div>
  121. </div>
  122. </div>-->
  123. </div>
  124. <div class="col-sm-10">
  125. <div id="calendar"></div>
  126. </div>
  127. </div>
  128. </div>
  129. <script src="../js/jquery-ui.min.js"></script>
  130. <script src="../js/bootstrap-select/js/bootstrap-select.js"></script>
  131. <script src="../js/fullcalendar/fullcalendar.min.js"></script>
  132. <script>
  133. var userList = [];
  134. $(document).ready(function() {
  135. getProlistDrop($('#sc_pro')).then(function() {
  136. getClassAndUser();
  137. bindCalendar();
  138. });
  139. $(".zxarea").show();
  140. $('#sc_pro').on('change', function(){
  141. getClassAndUser();
  142. bindCalendar();
  143. });
  144. });
  145. //获取班别、人员
  146. function getClassAndUser() {
  147. $.getJSON(huayi.config.callcenter_url + 'signtokenapi/api/WorkClassUser/getclassanduserlist', {
  148. "projectid": $('#sc_pro').val()
  149. }, function(result) {
  150. $('#classAndUserList').empty();
  151. if (result.state.toLowerCase() === "success") {
  152. result = result.data
  153. if(result && result.length){
  154. $(result).each(function(i, n) {
  155. var html = '<div class="ibox float-e-margins">' +
  156. '<div class="ibox-content">' +
  157. '<div id="external-events">' +
  158. '<p class="depName">' + n.name + '</p>'
  159. if(n.list_class && n.list_class.length){
  160. $(n.list_class).each(function(g, h) {
  161. html += '<div class="external-event navy-bg" usertype="' + n.id + '" code="' + h.code + '" intime="' + h.starttime +
  162. '" outtime="' + h.endtime + '">' + h.name + '[' + h.starttime + '-' + h.endtime + ']</div>'
  163. });
  164. }
  165. html += '</div>' +
  166. '<div class="wfz">' +
  167. '<p class="GroupName">' + n.name + '人员</p>' +
  168. '<div class="zxlist" userList="' + JSON.stringify(n.list_user) + '">'
  169. if(n.list_user && n.list_user.length){
  170. $(n.list_user).each(function(j, m) {
  171. html += "<span class='lable' onclick='peopleClick(this)' style='display: inline;' code='" + m.id + "'>" +
  172. m.username + "</span>"
  173. });
  174. }
  175. html += '</div>' +
  176. '<div class="clearfix"></div>' +
  177. '</div>' +
  178. '</div>' +
  179. '</div>';
  180. $('#classAndUserList').append(html);
  181. });
  182. $("#external-events div.external-event").each(function() {
  183. var d = {
  184. title: $.trim($(this).text()),
  185. classcode: $(this).attr("code"),
  186. intime: $(this).attr("intime"),
  187. outtime: $(this).attr("outtime"),
  188. usertype: $(this).attr("usertype"),
  189. };
  190. $(this).data("eventObject", d);
  191. $(this).draggable({
  192. zIndex: 999,
  193. revert: true,
  194. revertDuration: 0,
  195. helper: 'clone'
  196. })
  197. });
  198. }
  199. }
  200. });
  201. }
  202. function peopleClick(ele) {
  203. $(ele).toggleClass('active');
  204. $(ele).parents('.ibox').siblings().find('.zxlist').children('span').removeClass("active");
  205. addUserId(ele);
  206. }
  207. function addUserId(ele) {
  208. userList = [];
  209. $(ele).parent().find('span.active').each(function(i, n) {
  210. userList.push($(this).attr('code'));
  211. });
  212. }
  213. //项目下拉数据
  214. function getProlistDrop(el) {
  215. var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
  216. $.ajax({
  217. type: "get",
  218. url: huayi.config.callcenter_url + "equipmentapi/api/ProjectInfo/getlistdrop",
  219. dataType: 'json',
  220. async: true,
  221. success: function(data) {
  222. el.empty();
  223. var res = data.data;
  224. if (res) {
  225. for (var i = 0; i < res.length; i++) {
  226. if (i == 0) {
  227. $('<option value=' + res[i].id + ' selected>' + res[i].text + '</option>').appendTo(el);
  228. } else {
  229. $('<option value=' + res[i].id + '>' + res[i].text + '</option>').appendTo(el);
  230. }
  231. }
  232. el.selectpicker('refresh');
  233. }
  234. dtd.resolve(); // 改变Deferred对象的执行状态
  235. }
  236. });
  237. return dtd.promise(); // 返回promise对象
  238. }
  239. function bindCalendar() {
  240. $('#calendar').fullCalendar('destroy');
  241. $('#calendar').fullCalendar({
  242. header: {
  243. //left: 'month,agendaWeek,agendaDay',
  244. left: 'month',
  245. center: 'title',
  246. right: 'today, prev, next'
  247. },
  248. monthNames: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  249. monthNamesShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  250. titleFormat: {
  251. month: "yyyy MMMM "
  252. },
  253. firstDay: "1",
  254. editable: true,
  255. droppable: true,
  256. drop: function(g, h) {
  257. var f = $(this).data("eventObject");
  258. var d = $.extend({}, f);
  259. if (f.classcode) {
  260. var groupcode = f.classcode;
  261. var usertype = f.usertype;
  262. if ($(this).parent().siblings('.wfz').find('span.active').length && userList.length) {
  263. d.start = g;
  264. d.title = $(".active").parents('.wfz').siblings('#external-events').find('.depName').text() + " " + $(".active").text() + '\n' + d.title;
  265. var c = g.getDate();
  266. var a = g.getMonth() + 1;
  267. var e = g.getFullYear();
  268. d.groupcode = groupcode;
  269. $.post(huayi.config.callcenter_url + 'signtokenapi/api/WorkClassUser/saveuser', {
  270. date: e + '-' + a + '-' + c, //是 string 日期
  271. classcode: groupcode, //是 string 班别代码
  272. usertype: usertype, //是 string 排班部门分类id(字典RYJS)
  273. userlist: userList, //是 List<string> 人员列表ids
  274. projectid: $('#sc_pro').val()
  275. }, function(result) {
  276. result = JSON.parse(result);
  277. if (result.state.toLowerCase() == "success") {
  278. // d.id = result.data;
  279. $('#calendar').fullCalendar('refetchEvents');
  280. }
  281. })
  282. } else {
  283. layer.confirm('请选择人员', {
  284. icon: 2,
  285. btn: ['确定'] //按钮
  286. });
  287. }
  288. }
  289. },
  290. //eventDragStart: function (event, jsEvent, ui, view) {
  291. // if (!$(".active").attr("code")) {
  292. // layer.confirm('请选择一个班组', {
  293. // btn: ['确定'] //按钮
  294. // });
  295. // }
  296. //},
  297. eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
  298. //当拖拽完成并且时间改变时触发
  299. // dayDelta 保存日程向前或者向后移动了多少天
  300. // minuteDelta 这个值只有在agenda视图有效,移动的时间
  301. // allDay 如果是月视图,或者是agenda视图的全天日程,此值为true,否则为false
  302. var g = event.start;
  303. var c = g.getDate();
  304. var a = g.getMonth() + 1;
  305. var e = g.getFullYear();
  306. $.post(huayi.config.callcenter_url + 'signtokenapi/api/WorkClassUser/update', {
  307. id: event.id,
  308. date: e + '-' + a + '-' + c,
  309. classcode: event.classcode, //是 string 班别代码
  310. // usertype: event.usertype, //是 string 排班部门分类id(字典RYJS)
  311. // userlist: userList, //是 List<string> 人员列表ids
  312. // projectid: $('#sc_pro').val()
  313. }, function(result) {
  314. result = JSON.parse(result);
  315. if (result.state.toLowerCase() != "success") {
  316. revertFunc();
  317. }
  318. })
  319. },
  320. events: function(start, end, callback) {
  321. console.log(start)
  322. console.log(end)
  323. var st = $.fullCalendar.formatDate(start, "yyyy-MM-dd");
  324. var ed = $.fullCalendar.formatDate(end, "yyyy-MM-dd");
  325. $.getJSON(huayi.config.callcenter_url + "signtokenapi/api/WorkClassUser/getusermarker", {
  326. "starttime": st,
  327. "endtime": ed,
  328. "projectid": $('#sc_pro').val()
  329. }, function(r) {
  330. $(r.data).each(function(i, v) {
  331. v.title = v.usertypename + ' ' + v.usernamelist.join(',') + '<br />' + v.classcode + v.classname + '['+ v.classstarttime + '-' + v.classendtime + ']';
  332. v.start = v.date;
  333. })
  334. callback(r.data);
  335. // var events = [];
  336. // $(r.data).each(function(i, v) {
  337. // events.push({
  338. // title: v.usertypename + ' ' + v.usernamelist.join(',') + '<br />' + v.classcode + v.classname + '['+ v.classstarttime + '-' + v.classendtime + ']',
  339. // start: v.date
  340. // });
  341. // });
  342. // callback(events);
  343. });
  344. },
  345. eventRender: function (event, element) {//title以HTML显示(换行)
  346. element.html(event.title);
  347. },
  348. eventClick: function(calEvent, jsEvent, view) { // 当点击日历中的某一日程(事件)时,触发此操作
  349. var id = calEvent.id;
  350. layer.confirm('确定删除吗?', {
  351. icon: 7,
  352. btn: ['是', '否'] //按钮
  353. }, function() {
  354. $.post(huayi.config.callcenter_url + "signtokenapi/api/WorkClassUser/delete", {
  355. ids: id,
  356. }, function(result) {
  357. result = JSON.parse(result);
  358. if (result.state.toLowerCase() == "success") {
  359. layer.msg("删除成功");
  360. $('#calendar').fullCalendar('removeEvents', id);
  361. }
  362. })
  363. });
  364. },
  365. eventMouseover: function(calEvent, jsEvent, view) { // 鼠标划过和离开的事件,用法和参数同上
  366. // var id = calEvent.id;
  367. }
  368. });
  369. }
  370. </script>
  371. </body>
  372. </html>