reeorchart.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <%@ page contentType="text/html; charset=utf-8" session="false" %>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>我的工作台</title>
  6. <%@ include file="../common/header.jsp" %>
  7. <link type="text/css" rel="stylesheet" href="${contextPath}/css/themes/easyui.css" />
  8. <script type="text/javascript" src="${contextPath }/js/jquery.easyui.min.js"></script>
  9. <script type="text/javascript" src="${contextPath}/js/highcharts.js"></script>
  10. <script type="text/javascript" src="${contextPath}/js/exporting.js"></script>
  11. <script type="text/javascript">
  12. var mydata,minWeight,xStr,Series,Aw,Ll,chart,chartHeight,chartWidth,panelCHeight=0,panelSHeight=0,panelStatus = 1;
  13. $(document).ready( function() {
  14. loadList(); //加载jqgrid
  15. $("#list").jqGrid("setGridWidth",$(window).width()*0.32);
  16. $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
  17. $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
  18. $("#list").jqGrid("setSelection",1);
  19. $("#dl1Result").load("${contextPath }/admin/statistics/process1.html");
  20. $("#dl2Result").load("${contextPath }/admin/statistics/process2.html");
  21. $("body").layout("panel","south").panel({
  22. onClose: function(){
  23. panelC = $("body").layout("panel","center").panel();
  24. $("#list").jqGrid("setGridWidth",$(window).width()*0.33);
  25. $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
  26. $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
  27. $("#list").jqGrid("setGridHeight",panelC.height()-60);
  28. $("#p1list").jqGrid("setGridHeight",panelC.height()-80);
  29. $("#p2list").jqGrid("setGridHeight",panelC.height()-80);
  30. panelStatus = 0;
  31. },
  32. onOpen: function(){
  33. if(panelCHeight == 0){
  34. panelStatus = 1;
  35. panelC = $("body").layout("panel","center").panel();
  36. panelCHeight = panelC.height();
  37. panelSHeight = $(window).height() - panelC.height();
  38. chartWidth = $(window).width()*0.99;
  39. chartHeight = panelSHeight*0.85;
  40. loadChart(); //加载点线图
  41. }
  42. },
  43. onResize: function(){
  44. panelS = $("body").layout("panel","south").panel();
  45. panelCHeight = $(window).height() - panelS.height();
  46. $("#list").jqGrid("setGridHeight",panelCHeight-70);
  47. $("#p1list").jqGrid("setGridHeight",panelCHeight-90);
  48. $("#p2list").jqGrid("setGridHeight",panelCHeight-90);
  49. $("#list").jqGrid("setGridWidth",$(window).width()*0.33);
  50. $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
  51. $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
  52. chartWidth = $(window).width()*0.99;
  53. chartHeight = panelS.height()*0.99;
  54. loadChart(); //加载点线图
  55. }
  56. });
  57. });
  58. $(window).resize(function(){
  59. panelS = $("body").layout("panel","south").panel();
  60. $("#list").jqGrid("setGridHeight",panelCHeight-110);
  61. $("#p1list").jqGrid("setGridHeight",panelCHeight-130);
  62. $("#p2list").jqGrid("setGridHeight",panelCHeight-130);
  63. $("#list").jqGrid("setGridWidth",$(window).width()*0.32);
  64. $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
  65. $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
  66. chartWidth = $(window).width()*0.99;
  67. chartHeight = panelS.height()*0.99;
  68. loadChart(); //加载点线图
  69. });
  70. //jqgrid初始化
  71. function loadList(){
  72. jQuery("#list").jqGrid({
  73. datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  74. height: 170, //高度
  75. colNames:["主键","TMR","计划名称", "制定日期", "开始时间", "DataCaptureNo", "lastInTime","ActualWeight"], //列名
  76. colModel:[
  77. {
  78. name: "ID",
  79. index: "ID",
  80. width: 10,
  81. align: "center",
  82. sorttype: "string",
  83. hidden: true
  84. },
  85. {
  86. name: "TNAME",
  87. index: "TNAME",
  88. width: 50,
  89. align: "center",
  90. sorttype: "string"
  91. },
  92. {
  93. name: "ProjName",
  94. index: "ProjName",
  95. width: 70,
  96. align: "center",
  97. sorttype: "string"
  98. },
  99. {
  100. name: "Mydate",
  101. index: "Mydate",
  102. width: 80,
  103. align: "center",
  104. sorttype: "string"
  105. },
  106. {
  107. name: "InTime",
  108. index: "InTime",
  109. width: 150,
  110. align: "center",
  111. sorttype: "string"
  112. },
  113. {
  114. name: "DataCaptureNo",
  115. index: "DataCaptureNo",
  116. width: 10,
  117. align: "center",
  118. sorttype: "string",
  119. hidden: true
  120. },
  121. {
  122. name: "lastInTime",
  123. index: "lastInTime",
  124. width: 10,
  125. align: "center",
  126. sorttype: "string",
  127. hidden: true
  128. },
  129. {
  130. name: "ActualWeight",
  131. index: "ActualWeight",
  132. width: 10,
  133. align: "center",
  134. sorttype: "string",
  135. hidden: true
  136. }
  137. ],
  138. onSelectRow: function(rowid){
  139. var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
  140. var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
  141. $("#currentpId").val(rowData.ID);
  142. $("#dl1Result").load("${contextPath }/admin/statistics/process1.html");
  143. $("#dl2Result").load("${contextPath }/admin/statistics/process2.html");
  144. //获取点线图的数据
  145. $.ajax({
  146. async: false,
  147. type: "POST",
  148. dataType: "json", //返回类型json
  149. data: "beginDate="+rowData.InTime+"&endDate="+rowData.lastInTime+"&SrcAddr="+rowData.DataCaptureNo+"&currentpId="+rowData.ID+"&ActualWeight="+rowData.ActualWeight,
  150. url: "${contextPath }/admin/statistics/pdxlist.html",
  151. error: function(){alert("系统错误");},
  152. success: function(json){
  153. if(json.status == "success"){
  154. minWeight = json.minWeight;
  155. xStr = json.MTime;
  156. Series = json.Weight;
  157. Aw = json.AW;
  158. Ll = json.Ll;
  159. }
  160. }
  161. });
  162. loadChart(); //加载点线图
  163. },
  164. /**
  165. * 设置水平滚动条 begin
  166. **/
  167. shrinkToFit:false,
  168. autoScroll: true,
  169. //width: 370,
  170. autowidth: true, //自动调节宽度
  171. rowNum: 1000, //每页显示条数
  172. /**
  173. * 设置水平滚动条 end
  174. **/
  175. altRows: true, //设置表格是否允许行交替变色值
  176. altclass:"tdbgmouseover" //自定义隔行变色的样式
  177. });
  178. //获取数据集
  179. mydata = getLists();
  180. if(mydata!=null){
  181. for(var i=0;i<=mydata.length;i++){
  182. jQuery("#list").jqGrid("addRowData",i+1,mydata[i]);
  183. }
  184. //如果页面上没有分页工具条、就不要自动刷新一次了,不然数据显示不完全,jqgrid可能有默认每页显示的条数,如果想数据完全展示,
  185. //在自动刷新后并且没有页面分页工具条时必须给一个默认页面显示条数才可以。
  186. //rowNum: 10000, //每页显示条数
  187. //jQuery("#list").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
  188. }
  189. }
  190. //获取服务器数据
  191. function getLists(){
  192. var beginDate = $("#beginDate").val();
  193. var endDate = $("#endDate").val();
  194. var Times = $("#Times").val();
  195. var DataCaptureNo = $("#DataCaptureNo").val();
  196. var DriverID = $("#DriverID").val();
  197. $.ajax({
  198. async: false,
  199. type: "POST",
  200. dataType: "json", //返回类型json
  201. data: "beginDate="+beginDate+"&endDate="+endDate+"&Times="+Times+"&DataCaptureNo="+DataCaptureNo+"&DriverID="+DriverID,
  202. url: "${contextPath }/admin/statistics/reeorchartlist.html",
  203. error: function(){alert("系统错误");},
  204. success: function(json){
  205. mydata = json;
  206. }
  207. });
  208. return mydata;
  209. }
  210. //Chart初始化
  211. function loadChart(){
  212. chart = new Highcharts.Chart({
  213. chart: {
  214. backgroundColor:"#FFFFEF",
  215. shadow: true,
  216. renderTo: "container",
  217. type: "spline",
  218. zoomType: "x,y",
  219. height: chartHeight,
  220. width: chartWidth
  221. },
  222. navigation: {
  223. buttonOptions: {
  224. enabled: false
  225. }
  226. },
  227. lang: {
  228. loading: "请稍等……",
  229. printButtonTitle: "打印",
  230. resetZoom: "缩放比例",
  231. resetZoomTitle: "缩放比例",
  232. exportButtonTitle: "导出",
  233. downloadPNG: "PNG格式导出",
  234. downloadJPEG: "JPEG格式导出",
  235. downloadPDF: "PDF格式导出",
  236. downloadSVG: "SVG格式导出"
  237. },
  238. title: {
  239. text: "过程分析",
  240. x: -20 //center
  241. },
  242. xAxis: {
  243. categories: xStr,
  244. labels: {
  245. step: 20
  246. }
  247. },
  248. yAxis: {
  249. title: {
  250. text: "重量(kg)"
  251. },
  252. min: minWeight,
  253. tickInterval: 1000 //坐标轴刻度间距:tickPixelInterval像素距离、tickInterval数值距离
  254. },
  255. tooltip: {
  256. crosshairs: true, //鼠标移动x轴显示虚线
  257. formatter: function() {
  258. return "<b>"+ this.series.name +"</b><br/>"+
  259. this.x +" "+ this.y +"kg";
  260. }
  261. },
  262. legend: {
  263. layout: "vertical",
  264. align: "right",
  265. verticalAlign: "top",
  266. x: -10,
  267. y: 100,
  268. borderWidth: 1,
  269. itemMarginBottom: 5
  270. },
  271. plotOptions: {
  272. series: {
  273. animation: false
  274. },
  275. spline: {
  276. lineWidth: 1,
  277. states: {
  278. hover: {
  279. lineWidth: 1
  280. }
  281. },
  282. marker: {
  283. enabled: false,
  284. states: {
  285. hover: {
  286. enabled: false,
  287. radius: 1,
  288. lineWidth: 1
  289. }
  290. }
  291. }
  292. }
  293. },
  294. series: [
  295. {
  296. name: "重量",
  297. data: Series
  298. },
  299. {
  300. type: "scatter",
  301. name: "实际重量",
  302. data: Aw,
  303. marker: {
  304. radius: 4
  305. },
  306. color: "#BE77FF"
  307. },
  308. {
  309. name: "理论重量",
  310. step: "right",
  311. data: Ll,
  312. marker: {
  313. radius: 3
  314. },
  315. color: "#EA0000"
  316. }
  317. ]
  318. });
  319. }
  320. </script>
  321. </head>
  322. <body class="easyui-layout">
  323. <div region="center" style="padding:5px;background:#eee;">
  324. <table cellspacing="1" cellpadding="0" border="0" style="width: 100%;">
  325. <tr>
  326. <td width="33%">
  327. <input type="hidden" id="currentpId" name="currentpId" value="${currentpId }" />
  328. <input type="hidden" id="beginDate" name="beginDate" value="${beginDate }" />
  329. <input type="hidden" id="endDate" name="endDate" value="${endDate }" />
  330. <input type="hidden" id="Times" name="Times" value="${Times }" />
  331. <input type="hidden" id="DataCaptureNo" name="DataCaptureNo" value="${DataCaptureNo }" />
  332. <input type="hidden" id="DriverID" name="DriverID" value="${DriverID }" />
  333. <table id="list"></table>
  334. </td>
  335. <td width="33%"><div id="dl1Result"></div></td>
  336. <td width="33%"><div id="dl2Result"></div></td>
  337. </tr>
  338. </table>
  339. </div>
  340. <div region="south" split="true" title="监控图" style="height:320px;">
  341. <table cellspacing="1" cellpadding="0" border="0" style="width: 99%;">
  342. <tr>
  343. <td><div id="container"></div></td>
  344. </tr>
  345. </table>
  346. </div>
  347. </body>
  348. </html>