Keine Beschreibung

jthusuan.html 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. <link rel="stylesheet" href="../css/init.css" />
  10. <style>
  11. .husun {
  12. font-size: 12px;
  13. }
  14. .th-top {
  15. background: #f3f3f4;
  16. padding: 10px 20px;
  17. }
  18. .topCon {
  19. float: right;
  20. margin-right: 45px;
  21. }
  22. .th-content h2 {
  23. font-size: 18px;
  24. margin-bottom: 20px;
  25. }
  26. .th-content {
  27. width: 90%;
  28. margin: 0 auto;
  29. }
  30. .th-table table thead tr td {
  31. background: #1ab394;
  32. color: #fff;
  33. }
  34. .th-table {
  35. display: none;
  36. }
  37. </style>
  38. </head>
  39. <body class="gray-bg">
  40. <div class="husun">
  41. <div class="daoHang clearfix">
  42. <div class="dhLeft">
  43. <sapn><i class="syIcon"></i>位置:
  44. <a id="ReIndex" href="javaScript:;">首页</a>&gt;
  45. <a href="javaScript:;">报表分析</a>&gt;
  46. <a href="javaScript:;">话务运营分析</a>&gt;
  47. <a href="" style="color: #000;">接通呼损统计</a>
  48. </sapn>
  49. </div>
  50. </div>
  51. <div class="th-top clearfix form-inline">
  52. <div class="topCon">
  53. 选择日期:
  54. <input type="text" class="form-control" id="startTime" />
  55. <button class="btns sear">搜索</button>
  56. <a class="btns export">导出</a>
  57. </div>
  58. </div>
  59. <ul class="nav nav-tabs th-tab">
  60. <li role="presentation" class="active">
  61. <a href="javascript:;">图形</a>
  62. </li>
  63. <li role="presentation">
  64. <a href="javascript:;">表格</a>
  65. </li>
  66. </ul>
  67. <div class="th-content">
  68. <div class="th-tu">
  69. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  70. <div id="tabtu" style="width: 100%; height: 600px;"></div>
  71. </div>
  72. <div class="th-table">
  73. <h2 style="text-align: center;">服务热线-接通率和呼损率统计</h2>
  74. <table class="table table-bordered text-center table-hover thTable" style="width: 100%;">
  75. <thead>
  76. <tr>
  77. </tr>
  78. </thead>
  79. <tbody class="tbody">
  80. </tbody>
  81. </table>
  82. </div>
  83. </div>
  84. </div>
  85. <script src="../js/laydate/laydate.js"></script>
  86. <script src="../js/echarts.common.min.js"></script>
  87. <script>
  88. var token = $.cookie("token");
  89. var myChartp;
  90. var endtime = helper.DateFormat.getNowDate(); //结束时间
  91. var stime = helper.DateFormat.getPreMonth(endtime); //开始时间
  92. $(document).ready(function() {
  93. laydate.render({
  94. elem: '#startTime',
  95. range: '~',
  96. value: stime + ' ~ ' + endtime,
  97. theme: '#1ab394',
  98. calendar: 'true',
  99. });
  100. //tab切换
  101. $('.th-tab li').click(function() {
  102. $(this).addClass('active')
  103. .siblings().removeClass('active');
  104. var index = $(this).index();
  105. $('.th-content >div').eq(index).show()
  106. .siblings().hide();
  107. });
  108. //搜索事件
  109. $(".sear").click(function() {
  110. getDataLists();
  111. });
  112. //导出功能
  113. $('.export').click(function() {
  114. dcexcel(this);
  115. });
  116. myChartp = echarts.init(document.getElementById('tabtu'));
  117. myChartp.clear();
  118. myChartp.showLoading();
  119. option = {
  120. tooltip: {
  121. trigger: 'axis',
  122. },
  123. legend: {
  124. data: ['接通次数', '呼损次数', '接通率', '呼损率'],
  125. bottom: 0
  126. },
  127. xAxis: [{
  128. type: 'category',
  129. data: [],
  130. axisPointer: {
  131. type: ''
  132. },
  133. axisLabel: {
  134. rotate: 30,
  135. interval: 0
  136. }
  137. }],
  138. yAxis: [{
  139. type: 'value',
  140. name: '通话次数(通)',
  141. nameLocation: 'end',
  142. nameGap: 40,
  143. // min: 0,
  144. // max:300,
  145. interval: 50,
  146. axisLabel: {
  147. formatter: '{value} '
  148. }
  149. },
  150. {
  151. type: 'value',
  152. name: '百分比(%)',
  153. nameLocation: 'end',
  154. nameGap: 35,
  155. min: 0,
  156. max: 100,
  157. interval: 10,
  158. axisLabel: {
  159. formatter: '{value} '
  160. }
  161. }
  162. ],
  163. series: [{
  164. type: 'bar',
  165. name: '接通次数',
  166. data: []
  167. },
  168. {
  169. type: 'bar',
  170. name: '呼损次数',
  171. data: []
  172. },
  173. {
  174. type: 'line',
  175. name: '接通率',
  176. data: [],
  177. yAxisIndex: 1,
  178. },
  179. {
  180. type: 'line',
  181. name: '呼损率',
  182. data: [],
  183. yAxisIndex: 1,
  184. }
  185. ],
  186. color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f']
  187. }
  188. // 使用刚指定的配置项和数据显示图表。
  189. myChartp.setOption(option);
  190. getDataLists(); //加载数据
  191. getColumnList(); //获取表格
  192. });
  193. //获取数据
  194. function getDataLists() {
  195. $.ajax({
  196. type: "get",
  197. url: huayi.config.callcenter_url + "SwitchedlossCall/GetDataList",
  198. async: true,
  199. dataType: 'json',
  200. data: {
  201. token: token,
  202. stime: $('#startTime').val() && $('#startTime').val().split('~')[0],
  203. endtime: $('#startTime').val() && $('#startTime').val().split('~')[1]
  204. },
  205. success: function(data) {
  206. }
  207. })
  208. .then(function(data) {
  209. $('.thTable tbody').html('');
  210. myChartp.hideLoading();
  211. if(data.state.toLowerCase() == "success") {
  212. var tbodyCon = data.data;
  213. // 填入数据
  214. if(tbodyCon) {
  215. myChartp.setOption({
  216. xAxis: {
  217. data: (function() {
  218. var res = [];
  219. for(var i = 0; i < tbodyCon.length; i++) {
  220. res.push(tbodyCon[i].日期);
  221. }
  222. return res;
  223. })(),
  224. },
  225. series: (function() {
  226. var sres = [],
  227. sres1 = [],
  228. sres2 = [],
  229. sres3 = [];
  230. var sobj = [{
  231. data: sres,
  232. },
  233. {
  234. data: sres1,
  235. },
  236. {
  237. data: sres2,
  238. },
  239. {
  240. data: sres3,
  241. },
  242. ];
  243. for(var i = 0; i < tbodyCon.length; i++) {
  244. sres.push(tbodyCon[i].接通次数);
  245. sres1.push(tbodyCon[i].呼损次数);
  246. sres2.push(tbodyCon[i].接通率);
  247. sres3.push(tbodyCon[i].呼损率);
  248. }
  249. return sobj;
  250. })(),
  251. });
  252. //填充表格数据
  253. for(var j = 0; j < tbodyCon.length; j++) {
  254. $('<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');
  255. }
  256. } else {
  257. $('#tabtu').html('<p class="text-center">暂无数据</p>');
  258. $('.thTable tbody').html('<td colspan="9">没有找到您想要的记录呢!我会努力的...</td>');
  259. }
  260. } else {
  261. $('#tabtu').html('<p class="text-center">暂无数据</p>');
  262. $('.thTable tbody').html('<td colspan="9">没有找到您想要的记录呢!我会努力的...</td>');
  263. }
  264. });
  265. }
  266. //获取表头数据
  267. function getColumnList() {
  268. $.ajax({
  269. type: "get",
  270. url: huayi.config.callcenter_url + "SwitchedlossCall/GetColumnList",
  271. async: true,
  272. dataType: 'json',
  273. data: {
  274. token: token
  275. },
  276. success: function(res) {
  277. }
  278. })
  279. .then(function(data) {
  280. $('.thTable thead tr').html('');
  281. if(data.state.toLowerCase() == "success") {
  282. var con = data.data;
  283. if(con) {
  284. for(var i = 0; i < con.length; i++) {
  285. $('<td>' + con[i] + '</td>').appendTo('.thTable thead tr');
  286. }
  287. } else {
  288. $('<td colspan="9">暂无表头数据</td>').appendTo('.thTable thead tr')
  289. }
  290. } else {
  291. $('<td colspan="9">暂无表头数据</td>').appendTo('.thTable thead tr')
  292. }
  293. });
  294. }
  295. //导出
  296. function dcexcel(obj) {
  297. var url = huayi.config.callcenter_url + "SwitchedlossCall/ExptList?token=" + token;
  298. url += "&stime=" + stime + "&endtime=" + endtime;
  299. obj.href = url;
  300. }
  301. </script>
  302. </body>
  303. </html>