PingAnYeXianSZCG_Web 前端代码

jthusuan.html 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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/init.css" />
  18. <style>
  19. .clearfix:after {
  20. content: "";
  21. display: block;
  22. clear: both;
  23. }
  24. .husun{
  25. font-size: 12px;
  26. }
  27. .th-top{
  28. background: #f3f3f4;
  29. height: 60px;
  30. padding: 10px 20px;
  31. }
  32. .topCon{
  33. float: right;
  34. margin-right: 45px;
  35. }
  36. .th-content h2{
  37. font-size: 18px;
  38. margin-bottom: 20px;
  39. }
  40. .topCon input{
  41. width: 128px;
  42. padding: 2px 2PX 2PX 10PX;
  43. height: 28px;
  44. border: 1px solid #ebebeb;
  45. color: #1ab394;
  46. outline: none;
  47. vertical-align: middle;
  48. }
  49. .th-content{
  50. width: 90%;
  51. margin: 0 auto;
  52. }
  53. .th-table table thead tr td {
  54. background: #1ab394;
  55. color: #fff;
  56. }
  57. .th-table{
  58. display: none;
  59. }
  60. </style>
  61. </head>
  62. <body class="gray-bg" style="background: #fefefe;">
  63. <div class="husun">
  64. <div class="daoHang clearfix">
  65. <div class="dhLeft">
  66. <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>
  67. </div>
  68. </div>
  69. <div class="th-top clearfix">
  70. <div class="topCon">
  71. 开始时间:
  72. <input type="text" class="laydate-icon" id="startTime"/>
  73. 结束时间:
  74. <input type="text" class="laydate-icon" id="endTime"/>
  75. <button class="btns sear">搜索</button>
  76. <a class="btns export">导出</a>
  77. </div>
  78. </div>
  79. <ul class="nav nav-tabs th-tab">
  80. <li role="presentation" class="active"><a href="javascript:;">图形</a></li>
  81. <li role="presentation"><a href="javascript:;">表格</a></li>
  82. </ul>
  83. <div class="th-content">
  84. <div class="th-tu">
  85. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  86. <div id="tabtu" style="width: 100%; height: 600px;"></div>
  87. </div>
  88. <div class="th-table">
  89. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  90. <table class="table table-bordered text-center table-hover thTable" style="width: 100%;">
  91. <thead>
  92. <tr>
  93. </tr>
  94. </thead>
  95. <tbody class="tbody">
  96. </tbody>
  97. </table>
  98. </div>
  99. </div>
  100. </div>
  101. <script src="./js/jquery.min.js?v=2.1.4"></script>
  102. <script src="./js/bootstrap.min.js?v=3.3.6"></script>
  103. <script src="./js/jquery.cookie.js"></script>
  104. <script src="./css/laydate/laydate.js"></script>
  105. <script src="./js/echarts.common.min.js"></script>
  106. <script>
  107. $(function(){
  108. var token = $.cookie("token");
  109. var stime,//开始时间
  110. endtime,//结束时间
  111. tabtu,
  112. xzhou,
  113. jtCount,//接通次数
  114. hsCount,//呼损次数
  115. jtPercent,//接通率
  116. hsPercent;//呼损率
  117. laydate.skin('molv');
  118. laydate({
  119. elem: '#startTime',
  120. event: 'focus',
  121. format: 'YYYY-MM-DD', // 分隔符可以任意定义,该例子表示只显示年月
  122. // festival: true, //显示节日
  123. });
  124. laydate({
  125. elem: '#endTime',
  126. event: 'focus',
  127. format: 'YYYY-MM-DD', // 分隔符可以任意定义,该例子表示只显示年月
  128. // festival: true, //显示节日
  129. });
  130. //tab切换
  131. $('.th-tab li').click(function(){
  132. $(this).addClass('active')
  133. .siblings().removeClass('active');
  134. var index=$(this).index();
  135. $('.th-content >div').eq(index).show()
  136. .siblings().hide();
  137. })
  138. $(document).ready(function(){
  139. //图形
  140. tabtu = echarts.init(document.getElementById('tabtu'));
  141. option = {
  142. tooltip: {
  143. trigger: 'axis',
  144. },
  145. legend: {
  146. data: ['接通次数', '呼损次数', '接通率', '呼损率'],
  147. bottom: 0
  148. },
  149. xAxis: [{
  150. type: 'category',
  151. data: xzhou,
  152. axisPointer: {
  153. type: ''
  154. },
  155. axisLabel:{
  156. rotate: 30,
  157. interval:0
  158. }
  159. }],
  160. yAxis: [{
  161. type: 'value',
  162. name: '通话次数(通)',
  163. nameLocation:'middle',
  164. nameGap:40,
  165. // min: 0,
  166. // max:300,
  167. interval: 50,
  168. axisLabel: {
  169. formatter: '{value} '
  170. }
  171. },
  172. {
  173. type: 'value',
  174. name: '百分比(%)',
  175. nameLocation:'middle',
  176. nameGap:35,
  177. min: 0,
  178. max: 100,
  179. interval: 10,
  180. axisLabel: {
  181. formatter: '{value} '
  182. }
  183. }
  184. ],
  185. series: [{
  186. type: 'bar',
  187. name: '接通次数',
  188. data: jtCount
  189. },
  190. {
  191. type: 'bar',
  192. name: '呼损次数',
  193. data: hsCount
  194. },
  195. {
  196. type: 'line',
  197. name: '接通率',
  198. data: jtPercent,
  199. yAxisIndex: 1,
  200. },
  201. {
  202. type: 'line',
  203. name: '呼损率',
  204. data: hsPercent,
  205. yAxisIndex: 1,
  206. }
  207. ],
  208. color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f']
  209. };
  210. Ajax();
  211. tabtu.setOption(option);
  212. })
  213. //表头数据
  214. $.ajax({
  215. type:"get",
  216. url:huayi.config.callcenter_url+"SwitchedlossCall/GetColumnList",
  217. async:true,
  218. dataType:'json',
  219. data:{
  220. token:token
  221. },
  222. success:function(res){
  223. var con=res.data;
  224. console.log(con);
  225. for(var i=0;i<con.length;i++){
  226. $('<td>' + con[i]+ '</td>').appendTo('.thTable thead tr')
  227. }
  228. }
  229. });
  230. //搜索事件
  231. $(".sear").click(function(){
  232. $('.thTable tbody').html('');
  233. stime=$("#startTime").val();
  234. endtime=$("#endTime").val();
  235. Ajax(stime,endtime);
  236. tabtu.setOption(option);
  237. });
  238. //导出
  239. $('.export').click(function() {
  240. dcexcel(this);
  241. })
  242. function dcexcel(obj) {
  243. var url = huayi.config.callcenter_url + "SwitchedlossCall/ExptList?token=" + $.cookie("token");
  244. url += "&stime=" + $("#startTime").val() + "&endtime=" + $("#endTime").val();
  245. obj.href = url;
  246. }
  247. //表格数据
  248. function Ajax(stime,endtime){
  249. var jtshu=[],
  250. hsshu=[],
  251. jtlv=[],
  252. hslv=[],
  253. riqi=[];
  254. $.ajax({
  255. type:'get',
  256. url:huayi.config.callcenter_url+'SwitchedlossCall/GetDataList',
  257. async:false,
  258. dataType:'json',
  259. data:{
  260. token:token,
  261. stime:stime,
  262. endtime:endtime
  263. },
  264. success:function(data) {
  265. var tbodyCon=data.data;
  266. console.log(tbodyCon);
  267. for(var j=0;j<tbodyCon.length;j++){
  268. $('<tr><td>' + tbodyCon[j].日期+ '</td><td>' + tbodyCon[j].接通次数+ '</td><td>' + tbodyCon[j].呼损次数+ '</td><td>' + tbodyCon[j].接通率+ '</td><td>' + tbodyCon[j].呼损率+ '</td></tr>').appendTo('.thTable tbody');
  269. riqi.push(tbodyCon[j].日期)
  270. jtshu.push(tbodyCon[j].坐席名称);
  271. hsshu.push(tbodyCon[j].呼入次数);
  272. jtlv.push(tbodyCon[j].呼出次数);
  273. hslv.push(tbodyCon[j].通话总时长);
  274. }
  275. }
  276. });
  277. xzhou=riqi;
  278. jtCount=jtshu;
  279. hsCount=hsshu;
  280. jtPercent=jtlv;
  281. hsPercent=hslv;
  282. console.log(xzhou);
  283. option.xAxis[0].data=xzhou;
  284. option.series[0].data=jtCount;
  285. option.series[1].data=hsCount;
  286. option.series[2].data=jtPercent;
  287. option.series[3].data=hsPercent;
  288. }
  289. })
  290. </script>
  291. </body>
  292. </html>