provinces_statistics.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  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. #left_container {
  9. height: 400px;
  10. }
  11. #right_container {
  12. height: 400px;
  13. }
  14. #bottom_container {
  15. height: 400px;
  16. }
  17. .select {
  18. width: 200px;
  19. height: 31px;
  20. box-sizing: border-box;
  21. border-width: 1px;
  22. border-style: solid;
  23. border-color: rgb(221, 221, 221);
  24. border-image: initial;
  25. transition: all 0.2s linear 0s;
  26. font-size: 14px;
  27. line-height: 1.42857;
  28. padding: 0px 4px 4px 4px;
  29. }
  30. </style>
  31. </head>
  32. <body layout:fragment="content">
  33. <div class="page-container">
  34. <form class="form form-horizontal" id="form-add" th:action="@{/statistics/toProvincesStatistics}" th:method="get">
  35. <div>
  36. <label>开始日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入开始日期"
  37. id="begin_date" name="begin_date"/>
  38. <label>结束日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入结束日期"
  39. id="end_date" name="end_date"/>
  40. <span><a onclick="search1()" class="btn btn-info radius"><i
  41. class="Hui-iconfont">&#xe665;</i> 搜索</a></span>
  42. </div>
  43. <div class="clearfix width-row">
  44. <div class="width-half">
  45. <div class="chart_data">
  46. <div id="left_container"></div>
  47. </div>
  48. </div>
  49. <div class="width-half">
  50. <div class="chart_data">
  51. <div class="sel-box sel-box-recove">
  52. <select class="select" onChange="changeType()"
  53. th:name="projectType" id="projectType">
  54. <option value="">--请选择--</option>
  55. <option value="" th:each="item : ${projectServiceTypeList}" th:value="${item.id}"
  56. th:text="${item.service_type_name}">
  57. </option>
  58. </select>
  59. </div>
  60. <div id="right_container"></div>
  61. </div>
  62. </div>
  63. </div>
  64. <div style="margin-top: 20px;">
  65. <select class="select" th:name="projectType2" id="projectType2">
  66. <option value="">--请选择--</option>
  67. <option value="" th:each="item : ${projectServiceTypeList}" th:value="${item.id}"
  68. th:text="${item.service_type_name}">
  69. </option>
  70. </select>
  71. <input type="text" class="input-text" style="width:200px" readonly placeholder="请输入开始年份"
  72. id="startYear" name="startYear"/>
  73. <label>-</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入结束年份"
  74. id="endYear" name="endYear"/>
  75. <span><a onclick="search2()" class="btn btn-info radius"><i
  76. class="Hui-iconfont">&#xe665;</i> 搜索</a></span>
  77. </div>
  78. <div class="chart_data">
  79. <div id="bottom_container"></div>
  80. </div>
  81. </form>
  82. </div>
  83. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts.js}"></script>
  84. <script type="text/javascript" th:src="@{/js/lib/highcharts/exporting.js}"></script>
  85. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts-zh_CN.js}"></script>
  86. <style>
  87. a.cur {
  88. background: #0a6999;
  89. color: #fff;
  90. }
  91. </style>
  92. <script th:inline="javascript">
  93. $(function () {
  94. $(".highlight a").click(function () {
  95. $(this).addClass("cur").parent().siblings().find("a").removeClass("cur")
  96. })
  97. applyType();
  98. applyResult();
  99. applyTrend();
  100. });
  101. function search1() {
  102. applyType();
  103. applyResult();
  104. }
  105. function search2() {
  106. applyTrend();
  107. }
  108. function changeType() {
  109. applyResult();
  110. }
  111. //初始化左图
  112. var initColumn = {
  113. chart: {
  114. renderTo: 'left_container',
  115. type: 'column',
  116. events: {
  117. render: function () {
  118. }
  119. }
  120. },
  121. title: {
  122. text: '省市申报发布数/申报数'
  123. },
  124. subtitle: {
  125. text: null
  126. },
  127. xAxis: {
  128. crosshair: true
  129. },
  130. yAxis: {
  131. min: 0,
  132. allowDecimals: false,
  133. title: {
  134. text: '',
  135. align: 'high'
  136. },
  137. labels: {
  138. overflow: 'justify'
  139. }
  140. },
  141. tooltip: {
  142. valueSuffix: ' 个'
  143. },
  144. plotOptions: {
  145. column: {
  146. pointPadding: 0.2,
  147. borderWidth: 0
  148. }
  149. },
  150. series: []
  151. };
  152. //初始化右饼图
  153. var initRightPie = {
  154. chart: {
  155. renderTo: 'right_container',
  156. plotBackgroundColor: null,
  157. plotBorderWidth: null,
  158. plotShadow: false
  159. },
  160. title: {
  161. text: '省市申报申请结果数量占比'
  162. },
  163. tooltip: {
  164. headerFormat: '',
  165. pointFormat: '{point.name}: <b>{point.y}</b> '
  166. },
  167. plotOptions: {
  168. pie: {
  169. allowPointSelect: true,
  170. cursor: 'pointer',
  171. dataLabels: {
  172. enabled: true,
  173. // 通过 format 或 formatter 来格式化数据标签显示
  174. //format: '值: {point.y} 占比 {point.percentage} %',
  175. formatter: function () {
  176. //this 为当前的点(扇区)对象,可以通过 console.log(this) 来查看详细信息
  177. return '<span"> ' + this.point.name + ':' + this.y + '</span>';
  178. }
  179. },
  180. showInLegend: true // 显示在图例中
  181. },
  182. series: {
  183. animation: {
  184. duration: 2000
  185. }
  186. }
  187. },
  188. series: [{
  189. type: 'pie',
  190. name: ''
  191. }]
  192. };
  193. //初始化折线图
  194. var initLine = {
  195. chart: {
  196. renderTo: 'bottom_container',
  197. plotBackgroundColor: null,
  198. plotBorderWidth: null,
  199. plotShadow: false
  200. },
  201. title: {
  202. text: '增长趋势图'
  203. },
  204. xAxis: {
  205. title: {
  206. text: '申报时间'
  207. },
  208. },
  209. yAxis: {
  210. title: {
  211. text: '申报量'
  212. }
  213. },
  214. plotOptions: {
  215. series: {
  216. animation: {
  217. duration: 2000
  218. }
  219. }
  220. },
  221. series: []
  222. };
  223. //申请单据占比
  224. function applyType() {
  225. $.ajax({
  226. type: "post",
  227. dataType: "json",
  228. data: {
  229. begin_date: $("#begin_date").val(),
  230. end_date: $("#end_date").val()
  231. },
  232. url: pagePath + "/statistics/getProvincesAnalysisType",
  233. success: function (result) {
  234. if (result.success) {
  235. var data = result.obj;
  236. var chart = new Highcharts.Chart(initColumn);
  237. chart.xAxis[0].setCategories(data.categories);
  238. chart.addSeries(data.statisticView);
  239. } else {
  240. errorMessage(result.message);
  241. }
  242. },
  243. error: function () {
  244. errorMessage('系统错误!');
  245. }
  246. });
  247. }
  248. function applyResult() {
  249. $.ajax({
  250. type: "post",
  251. dataType: "json",
  252. data: {
  253. begin_date: $("#begin_date").val(),
  254. end_date: $("#end_date").val(),
  255. projectType: $("#projectType").val()
  256. },
  257. url: pagePath + "/statistics/getProvincesAnalysisResult",
  258. success: function (result) {
  259. if (result.success) {
  260. var data = result.obj;
  261. var chart = new Highcharts.Chart(initRightPie);
  262. chart.series[0].setData(data);
  263. var subtitle = {
  264. text: "<div style='height: 24px'></div>",
  265. useHTML: true
  266. };
  267. chart.setSubtitle(subtitle);
  268. } else {
  269. errorMessage(result.message);
  270. }
  271. },
  272. error: function () {
  273. errorMessage('系统错误!');
  274. }
  275. });
  276. }
  277. function applyTrend() {
  278. $.ajax({
  279. type: "post",
  280. dataType: "json",
  281. data: {
  282. startYear: $("#startYear").val(),
  283. endYear: $("#endYear").val(),
  284. projectType: $("#projectType2").val()
  285. },
  286. url: pagePath + "/statistics/getProvincesAnalysisTrend",
  287. success: function (result) {
  288. if (result.success) {
  289. var data = result.obj;
  290. var chart = new Highcharts.Chart(initLine);
  291. chart.xAxis[0].setCategories(data.categories);
  292. //chart.series[0].setData(data.statisticView.data);
  293. //chart.series[0].name="区级智能制造";
  294. chart.addSeries(data.statisticView);
  295. } else {
  296. errorMessage(result.message);
  297. }
  298. },
  299. error: function () {
  300. errorMessage('系统错误!');
  301. }
  302. });
  303. }
  304. var startDate = laydate.render({
  305. elem: '#begin_date', //指定元素
  306. done: function (value, date) {
  307. if (value !== '') {
  308. endDate.config.min.year = date.year;
  309. endDate.config.min.month = date.month - 1;
  310. endDate.config.min.date = date.date;
  311. endDate.config.min.hours = date.hours;
  312. endDate.config.min.minutes = date.minutes;
  313. endDate.config.min.seconds = date.seconds;
  314. } else {
  315. endDate.config.min.year = '1900';
  316. endDate.config.min.month = '0';
  317. endDate.config.min.date = '1';
  318. endDate.config.min.hours = '0';
  319. endDate.config.min.minutes = '0';
  320. endDate.config.min.seconds = '0';
  321. }
  322. }
  323. });
  324. var endDate = laydate.render({
  325. elem: '#end_date', //指定元素
  326. done: function (value, date) {
  327. if (value !== '') {
  328. startDate.config.max.year = date.year;
  329. startDate.config.max.month = date.month - 1;
  330. startDate.config.max.date = date.date;
  331. startDate.config.max.hours = date.hours;
  332. startDate.config.max.minutes = date.minutes;
  333. startDate.config.max.seconds = date.seconds;
  334. } else {
  335. startDate.config.max.year = '2100';
  336. startDate.config.max.month = '0';
  337. startDate.config.max.date = '1';
  338. startDate.config.max.hours = '0';
  339. startDate.config.max.minutes = '0';
  340. startDate.config.max.seconds = '0';
  341. }
  342. }
  343. });
  344. var startYear = laydate.render({
  345. elem: '#startYear' //指定元素
  346. , type: 'year'
  347. , done: function (value, date) {
  348. if (value !== '') {
  349. endYear.config.min.year = date.year;
  350. endYear.config.min.month = date.month - 1;
  351. endYear.config.min.date = date.date;
  352. endYear.config.min.hours = date.hours;
  353. endYear.config.min.minutes = date.minutes;
  354. endYear.config.min.seconds = date.seconds;
  355. } else {
  356. endYear.config.min.year = '1900';
  357. endYear.config.min.month = '0';
  358. endYear.config.min.date = '1';
  359. endYear.config.min.hours = '0';
  360. endYear.config.min.minutes = '0';
  361. endYear.config.min.seconds = '0';
  362. }
  363. }
  364. });
  365. var endYear = laydate.render({
  366. elem: '#endYear' //指定元素
  367. , type: 'year'
  368. , done: function (value, date) {
  369. if (value !== '') {
  370. startYear.config.max.year = date.year;
  371. startYear.config.max.month = date.month - 1;
  372. startYear.config.max.date = date.date;
  373. startYear.config.max.hours = date.hours;
  374. startYear.config.max.minutes = date.minutes;
  375. startYear.config.max.seconds = date.seconds;
  376. } else {
  377. startYear.config.max.year = '2100';
  378. startYear.config.max.month = '0';
  379. startYear.config.max.date = '1';
  380. startYear.config.max.hours = '0';
  381. startYear.config.max.minutes = '0';
  382. startYear.config.max.seconds = '0';
  383. }
  384. }
  385. });
  386. </script>
  387. </body>
  388. </html>