暫無描述

callTime.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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. <!--[if lt IE 9]>
  10. <meta http-equiv="refresh" content="0;ie.html" />
  11. <![endif]-->
  12. <link href="../css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
  13. <link href="../css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
  14. <link href="../css/animate.min.css" rel="stylesheet">
  15. <link href="../css/style.min862f.css?v=4.1.0" rel="stylesheet">
  16. <link rel="stylesheet" href="../css/laydate/need/laydate.css" />
  17. <!--<link rel="stylesheet" href="./css/huTotal.css" />-->
  18. <link rel="stylesheet" href="../css/init.css" />
  19. <style>
  20. .clearfix:after {
  21. content: "";
  22. display: block;
  23. clear: both;
  24. }
  25. .th-top {
  26. background: #f3f3f4;
  27. height: 60px;
  28. padding: 10px 20px;
  29. }
  30. .topCon {
  31. float: right;
  32. margin-right: 45px;
  33. }
  34. .th-content h2 {
  35. font-size: 22px;
  36. /*margin-bottom: 20px;*/
  37. }
  38. .topCon input {
  39. width: 128px;
  40. padding: 2px 2PX 2PX 10PX;
  41. height: 28px;
  42. border: 1px solid #ebebeb;
  43. color: #1ab394;
  44. outline: none;
  45. vertical-align: middle;
  46. }
  47. .th-content {
  48. width: 90%;
  49. margin: 0 auto;
  50. }
  51. .th-table table thead tr td {
  52. background: #00a1cb;
  53. color: #fff;
  54. }
  55. .th-table {
  56. display: none;
  57. }
  58. #thead thead th {
  59. background: #00a0cd;
  60. color: #fff;
  61. }
  62. table thead,
  63. tbody tr {
  64. display: table;
  65. width: 100%;
  66. table-layout: fixed;
  67. }
  68. .table {
  69. margin-bottom: 0;
  70. }
  71. </style>
  72. </head>
  73. <body class="gray-bg" style="background: #fefefe;">
  74. <div class="thTime wrapper wrapper-content animated fadeInRight">
  75. <div class="daoHang clearfix">
  76. <div class="dhLeft">
  77. <sapn><i class="syIcon"></i>位置:
  78. <a id="ReIndex" href="javaScript:;">首页</a>&gt;
  79. <a href="javaScript:;">报表管理</a>&gt;
  80. <a href="" class="nowPosition">通话时长统计</a>
  81. </sapn>
  82. </div>
  83. <div class="dhRight">
  84. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  85. </div>
  86. </div>
  87. <div class="toolBar clearfix">
  88. <div class="toolRight">
  89. 开始时间:
  90. <input type="text" class="laydate-icon" id="startTime" /> 结束时间:
  91. <input type="text" class="laydate-icon" id="endTime" />
  92. <button class="btns sear">搜索</button>
  93. <a class="btns export">导出</a>
  94. </div>
  95. </div>
  96. <ul class="nav nav-tabs th-tab">
  97. <li role="presentation" class="active">
  98. <a href="javascript:;">图形</a>
  99. </li>
  100. <li role="presentation">
  101. <a href="javascript:;">表格</a>
  102. </li>
  103. </ul>
  104. <div class="th-content">
  105. <div class="th-tu" style="width: 100%;">
  106. <h2 style="text-align: center;">服务热线坐席通话时长统计</h2>
  107. <div id="tabtu" style="width: 100%; height: 600px;"></div>
  108. </div>
  109. <div class="th-table">
  110. <h2 style="text-align: center;">热线坐席通话时长统计</h2>
  111. <div style="width: 100%;padding: 10px;">
  112. <div class="table-head">
  113. <table id="thead" class="table table-hover table-striped table-bordered table-condensed">
  114. <colgroup>
  115. <col style="width: 80px;" />
  116. <col/>
  117. </colgroup>
  118. <thead>
  119. <tr>
  120. </tr>
  121. </thead>
  122. </table>
  123. </div>
  124. <div class="table-body">
  125. <table class="thTable table table-hover table-striped table-bordered table-condensed">
  126. <colgroup>
  127. <col style="width: 80px;" />
  128. <col/>
  129. </colgroup>
  130. <tbody>
  131. </tbody>
  132. </table>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <script src="../js/jquery.min.js?v=2.1.4"></script>
  139. <script src="../js/bootstrap.min.js?v=3.3.6"></script>
  140. <script src="../js/jquery.cookie.js"></script>
  141. <script src="../css/laydate/laydate.js"></script>
  142. <script src="../js/echarts.common.min.js"></script>
  143. <!--<script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>-->
  144. <script>
  145. $(function() {
  146. var token = $.cookie("token");
  147. laydate.skin('blue');
  148. laydate({
  149. elem: '#startTime',
  150. event: 'focus',
  151. format: 'YYYY-MM-DD', // 分隔符可以任意定义,该例子表示只显示年月
  152. // festival: true, //显示节日
  153. choose: function(datas) { //选择日期完毕的回调
  154. // alert('得到:'+datas);
  155. }
  156. });
  157. laydate({
  158. elem: '#endTime',
  159. event: 'focus',
  160. format: 'YYYY-MM-DD', // 分隔符可以任意定义,该例子表示只显示年月
  161. });
  162. var stime, //开始时间
  163. endtime, //结束时间
  164. aa = true,
  165. tabtu,
  166. legend = [], //图例
  167. zxn, //坐席名称
  168. callIn, //呼入次数
  169. callInTime, //呼入时长
  170. callOut, //呼出次数
  171. callOutTime, //呼出时长
  172. hcNoCount, //呼出未接通次数
  173. zhenLing, //振铃时长
  174. total, //通话总时长
  175. pingjun; //平均通话时长
  176. //tab切换
  177. $('.th-tab li').click(function() {
  178. $(this).addClass('active')
  179. .siblings().removeClass('active');
  180. var index = $(this).index();
  181. $('.th-content >div').eq(index).show()
  182. .siblings().hide();
  183. })
  184. $(document).ready(function() {
  185. //图形
  186. tabtu = echarts.init(document.getElementById('tabtu'));
  187. option = {
  188. tooltip: {
  189. trigger: 'axis',
  190. },
  191. legend: {
  192. data: legend,
  193. bottom: 0
  194. },
  195. xAxis: [{
  196. type: 'category',
  197. data: zxn,
  198. axisPointer: {
  199. type: ''
  200. },
  201. axisLabel: {
  202. interval: 0,
  203. //rotate: 40
  204. //formatter: function (value) {
  205. // return value.split("").join("\n");
  206. //}
  207. }
  208. }],
  209. dataZoom: {
  210. show: true,
  211. realtime: true,
  212. y: 36,
  213. height: 20,
  214. start: 43,
  215. end: 57
  216. },
  217. yAxis: [{
  218. type: 'value',
  219. name: '通话次数(通)',
  220. nameLocation: 'middle',
  221. nameGap: 50,
  222. // min: 0,
  223. // max:200,
  224. // interval: 20,
  225. axisLabel: {
  226. formatter: '{value} '
  227. }
  228. },
  229. {
  230. type: 'value',
  231. name: '通话时长(分)',
  232. nameLocation: 'middle',
  233. nameGap: 50,
  234. // min: 0,
  235. // max: 100000,
  236. // interval: 5000,
  237. axisLabel: {
  238. rotate: -50,
  239. formatter: '{value} '
  240. }
  241. }
  242. ],
  243. series: [{
  244. type: 'bar',
  245. name: '呼入次数',
  246. data: callIn
  247. }, {
  248. type: 'line',
  249. name: '呼入时长',
  250. yAxisIndex: 1,
  251. data: callInTime
  252. },
  253. {
  254. type: 'bar',
  255. name: '呼出次数',
  256. data: callOut
  257. }, {
  258. type: 'line',
  259. name: '呼出时长',
  260. yAxisIndex: 1,
  261. data: callOutTime
  262. }, {
  263. type: 'bar',
  264. name: '呼出未接通次数',
  265. data: hcNoCount
  266. }, {
  267. type: 'line',
  268. name: '振铃时长',
  269. yAxisIndex: 1,
  270. data: zhenLing
  271. },
  272. {
  273. type: 'line',
  274. name: '通话总时长',
  275. yAxisIndex: 1,
  276. data: total
  277. },
  278. {
  279. type: 'line',
  280. name: '平均通话时长',
  281. yAxisIndex: 1,
  282. data: pingjun
  283. }
  284. ],
  285. color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f', '#cddc39', '#ff5722', '#e91e63', '#673ab7']
  286. };
  287. Ajax();
  288. tabtu.setOption(option);
  289. })
  290. //表头数据
  291. var con;
  292. $.ajax({
  293. type: "get",
  294. url: huayi.config.callcenter_url + "TalkTime/GetColumnList",
  295. async: false,
  296. dataType: 'json',
  297. data: {
  298. token: token
  299. },
  300. success: function(res) {
  301. con = res.data;
  302. $('#thead thead tr').html('');
  303. for(var i = 0; i < con.length; i++) {
  304. $('<th>' + con[i] + '</th>').appendTo('#thead thead tr')
  305. }
  306. return con
  307. }
  308. });
  309. legend = con;
  310. //搜索事件
  311. $(".sear").click(function() {
  312. $('.thTable tbody').html('');
  313. stime = $("#startTime").val();
  314. endtime = $("#endTime").val();
  315. Ajax(stime, endtime);
  316. tabtu.setOption(option);
  317. });
  318. //导出功能
  319. $('.export').click(function() {
  320. dcexcel(this);
  321. })
  322. function dcexcel(obj) {
  323. var url = huayi.config.callcenter_url + "TalkTime/ExptList?token=" + $.cookie("token");
  324. url += "&stime=" + $("#startTime").val() + "&endtime=" + $("#endTime").val();
  325. obj.href = url;
  326. }
  327. //表格数据
  328. function Ajax(stime, endtime) {
  329. var zx_name = [],
  330. huru = [],
  331. huruTime = [],
  332. huchu = [],
  333. huchuTime = [],
  334. hcNo = [],
  335. zlTime = [],
  336. allCall = [],
  337. averange = [];
  338. $.ajax({
  339. type: 'get',
  340. url: huayi.config.callcenter_url + 'TalkTime/GetDataList',
  341. async: false,
  342. dataType: 'json',
  343. data: {
  344. token: token,
  345. stime: stime,
  346. endtime: endtime
  347. },
  348. success: function(data) {
  349. var tbodyCon = data.data;
  350. $('.thTable tbody').html('');
  351. for(var j = 0; j < tbodyCon.length; j++) {
  352. $('<tr><td>' + tbodyCon[j].坐席名称 + '</td><td>' + tbodyCon[j].呼入次数 + '</td><td>' + studyTime(tbodyCon[j].呼入时长) + '</td><td>' + tbodyCon[j].呼出次数 + '</td><td>' + studyTime(tbodyCon[j].呼出时长) + '</td><td>' + tbodyCon[j].呼出未接通次数 + '</td><td>' + studyTime(tbodyCon[j].振铃时长) + '</td><td>' + studyTime(tbodyCon[j].通话总时长) + '</td><td>' + studyTime(tbodyCon[j].平均通话总时长) + '</td></tr>').appendTo('.thTable tbody')
  353. zx_name.push(tbodyCon[j].坐席名称);
  354. huru.push(tbodyCon[j].呼入次数)
  355. huruTime.push(((tbodyCon[j].呼入时长 / 60).toFixed(2)) * 1)
  356. huchu.push(tbodyCon[j].呼出次数)
  357. huchuTime.push(((tbodyCon[j].呼出时长 / 60).toFixed(2)) * 1)
  358. hcNo.push(tbodyCon[j].呼出未接通次数)
  359. zlTime.push(((tbodyCon[j].振铃时长 / 60).toFixed(2)) * 1)
  360. allCall.push(((tbodyCon[j].通话总时长 / 60).toFixed(2)) * 1)
  361. averange.push(((tbodyCon[j].平均通话总时长 / 60).toFixed(2)) * 1)
  362. }
  363. }
  364. });
  365. // console.log(leg);
  366. // legend=leg;//图例
  367. zxn = zx_name;
  368. callIn = huru; //呼入次数
  369. callInTime = huruTime; //呼入时长
  370. callOut = huchu; //呼出次数
  371. callOutTime = huchuTime; //呼出时长
  372. hcNoCount = hcNo; //呼出未接通次数
  373. zhenLing = zlTime; //振铃时长
  374. total = allCall; //通话总时长
  375. pingjun = averange; //平均通话时长
  376. //console.log(zxn);
  377. option.xAxis[0].data = zxn;
  378. option.series[0].data = callIn;
  379. option.series[1].data = callInTime;
  380. option.series[2].data = callOut;
  381. option.series[3].data = callOutTime;
  382. option.series[4].data = hcNoCount;
  383. option.series[5].data = zhenLing;
  384. option.series[6].data = total;
  385. option.series[7].data = pingjun;
  386. }
  387. })
  388. var hour = 0,
  389. minute = 0,
  390. second = 0;
  391. function studyTime(t) {
  392. console.log(t)
  393. hour = Math.floor(t / 60 / 60);
  394. minute = Math.floor(t / 60 % 60);
  395. second = Math.floor(t % 60);
  396. if(hour < 10) {
  397. hour = "0" + hour;
  398. }
  399. if(minute < 10) {
  400. minute = "0" + minute;
  401. }
  402. if(second < 10) {
  403. second = "0" + second;
  404. }
  405. return hour + ":" + minute + ":" + second;
  406. }
  407. </script>
  408. </body>
  409. </html>