12345市长热线标准版-前端

yueLiuLiang.html 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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. var token = $.cookie("token");
  160. laydate.render({
  161. elem: '#chooseTime',
  162. format: 'yyyy-MM',
  163. type: 'month',
  164. theme: '#00a1cb'
  165. });
  166. laydate.render({
  167. elem: '#chooseTime2',
  168. format: 'yyyy-MM',
  169. type: 'month',
  170. theme: '#00a1cb'
  171. });
  172. var myDate=new Date();
  173. function turn(aa){
  174. if(aa<10){
  175. aa = "0" + aa;
  176. }
  177. return aa
  178. }
  179. $('#chooseTime').val(myDate.getFullYear()+"-"+turn(myDate.getMonth()+1)+"-"+turn(myDate.getDate()))
  180. $('#chooseTime2').val(myDate.getFullYear()+"-"+turn(myDate.getMonth()+1)+"-"+turn(myDate.getDate()))
  181. $(document).ready(function() {
  182. $('.th-tab li').click(function() {
  183. $(this).addClass('active')
  184. .siblings().removeClass('active');
  185. var index = $(this).index();
  186. $('.tab-content >div').eq(index).show()
  187. .siblings().hide();
  188. })
  189. //返回首页
  190. $('#ReIndex').click(function() {
  191. top.home_index();
  192. })
  193. //图形
  194. myChart = echarts.init(document.getElementById('huData'));
  195. myChart.setOption({
  196. color: ['#00a1cb'],
  197. tooltip: {
  198. trigger: 'axis',
  199. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  200. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  201. }
  202. },
  203. toolbox: {
  204. show: true,
  205. },
  206. calculable: true,
  207. xAxis: [{
  208. type: 'category',
  209. name: '月份',
  210. splitLine: {
  211. show: false
  212. }, //去除网格线
  213. data: [],
  214. axisTick: {
  215. alignWithLabel: true
  216. }
  217. }],
  218. yAxis: [{
  219. type: 'value',
  220. name: '数量',
  221. nameLocation: 'end',
  222. splitLine: {
  223. show: false
  224. } //去除网格线
  225. }],
  226. series: [{
  227. name: '流量',
  228. type: 'bar',
  229. barWidth: 20, //图形宽度
  230. data: [],
  231. itemStyle: {
  232. normal: {
  233. label: {
  234. show: true,
  235. textStyle: {
  236. color: '#FF9800' //顶部数据颜色
  237. }
  238. }
  239. }
  240. },
  241. label: {
  242. normal: {
  243. show: true,
  244. position: 'top' //顶部数据显示位置
  245. }
  246. }
  247. }
  248. ]
  249. })
  250. Ajax();
  251. function Ajax() {
  252. $.ajax({
  253. type: "get",
  254. url: huayi.config.callcenter_url + "FlowAnalysis/GetMonthCount",
  255. async: true,
  256. dataType: 'json',
  257. data: {
  258. token: token,
  259. sdate: $('#chooseTime').val(),
  260. edate: $('#chooseTime2').val()
  261. },
  262. success: function(data) {
  263. if(data.state.toLowerCase() == "success") {
  264. myChart.setOption({
  265. xAxis: [{
  266. data: data.data.months
  267. }],
  268. series: [{
  269. data: data.data.counts
  270. }]
  271. });
  272. }
  273. }
  274. });
  275. $.ajax({
  276. type: "get",
  277. url: huayi.config.callcenter_url + "FlowAnalysis/GetMonthCountTable",
  278. async: true,
  279. dataType: 'json',
  280. data: {
  281. token: token,
  282. sdate: $('#chooseTime').val(),
  283. edate: $('#chooseTime2').val()
  284. },
  285. success: function(data) {
  286. if(data.state.toLowerCase() == "success") {
  287. $('.thTable tbody').html('');
  288. $(data.data).each(function(j, m) {
  289. $('<tr>' +
  290. '<td>' + m.年月 + '</td>' +
  291. '<td>' + m.数量 + '</td>' +
  292. '</tr>').appendTo('.thTable tbody')
  293. })
  294. }
  295. }
  296. });
  297. }
  298. //搜索事件
  299. $('.sear').click(function() {
  300. Ajax();
  301. })
  302. //导出功能
  303. $('.export').click(function() {
  304. dcexcel(this);
  305. })
  306. function dcexcel(obj) {
  307. var url = huayi.config.callcenter_url + "FlowAnalysis/ExptMonthList?token=" + $.cookie("token");
  308. url += "&sdate=" + $("#chooseTime").val() + "&edate=" + $("#chooseTime2").val();
  309. obj.href = url;
  310. }
  311. })
  312. </script>
  313. </body>
  314. </html>