12345市长热线标准版-前端

callTime.html 12KB

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