producedAbnormalityStatistics.ftl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <style>
  10. .charts-box{width:500px;height:400px;display: inline-block;position: relative;margin-right: 40px;margin-bottom: 40px;}
  11. .my-nav{width: 100%;height: 48px;background: #fff;display: table;text-align: center;}
  12. .my-nav>a{display: table-cell;vertical-align: middle; border: 1px solid #32a3d8;font-size: 15px;border-left: 0;color: #32a3d8;}
  13. .my-nav>a:first-child{border-left: 1px solid #32a3d8;}
  14. .my-nav>a.active{background-color: #32a3d8;color:#fff;}
  15. </style>
  16. <title>生产统计</title>
  17. <#include "/base/list_base.ftl">
  18. </head>
  19. <body>
  20. <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 统计管理 <span class="c-gray en">&gt;</span> 生产统计 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px;background-color: #32a3d8;border: 1px solid #32a3d8;" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
  21. <div class="pd-20">
  22. <div style="width: 250px;margin-bottom: 20px;">
  23. <nav class="my-nav" id="tab-nav-menu">
  24. <a <#if machineType == '1'>class="active" </#if> onclick="machineTypeNormal(1);">净水机</a><a <#if machineType == '2'>class="active" </#if> onclick="machineTypeNormal(2);">冲奶机</a>
  25. </nav>
  26. </div>
  27. <div>
  28. <div class="charts-box">
  29. <div id="container" style="width:500px;height:400px;display: inline-block;"></div>
  30. </div>
  31. <div class="charts-box">
  32. <div id="container1" style="width:500px;height:400px;display: inline-block;"></div>
  33. </div>
  34. </div>
  35. <div>
  36. <div class="charts-box" style="height: 478px;background-color: #f5f5f5;">
  37. <div style="margin: 15px;">
  38. <nav class="my-nav" id="tab-nav-map">
  39. <#list processList as list>
  40. <a name="${list.processId }" <#if list_index == 0>class="active"</#if> >${list.processName }</a>
  41. </#list>
  42. </nav>
  43. </div>
  44. <div id="container3" style="width:500px;height:400px;display: inline-block;"></div>
  45. </div>
  46. <div class="charts-box" style="height: 478px;">
  47. <div id="container2" style="width:500px;height:478px;display: inline-block;"></div>
  48. </div>
  49. </div>
  50. </div>
  51. <script type="text/javascript" src="${path}/common/lib/hcharts/Highcharts/5.0.6/js/highcharts.js"></script>
  52. <!--<script type="text/javascript" src="lib/Highcharts/4.1.7/js/modules/exporting.js"></script>-->
  53. <script type="text/javascript">
  54. $(function () {
  55. });
  56. var chart =new Highcharts.Chart('container', {
  57. chart: {
  58. type: 'column',
  59. backgroundColor:'#f5f5f5'
  60. },
  61. title: {
  62. text: '每月生产数量'
  63. },
  64. subtitle: {
  65. text: ''
  66. },
  67. xAxis: {
  68. categories: [
  69. '一月',
  70. '二月',
  71. '三月',
  72. '四月',
  73. '五月',
  74. '六月',
  75. '七月',
  76. '八月',
  77. '九月',
  78. '十月',
  79. '十一月',
  80. '十二月'
  81. ]
  82. },
  83. legend: {
  84. enabled: false
  85. },
  86. yAxis: {
  87. min: 0,
  88. title: {
  89. text: '数量'
  90. }
  91. },
  92. tooltip: {
  93. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  94. pointFormat: '<tr><td style="color:{series.color};padding:0"> </td>' +
  95. '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
  96. footerFormat: '</table>',
  97. shared: true,
  98. useHTML: true
  99. },
  100. plotOptions: {
  101. column: {
  102. pointPadding: 0.2,
  103. borderWidth: 0
  104. }
  105. },
  106. series: [{
  107. name: ' ',
  108. data: ${years!''}
  109. }]
  110. });
  111. var chart1 =new Highcharts.Chart('container1', {
  112. chart: {
  113. type: 'column',
  114. backgroundColor:'#f5f5f5'
  115. },
  116. title: {
  117. text: '七天每日生产数量'
  118. },
  119. subtitle: {
  120. text: ''
  121. },
  122. xAxis: {
  123. categories: ${monthDay!''}
  124. },
  125. legend: {
  126. enabled: false
  127. },
  128. yAxis: {
  129. min: 0,
  130. title: {
  131. text: '数量'
  132. }
  133. },
  134. tooltip: {
  135. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  136. pointFormat: '<tr></td>' +
  137. '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
  138. footerFormat: '</table>',
  139. shared: true,
  140. useHTML: true
  141. },
  142. plotOptions: {
  143. column: {
  144. pointPadding: 0.2,
  145. borderWidth: 0
  146. }
  147. },
  148. series: [{
  149. name: ' ',
  150. data: ${days!''}
  151. }]
  152. });
  153. var chart2 =new Highcharts.Chart('container2', {
  154. chart: {
  155. plotBackgroundColor: null,
  156. plotBorderWidth: null,
  157. plotShadow: false,
  158. backgroundColor:'#f5f5f5'
  159. },
  160. title: {
  161. text: '流程异常'
  162. },
  163. subtitle: {
  164. text: '共生产台${machineNum!''}机器,${machineAbnormality!''}台流程异常<span style="color:#fba62e;">异常率${abnormalityPercentage!''}%</span>'
  165. },
  166. tooltip: {
  167. pointFormat: '<b>{point.percentage:.1f}%</b>'
  168. },
  169. plotOptions: {
  170. pie: {
  171. allowPointSelect: true,
  172. cursor: 'pointer',
  173. dataLabels: {
  174. enabled: true,
  175. color: '#000000',
  176. connectorColor: '#000000',
  177. format: '{point.percentage:.1f} %'
  178. }
  179. }
  180. },
  181. series: [{
  182. type: 'pie',
  183. name: 'Browser share',
  184. colors: ['#2adaa7', '#fba62e', '#90ed7d', '#f7a35c', '#8085e9', '#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1'],
  185. data: [
  186. ['正常', ${normalPercentage!''}],
  187. {
  188. name: '异常',
  189. y: ${abnormalityPercentage!''},
  190. sliced: true,
  191. selected: true
  192. },
  193. ]
  194. }]
  195. });
  196. var chart3 =new Highcharts.Chart('container3', {
  197. chart: {
  198. type: 'column',
  199. backgroundColor:'#f5f5f5'
  200. },
  201. title: {
  202. text: ''
  203. },
  204. subtitle: {
  205. text: ''
  206. },
  207. xAxis: {
  208. categories: ${desString!''}
  209. },
  210. legend: {
  211. enabled: false
  212. },
  213. yAxis: {
  214. min: 0,
  215. title: {
  216. text: '类型'
  217. }
  218. },
  219. tooltip: {
  220. headerFormat: '<span style="font-size:10px">{point.key} :</span><table>',
  221. pointFormat: '<tr>' +
  222. '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
  223. footerFormat: '</table>',
  224. shared: false,
  225. useHTML: false
  226. },
  227. plotOptions: {
  228. column: {
  229. pointPadding: 0.2,
  230. borderWidth: 0
  231. }
  232. },
  233. series: [{
  234. name: ' ',
  235. data: ${nodeString!''}
  236. }]
  237. });
  238. //按钮切换
  239. $(document).on('click', '#tab-nav-menu>a', function() {
  240. $(this).addClass("active").siblings().removeClass("active");
  241. //这里写更新1,2,3,4图数据的代码,逻辑自己判断
  242. });
  243. $(document).on('click', '#tab-nav-map>a', function() {
  244. $(this).addClass("active").siblings().removeClass("active");
  245. var processId = $(this).attr("name");
  246. $.ajax({
  247. "type" : "post",
  248. "url" : "${path}/admin/machine/_node_normal",
  249. "dataType" : "json",
  250. "data" :{processId : processId},
  251. "success" : function(data) {
  252. if(data.returnCode == 200){
  253. var desString = eval(data.desString);
  254. var nodeString = eval(data.nodeString);
  255. chart3.update({
  256. chart: {
  257. type: 'column',
  258. backgroundColor:'#f5f5f5'
  259. },
  260. title: {
  261. text: ''
  262. },
  263. subtitle: {
  264. text: ''
  265. },
  266. xAxis: {
  267. categories: desString
  268. },
  269. legend: {
  270. enabled: false
  271. },
  272. yAxis: {
  273. min: 0,
  274. title: {
  275. text: '类型'
  276. }
  277. },
  278. tooltip: {
  279. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  280. pointFormat: '<tr><td style="color:{series.color};padding:0"> </td>' +
  281. '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
  282. footerFormat: '</table>',
  283. shared: false,
  284. useHTML: false
  285. },
  286. plotOptions: {
  287. column: {
  288. pointPadding: 0.2,
  289. borderWidth: 0
  290. }
  291. },
  292. series: [{
  293. name: ' ',
  294. data: nodeString
  295. }]
  296. });
  297. }else{
  298. layer.msg('查询失败', {icon: 2, time: 2000});
  299. }
  300. },
  301. "error":function(data){
  302. layer.msg('操作失败', {icon: 2, time: 2000});
  303. }
  304. });
  305. });
  306. function machineTypeNormal(machineType) {
  307. window.location.href=root_path + '/admin/machine/_produced_abnormality_statistics?machineType='+machineType;
  308. }
  309. </script>
  310. </body>
  311. </html>