PingAnYeXianSZCG_Web 前端代码

callTime.html 10KB

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