安图前端代码

ShuJuDuiBi.html 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 rel="stylesheet" href="./css/init.css" />
  13. <style type="text/css">
  14. .shuju-top {
  15. font-size: 12px;
  16. }
  17. .shuju-top {
  18. background: #f3f3f4;
  19. height: 60px;
  20. padding: 10px 20px;
  21. }
  22. .shuju-top .topCon select {
  23. padding: 2px;
  24. height: 28px;
  25. border: 1px solid #ebebeb;
  26. color: #1ab394;
  27. outline: none;
  28. vertical-align: middle;
  29. }
  30. .topCon {
  31. float: right;
  32. margin-right: 20px;
  33. }
  34. .shuju-con {
  35. width: 90%;
  36. height: 600px;
  37. margin: 20px auto;
  38. }
  39. </style>
  40. </head>
  41. <body class="gray-bg" style="background: #fefefe;">
  42. <div class="daoHang clearfix">
  43. <div class="dhLeft">
  44. <sapn><i class="syIcon"></i>位置:
  45. <a id="ReIndex" href="javaScript:;">首页</a>&gt;
  46. <a href="javaScript:;">报表分析</a>&gt;
  47. <a href="javaScript:;">话务运营分析</a>&gt;
  48. <a href="" class="nowPosition">总呼数据图形分析</a>
  49. </sapn>
  50. </div>
  51. <div class="dhRight">
  52. <a href="#" title="刷新"><i class="fa fa-refresh"></i></a>
  53. </div>
  54. </div>
  55. <div class="shuju-top">
  56. <div class="topCon">
  57. <div class="form-inline th-bar clearfix">
  58. <div class="time-box form-group">
  59. <i class="tub fa fa-calendar"></i>
  60. <input class="form-control" type="text" id="chooseTime" placeholder="选择时间">
  61. </div>
  62. <div class="form-group tool_bars pull-right">
  63. <button class="btns sear">搜索</button>
  64. <a class="btns export">导出</a>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="shuju-con">
  70. <h2 style="text-align: center;font-size: 18px;">呼叫数据对比</h2>
  71. <div id="hjCompaer" style="height: 100%;width: 100%;"></div>
  72. </div>
  73. <script src="./js/laydate/laydate.js"></script>
  74. <script src="./js/echarts.common.min.js"></script>
  75. <script>
  76. $(function() {
  77. var token = $.cookie("token");
  78. var beginyear, //开始年份
  79. endyear, //结束年份
  80. hjCompaer, //图形
  81. legendCon; //图形legend
  82. $(document).ready(function() {
  83. laydate.render({
  84. elem: '#chooseTime',
  85. format: 'yyyy',
  86. range: "~",
  87. type: 'year',
  88. theme: '#1ab394',
  89. });
  90. // Ajax()
  91. hjCompaer = echarts.init(document.getElementById('hjCompaer'));
  92. option = {
  93. tooltip: {
  94. trigger: 'axis',
  95. },
  96. legend: {
  97. data: legendCon,
  98. bottom: 0
  99. },
  100. xAxis: [{
  101. type: 'category',
  102. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  103. axisPointer: {
  104. type: ''
  105. }
  106. }],
  107. yAxis: [{
  108. type: 'value',
  109. name: '电话数量',
  110. nameLocation: 'end',
  111. nameGap: 40,
  112. axisLabel: {
  113. formatter: '{value} '
  114. }
  115. }, {
  116. type: 'value',
  117. name: '百分比',
  118. nameLocation: 'end',
  119. nameGap: 35,
  120. interval: 10,
  121. axisLabel: {
  122. formatter: '{value} '
  123. }
  124. }],
  125. series: [{
  126. name: '',
  127. type: 'bar',
  128. data: []
  129. }, {
  130. name: '',
  131. type: 'bar',
  132. data: []
  133. }, {
  134. name: '',
  135. type: 'line',
  136. data: []
  137. }, {
  138. name: '',
  139. type: 'bar',
  140. data: []
  141. }, {
  142. name: '',
  143. type: 'bar',
  144. yAxisIndex: 1,
  145. data: []
  146. }, {
  147. name: '',
  148. type: 'line',
  149. yAxisIndex: 1,
  150. data: []
  151. }],
  152. color: ['#1ab394', '#adcbfd', '#fbbe5b', '#f26ea2', '#88ebc4', '#fa957f']
  153. };
  154. hjCompaer.setOption(option);
  155. });
  156. //搜索事件
  157. $(".sear").click(function() {
  158. if($('#chooseTime').val() == '') {
  159. layer.confirm('请选择时间!', {
  160. btn: ['确定']
  161. });
  162. return;
  163. }
  164. var a = $('#chooseTime').val() && $('#chooseTime').val().split('~')[0];
  165. console.log(a);
  166. Ajax();
  167. hjCompaer.setOption(option);
  168. });
  169. function Ajax() {
  170. var arr = [];
  171. var allData = [];
  172. // var a=$('#chooseTime').val() && $('#chooseTime').val().split('~')[0];
  173. // var a=$('#chooseTime').val() && $('#chooseTime').val().split('~')[0];
  174. $.ajax({
  175. type: 'get',
  176. url: huayi.config.callcenter_url + 'YearContrast/GetDataList',
  177. dataType: 'json',
  178. data: {
  179. token: token,
  180. beginyear: $('#chooseTime').val() && $('#chooseTime').val().split('~')[0].replace(/(^\s*)|(\s*$)/g, ""),
  181. endyear: $('#chooseTime').val() && $('#chooseTime').val().split('~')[1].replace(/(^\s*)|(\s*$)/g, "")
  182. },
  183. async: false,
  184. success: function(res) {
  185. var content = res.data;
  186. $.each(content, function(index, ele) {
  187. arr.push(content[index].key);
  188. allData.push(content[index].value) //console.log(allData);
  189. });
  190. }
  191. });
  192. //console.log(legendCon);
  193. option.legend.data = arr; //图例
  194. option.series[0].name = arr[0]; //图例
  195. //添加数据name
  196. for(var i = 0; i < arr.length; i++) {
  197. option.series[i].name = arr[i];
  198. }
  199. //添加图形数据
  200. for(var j = 0; j < allData.length; j++) {
  201. option.series[j].data = allData[j];
  202. }
  203. }
  204. //导出功能
  205. $('.export').click(function() {
  206. dcexcel(this);
  207. })
  208. function dcexcel(obj) {
  209. var url = huayi.config.callcenter_url + "YearContrast/ExptList?token=" + $.cookie("token");
  210. url += "&beginyear=" + $('#chooseTime').val() && $('#chooseTime').val().split('~')[0] + "&endyear=" + $('#chooseTime').val() && $('#chooseTime').val().split('~')[1];
  211. obj.href = url;
  212. }
  213. }
  214. );
  215. </script>
  216. </body>
  217. </html>