fpdetail.jsp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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 mydataFpdetail;
  5. $(document).ready( function() {
  6. fpdetailList(); //加载jqgrid
  7. panelS = $("body").layout("panel","south").panel();
  8. $("#fpdetaillist").jqGrid("setGridHeight",panelS.height()-60);
  9. $("#fpdetaillist").jqGrid("setGridWidth",document.body.clientWidth - 30);
  10. });
  11. //jqgrid初始化
  12. function fpdetailList(){
  13. jQuery("#fpdetaillist").jqGrid({
  14. datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  15. height: 120, //高度
  16. colNames:["主键","饲料名称","是否补料","重量","早班1重量","早班1载重", "早班2重量","早班2载重","中班1重量","中班1载重","中班2重量","中班2载重", "晚班1重量","晚班1载重","晚班2重量","晚班2载重"], //列名
  17. colModel:[
  18. {
  19. name: "ID",
  20. index: "ID",
  21. align: "center",
  22. sorttype: "string",
  23. editable: false,
  24. hidden: true
  25. //editoptions:{readonly:true} 如果要显示该列可以设置只读
  26. },
  27. {
  28. name: "FNAME",
  29. index: "FNAME",
  30. align: "center",
  31. sorttype: "string",
  32. editable: false
  33. },
  34. {
  35. name: "isSupplyFeed",
  36. index: "isSupplyFeed",
  37. align: "center",
  38. sorttype: "string",
  39. editable: false,hidden: true
  40. },
  41. {
  42. name: "FWEIGHR",
  43. index: "FWEIGHR",
  44. align: "center",
  45. sorttype: "string",
  46. editable: false
  47. },
  48. {
  49. name: "w1",
  50. index: "w1",
  51. align: "center",
  52. sorttype: "string",
  53. editable: false
  54. },
  55. {
  56. name: "w1sum",
  57. index: "w1sum",
  58. align: "center",
  59. sorttype: "string",
  60. editable: false
  61. },
  62. {
  63. name: "w2",
  64. index: "w2",
  65. align: "center",
  66. sorttype: "string",
  67. editable: false,hidden: true
  68. },
  69. {
  70. name: "w2sum",
  71. index: "w2sum",
  72. align: "center",
  73. sorttype: "string",
  74. editable: false,hidden: true
  75. },
  76. {
  77. name: "w3",
  78. index: "w3",
  79. align: "center",
  80. sorttype: "string",
  81. editable: false
  82. },
  83. {
  84. name: "w3sum",
  85. index: "w3sum",
  86. align: "center",
  87. sorttype: "string",
  88. editable: false
  89. },
  90. {
  91. name: "w4",
  92. index: "w4",
  93. align: "center",
  94. sorttype: "string",
  95. editable: false,hidden: true
  96. },
  97. {
  98. name: "w4sum",
  99. index: "w4sum",
  100. align: "center",
  101. sorttype: "string",
  102. editable: false,hidden: true
  103. },
  104. {
  105. name: "w5",
  106. index: "w5",
  107. align: "center",
  108. sorttype: "string",
  109. editable: false
  110. },
  111. {
  112. name: "w5sum",
  113. index: "w5sum",
  114. align: "center",
  115. sorttype: "string",
  116. editable: false
  117. },
  118. {
  119. name: "w6",
  120. index: "w6",
  121. align: "center",
  122. sorttype: "string",
  123. editable: false,hidden: true
  124. },
  125. {
  126. name: "w6sum",
  127. index: "w6sum",
  128. align: "center",
  129. sorttype: "string",
  130. editable: false,hidden: true
  131. }
  132. ],
  133. pager: "#page1", //#page分页控件绑定的位置对象
  134. pginput: false, //不显示分页文本框
  135. pgbuttons: false, //不显示翻页按钮
  136. rowNum: 1000, //每页显示条数
  137. autowidth: true //自动调节宽度
  138. });
  139. //获取数据集
  140. mydataFpdetail = getFpdetailLists();
  141. if(mydataFpdetail!=null){
  142. for(var i=0;i<=mydataFpdetail.length;i++){
  143. jQuery("#fpdetaillist").jqGrid('addRowData',i+1,mydataFpdetail[i]);
  144. }
  145. jQuery("#fpdetaillist").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
  146. }
  147. var isEnableSupplyFeed = $("#isEnableSupplyFeed").val();
  148. var isMorningPart = $("#isMorningPart").val();
  149. var isNoonPart = $("#isNoonPart").val();
  150. var isNightPart = $("#isNightPart").val();
  151. if(isEnableSupplyFeed == 1){
  152. $("#fpdetaillist").jqGrid("showCol","isSupplyFeed");
  153. }
  154. if(isMorningPart == 1){
  155. $("#fpdetaillist").jqGrid("showCol","w2");
  156. $("#fpdetaillist").jqGrid("showCol","w2sum");
  157. }
  158. if(isNoonPart == 1){
  159. $("#fpdetaillist").jqGrid("showCol","w4");
  160. $("#fpdetaillist").jqGrid("showCol","w4sum");
  161. }
  162. if(isNightPart == 1){
  163. $("#fpdetaillist").jqGrid("showCol","w6");
  164. $("#fpdetaillist").jqGrid("showCol","w6sum");
  165. }
  166. }
  167. //获取服务器数据
  168. function getFpdetailLists(){
  169. var currentFpId = $("#currentFpId").val();
  170. $.ajax({
  171. async: false,
  172. type: 'POST',
  173. dataType:'json', //返回类型json
  174. url: "${contextPath }/admin/recipeplan/fpdetaillist.html?currentFpId="+currentFpId,
  175. error: function(){alert("系统错误");},
  176. success: function(json){
  177. mydataFpdetail = json;
  178. }
  179. });
  180. return mydataFpdetail;
  181. }
  182. </script>
  183. <input type="hidden" id="currentFpId" name="currentFpId" value="${currentFpId }" />
  184. <input type="hidden" id="isEnableSupplyFeed" name="isEnableSupplyFeed" value="${isEnableSupplyFeed }" />
  185. <input type="hidden" id="isMorningPart" name="isMorningPart" value="${isMorningPart }" />
  186. <input type="hidden" id="isNoonPart" name="isNoonPart" value="${isNoonPart }" />
  187. <input type="hidden" id="isNightPart" name="isNightPart" value="${isNightPart }" />
  188. <table id="fpdetaillist"></table>
  189. <div id="page1"></div>