12345市长热线标准版-前端

jthusuan.html 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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: #00a1cb;
  55. color: #fff;
  56. }
  57. .th-table{
  58. display: none;
  59. }
  60. #thead thead th{
  61. background: #00a0cd;
  62. color: #fff;
  63. }
  64. table thead, tbody tr {
  65. display:table;
  66. width:100%;
  67. table-layout:fixed;
  68. }
  69. .table{
  70. margin-bottom: 0;
  71. }
  72. </style>
  73. </head>
  74. <body class="gray-bg" style="background: #fefefe;">
  75. <div class="husun wrapper wrapper-content animated fadeInRight">
  76. <div class="daoHang clearfix">
  77. <div class="dhLeft">
  78. <sapn><i class="syIcon"></i>位置:<a id="ReIndex" href="javaScript:;">首页</a>&gt;<a href="javaScript:;">报表管理</a>&gt;<a href="" class="nowPosition">接通呼损统计</a></sapn>
  79. </div>
  80. <div class="dhRight"><a href="" title="刷新"><i class="fa fa-refresh"></i></a></div>
  81. </div>
  82. <div class="toolBar clearfix">
  83. <div class="toolRight">
  84. 开始时间:
  85. <input type="text" class="laydate-icon" id="startTime"/>
  86. 结束时间:
  87. <input type="text" class="laydate-icon" id="endTime"/>
  88. <button class="btns sear">搜索</button>
  89. <a class="btns export">导出</a>
  90. </div>
  91. </div>
  92. <ul class="nav nav-tabs th-tab">
  93. <li role="presentation" class="active"><a href="javascript:;">图形</a></li>
  94. <li role="presentation"><a href="javascript:;">表格</a></li>
  95. </ul>
  96. <div class="th-content">
  97. <div class="th-tu">
  98. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  99. <div id="tabtu" style="width: 100%; height: 600px;"></div>
  100. </div>
  101. <div class="th-table">
  102. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  103. <div style="width: 100%;padding: 10px;">
  104. <div class="table-head">
  105. <table id="thead" class="table table-hover table-striped table-bordered table-condensed">
  106. <colgroup>
  107. <col style="width: 80px;"/>
  108. <col/>
  109. </colgroup>
  110. <thead>
  111. <tr>
  112. </tr>
  113. </thead>
  114. </table>
  115. </div>
  116. <div class="table-body">
  117. <table class="thTable table table-hover table-striped table-bordered table-condensed">
  118. <colgroup>
  119. <col style="width: 80px;"/>
  120. <col/>
  121. </colgroup>
  122. <tbody>
  123. </tbody>
  124. </table>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. <script src="../js/jquery.min.js?v=2.1.4"></script>
  131. <script src="../js/bootstrap.min.js?v=3.3.6"></script>
  132. <script src="../js/jquery.cookie.js"></script>
  133. <script src="../css/laydate/laydate.js"></script>
  134. <script src="../js/echarts.common.min.js"></script>
  135. <script>
  136. $(function(){
  137. //返回首页
  138. $('#ReIndex').click(function(){
  139. top.home_index();
  140. })
  141. var token = $.cookie("token");
  142. var stime,//开始时间
  143. endtime,//结束时间
  144. tabtu,
  145. xzhou,
  146. jtCount,//接通次数
  147. hsCount,//呼损次数
  148. jtPercent,//接通率
  149. hsPercent;//呼损率
  150. laydate.skin('blue');
  151. laydate({
  152. elem: '#startTime',
  153. event: 'focus',
  154. format: 'YYYY-MM-DD', // 分隔符可以任意定义,该例子表示只显示年月
  155. // festival: true, //显示节日
  156. });
  157. laydate({
  158. elem: '#endTime',
  159. event: 'focus',
  160. format: 'YYYY-MM-DD', // 分隔符可以任意定义,该例子表示只显示年月
  161. // festival: true, //显示节日
  162. });
  163. //tab切换
  164. $('.th-tab li').click(function(){
  165. $(this).addClass('active')
  166. .siblings().removeClass('active');
  167. var index=$(this).index();
  168. $('.th-content >div').eq(index).show()
  169. .siblings().hide();
  170. })
  171. $(document).ready(function(){
  172. //图形
  173. tabtu = echarts.init(document.getElementById('tabtu'));
  174. option = {
  175. tooltip: {
  176. trigger: 'axis',
  177. },
  178. legend: {
  179. data: ['接通次数', '呼损次数', '接通率', '呼损率'],
  180. bottom: 0
  181. },
  182. xAxis: [{
  183. type: 'category',
  184. data: xzhou,
  185. axisPointer: {
  186. type: ''
  187. },
  188. axisLabel:{
  189. rotate: 30,
  190. interval:0
  191. }
  192. }],
  193. yAxis: [{
  194. type: 'value',
  195. name: '通话次数(通)',
  196. nameLocation:'middle',
  197. nameGap:40,
  198. min: 0,
  199. max:500,
  200. interval: 50,
  201. axisLabel: {
  202. formatter: '{value} '
  203. }
  204. },
  205. {
  206. type: 'value',
  207. name: '百分比(%)',
  208. nameLocation:'middle',
  209. nameGap:35,
  210. min: 0,
  211. max: 100,
  212. interval: 10,
  213. axisLabel: {
  214. formatter: '{value} '
  215. }
  216. }
  217. ],
  218. series: [{
  219. type: 'bar',
  220. name: '接通次数',
  221. data: jtCount
  222. },
  223. {
  224. type: 'bar',
  225. name: '呼损次数',
  226. data: hsCount
  227. },
  228. {
  229. type: 'line',
  230. name: '接通率',
  231. data: jtPercent,
  232. yAxisIndex: 1,
  233. },
  234. {
  235. type: 'line',
  236. name: '呼损率',
  237. data: hsPercent,
  238. yAxisIndex: 1,
  239. }
  240. ],
  241. color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f']
  242. };
  243. Ajax();
  244. tabtu.setOption(option);
  245. })
  246. //表头数据
  247. $.ajax({
  248. type:"get",
  249. url:huayi.config.callcenter_url+"SwitchedlossCall/GetColumnList",
  250. async:true,
  251. dataType:'json',
  252. data:{
  253. token:token
  254. },
  255. success:function(res){
  256. var con=res.data;
  257. console.log(con);
  258. for(var i=0;i<con.length;i++){
  259. $('<th>' + con[i]+ '</th>').appendTo('#thead thead tr')
  260. }
  261. }
  262. });
  263. //搜索事件
  264. $(".sear").click(function(){
  265. $('.thTable tbody').html('');
  266. stime=$("#startTime").val();
  267. endtime=$("#endTime").val();
  268. Ajax(stime,endtime);
  269. tabtu.setOption(option);
  270. });
  271. //导出
  272. $('.export').click(function() {
  273. dcexcel(this);
  274. })
  275. function dcexcel(obj) {
  276. var url = huayi.config.callcenter_url + "SwitchedlossCall/ExptList?token=" + $.cookie("token");
  277. url += "&stime=" + $("#startTime").val() + "&endtime=" + $("#endTime").val();
  278. obj.href = url;
  279. }
  280. //表格数据
  281. function Ajax(stime,endtime){
  282. var jtshu=[],
  283. hsshu=[],
  284. jtlv=[],
  285. hslv=[],
  286. riqi=[];
  287. $.ajax({
  288. type:'get',
  289. url:huayi.config.callcenter_url+'SwitchedlossCall/GetDataList',
  290. async:false,
  291. dataType:'json',
  292. data:{
  293. token:token,
  294. stime:stime,
  295. endtime:endtime
  296. },
  297. success:function(data) {
  298. var tbodyCon=data.data;
  299. console.log(tbodyCon);
  300. for(var j=0;j<tbodyCon.length;j++){
  301. $('<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');
  302. riqi.push(tbodyCon[j].日期)
  303. jtshu.push(tbodyCon[j].接通次数);
  304. hsshu.push(tbodyCon[j].呼损次数);
  305. jtlv.push(tbodyCon[j].接通率);
  306. hslv.push(tbodyCon[j].呼损率);
  307. }
  308. }
  309. });
  310. xzhou=riqi;
  311. jtCount=jtshu;
  312. hsCount=hsshu;
  313. jtPercent=jtlv;
  314. hsPercent=hslv;
  315. console.log(xzhou);
  316. option.xAxis[0].data=xzhou;
  317. option.series[0].data=jtCount;
  318. option.series[1].data=hsCount;
  319. option.series[2].data=jtPercent;
  320. option.series[3].data=hsPercent;
  321. }
  322. })
  323. </script>
  324. </body>
  325. </html>