| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <script src="../js/jquery-ui.min.js"></script>
- <link rel="stylesheet" href="../css/init.css" />
- <link href="../js/fullcalendar/fullcalendar.css" rel="stylesheet" />
- <script src="../js/fullcalendar/fullcalendar.min.js"></script>
- <title>系统管理-->排班管理</title>
- <style>
- .fc-event-title {
- color:white;
- }
- .group {
- margin-bottom:5px;
- }
- .seatuser {
- color: black;
- padding: 5px 10px;
- border-radius: 2px;
- cursor: pointer;
- margin-bottom: 5px;
- background-color: #f3f3f4;
- }
- .active {
- background-color: #1ab394;
- color: #fff;
- }
- .lable {
- display: none;
- background-color: #d1dade;
- color: #5e5e5e;
- font-size: 10px;
- padding: 3px 8px;
- text-shadow: none;
- font-size: 75%;
- font-weight: 700;
- line-height: 1;
- text-align: center;
- white-space: nowrap;
- vertical-align: baseline;
- border-radius: .25em;
- margin:3px;
- float:left;
- cursor: pointer;
- }
- .active ~ .lable {
- display: inline;
- }
- </style>
- </head>
- <body class="gray-bg">
- <div class="container-fluid wrapper-content animated fadeInRight">
- <div class="daoHang clearfix">
- <div class="dhLeft">
- <sapn><i class="syIcon"></i>位置:<a id="ReIndex" href="javaScript:;">首页</a>><a href="javaScript:;">系统管理</a>><a href="" class="nowPosition">排班管理</a></sapn>
- </div>
- <div class="dhRight">
- <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
- </div>
- </div>
- <div class="col-sm-2">
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <div id='external-events'>
- <p>班别</p>
- </div>
- </div>
- </div>
- <div class="ibox float-e-margins zxarea" style="display:none;">
- <div class="ibox-content">
- <div style="margin-bottom:10px;">
- <p>班组</p>
- <div id="bzlist" >
- <div class='seatuser' code=''>全部</div>
- </div>
- <div class="clearfix"></div>
- </div>
- <div class="wfz" style="display:none;">
- <p>未分组坐席</p>
- <div id="zxlist" >
- </div>
- <div class="clearfix" ></div>
- </div>
- </div>
- </div>
- </div>
- <div class="col-sm-10">
- <div id="calendar"></div>
- </div>
- </div>
- <script>
- var bl = false;
- $(document).ready(function () {
- var rl = $('#RoleCode', top.document).val();
- var gcode = $('#GroupCode', top.document).val();
- if (rl == "GLY") {
- bl = true;
- //$(".zxarea").show();
- }
- $(".zxarea").show();
- $.getJSON(huayi.config.callcenter_url + 'Class/GetClassList', {
- "token": $.cookie("token")
- }, function (result) {
- if (result.state.toLowerCase() == "success") {
- $(result.data).each(function (i, n) {
- var html = "<div class='external-event navy-bg' code='" + n.F_Code + "' intime='" + n.F_InTime
- + "' outtime='" + n.F_OutTime + "'>" + n.F_Name + "[" + n.F_InTime + "-" + n.F_OutTime + "]" + "</div>";
- $("#external-events").append(html);
- })
- if (bl) {
- $("#external-events div.external-event").each(function () {
- var d = { title: $.trim($(this).text()), classcode: $(this).attr("code"), intime: $(this).attr("intime"), outtime: $(this).attr("outtime") };
- $(this).data("eventObject", d);
- $(this).draggable({ zIndex: 999, revert: true, revertDuration: 0, helper: 'clone' })
- });
- }
- }
- });
- //获取班组列表
- $.getJSON(huayi.config.callcenter_url + 'Group/GetGroupList', { "token": $.cookie("token") }, function (result) {
- if (result.state.toLowerCase() == "success") {
- var num = 0;
- $(result.data).each(function (i, n) {
- var html = "<div class='group drag' code='" + n.F_GroupCode + "'>";
- html += "<div class='seatuser ' code='" + n.F_GroupCode + "'>" + n.F_GroupName + "</div>";
- $(n.Users).each(function (j, m) {
- html += "<span class='lable' code='" + m.F_UserCode + "'>" + m.F_UserName + "</span>";
- })
- html += '<div class="clearfix"></div></div>';
- $("#bzlist").append(html);
- if (gcode == n.F_GroupCode) {
- num = i+1;
- }
- })
- $(".seatuser").click(function (i, n) {
- $(".seatuser").removeClass("active");
- $(this).addClass("active");
- bind();
- })
- if (bl) {
- $(".group span.lable").each(function () {
- var d = { code: $(this).attr("code"), name: $(this).text() };
- $(this).data("eventObject", d);
- $(this).draggable({ zIndex: 999, revert: "invalid", helper: 'clone' })
- });
- $(".drag").droppable({
- drop: function (event, ui) {
- var dragobj = $(ui.draggable[0]);
- var dropobj = $(this);
- var dragdata = dragobj.data("eventObject");
- if (dragdata.code) {
- $.post(huayi.config.callcenter_url + 'GroupClass/GroupSeat', {
- groupcode: dropobj.attr("code"), usercode: dragdata.code,
- "token": $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- var html = "<span class='lable' code='" + dragdata.code + "'>" + dragdata.name + "</span>";
- $(html).insertBefore(dropobj.find(".clearfix")).data("eventObject", dragdata).draggable({
- zIndex: 999, revert: "invalid", helper: 'clone'
- });
- dragobj.remove();
- }
- })
- }
- }
- })
- }
- $($(".seatuser")[num]).trigger("click");
- }
- });
- $.getJSON(huayi.config.callcenter_url + 'GroupClass/GetNoGroupSeatList', { "token": $.cookie("token") }, function (result) {
- if (result.state.toLowerCase() == "success") {
- if (result.data.length > 0) {
- $(".wfz").show();
- $(result.data).each(function (i, n) {
- var html = "<span class='lable' style='display: inline;' code='" + n.F_UserCode + "'>" + n.F_UserName + "</span>";
- $("#zxlist").append(html);
- })
- if (bl) {
- $("#zxlist span.lable").each(function () {
- var d = { code: $(this).attr("code"), name: $(this).text() };
- $(this).data("eventObject", d);
- $(this).draggable({
- zIndex: 999, revert: "invalid", helper: 'clone'
- })
- });
- }
- }
- }
- });
- });
- function bind() {
- $('#calendar').html("");
- $('#calendar').fullCalendar({
- header: {
- //left: 'month,agendaWeek,agendaDay',
- left: 'month',
- center: 'title',
- right: 'today, prev, next'
- },
- monthNames: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
- monthNamesShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
- titleFormat: {
- month: "yyyy MMMM "
- },
- firstDay: "1",
- editable: bl,
- droppable: bl,
- drop: function (g, h) {
- var f = $(this).data("eventObject");
- var d = $.extend({}, f);
- if (f.classcode) {
- var groupcode = $(".active").attr("code");
- if (groupcode) {
- d.start = g;
- //d.allDay = false;
- d.title = $(".active").text() + " " + d.title;
- var c = g.getDate();
- var a = g.getMonth() + 1;
- var e = g.getFullYear();
- //var sdate = new Date(e + '-' + a + '-' + c + ' ' + f.intime);
- //var edate = new Date(e + '-' + a + '-' + c + ' ' + f.outtime);
- //d.start = sdate;
- //d.end = edate;
- d.groupcode = groupcode;
- //if (sdate > edate) {
- // d.end = new Date(e + '-' + a + '-' + (c + 1) + ' ' + f.outtime);;
- //}
- $.post(huayi.config.callcenter_url + 'GroupClass/AddGroupClass', {
- date: e + '-' + a + '-' + c, groupcode: groupcode, classcode: f.classcode,
- "token": $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- d.id = result.data;
- $("#calendar").fullCalendar("renderEvent", d, true);
- }
- })
- }
- else {
- layer.confirm('请选择一个班组', {
- btn: ['确定'] //按钮
- });
- }
- }
- },
- //eventDragStart: function (event, jsEvent, ui, view) {
- // if (!$(".active").attr("code")) {
- // layer.confirm('请选择一个班组', {
- // btn: ['确定'] //按钮
- // });
- // }
- //},
- eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
- var g = event.start;
- var c = g.getDate();
- var a = g.getMonth() + 1;
- var e = g.getFullYear();
- $.post(huayi.config.callcenter_url + 'GroupClass/AddGroupClass', {
- id: event.id, date: e + '-' + a + '-' + c, groupcode: event.groupcode, classcode: event.classcode,
- "token": $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() != "success") {
- revertFunc();
- }
- })
- },
- events: function (start, end, callback) {
- var st = $.fullCalendar.formatDate(start, "yyyy-MM-dd");
- var ed = $.fullCalendar.formatDate(end, "yyyy-MM-dd");
- $.getJSON(huayi.config.callcenter_url + "GroupClass/GetRLList", { "starttime": st, "endtime": ed, "groupcode": $(".active").attr("code"), "token": $.cookie("token") }, function (r) {
- $(r).each(function (i, n) {
- n.end = false;
- })
- callback(r);
- })
- },
- eventClick: function (calEvent, jsEvent, view) {
- if (bl) {
- var id = calEvent.id;
- layer.confirm('确定删除吗?', {
- btn: ['是', '否'] //按钮
- }, function () {
- /*发送请求*/
- $.post(huayi.config.callcenter_url + "GroupClass/DelGroupClass", {
- id: id,
- token: $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- layer.msg("删除成功");
- $('#calendar').fullCalendar('removeEvents', id);
- }
- })
- });
- }
- },
- eventMouseover: function (calEvent, jsEvent, view) {
- var id = calEvent.id;
- }
- });
- }
- </script>
- </body>
- </html>
|