Нет описания

jthusuan.html 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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. stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0];
  111. endtime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1];
  112. getDataLists();
  113. });
  114. //导出功能
  115. $('.export').click(function() {
  116. dcexcel(this);
  117. });
  118. myChartp = echarts.init(document.getElementById('tabtu'));
  119. myChartp.clear();
  120. myChartp.showLoading();
  121. option = {
  122. tooltip: {
  123. trigger: 'axis',
  124. },
  125. legend: {
  126. data: ['接通次数', '呼损次数', '接通率', '呼损率'],
  127. bottom: 0
  128. },
  129. xAxis: [{
  130. type: 'category',
  131. data: [],
  132. axisPointer: {
  133. type: ''
  134. },
  135. axisLabel: {
  136. rotate: 30,
  137. interval: 0
  138. }
  139. }],
  140. yAxis: [{
  141. type: 'value',
  142. name: '通话次数(次)',
  143. nameLocation: 'end',
  144. nameGap: 40,
  145. // min: 0,
  146. // max:300,
  147. interval: 50,
  148. axisLabel: {
  149. formatter: '{value} '
  150. }
  151. },
  152. {
  153. type: 'value',
  154. name: '百分比(%)',
  155. nameLocation: 'end',
  156. nameGap: 35,
  157. min: 0,
  158. max: 100,
  159. interval: 10,
  160. axisLabel: {
  161. formatter: '{value} '
  162. }
  163. }
  164. ],
  165. series: [{
  166. type: 'bar',
  167. name: '接通次数',
  168. data: []
  169. },
  170. {
  171. type: 'bar',
  172. name: '呼损次数',
  173. data: []
  174. },
  175. {
  176. type: 'line',
  177. name: '接通率',
  178. data: [],
  179. yAxisIndex: 1,
  180. },
  181. {
  182. type: 'line',
  183. name: '呼损率',
  184. data: [],
  185. yAxisIndex: 1,
  186. }
  187. ],
  188. color: ['#1ab394', '#fbbe5b', '#88ebc4', '#fa957f']
  189. }
  190. // 使用刚指定的配置项和数据显示图表。
  191. myChartp.setOption(option);
  192. getDataLists(); //加载数据
  193. getColumnList(); //获取表格头部
  194. });
  195. //获取数据
  196. function getDataLists() {
  197. $.ajax({
  198. type: "get",
  199. url: huayi.config.callcenter_url + "SwitchedlossCall/GetDataList",
  200. async: true,
  201. dataType: 'json',
  202. data: {
  203. stime: stime,
  204. endtime: endtime,
  205. token: token,
  206. },
  207. success: function(data) {
  208. }
  209. })
  210. .then(function(data) {
  211. $('.thTable tbody').html('');
  212. myChartp.hideLoading();
  213. if(data.state.toLowerCase() == "success") {
  214. var tbodyCon = data.data;
  215. //排序
  216. tbodyCon.sort(compare("日期"));
  217. // 填入数据
  218. if(tbodyCon) {
  219. myChartp.setOption({
  220. xAxis: {
  221. data: (function() {
  222. var res = [];
  223. for(var i = 0; i < tbodyCon.length; i++) {
  224. res.push(tbodyCon[i].日期);
  225. }
  226. return res;
  227. })(),
  228. },
  229. series: (function() {
  230. var sres = [],
  231. sres1 = [],
  232. sres2 = [],
  233. sres3 = [];
  234. var sobj = [{
  235. data: sres,
  236. },
  237. {
  238. data: sres1,
  239. },
  240. {
  241. data: sres2,
  242. },
  243. {
  244. data: sres3,
  245. },
  246. ];
  247. for(var i = 0; i < tbodyCon.length; i++) {
  248. sres.push(tbodyCon[i].接通次数);
  249. sres1.push(tbodyCon[i].呼损次数);
  250. sres2.push(tbodyCon[i].接通率);
  251. sres3.push(tbodyCon[i].呼损率);
  252. }
  253. return sobj;
  254. })(),
  255. });
  256. //填充表格数据
  257. for(var j = 0; j < tbodyCon.length; j++) {
  258. $('<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');
  259. }
  260. } else {
  261. $('#tabtu').html('<p class="text-center">暂无数据</p>');
  262. $('.thTable tbody').html('<td colspan="5">没有找到您想要的记录呢!我会努力的...</td>');
  263. }
  264. } else {
  265. $('#tabtu').html('<p class="text-center">暂无数据</p>');
  266. $('.thTable tbody').html('<td colspan="5">没有找到您想要的记录呢!我会努力的...</td>');
  267. }
  268. });
  269. }
  270. //获取表头数据
  271. function getColumnList() {
  272. $.ajax({
  273. type: "get",
  274. url: huayi.config.callcenter_url + "SwitchedlossCall/GetColumnList",
  275. async: true,
  276. dataType: 'json',
  277. data: {
  278. token: token
  279. },
  280. success: function(res) {
  281. }
  282. })
  283. .then(function(data) {
  284. $('.thTable thead tr').html('');
  285. if(data.state.toLowerCase() == "success") {
  286. var con = data.data;
  287. if(con) {
  288. for(var i = 0; i < con.length; i++) {
  289. $('<td>' + con[i] + '</td>').appendTo('.thTable thead tr');
  290. }
  291. } else {
  292. $('<td colspan="5">暂无表头数据</td>').appendTo('.thTable thead tr')
  293. }
  294. } else {
  295. $('<td colspan="5">暂无表头数据</td>').appendTo('.thTable thead tr')
  296. }
  297. });
  298. }
  299. //导出
  300. function dcexcel(obj) {
  301. var url = huayi.config.callcenter_url + "SwitchedlossCall/ExptList?token=" + token;
  302. url += "&stime=" + stime + "&endtime=" + endtime;
  303. obj.href = url;
  304. }
  305. //定义一个比较器
  306. function compare(propertyName) {
  307. return function(object1, object2) {
  308. var value1 = object1[propertyName];
  309. var value2 = object2[propertyName];
  310. if(value2 < value1) {
  311. return 1;
  312. } else if(value2 > value1) {
  313. return -1;
  314. } else {
  315. return 0;
  316. }
  317. }
  318. }
  319. </script>
  320. </body>
  321. </html>