12345市长热线标准版-前端

callTime.html 11KB

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