process1.jsp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <%@ page contentType="text/html; charset=utf-8" session="false" %>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3. <script type="text/javascript">
  4. var mydataP1;
  5. $(document).ready( function() {
  6. loadFtdetailList(); //加载jqgrid
  7. if(panelStatus == 0){
  8. panelC = $("body").layout("panel","center").panel();
  9. $("#list").jqGrid("setGridWidth",$(window).width()*0.33);
  10. $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
  11. $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
  12. $("#list").jqGrid("setGridHeight",panelC.height()-60);
  13. $("#p1list").jqGrid("setGridHeight",panelC.height()-80);
  14. $("#p2list").jqGrid("setGridHeight",panelC.height()-80);
  15. }else{
  16. panelS = $("body").layout("panel","south").panel();
  17. panelCHeight = $(window).height() - panelS.height();
  18. $("#list").jqGrid("setGridHeight",panelCHeight-110);
  19. $("#p1list").jqGrid("setGridHeight",panelCHeight-130);
  20. $("#p2list").jqGrid("setGridHeight",panelCHeight-130);
  21. $("#list").jqGrid("setGridWidth",$(window).width()*0.33);
  22. $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
  23. $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
  24. }
  25. });
  26. //jqgrid初始化
  27. function loadFtdetailList(){
  28. jQuery("#p1list").jqGrid({
  29. datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  30. height: 100, //高度
  31. colNames:["主键","操作编号","计划重量","实际重量", "代表成分", "完成时间", "过程时间", "开始读数重量", "最后读数重量","方式","wc"], //列名
  32. colModel:[
  33. {
  34. name: "ID",
  35. index: "ID",
  36. align: "center",
  37. sorttype: "string",
  38. hidden: true
  39. },
  40. {
  41. name: "SORT",
  42. index: "SORT",
  43. width: 50,
  44. align: "center",
  45. sorttype: "string"
  46. },
  47. {
  48. name: "LWEIGHT",
  49. index: "LWEIGHT",
  50. width: 70,
  51. align: "center",
  52. sorttype: "string"
  53. },
  54. {
  55. name: "ActualWeightMinus",
  56. index: "ActualWeightMinus",
  57. width: 70,
  58. align: "center",
  59. sorttype: "string"
  60. },
  61. {
  62. name: "FNAME",
  63. index: "FNAME",
  64. width: 70,
  65. align: "center",
  66. sorttype: "string"
  67. },
  68. {
  69. name: "InTime",
  70. index: "InTime",
  71. width: 70,
  72. align: "center",
  73. sorttype: "string"
  74. },
  75. {
  76. name: "processTime",
  77. index: "processTime",
  78. width: 70,
  79. align: "center",
  80. sorttype: "string"
  81. },
  82. {
  83. name: "LastActualWeight",
  84. index: "LastActualWeight",
  85. width: 70,
  86. align: "center",
  87. sorttype: "string"
  88. },
  89. {
  90. name: "ActualWeight",
  91. index: "ActualWeight",
  92. width: 70,
  93. align: "center",
  94. sorttype: "string"
  95. },
  96. {
  97. name: "ButtonType",
  98. index: "ButtonType",
  99. width: 70,
  100. align: "center",
  101. sorttype: "string"
  102. },
  103. {
  104. name: "isWc",
  105. index: "isWc",
  106. align: "center",
  107. sorttype: "string",
  108. hidden: true
  109. }
  110. ],
  111. afterInsertRow: function(rowid,rowdata,rowelem){
  112. if(rowdata.isWc == 1){
  113. $("#p1list").setCell(rowid,1,"",{background:'#FFE66F'});
  114. $("#p1list").setCell(rowid,2,"",{background:'#FFE66F'});
  115. $("#p1list").setCell(rowid,3,"",{background:'#FFE66F'});
  116. $("#p1list").setCell(rowid,4,"",{background:'#FFE66F'});
  117. $("#p1list").setCell(rowid,5,"",{background:'#FFE66F'});
  118. $("#p1list").setCell(rowid,6,"",{background:'#FFE66F'});
  119. $("#p1list").setCell(rowid,7,"",{background:'#FFE66F'});
  120. $("#p1list").setCell(rowid,8,"",{background:'#FFE66F'});
  121. }
  122. },
  123. footerrow: true, //统计运算的功能
  124. gridComplete: completeMethod,
  125. /**
  126. * 设置水平滚动条 begin
  127. **/
  128. shrinkToFit:false,
  129. autoScroll: true,
  130. width: 370,
  131. //autowidth: true, //自动调节宽度
  132. rowNum: 1000, //每页显示条数
  133. /**
  134. * 设置水平滚动条 end
  135. **/
  136. altRows: true, //设置表格是否允许行交替变色值
  137. altclass:"tdbgmouseover" //自定义隔行变色的样式
  138. });
  139. //获取数据集
  140. mydataP1 = getFtdetailLists();
  141. if(mydataP1!=null){
  142. for(var i=0;i<=mydataP1.length;i++){
  143. jQuery("#p1list").jqGrid('addRowData',i+1,mydataP1[i]);
  144. }
  145. }
  146. }
  147. //获取服务器数据
  148. function getFtdetailLists(){
  149. var currentpId = $("#currentpId").val();
  150. $.ajax({
  151. async: false,
  152. type: 'POST',
  153. dataType:'json', //返回类型json
  154. url: "${contextPath }/admin/statistics/process1list.html?currentpId="+currentpId,
  155. error: function(){alert("系统错误");},
  156. success: function(json){
  157. mydataP1 = json;
  158. }
  159. });
  160. return mydataP1;
  161. }
  162. //页脚统计
  163. function completeMethod(){
  164. var sum_lweight=$("#p1list").getCol("LWEIGHT",false,"sum");
  165. var sum_awm=$("#p1list").getCol("ActualWeightMinus",false,"sum");
  166. $("#p1list").footerData("set", {SORT:"合计:", LWEIGHT: sum_lweight.toFixed(2)});
  167. $("#p1list").footerData("set", {ActualWeightMinus: sum_awm.toFixed(2)});
  168. }
  169. </script>
  170. <table id="p1list"></table>