Нет описания

dailyDuration.js 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /***
  2. * 日通话时长统计
  3. * */
  4. var token = $.cookie("token");
  5. $(function() {
  6. $('.tool_bars').authorizeButton();
  7. getSeatList();
  8. laydate.render({
  9. elem: '#chooseTime',
  10. theme: '#249fea',
  11. range: '~',
  12. });
  13. getColumnList();
  14. getDataList();
  15. //搜索事件
  16. $("#sc_btns").click(function() {
  17. $('.thTable tbody').html('');
  18. getDataList();
  19. });
  20. });
  21. //导出
  22. function btn_export() {
  23. var url = huayi.config.callcenter_url + "DaysTalkTime/ExptList?token=" + token;
  24. var st = $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[0];
  25. var et = $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[1];
  26. url += "&stime=" + st + "&endtime=" + et + "&usercode=" + $("#seat").val();
  27. window.location.href = url;
  28. }
  29. //表头
  30. function getColumnList() {
  31. $.ajax({
  32. type: 'get',
  33. url: huayi.config.callcenter_url + "DaysTalkTime/GetColumnList",
  34. async: true,
  35. dataType: 'json',
  36. data: {
  37. token: token
  38. },
  39. success: function(res) {
  40. var con = res.data;
  41. if(res.state.toLowerCase() == "success") {
  42. for(var i = 0; i < con.length; i++) {
  43. $('<td>' + con[i] + '</td>').appendTo('.thTable thead tr')
  44. }
  45. }
  46. }
  47. })
  48. }
  49. //表内数据
  50. function getDataList() {
  51. $.ajax({
  52. type: "get",
  53. url: huayi.config.callcenter_url + "DaysTalkTime/GetDataList",
  54. async: true,
  55. dataType: 'json',
  56. data: {
  57. stime: $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[0],
  58. endtime: $('#chooseTime').val() && $('#chooseTime').val().split(' ~ ')[1],
  59. usercode: $("#seat").val(),
  60. token: token
  61. },
  62. success: function(res) {
  63. var result = res.data;
  64. if(res.state.toLowerCase() == "success") {
  65. for(var i = 0; i < result.length; i++) {
  66. $('<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></tr>').appendTo('.thTable tbody')
  67. // console.log(typeof(result[i].日期))
  68. }
  69. }
  70. }
  71. });
  72. }
  73. //获取坐席下拉列表
  74. function getSeatList() {
  75. $.getJSON(huayi.config.callcenter_url + "UserAccount/GetSeatList", {
  76. token: $.cookie("token")
  77. }, function(result) {
  78. if(result.state.toLowerCase() == "success") {
  79. var seatlist = result.data;
  80. $("#seat").empty();
  81. $("#seat").append('<option value=" ">请选择坐席工号</option>');
  82. $(seatlist).each(function(i, n) {
  83. $("#seat").append('<option value="' + n.F_UserCode + '">' + n.F_UserCode + '(' + n.F_UserName + ')' + '</option>');
  84. })
  85. $('#seat').selectpicker('refresh');
  86. }
  87. });
  88. }