project_statistics.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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. #apply_container {
  9. height: 400px;
  10. }
  11. #result_container {
  12. height: 400px;
  13. }
  14. #street_container {
  15. height: 500px;
  16. }
  17. </style>
  18. </head>
  19. <body layout:fragment="content">
  20. <div class="page-container">
  21. <form class="form form-horizontal" id="form-add" th:action="@{/statistics/getOverallAnalysis}" th:method="get">
  22. <input type="hidden" id="chartType" name="chartType"/>
  23. <div>
  24. <label>开始日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入开始日期" id="begin_date" name="begin_date" />
  25. <label>结束日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入结束日期" id="end_date" name="end_date" />
  26. <span><a onclick="streetDeclaer()" class="btn btn-info radius"><i class="Hui-iconfont">&#xe665;</i> 搜索</a></span>
  27. </div>
  28. <div class="clearfix width-row">
  29. <div class="width-half">
  30. <div class="chart_data">
  31. <div id="apply_container"></div>
  32. </div>
  33. </div>
  34. <div class="width-half">
  35. <div class="chart_data">
  36. <div class="sel-box sel-box-recove">
  37. <select class="select" onChange="changeType()"
  38. th:name="projectType" id="projectType">
  39. <option value="">--请选择--</option>
  40. <option value="" th:each="item : ${projectTypeList}" th:value="${item.id}" th:text="${item.type_name}">
  41. </option>
  42. </select>
  43. </div>
  44. <div id="result_container"></div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="chart_data">
  49. <div id="street_container"></div>
  50. </div>
  51. </form>
  52. </div>
  53. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts.js}"></script>
  54. <script type="text/javascript" th:src="@{/js/lib/highcharts/exporting.js}"></script>
  55. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts-zh_CN.js}"></script>
  56. <style>
  57. a.cur{
  58. background: #0a6999;color:#fff;
  59. }
  60. </style>
  61. <script th:inline="javascript">
  62. $(function () {
  63. $(".highlight a").click(function(){
  64. $(this).addClass("cur").parent().siblings().find("a").removeClass("cur")
  65. });
  66. applyRate();
  67. applyResultRate();
  68. streetCompare();
  69. });
  70. //初始化柱形图
  71. var initColumn = {
  72. chart: {
  73. type: 'column'
  74. },
  75. title: {
  76. text: '各街道单据数量对比'
  77. },
  78. xAxis: {
  79. crosshair: true,
  80. labels: {
  81. enabled: false
  82. }
  83. },
  84. yAxis: {
  85. min: 0,
  86. allowDecimals: false,
  87. title: {
  88. text: '',
  89. align: 'high'
  90. },
  91. labels: {
  92. overflow: 'justify'
  93. }
  94. },
  95. tooltip: {
  96. formatter : function(){
  97. return '<span style="font-size: 12px">'+this.series.name+':'+this.y+'个</span>';//这里随便你返回什么东西吧
  98. }
  99. },
  100. plotOptions: {
  101. column: {
  102. pointPadding: 0.2,
  103. borderWidth: 0
  104. }
  105. },
  106. series: []
  107. };
  108. //初始化饼图
  109. var initPie ={
  110. chart: {
  111. plotBackgroundColor: null,
  112. plotBorderWidth: null,
  113. plotShadow: false
  114. },
  115. title: {
  116. text: '区级工业经济扶持申请单据占比'
  117. },
  118. tooltip: {
  119. headerFormat: '',
  120. pointFormat: '{point.name}: <b>{point.y}</b> '
  121. },
  122. plotOptions: {
  123. pie: {
  124. allowPointSelect: true,
  125. cursor: 'pointer',
  126. dataLabels: {
  127. enabled: true,
  128. // 通过 format 或 formatter 来格式化数据标签显示
  129. //format: '值: {point.y} 占比 {point.percentage} %',
  130. formatter: function () {
  131. //this 为当前的点(扇区)对象,可以通过 console.log(this) 来查看详细信息
  132. return '<span"> ' + this.point.name + ':' + this.y + '</span>';
  133. }
  134. },
  135. showInLegend: true // 显示在图例中
  136. }
  137. },
  138. series: [{
  139. type: 'pie',
  140. name: ''
  141. }]
  142. };
  143. //存量工业用地变更申请单据占比
  144. function applyRate() {
  145. $("#chartType").val(2);
  146. $.ajax({
  147. type: "get",
  148. dataType: "json",
  149. data: {
  150. begin_date: $("#begin_date").val(),
  151. end_date: $("#end_date").val()
  152. },
  153. url: pagePath+ "/statistics/getProjectTypeRate",
  154. success: function (result) {
  155. console.log(result);
  156. if (result.success) {
  157. var value = result.obj;
  158. var data = [];
  159. for(var j=0;j<value.length;j++){
  160. data.push({"name":value[j].type, "y":value[j].overallNum});
  161. }
  162. console.log(data);
  163. var chart = new Highcharts.Chart("apply_container", initPie);
  164. chart.series[0].setData(data);
  165. } else {
  166. errorMessage(result.message);
  167. }
  168. },
  169. error: function () {
  170. errorMessage('系统错误!');
  171. }
  172. });
  173. }
  174. //存量工业用地变更申请结果占比
  175. function applyResultRate() {
  176. //初始化饼图
  177. var initPie ={
  178. chart: {
  179. plotBackgroundColor: null,
  180. plotBorderWidth: null,
  181. plotShadow: false
  182. },
  183. title: {
  184. text: '区级工业经济扶持申请结果占比'
  185. },
  186. tooltip: {
  187. headerFormat: '',
  188. pointFormat: '{point.name}: <b>{point.y}</b> '
  189. },
  190. plotOptions: {
  191. pie: {
  192. allowPointSelect: true,
  193. cursor: 'pointer',
  194. dataLabels: {
  195. enabled: true,
  196. // 通过 format 或 formatter 来格式化数据标签显示
  197. //format: '值: {point.y} 占比 {point.percentage} %',
  198. formatter: function () {
  199. //this 为当前的点(扇区)对象,可以通过 console.log(this) 来查看详细信息
  200. return '<span"> ' + this.point.name + ':' + this.y + '</span>';
  201. }
  202. },
  203. showInLegend: true // 显示在图例中
  204. }
  205. },
  206. series: [{
  207. type: 'pie',
  208. name: ''
  209. }]
  210. };
  211. $.ajax({
  212. type: "get",
  213. dataType: "json",
  214. data: {
  215. begin_date: $("#begin_date").val(),
  216. end_date: $("#end_date").val(),
  217. projectType: $("#projectType").val()
  218. },
  219. url: pagePath+ "/statistics/getProjectResult",
  220. success: function (result) {
  221. console.log(result);
  222. if (result.success) {
  223. var value = result.obj;
  224. var data = [];
  225. for(var j=0;j<value.length;j++){
  226. data.push({"name":value[j].type,"y":value[j].overallNum});
  227. }
  228. var chart = new Highcharts.Chart("result_container", initPie);
  229. var subtitle = {
  230. text: "<div style='height: 24px'></div>",
  231. useHTML: true
  232. };
  233. chart.setSubtitle(subtitle);
  234. chart.series[0].setData(data);
  235. } else {
  236. errorMessage(result.message);
  237. }
  238. },
  239. error: function () {
  240. errorMessage('系统错误!');
  241. }
  242. });
  243. }
  244. //各单位处理单据对比
  245. function streetCompare(){
  246. $.ajax({
  247. type: "get",
  248. dataType: "json",
  249. data: {
  250. begin_date: $("#begin_date").val(),
  251. end_date: $("#end_date").val()
  252. },
  253. url: pagePath + "/statistics/getProjectHandleCompare",
  254. success: function (result) {
  255. console.log(result);
  256. if (result.success) {
  257. var chart = Highcharts.chart('street_container', initColumn);
  258. var value = result.obj;
  259. for(var j=0;j < value.length;j++){
  260. var data = [];
  261. data.push(value[j].overallNum);
  262. console.log(data);
  263. chart.addSeries({
  264. name: value[j].streetName,
  265. data: data
  266. });
  267. }
  268. } else {
  269. errorMessage(result.message);
  270. }
  271. },
  272. error: function () {
  273. errorMessage('系统错误!');
  274. }
  275. });
  276. }
  277. function changeType(){
  278. applyResultRate();
  279. }
  280. function streetDeclaer(){
  281. applyRate();
  282. applyResultRate();
  283. streetCompare();
  284. }
  285. laydate.render({
  286. elem: '#begin_date', //指定元素
  287. // min: 0
  288. });
  289. laydate.render({
  290. elem: '#end_date', //指定元素
  291. // min: 0
  292. });
  293. </script>
  294. </body>
  295. </html>