diagnostic_statistics.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. .sel-box {
  15. top: 40px;
  16. width: 200px;
  17. position: absolute;
  18. z-index: 999;
  19. left: 50%;
  20. margin-left: -88px;
  21. }
  22. </style>
  23. </head>
  24. <body layout:fragment="content">
  25. <div class="page-container">
  26. <form class="form form-horizontal" id="form-add" th:action="@{/statistics/toMattersStatistics}" th:method="get"
  27. style="padding-left: 13px">
  28. <div class="row cl">
  29. <label>开始日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入开始日期"
  30. id="begin_date" name="begin_date"/>
  31. <label>结束日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入结束日期"
  32. id="end_date" name="end_date"/>
  33. <span><a onclick="search1()" class="btn btn-info radius"><i
  34. class="Hui-iconfont">&#xe665;</i> 搜索</a></span>
  35. </div>
  36. <div class="clearfix width-row">
  37. <div class="width-half">
  38. <div class="chart_data">
  39. <div id="left_container"></div>
  40. </div>
  41. </div>
  42. <div class="width-half">
  43. <div class="chart_data">
  44. <div id="right_container"></div>
  45. </div>
  46. </div>
  47. </div>
  48. </form>
  49. </div>
  50. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts.js}"></script>
  51. <script type="text/javascript" th:src="@{/js/lib/highcharts/exporting.js}"></script>
  52. <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts-zh_CN.js}"></script>
  53. <style>
  54. a.cur {
  55. background: #0a6999;
  56. color: #fff;
  57. }
  58. </style>
  59. <script th:inline="javascript">
  60. $(function () {
  61. $(".highlight a").click(function () {
  62. $(this).addClass("cur").parent().siblings().find("a").removeClass("cur")
  63. })
  64. usage();
  65. satisfaction();
  66. });
  67. function search1() {
  68. usage();
  69. satisfaction();
  70. }
  71. //初始化左饼图
  72. var initLeftPie = {
  73. chart: {
  74. renderTo: 'left_container',
  75. plotBackgroundColor: null,
  76. plotBorderWidth: null,
  77. plotShadow: false
  78. },
  79. title: {
  80. text: '创新能力体检使用情况占比'
  81. },
  82. tooltip: {
  83. headerFormat: '',
  84. pointFormat: '{point.name}: <b>{point.y}</b> '
  85. },
  86. plotOptions: {
  87. pie: {
  88. allowPointSelect: true,
  89. cursor: 'pointer',
  90. dataLabels: {
  91. enabled: true,
  92. // 通过 format 或 formatter 来格式化数据标签显示
  93. //format: '值: {point.y} 占比 {point.percentage} %',
  94. formatter: function () {
  95. //this 为当前的点(扇区)对象,可以通过 console.log(this) 来查看详细信息
  96. return '<span"> ' + this.point.name + ':' + this.y + '</span>';
  97. }
  98. },
  99. showInLegend: true // 显示在图例中
  100. },
  101. series: {
  102. animation: {
  103. duration: 2000
  104. }
  105. }
  106. },
  107. series: [{
  108. type: 'pie',
  109. name: ''
  110. }]
  111. };
  112. //初始化右饼图
  113. var initRightPie = {
  114. chart: {
  115. renderTo: 'right_container',
  116. plotBackgroundColor: null,
  117. plotBorderWidth: null,
  118. plotShadow: false
  119. },
  120. title: {
  121. text: '企业诊断报告满意度占比'
  122. },
  123. tooltip: {
  124. headerFormat: '',
  125. pointFormat: '{point.name}: <b>{point.y}</b> '
  126. },
  127. plotOptions: {
  128. pie: {
  129. allowPointSelect: true,
  130. cursor: 'pointer',
  131. dataLabels: {
  132. enabled: true,
  133. // 通过 format 或 formatter 来格式化数据标签显示
  134. //format: '值: {point.y} 占比 {point.percentage} %',
  135. formatter: function () {
  136. //this 为当前的点(扇区)对象,可以通过 console.log(this) 来查看详细信息
  137. return '<span"> ' + this.point.name + ':' + this.y + '</span>';
  138. }
  139. },
  140. showInLegend: true // 显示在图例中
  141. },
  142. series: {
  143. animation: {
  144. duration: 2000
  145. }
  146. }
  147. },
  148. series: [{
  149. type: 'pie',
  150. name: ''
  151. }]
  152. };
  153. //申请单据占比
  154. function usage() {
  155. $.ajax({
  156. type: "post",
  157. dataType: "json",
  158. data: {
  159. begin_date: $("#begin_date").val(),
  160. end_date: $("#end_date").val()
  161. },
  162. url: pagePath + "/policy/diagnostic/usage",
  163. success: function (result) {
  164. if (result.success) {
  165. var data = result.obj;
  166. var chart = new Highcharts.Chart(initLeftPie);
  167. chart.series[0].setData(data);
  168. } else {
  169. errorMessage(result.message);
  170. }
  171. },
  172. error: function () {
  173. errorMessage('系统错误!');
  174. }
  175. });
  176. }
  177. function satisfaction() {
  178. $.ajax({
  179. type: "post",
  180. dataType: "json",
  181. data: {
  182. begin_date: $("#begin_date").val(),
  183. end_date: $("#end_date").val(),
  184. projectType: $("#projectType").val()
  185. },
  186. url: pagePath + "/policy/diagnostic/satisfaction",
  187. success: function (result) {
  188. if (result.success) {
  189. var data = result.obj;
  190. var chart = new Highcharts.Chart(initRightPie);
  191. chart.series[0].setData(data);
  192. var subtitle = {
  193. text: "<div style='height: 24px'></div>",
  194. useHTML: true
  195. };
  196. chart.setSubtitle(subtitle);
  197. } else {
  198. errorMessage(result.message);
  199. }
  200. },
  201. error: function () {
  202. errorMessage('系统错误!');
  203. }
  204. });
  205. }
  206. var startDate = laydate.render({
  207. elem: '#begin_date', //指定元素
  208. done: function (value, date) {
  209. if (value !== '') {
  210. endDate.config.min.year = date.year;
  211. endDate.config.min.month = date.month - 1;
  212. endDate.config.min.date = date.date;
  213. endDate.config.min.hours = date.hours;
  214. endDate.config.min.minutes = date.minutes;
  215. endDate.config.min.seconds = date.seconds;
  216. } else {
  217. endDate.config.min.year = '1900';
  218. endDate.config.min.month = '0';
  219. endDate.config.min.date = '1';
  220. endDate.config.min.hours = '0';
  221. endDate.config.min.minutes = '0';
  222. endDate.config.min.seconds = '0';
  223. }
  224. }
  225. });
  226. var endDate = laydate.render({
  227. elem: '#end_date', //指定元素
  228. done: function (value, date) {
  229. if (value !== '') {
  230. startDate.config.max.year = date.year;
  231. startDate.config.max.month = date.month - 1;
  232. startDate.config.max.date = date.date;
  233. startDate.config.max.hours = date.hours;
  234. startDate.config.max.minutes = date.minutes;
  235. startDate.config.max.seconds = date.seconds;
  236. } else {
  237. startDate.config.max.year = '2100';
  238. startDate.config.max.month = '0';
  239. startDate.config.max.date = '1';
  240. startDate.config.max.hours = '0';
  241. startDate.config.max.minutes = '0';
  242. startDate.config.max.seconds = '0';
  243. }
  244. }
  245. });
  246. </script>
  247. </body>
  248. </html>