matters_statistics.html 13 KB

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