虞城12345_前端

yueLiuLiang.html 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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. <link href="../css/init.css" rel="stylesheet" />
  9. <script src="../js/laydate/laydate.js"></script>
  10. <link rel="stylesheet" href="../css/init.css" />
  11. <title>月流量统计</title>
  12. </head>
  13. <style>
  14. @font-face {
  15. font-family: 'iconfont';
  16. src: url('fonts/iconfont.eot');
  17. /* IE9*/
  18. src: url('fonts/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  19. url('fonts/iconfont.woff') format('woff'), /* chrome、firefox */
  20. url('fonts/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
  21. url('fonts/iconfont.svg#iconfont') format('svg');
  22. /* iOS 4.1- */
  23. }
  24. .iconfont {
  25. font-family: "iconfont";
  26. font-style: normal;
  27. }
  28. ul,
  29. li,
  30. ol {
  31. list-style: none;
  32. }
  33. a {
  34. text-decoration: none
  35. }
  36. .clearfix:after {
  37. content: "";
  38. display: block;
  39. clear: both;
  40. }
  41. .hut-top {
  42. background: #f3f3f4;
  43. /*height: 60px;*/
  44. padding: 10px 20px;
  45. }
  46. .hut-tcon {
  47. float: right;
  48. }
  49. .dhLeft a {
  50. color: #999;
  51. }
  52. .time-box {
  53. display: inline-block;
  54. position: relative;
  55. }
  56. .toolRight input {
  57. padding-right: 30px;
  58. }
  59. .tub {
  60. position: absolute;
  61. right: 8px;
  62. top: 5px;
  63. font-size: 18px;
  64. color: #00a0ca;
  65. }
  66. .th-table {
  67. display: none;
  68. }
  69. .tab-content {
  70. width: 90%;
  71. margin: 0 auto;
  72. }
  73. #thead thead th {
  74. background: #00a0cd;
  75. color: #fff;
  76. }
  77. table thead,
  78. tbody tr {
  79. display: table;
  80. width: 100%;
  81. table-layout: fixed;
  82. }
  83. .table {
  84. margin-bottom: 0;
  85. }
  86. </style>
  87. <body class="gray-bg" style="background: #fefefe;">
  88. <div class="hu-total wrapper wrapper-content animated fadeInRight">
  89. <div class="daoHang clearfix">
  90. <div class="dhLeft">
  91. <sapn><i class="syIcon"></i>位置:
  92. <a id="ReIndex" href="javaScript:;">首页</a>&gt;
  93. <a href="javaScript:;">报表管理</a>&gt;
  94. <a href="" class="nowPosition">月流量报表</a>
  95. </sapn>
  96. </div>
  97. <div class="dhRight">
  98. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  99. </div>
  100. </div>
  101. <div class="toolBar clearfix">
  102. <div class="toolRight" style="float: right;">
  103. <span>开始日期:</span>
  104. <span class="time-box"><i class="tub fa fa-calendar"></i><input type="text" id="chooseTime" /></span>
  105. <span>结束日期:</span>
  106. <span class="time-box"><i class="tub fa fa-calendar"></i><input type="text" id="chooseTime2" /></span>
  107. <button class="btns sear">搜索</button>
  108. <a class="btns export">导出</a>
  109. </div>
  110. </div>
  111. <div class="hu-content">
  112. <ul class="nav nav-tabs th-tab">
  113. <li role="presentation" class="active">
  114. <a href="javascript:;">图表</a>
  115. </li>
  116. <li role="presentation">
  117. <a href="javascript:;">表格</a>
  118. </li>
  119. </ul>
  120. <div class="tab-content">
  121. <div class="hu-con-right">
  122. <div id="huData" style="width:100%; height: 500px;">
  123. </div>
  124. </div>
  125. <div class="th-table">
  126. <div style="width: 100%;padding: 10px;">
  127. <div class="table-head">
  128. <table id="thead" class="table table-hover table-striped table-bordered table-condensed">
  129. <colgroup>
  130. <col style="width: 80px;" />
  131. <col/>
  132. </colgroup>
  133. <thead>
  134. <tr>
  135. <th>月份</th>
  136. <th>流量数</th>
  137. </tr>
  138. </thead>
  139. </table>
  140. </div>
  141. <div class="table-body">
  142. <table class="thTable table table-hover table-striped table-bordered table-condensed">
  143. <colgroup>
  144. <col style="width: 80px;" />
  145. <col/>
  146. </colgroup>
  147. <tbody>
  148. </tbody>
  149. </table>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. <script src="../js/echarts.common.min.js"></script>
  157. <script>
  158. var myChart;
  159. $(document).ready(function () {
  160. var token = $.cookie("token");
  161. laydate.render({
  162. elem: '#chooseTime',
  163. format: 'yyyy-MM',
  164. type: 'month',
  165. theme: '#00a1cb',
  166. value: new Date()
  167. });
  168. laydate.render({
  169. elem: '#chooseTime2',
  170. format: 'yyyy-MM',
  171. type: 'month',
  172. theme: '#00a1cb',
  173. value: new Date()
  174. });
  175. laydate.ready(function () {
  176. Ajax();
  177. })
  178. $('.th-tab li').click(function() {
  179. $(this).addClass('active')
  180. .siblings().removeClass('active');
  181. var index = $(this).index();
  182. $('.tab-content >div').eq(index).show()
  183. .siblings().hide();
  184. })
  185. //图形
  186. myChart = echarts.init(document.getElementById('huData'));
  187. myChart.setOption({
  188. color: ['#00a1cb'],
  189. tooltip: {
  190. trigger: 'axis',
  191. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  192. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  193. }
  194. },
  195. toolbox: {
  196. show: true,
  197. },
  198. calculable: true,
  199. xAxis: [{
  200. type: 'category',
  201. name: '月份',
  202. splitLine: {
  203. show: false
  204. }, //去除网格线
  205. data: [],
  206. axisTick: {
  207. alignWithLabel: true
  208. }
  209. }],
  210. yAxis: [{
  211. type: 'value',
  212. name: '数量',
  213. nameLocation: 'end',
  214. splitLine: {
  215. show: false
  216. } //去除网格线
  217. }],
  218. series: [{
  219. name: '流量',
  220. type: 'bar',
  221. barWidth: 20, //图形宽度
  222. data: [],
  223. itemStyle: {
  224. normal: {
  225. label: {
  226. show: true,
  227. textStyle: {
  228. color: '#FF9800' //顶部数据颜色
  229. }
  230. }
  231. }
  232. },
  233. label: {
  234. normal: {
  235. show: true,
  236. position: 'top' //顶部数据显示位置
  237. }
  238. }
  239. }
  240. ]
  241. })
  242. Ajax();
  243. function Ajax() {
  244. $.ajax({
  245. type: "get",
  246. url: huayi.config.callcenter_url + "FlowAnalysis/GetMonthCount",
  247. async: true,
  248. dataType: 'json',
  249. data: {
  250. token: token,
  251. sdate: $('#chooseTime').val(),
  252. edate: $('#chooseTime2').val()
  253. },
  254. success: function(data) {
  255. if(data.state.toLowerCase() == "success") {
  256. myChart.setOption({
  257. xAxis: [{
  258. data: data.data.months
  259. }],
  260. series: [{
  261. data: data.data.counts
  262. }]
  263. });
  264. }
  265. }
  266. });
  267. $.ajax({
  268. type: "get",
  269. url: huayi.config.callcenter_url + "FlowAnalysis/GetMonthCountTable",
  270. async: true,
  271. dataType: 'json',
  272. data: {
  273. token: token,
  274. sdate: $('#chooseTime').val(),
  275. edate: $('#chooseTime2').val()
  276. },
  277. success: function(data) {
  278. if(data.state.toLowerCase() == "success") {
  279. $('.thTable tbody').html('');
  280. $(data.data).each(function(j, m) {
  281. $('<tr>' +
  282. '<td>' + m.年月 + '</td>' +
  283. '<td>' + m.数量 + '</td>' +
  284. '</tr>').appendTo('.thTable tbody')
  285. })
  286. }
  287. }
  288. });
  289. }
  290. //搜索事件
  291. $('.sear').click(function() {
  292. Ajax();
  293. })
  294. //导出功能
  295. $('.export').click(function() {
  296. dcexcel(this);
  297. })
  298. function dcexcel(obj) {
  299. var url = huayi.config.callcenter_url + "FlowAnalysis/ExptMonthList?token=" + $.cookie("token");
  300. url += "&sdate=" + $("#chooseTime").val() + "&edate=" + $("#chooseTime2").val();
  301. obj.href = url;
  302. }
  303. })
  304. </script>
  305. </body>
  306. </html>