| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <!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.custom.min.js"></script>
- <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
- <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;
- }
- .seatuser {
- color: black;
- padding: 5px 10px;
- border-radius: 2px;
- cursor: pointer;
- margin-bottom: 5px;
- background-color: #f3f3f4;
- }
- .active {
- background-color: #1ab394;
- color: #fff;
- }
- </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 >
- <p>坐席</p>
- <div id="zxlist" style="height:500px;overflow:auto;"></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();
- if (rl == "GLY") {
- bl = true;
- $(".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);
- })
- $("#external-events div.external-event").each(function () {
- var d = { title: $.trim($(this).text()), code: $(this).attr("code"), intime: $(this).attr("intime"), outtime: $(this).attr("outtime") };
- $(this).data("eventObject", d);
- $(this).draggable({ zIndex: 999, revert: true, revertDuration: 0 })
- });
- }
- });
- //获取坐席列表
- if (bl) {
- $.getJSON(huayi.config.callcenter_url + 'SeatMonitoring/getlist', { "token": $.cookie("token") }, function (result) {
- if (result.state.toLowerCase() == "success") {
- $(result.data).each(function (i, n) {
- $("#zxlist").append("<div class='seatuser' code='" + n.F_UserCode + "'>" + n.F_UserName + "</div>");
- })
- $(".seatuser").click(function (i, n) {
- $(".seatuser").removeClass("active");
- $(this).addClass("active");
- bind();
- })
- $($(".seatuser")[0]).trigger("click");
- }
- });
- }
- else {
- bind();
- }
- })
- 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);
- //d.start = g;
- //d.allDay = false;
- 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;
- if (sdate > edate) {
- d.end = new Date(e + '-' + a + '-' + (c + 1) + ' ' + f.outtime);;
- }
- $.post(huayi.config.callcenter_url + 'UserClass/AddUserClass', {
- date: e + '-' + a + '-' + c, usercode: $(".active").attr("code"), classcode: f.code,
- "token": $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- d.id = result.data;
- $("#calendar").fullCalendar("renderEvent", d, true);
- }
- })
- },
- eventDragStop: function (event, jsEvent, ui, view) {
- var e = event;
- },
- 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 + 'UserClass/AddUserClass', {
- id: event.id, date: e + '-' + a + '-' + c, usercode: $(".active").attr("code"), classcode: event.code,
- "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 + "UserClass/GetRLList", { "starttime": st, "endtime": ed, "usercode": $(".active").attr("code"), "token": $.cookie("token") }, function (r) {
- //$(r).each(function (i, n) {
- // n.allDay = false;
- //})
- callback(r);
- })
- },
- eventClick: function (calEvent, jsEvent, view) {
- if (bl) {
- var id = calEvent.id;
- layer.confirm('确定删除吗?', {
- btn: ['是', '否'] //按钮
- }, function () {
- /*发送请求*/
- $.post(huayi.config.callcenter_url + "UserClass/DelUserClass", {
- 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>
|