overall_statistics.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>总体统计</title>
  7. <style>
  8. #container {
  9. height: 500px;
  10. }
  11. #polyline {
  12. height: 500px;
  13. width: 1100px;
  14. border:1px solid #000;
  15. }
  16. </style>
  17. </head>
  18. <body layout:fragment="content">
  19. <div class="page-container">
  20. <form class="form form-horizontal" id="form-add" th:action="@{/statistics/getOverallAnalysis}" th:method="get">
  21. <input type="hidden" id="chartType" name="chartType"/>
  22. <div>
  23. <label>开始日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入开始日期" id="begin_date" name="begin_date" />
  24. <label>结束日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入结束日期" id="end_date" name="end_date" />
  25. <span><a onclick="streetDeclaer()" class="btn btn-info radius"><i class="Hui-iconfont">&#xe665;</i> 搜索</a></span>
  26. </div>
  27. <div class="chart_data">
  28. <div id="container"></div>
  29. </div>
  30. <!--<div class="chart_data mt-20 col-xs-12 col-sm-12" id="polyline"></div>-->
  31. </form>
  32. </div>
  33. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts.js}"></script>
  34. <script type="text/javascript" th:src="@{/js/lib/highcharts/exporting.js}"></script>
  35. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts-zh_CN.js}"></script>
  36. <style>
  37. a.cur{
  38. background: #0a6999;color:#fff;
  39. }
  40. </style>
  41. <script th:inline="javascript">
  42. $(function () {
  43. $(".highlight a").click(function(){
  44. $(this).addClass("cur").parent().siblings().find("a").removeClass("cur")
  45. })
  46. overallAnalysis();
  47. // businessTrend();
  48. });
  49. //初始化柱形图
  50. var initColumn = {
  51. chart: {
  52. renderTo: 'container',
  53. type: 'column',
  54. events: {
  55. render: function () {
  56. }
  57. }
  58. },
  59. title: {
  60. text: '2017年各街道申报项目数'
  61. },
  62. subtitle: {
  63. text: null
  64. },
  65. xAxis: {
  66. crosshair: true
  67. },
  68. yAxis: {
  69. min: 0,
  70. allowDecimals: false,
  71. title: {
  72. text: '',
  73. align: 'high'
  74. },
  75. labels: {
  76. overflow: 'justify'
  77. }
  78. },
  79. tooltip: {
  80. valueSuffix: ' 个'
  81. },
  82. plotOptions: {
  83. column: {
  84. pointPadding: 0.2,
  85. borderWidth: 0
  86. }
  87. },
  88. series: []
  89. };
  90. //初始化饼图
  91. var initPie ={
  92. chart: {
  93. renderTo: 'container',
  94. plotBackgroundColor: null,
  95. plotBorderWidth: null,
  96. plotShadow: false
  97. },
  98. title: {
  99. text: '各政务类型处理单据占比'
  100. },
  101. tooltip: {
  102. headerFormat: '',
  103. pointFormat: '{point.name}: <b>{point.y}</b> '
  104. },
  105. plotOptions: {
  106. pie: {
  107. allowPointSelect: true,
  108. cursor: 'pointer',
  109. dataLabels: {
  110. enabled: true,
  111. // 通过 format 或 formatter 来格式化数据标签显示
  112. //format: '值: {point.y} 占比 {point.percentage} %',
  113. formatter: function () {
  114. //this 为当前的点(扇区)对象,可以通过 console.log(this) 来查看详细信息
  115. return '<span"> ' + this.point.name + ':' + this.y + '</span>';
  116. }
  117. },
  118. showInLegend: true // 显示在图例中
  119. }
  120. },
  121. series: [{
  122. type: 'pie',
  123. name: ''
  124. }]
  125. };
  126. //总体分析
  127. function overallAnalysis() {
  128. $("#chartType").val(2);
  129. $.ajax({
  130. type: "get",
  131. dataType: "json",
  132. data: {
  133. begin_date: $("#begin_date").val(),
  134. end_date: $("#end_date").val()
  135. },
  136. url: pagePath+ "/statistics/getOverallAnalysis",
  137. success: function (result) {
  138. console.log(result);
  139. if (result.success) {
  140. var value = result.obj;
  141. var data = [];
  142. for(var j=0;j<value.length;j++){
  143. data.push({"name":value[j].type,"y":value[j].overallNum});
  144. }
  145. console.log(data);
  146. var chart = new Highcharts.Chart(initPie);
  147. chart.series[0].setData(data);
  148. } else {
  149. errorMessage(result.message);
  150. }
  151. },
  152. error: function () {
  153. errorMessage('系统错误!');
  154. }
  155. });
  156. }
  157. //各政务增长趋势图
  158. function businessTrend() {
  159. $("#chartType").val(4);
  160. var initPolyline = Highcharts.chart('polyline', {
  161. title: {
  162. text: '各政务增长趋势图',
  163. x: -20 //center
  164. },
  165. xAxis: {
  166. categories: []
  167. },
  168. yAxis: {
  169. title: {
  170. text: ''
  171. },
  172. min: 0,
  173. allowDecimals: false,
  174. },
  175. tooltip: {
  176. valueSuffix: '次'
  177. },
  178. legend: {
  179. layout: 'vertical',
  180. align: 'right',
  181. verticalAlign: 'middle',
  182. borderWidth: 0
  183. },
  184. series: []
  185. });
  186. $.ajax({
  187. type: "post",
  188. dataType: "json",
  189. data: {
  190. begin_date: $("#begin_date").val(),
  191. end_date: $("#end_date").val()
  192. },
  193. url: pagePath + "/projectDeclaration/streetReportingTrend",
  194. success: function (result) {
  195. console.log(result);
  196. if (result.success) {
  197. var obj = result.obj;
  198. var map = obj.polyline_data;
  199. //x轴年份
  200. var categories = obj.year_array;
  201. initPolyline.xAxis[0].categories=categories;
  202. //展示数据
  203. for(var key in map){
  204. initPolyline.addSeries({
  205. name: key,
  206. data: map[key]
  207. });
  208. }
  209. } else {
  210. errorMessage(result.message);
  211. }
  212. },
  213. error: function () {
  214. errorMessage('系统错误!');
  215. }
  216. });
  217. }
  218. //各街道申报数量
  219. function streetDeclaerNum(type) {
  220. $("#chartType").val(1);
  221. $.ajax({
  222. type: "post",
  223. dataType: "json",
  224. data: {
  225. begin_date: $("#begin_date").val(),
  226. end_date: $("#end_date").val(),
  227. type : type
  228. },
  229. url: pagePath + "/projectDeclaration/streetDeclaerNum/",
  230. success: function (result) {
  231. console.log(result);
  232. if (result.success) {
  233. var chart = new Highcharts.Chart(initColumn);
  234. var categoies = [];
  235. var row1 = [];
  236. var row2 = [];
  237. var value = result.obj;
  238. for(var j=0;j<value.length;j++){
  239. categoies.push(value[j].street_name);
  240. row1.push(value[j].declare_num);
  241. row2.push(value[j].declare_success);
  242. }
  243. chart.xAxis[0].categories=categoies;
  244. chart.addSeries({
  245. name: "申报项目",
  246. data: row1
  247. });
  248. chart.addSeries({
  249. name: "申报成功",
  250. data: row2
  251. });
  252. } else {
  253. errorMessage(result.message);
  254. }
  255. },
  256. error: function () {
  257. errorMessage('系统错误!');
  258. }
  259. });
  260. }
  261. //项目发展趋势
  262. function projectDevelopmentTrend(type) {
  263. $("#chartType").val(3);
  264. var initPolyline = Highcharts.chart('container', {
  265. title: {
  266. text: '项目发展趋势',
  267. x: -20 //center
  268. },
  269. // subtitle: {
  270. // text: 'Source: WorldClimate.com',
  271. // x: -20
  272. // },
  273. xAxis: {
  274. categories: []
  275. },
  276. yAxis: {
  277. title: {
  278. text: '项目申请次数(次)'
  279. },
  280. plotLines: [{
  281. value: 0,
  282. width: 1,
  283. color: '#808080'
  284. }]
  285. },
  286. tooltip: {
  287. valueSuffix: '次'
  288. },
  289. legend: {
  290. layout: 'vertical',
  291. align: 'right',
  292. verticalAlign: 'middle',
  293. borderWidth: 0
  294. },
  295. series: []
  296. });
  297. $.ajax({
  298. type: "post",
  299. dataType: "json",
  300. data: {
  301. begin_date: $("#begin_date").val(),
  302. end_date: $("#end_date").val(),
  303. type : type
  304. },
  305. url: pagePath + "/projectDeclaration/projectDevelopmentTrend",
  306. success: function (result) {
  307. console.log(result);
  308. if (result.success) {
  309. var obj = result.obj;
  310. var map = obj.polyline_data;
  311. //x轴年份
  312. var categories = obj.year_array;
  313. initPolyline.xAxis[0].categories=categories;
  314. //展示数据
  315. for(var key in map){
  316. initPolyline.addSeries({
  317. name: key,
  318. data: map[key]
  319. });
  320. }
  321. } else {
  322. errorMessage(result.message);
  323. }
  324. },
  325. error: function () {
  326. errorMessage('系统错误!');
  327. }
  328. });
  329. }
  330. //各类别项目申请情况
  331. function filingSituation(type) {
  332. $("#chartType").val(5);
  333. $.ajax({
  334. type: "post",
  335. dataType: "json",
  336. data: {
  337. begin_date: $("#begin_date").val(),
  338. end_date: $("#end_date").val(),
  339. type : type
  340. },
  341. url: pagePath + "/projectDeclaration/filingSituation/",
  342. success: function (result) {
  343. console.log(result);
  344. if (result.success) {
  345. var chart = new Highcharts.Chart(initColumn);
  346. var categoies = [];
  347. var row1 = [];
  348. var row2 = [];
  349. var value = result.obj;
  350. for(var j=0;j<value.length;j++){
  351. categoies.push(value[j].project_type_name);
  352. row1.push(value[j].declare_num);
  353. row2.push(value[j].declare_success);
  354. }
  355. chart.xAxis[0].categories=categoies;
  356. chart.addSeries({
  357. name: "申报项目",
  358. data: row1
  359. });
  360. chart.addSeries({
  361. name: "申报成功",
  362. data: row2
  363. });
  364. } else {
  365. errorMessage(result.message);
  366. }
  367. },
  368. error: function () {
  369. errorMessage('系统错误!');
  370. }
  371. });
  372. }
  373. function streetDeclaer(){
  374. overallAnalysis();
  375. }
  376. laydate.render({
  377. elem: '#begin_date', //指定元素
  378. // min: 0
  379. });
  380. laydate.render({
  381. elem: '#end_date', //指定元素
  382. // min: 0
  383. });
  384. </script>
  385. </body>
  386. </html>