intelligent_statistics.html 12 KB

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