Geen omschrijving

jthusuan.html 12KB

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