No Description

dayCallStatistics.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. var myChart;
  2. var tabIndex = 0;
  3. $(document).ready(function() {
  4. layui.use('laydate', function() {
  5. var laydate = layui.laydate;
  6. //日期
  7. laydate.render({
  8. elem: '#sc_times',
  9. range: "~",
  10. theme: '#249fea',
  11. });
  12. });
  13. //搜索事件
  14. $("#sc_btns").click(function() {
  15. getDataList();
  16. });
  17. getDataList();
  18. })
  19. function getDataList() {
  20. var colsArr = [];
  21. var dataArr = [];
  22. var keys = [];
  23. var loadindex;
  24. $.ajax({
  25. type: 'get',
  26. url: huayi.config.callcenter_url + "callcenterapi/api/daystalktime/getcolumnlist",
  27. async: true,
  28. dataType: 'json',
  29. success:function(data){
  30. if(data.state.toLowerCase() == "success") {
  31. var cons = data.data;
  32. var legends=[];
  33. if(cons && cons.length > 0) {
  34. var newArr = [];
  35. for (var j=0;j<cons.length;j++){
  36. keys.push(cons[j]);
  37. }
  38. newArr.push({
  39. field: keys[0],
  40. title: keys[0],
  41. align: 'center',
  42. fixed: true,
  43. //sort: true,
  44. width: 150,
  45. });
  46. for(var i = 1, colNL = keys.length; i < colNL; i++) {
  47. newArr.push({
  48. field: keys[i],
  49. title: keys[i],
  50. align: 'center',
  51. //fixed: true,
  52. //sort: true,
  53. //width: 150,
  54. });
  55. }
  56. colsArr.push(newArr);
  57. }
  58. }
  59. }
  60. });
  61. $.ajax({
  62. type: 'get',
  63. url: huayi.config.callcenter_url + "callcenterapi/api/daystalktime/getdatalist",
  64. async: true,
  65. dataType: 'json',
  66. beforeSend: function() {
  67. loadindex = layer.load()
  68. },
  69. data: {
  70. stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0],
  71. endtime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1],
  72. },
  73. success: function(data) {
  74. if(data.state.toLowerCase() == "success") {
  75. var result = data.data;
  76. if(result && result.length > 0) {
  77. dataArr = result;
  78. layui.use('table', function() {
  79. var table = layui.table;
  80. //方法级渲染
  81. table.render({
  82. elem: '#t_callTotal',
  83. skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格)
  84. even: true, //开启隔行背景
  85. size: 'lg', //sm,lg尺寸的表格
  86. cellMinWidth: 100,
  87. page: true,
  88. cols: colsArr,
  89. data: dataArr,
  90. height: 'full-150'
  91. });
  92. });
  93. }
  94. }
  95. },
  96. }).then(function() {
  97. layer.close(loadindex);
  98. });
  99. }
  100. //导出
  101. function dcexcel(obj) {
  102. var beginyear=$('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0];
  103. var endyear=$('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1];
  104. var url=huayi.config.callcenter_url +"callcenterapi/api/daystalktime/exportexcel?stime="+ beginyear +"&endtime="+endyear ;
  105. obj.href = url;
  106. }