Brak opisu

callTime.html 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <script src="Script/Common/huayi.load.js"></script>
  7. <script src="Script/Common/huayi.config.js"></script>
  8. <title>通话时长</title>
  9. <link rel="stylesheet" href="css/init.css" />
  10. <style>
  11. .clearfix:after {
  12. content: "";
  13. display: block;
  14. clear: both;
  15. }
  16. .th-top {
  17. background: #f3f3f4;
  18. height: 60px;
  19. padding: 10px 20px;
  20. }
  21. .topCon {
  22. float: right;
  23. margin-right: 45px;
  24. }
  25. .th-content h2 {
  26. font-size: 22px;
  27. /*margin-bottom: 20px;*/
  28. }
  29. .topCon input {
  30. width: 128px;
  31. padding: 2px 2PX 2PX 10PX;
  32. height: 28px;
  33. border: 1px solid #ebebeb;
  34. color: #1ab394;
  35. outline: none;
  36. vertical-align: middle;
  37. }
  38. .th-content {
  39. width: 90%;
  40. margin: 0 auto;
  41. }
  42. .th-table table thead tr td {
  43. background: #1ab394;
  44. color: #fff;
  45. }
  46. .th-table {
  47. display: none;
  48. }
  49. </style>
  50. </head>
  51. <body class="gray-bg" style="background: #fefefe;">
  52. <div class="thTime">
  53. <div class="daoHang clearfix">
  54. <div class="dhLeft">
  55. <sapn><i class="syIcon"></i>位置:
  56. <a id="ReIndex" href="javaScript:;">首页</a>&gt;
  57. <a href="javaScript:;">报表分析</a>&gt;
  58. <a href="javaScript:;">话务运营分析</a>&gt;
  59. <a href="" style="color: #000;">通话时长统计</a>
  60. </sapn>
  61. </div>
  62. </div>
  63. <div class="th-top clearfix">
  64. <div class="topCon">
  65. 开始时间:
  66. <input type="text" class="laydate-icon" id="startTime" /> 结束时间:
  67. <input type="text" class="laydate-icon" id="endTime" />
  68. <button class="btns sear">搜索</button>
  69. <a class="btns export">导出</a>
  70. </div>
  71. </div>
  72. <ul class="nav nav-tabs th-tab">
  73. <li role="presentation" class="active">
  74. <a href="javascript:;">图形</a>
  75. </li>
  76. <li role="presentation">
  77. <a href="javascript:;">表格</a>
  78. </li>
  79. </ul>
  80. <div class="th-content">
  81. <div class="th-tu" style="width: 100%;">
  82. <h2 style="text-align: center;">服务热线坐席通话时长统计</h2>
  83. <div id="tabtu" style="width: 100%; height: 500px;"></div>
  84. </div>
  85. <div class="th-table">
  86. <h2 style="text-align: center;">热线坐席通话时长统计</h2>
  87. <table class="table table-bordered text-center table-hover thTable" style="width: 100%;">
  88. <thead>
  89. <tr>
  90. <!--<td>坐席名称</td>
  91. <td>呼入次数</td>
  92. <td>呼出次数</td>
  93. <td>通话总时长</td>
  94. <td>平均通话时长</td>-->
  95. </tr>
  96. </thead>
  97. <tbody class="tbody">
  98. </tbody>
  99. </table>
  100. </div>
  101. </div>
  102. </div>
  103. <script src="js/jquery.min.js?v=2.1.4"></script>
  104. <script src="js/bootstrap.min.js?v=3.3.6"></script>
  105. <script src="js/jquery.cookie.js"></script>
  106. <script src="js/laydate/laydate.js"></script>
  107. <script src="js/echarts.common.min.js"></script>
  108. <!--<script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>-->
  109. <script>
  110. var token = $.cookie("token"),
  111. stime = helper.DateFormat.getNowDate(), //初始化当前年份
  112. endtime = stime, //结束年份
  113. aa = true,
  114. tabtu,
  115. legend = [], //图例
  116. zxn, //坐席名称
  117. callIn, //呼入次数
  118. callInTime, //呼入时长
  119. callInAccess, //呼入未接通次数 miaofuhao 180517
  120. callOut, //呼出次数
  121. callOutTime, //呼出时长
  122. hcNoCount, //呼出未接通次数
  123. zhenLing, //振铃时长
  124. total, //通话总时长
  125. pingjun; //平均通话时长
  126. //tab切换
  127. $('.th-tab li').click(function() {
  128. $(this).addClass('active')
  129. .siblings().removeClass('active');
  130. var index = $(this).index();
  131. $('.th-content >div').eq(index).show()
  132. .siblings().hide();
  133. })
  134. laydate.render({
  135. elem: '#startTime',
  136. calendar: true,
  137. theme: '#1ab394',
  138. value: stime,
  139. });
  140. laydate.render({
  141. elem: '#endTime',
  142. calendar: true,
  143. theme: '#1ab394',
  144. value: endtime,
  145. });
  146. $(document).ready(function() {
  147. //图形
  148. tabtu = echarts.init(document.getElementById('tabtu'));
  149. option = {
  150. tooltip: {
  151. trigger: 'axis',
  152. },
  153. legend: {
  154. data: legend,
  155. bottom: 0
  156. },
  157. xAxis: [{
  158. type: 'category',
  159. data: zxn,
  160. axisPointer: {
  161. type: ''
  162. }
  163. }],
  164. yAxis: [{
  165. type: 'value',
  166. name: '通话次数(通)',
  167. nameLocation: 'middle',
  168. nameGap: 35,
  169. // min: 0,
  170. // max:300,
  171. interval: 50,
  172. axisLabel: {
  173. formatter: '{value} '
  174. }
  175. },
  176. {
  177. type: 'value',
  178. name: '通话时长(s)',
  179. nameLocation: 'middle',
  180. nameGap: 35,
  181. // min: 0,
  182. // max: 150,
  183. interval: 100,
  184. axisLabel: {
  185. formatter: '{value} '
  186. }
  187. }
  188. ],
  189. series: [{
  190. type: 'bar',
  191. name: '呼入次数',
  192. data: callIn
  193. }, {
  194. type: 'line',
  195. name: '呼入时长',
  196. yAxisIndex: 1,
  197. data: callInTime
  198. }, {
  199. type: 'line',
  200. name: '呼入未接通次数',
  201. yAxisIndex: 1,
  202. data: callInAccess
  203. },
  204. {
  205. type: 'bar',
  206. name: '呼出次数',
  207. data: callOut
  208. }, {
  209. type: 'line',
  210. name: '呼出时长',
  211. yAxisIndex: 1,
  212. data: callOutTime
  213. }, {
  214. type: 'bar',
  215. name: '呼出未接通次数',
  216. data: hcNoCount
  217. }, {
  218. type: 'line',
  219. name: '振铃时长',
  220. yAxisIndex: 1,
  221. data: zhenLing
  222. },
  223. {
  224. type: 'line',
  225. name: '通话总时长',
  226. yAxisIndex: 1,
  227. data: total
  228. },
  229. {
  230. type: 'line',
  231. name: '平均通话时长',
  232. yAxisIndex: 1,
  233. data: pingjun
  234. }
  235. ],
  236. color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f', '#cddc39', '#ff5722', '#e91e63', '#673ab7', '#6fbbf5']
  237. };
  238. Ajax(stime, endtime);
  239. tabtu.setOption(option);
  240. })
  241. //表头数据
  242. var con;
  243. $.ajax({
  244. type: "get",
  245. url: huayi.config.callcenter_url + "TalkTime/GetColumnList",
  246. async: false,
  247. dataType: 'json',
  248. data: {
  249. token: token
  250. },
  251. success: function(res) {
  252. con = res.data;
  253. //console.log(con);
  254. for(var i = 0; i < con.length; i++) {
  255. $('<td>' + con[i] + '</td>').appendTo('.thTable thead tr')
  256. }
  257. return con
  258. }
  259. });
  260. legend = con;
  261. //搜索事件
  262. $(".sear").click(function() {
  263. $('.thTable tbody').html('');
  264. stime = $("#startTime").val();
  265. endtime = $("#endTime").val();
  266. Ajax(stime, endtime);
  267. tabtu.setOption(option);
  268. });
  269. //导出功能
  270. $('.export').click(function() {
  271. dcexcel(this);
  272. })
  273. function dcexcel(obj) {
  274. var url = huayi.config.callcenter_url + "TalkTime/ExptList?token=" + $.cookie("token");
  275. url += "&stime=" + $("#startTime").val() + "&endtime=" + $("#endTime").val();
  276. obj.href = url;
  277. }
  278. //表格数据
  279. function Ajax(stime, endtime) {
  280. var zx_name = [],
  281. huru = [],
  282. huruTime = [],
  283. huruAccess=[], //miaofuhao180817
  284. huchu = [],
  285. huchuTime = [],
  286. hcNo = [],
  287. zlTime = [],
  288. allCall = [],
  289. averange = [];
  290. $.ajax({
  291. type: 'get',
  292. url: huayi.config.callcenter_url + 'TalkTime/GetDataList',
  293. async: false,
  294. dataType: 'json',
  295. data: {
  296. token: token,
  297. stime: stime,
  298. endtime: endtime
  299. },
  300. success: function(data) {
  301. var tbodyCon = data.data;
  302. $('.thTable tbody').html('');
  303. console.log(tbodyCon);
  304. for(var j = 0; j < tbodyCon.length; j++) {
  305. $('<tr><td>' + tbodyCon[j].坐席名称 + '</td><td>' + tbodyCon[j].呼入次数 + '</td><td>' + tbodyCon[j].呼入时长 + '</td><td>' + tbodyCon[j].呼入未接通次数 + '</td><td>' + tbodyCon[j].呼出次数 + '</td><td>' + tbodyCon[j].呼出时长 + '</td><td>' + tbodyCon[j].呼出未接通次数 + '</td><td>' + tbodyCon[j].振铃时长 + '</td><td>' + tbodyCon[j].通话总时长 + '</td><td>' + tbodyCon[j].平均通话总时长 + '</td></tr>').appendTo('.thTable tbody')
  306. zx_name.push(tbodyCon[j].坐席名称);
  307. huru.push(tbodyCon[j].呼入次数)
  308. huruTime.push(tbodyCon[j].呼入时长)
  309. huruAccess.push(tbodyCon[j].呼入未接通次数) //miaofuhao180517
  310. huchu.push(tbodyCon[j].呼出次数)
  311. huchuTime.push(tbodyCon[j].呼出时长)
  312. hcNo.push(tbodyCon[j].呼出未接通次数)
  313. zlTime.push(tbodyCon[j].振铃时长)
  314. allCall.push(tbodyCon[j].通话总时长)
  315. averange.push(tbodyCon[j].平均通话总时长)
  316. }
  317. }
  318. });
  319. // console.log(leg);
  320. // legend=leg;//图例
  321. zxn = zx_name;
  322. callIn = huru; //呼入次数
  323. callInTime = huruTime; //呼入时长
  324. callInAccess = huruAccess; //呼入未接通次数 miaofuhao180517
  325. callOut = huchu; //呼出次数
  326. callOutTime = huchuTime; //呼出时长
  327. hcNoCount = hcNo; //呼出未接通次数
  328. zhenLing = zlTime; //振铃时长
  329. total = allCall; //通话总时长
  330. pingjun = averange; //平均通话时长
  331. //console.log(zxn);
  332. option.xAxis[0].data = zxn;
  333. option.series[0].data = callIn;
  334. option.series[1].data = callInTime;
  335. option.series[2].data = callInAccess;
  336. option.series[3].data = callOut;
  337. option.series[4].data = callOutTime;
  338. option.series[5].data = hcNoCount;
  339. option.series[6].data = zhenLing;
  340. option.series[7].data = total;
  341. option.series[8].data = pingjun;
  342. }
  343. </script>
  344. </body>
  345. </html>