Нет описания

seatStatement.js 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /**
  2. * 坐席工作报表
  3. * */
  4. $(function() {
  5. $('.tool_bars').authorizeButton();
  6. laydate.render({
  7. elem: '#chooseTime',
  8. theme: '#249fea',
  9. range: '~',
  10. });
  11. //部门下拉数据
  12. getDeptLists();
  13. getDataList();
  14. //搜索事件
  15. $("#sc_btns").click(function() {
  16. if($.trim($("#monthDays").val()) != ''){
  17. if (!regexs.phoneNum.test($.trim($("#monthDays").val()))) {
  18. layer.confirm('月工作天数必须是正整数!', {
  19. icon: 2,
  20. btn: ['确定'] //按钮
  21. });
  22. return;
  23. }
  24. }
  25. $('.thTable tbody').html('');
  26. getDataList();
  27. });
  28. $('#department').on('focus click', function() {
  29. $('#deptTreeView').removeClass('hidden').addClass('show');
  30. });
  31. $('#department').on('keyup', function() {
  32. if($(this).val() == '') {
  33. $('deptTreeView').treeview('uncheckAll', {
  34. silent: true
  35. });
  36. $(this).attr('data-id', '-1');
  37. }
  38. });
  39. $('#department + .caret').on('click', function() {
  40. $('#deptTreeView').removeClass('hidden').addClass('show');
  41. });
  42. $('#deptTreeView').mouseleave(function() {
  43. $(this).removeClass('show').addClass('hidden');
  44. });
  45. })
  46. //导出
  47. function btn_export() {
  48. var url = huayi.config.callcenter_url + "ZuoXiWorkTotal/ExptList?token=" + $.cookie("token");
  49. var st = $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[0];
  50. var et = $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[1];
  51. url += "&stime=" + st + "&endtime=" + et + "&dpt=" + $("#department").val() + "&dayss=" + $("#monthDays").val();
  52. window.location.href = url;
  53. }
  54. //表头
  55. function getColumnList() {
  56. $.ajax({
  57. type: 'get',
  58. url: huayi.config.callcenter_url + "ZuoXiWorkTotal/GetColumnList",
  59. async: true,
  60. dataType: 'json',
  61. data: {
  62. token: token
  63. },
  64. success: function(res) {
  65. var con = res.data;
  66. // console.log(con);
  67. for(var i = 0; i < con.length; i++) {
  68. $('<td>' + con[i] + '</td>').appendTo('.thTable thead tr')
  69. }
  70. }
  71. })
  72. }
  73. //表内数据
  74. function getDataList() {
  75. $.ajax({
  76. type: "get",
  77. url: huayi.config.callcenter_url + "ZuoXiWorkTotal/GetDataList",
  78. async: true,
  79. dataType: 'json',
  80. data: {
  81. stime: $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[0],
  82. endtime: $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[1],
  83. dpt: $("#department").val(),
  84. dayss: $("#monthDays").val(),
  85. token: $.cookie("token")
  86. },
  87. success: function(res) {
  88. var result = res.data;
  89. if(result){
  90. for(var i = 0; i < result.length; i++) {
  91. $('<tr><td>' + result[i].部门 + '</td><td>' + result[i].坐席 + '</td><td>' + result[i].坐席工号 + '</td><td>' + result[i].呼入电话数 + '</td><td>' + result[i].坐席接通量 + '</td><td>' + result[i].呼损量 + '</td><td>' + result[i].接通率 + '</td><td>' + result[i].呼损率 + '</td><td>' + result[i].平均排队时间 + '</td><td>' + result[i].接听通话次数 + '</td><td>' + result[i].通话分钟数 + '</td><td>' + result[i].通话秒数 + '</td><td>' + result[i].平均接听通话秒数 + '</td><td>' + result[i].平均振铃秒数 + '</td><td>' + result[i].呼入占有率 + '</td><td>' + result[i].用户评价 + '</td><td>' + result[i].坐席登录次数 + '</td><td>' + result[i].登录时长分钟数 + '</td><td>' + result[i].工作时长分钟数 + '</td><td>' + result[i].平均每天工作时长 + '</td><td>' + result[i].平均操作分钟数 + '</td><td>' + result[i].置忙次数 + '</td><td>' + result[i].休息时长分钟数 + '</td><td>' + result[i].平均每天休息时长 + '</td><td>' + result[i].置忙平均休息分钟数 + '</td><td>' + result[i].质检平均成绩 + '</td></tr>').appendTo('.thTable tbody')
  92. }
  93. }
  94. }
  95. });
  96. }
  97. //获取部门
  98. function getDeptLists() {
  99. $.getJSON(huayi.config.callcenter_url + 'Department/GetDeptList', {
  100. token: $.cookie("token")
  101. }, function (result) {
  102. if (result.state.toLowerCase() == "success") {
  103. var defaultDatas = result.data;
  104. var $sTree = $('#deptTreeView').treeview({
  105. color: "#428bca",
  106. expandIcon: 'glyphicon glyphicon-chevron-right',
  107. collapseIcon: 'glyphicon glyphicon-chevron-down',
  108. nodeIcon: 'fa fa-folder-o',
  109. data: defaultDatas,
  110. onNodeSelected: function (event, node) {
  111. $sTree.treeview('clearSearch');
  112. $('#department').val(node.text);
  113. $('#department').attr('data-id', node.id);
  114. $('#deptTreeView').removeClass('show').addClass('hidden');
  115. },
  116. onNodeUnselected: function (event, node) {
  117. $('#department').val('');
  118. $('#department').attr('data-id', '-1');
  119. }
  120. });
  121. var findSNodes = function () {
  122. return $sTree.treeview('search', [$('#department').val(), {
  123. ignoreCase: false,
  124. exactMatch: false
  125. }]);
  126. };
  127. $('#department').on('keyup', function (e) {
  128. var selectableNodes = findSNodes();
  129. });
  130. }
  131. })
  132. }