安图前端代码

callTime.html 9.6KB

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