lpplandel.jsp 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <%@ page contentType="text/html; charset=utf-8" session="false" %>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
  4. <head>
  5. <title>我的工作台</title>
  6. <%@ include file="../common/header.jsp" %>
  7. <script type="text/javascript" src="${contextPath }/js/calendar/WdatePicker.js"></script>
  8. <link type="text/css" rel="stylesheet" href="${contextPath}/css/themes/easyui.css" />
  9. <script type="text/javascript" src="${contextPath }/js/jquery.easyui.min.js"></script>
  10. <script type="text/javascript" language="javascript" src="${contextPath}/js/highslide.js"></script>
  11. <script type="text/javascript">
  12. var mydata,currentId="",loadfl2=0,loadfl3=0,loadfl4=0,loadfl5=0,loadfl6=0,loadfl7=0,loadfl8=0,loadfl9=0,loadfl10=0,loadfl11=0,loadfl12=0,loadfl13=0,loadfl14=0,loadfl15=0,loadfl16=0,panelCHeight=0,panelSHeight=0;
  13. $(document).ready( function() {
  14. loadList(); //加载jqgrid
  15. $("#list").jqGrid("setGridHeight",$(window).height() - 80);
  16. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  17. });
  18. $(window).resize(function(){
  19. $("#list").jqGrid("setGridHeight",$(window).height() - 80);
  20. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  21. });
  22. //jqgrid初始化
  23. function loadList(){
  24. jQuery("#list").jqGrid({
  25. datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  26. height: 150, //高度
  27. colNames:["主键","日期","计划名称","TMR", "驾驶员", "已执行", "班次", "发料顺序", "理论量","发料1","发料2","发料3","发料4","发料5","发料6","发料7","发料8","发料9","发料10","发料11","发料12","发料13","发料14","发料15","发料16"], //列名
  28. colModel:[
  29. {
  30. name: "ID",
  31. index: "ID",
  32. width: 1,
  33. align: "center",
  34. sorttype: "string",
  35. hidden: true
  36. },
  37. {
  38. name: "Mydate",
  39. index: "Mydate",
  40. width: 70,
  41. align: "center",
  42. sorttype: "string"
  43. },
  44. {
  45. name: "ProjName",
  46. index: "ProjName",
  47. width: 70,
  48. align: "center",
  49. sorttype: "string"
  50. },
  51. {
  52. name: "TNAME",
  53. index: "TNAME",
  54. width: 70,
  55. align: "center",
  56. sorttype: "int"
  57. },
  58. {
  59. name: "DNAME",
  60. index: "DNAME",
  61. width: 70,
  62. align: "center",
  63. sorttype: "int",
  64. editable: false,
  65. edittype: "select",
  66. editoptions:{
  67. dataUrl: "${contextPath }/admin/basicdata/tmrselect.html"
  68. }
  69. },
  70. {
  71. name: "HaveButton", //对应数据库字段
  72. index: "HaveButton", //按照哪个字段进行排序
  73. width: 70,
  74. align: "center", //显示位置
  75. sorttype: "string", //字段类型
  76. formatter: "checkbox",
  77. formatoptions: {disabled:true},
  78. edittype: "checkbox", //可以编辑的类型。可选值:text, textarea, select, checkbox, password, button, image and file.
  79. editoptions: {value:"Yes:No"} //默认值 和下拉框的默认值不同
  80. },
  81. {
  82. name: "Times",
  83. index: "Times",
  84. width: 70,
  85. align: "center",
  86. sorttype: "string"
  87. },
  88. {
  89. name: "Sort",
  90. index: "Sort",
  91. width: 70,
  92. align: "center",
  93. sorttype: "string"
  94. },
  95. {
  96. name: "LWEIGHT",
  97. index: "LWEIGHT",
  98. width: 70,
  99. align: "center",
  100. sorttype: "string"
  101. },
  102. {name: "FL1",index: "FL1",width: 70,align: "center",sorttype: "string"},
  103. {name: "FL2",index: "FL2",width: 70,align: "center",sorttype: "string"},
  104. {name: "FL3",index: "FL3",width: 70,align: "center",sorttype: "string"},
  105. {name: "FL4",index: "FL4",width: 70,align: "center",sorttype: "string"},
  106. {name: "FL5",index: "FL5",width: 70,align: "center",sorttype: "string"},
  107. {name: "FL6",index: "FL6",width: 70,align: "center",sorttype: "string"},
  108. {name: "FL7",index: "FL7",width: 70,align: "center",sorttype: "string"},
  109. {name: "FL8",index: "FL8",width: 70,align: "center",sorttype: "string"},
  110. {name: "FL9",index: "FL9",width: 70,align: "center",sorttype: "string"},
  111. {name: "FL10",index: "FL10",width: 70,align: "center",sorttype: "string"},
  112. {name: "FL11",index: "FL11",width: 80,align: "center",sorttype: "string"},
  113. {name: "FL12",index: "FL12",width: 80,align: "center",sorttype: "string"},
  114. {name: "FL13",index: "FL13",width: 80,align: "center",sorttype: "string"},
  115. {name: "FL14",index: "FL14",width: 80,align: "center",sorttype: "string"},
  116. {name: "FL15",index: "FL15",width: 80,align: "center",sorttype: "string"},
  117. {name: "FL16",index: "FL16",width: 80,align: "center",sorttype: "string"}
  118. ],
  119. caption: "日执行计划垃圾箱", //标题
  120. cellEdit: false,
  121. pginput: false, //不显示分页文本框
  122. pgbuttons: false, //不显示翻页按钮
  123. autowidth: true, //自动调节宽度
  124. rowNum: 1000, //每页显示条数
  125. sortname: "SORT" //按SORT进行排序 默认asc
  126. });
  127. //获取数据集
  128. mydata = getLists();
  129. if(mydata!=null){
  130. for(var i=0;i<=mydata.length;i++){
  131. jQuery("#list").jqGrid('addRowData',i+1,mydata[i]);
  132. }
  133. jQuery("#list").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
  134. }
  135. var ids = $("#list").jqGrid("getDataIDs");
  136. for ( var i = 0; i < ids.length; i++) {
  137. var rowData = $("#list").jqGrid("getRowData",ids[i]);
  138. var FL2 = rowData.FL2.length;
  139. var FL3 = rowData.FL3.length;
  140. var FL4 = rowData.FL4.length;
  141. var FL5 = rowData.FL5.length;
  142. var FL6 = rowData.FL6.length;
  143. var FL7 = rowData.FL7.length;
  144. var FL8 = rowData.FL8.length;
  145. var FL9 = rowData.FL9.length;
  146. var FL10 = rowData.FL10.length;
  147. var FL11 = rowData.FL11.length;
  148. var FL12 = rowData.FL12.length;
  149. var FL13 = rowData.FL13.length;
  150. var FL14 = rowData.FL14.length;
  151. var FL15 = rowData.FL15.length;
  152. var FL16 = rowData.FL16.length;
  153. if(FL2 > 0){
  154. loadfl2++;
  155. }
  156. if(FL3 > 0){
  157. loadfl3++;
  158. }
  159. if(FL4 > 0){
  160. loadfl4++;
  161. }
  162. if(FL5 > 0){
  163. loadfl5++;
  164. }
  165. if(FL6 > 0){
  166. loadfl6++;
  167. }
  168. if(FL7 > 0){
  169. loadfl7++;
  170. }
  171. if(FL8 > 0){
  172. loadfl8++;
  173. }
  174. if(FL9 > 0){
  175. loadfl9++;
  176. }
  177. if(FL10 > 0){
  178. loadfl10++;
  179. }
  180. if(FL11 > 0){
  181. loadfl11++;
  182. }
  183. if(FL12 > 0){
  184. loadfl12++;
  185. }
  186. if(FL13 > 0){
  187. loadfl13++;
  188. }
  189. if(FL14 > 0){
  190. loadfl14++;
  191. }
  192. if(FL15 > 0){
  193. loadfl15++;
  194. }
  195. if(FL16 > 0){
  196. loadfl16++;
  197. }
  198. }
  199. if(loadfl2 == 0){
  200. $("#list").jqGrid("hideCol","FL2");
  201. }else{
  202. $("#list").jqGrid("showCol","FL2");
  203. }
  204. if(loadfl3 == 0){
  205. $("#list").jqGrid("hideCol","FL3");
  206. }else{
  207. $("#list").jqGrid("showCol","FL3");
  208. }
  209. if(loadfl4 == 0){
  210. $("#list").jqGrid("hideCol","FL4");
  211. }else{
  212. $("#list").jqGrid("showCol","FL4");
  213. }
  214. if(loadfl5 == 0){
  215. $("#list").jqGrid("hideCol","FL5");
  216. }else{
  217. $("#list").jqGrid("showCol","FL5");
  218. }
  219. if(loadfl6 == 0){
  220. $("#list").jqGrid("hideCol","FL6");
  221. }else{
  222. $("#list").jqGrid("showCol","FL6");
  223. }
  224. if(loadfl7 == 0){
  225. $("#list").jqGrid("hideCol","FL7");
  226. }else{
  227. $("#list").jqGrid("showCol","FL7");
  228. }
  229. if(loadfl8 == 0){
  230. $("#list").jqGrid("hideCol","FL8");
  231. }else{
  232. $("#list").jqGrid("showCol","FL8");
  233. }
  234. if(loadfl9 == 0){
  235. $("#list").jqGrid("hideCol","FL9");
  236. }else{
  237. $("#list").jqGrid("showCol","FL9");
  238. }
  239. if(loadfl10 == 0){
  240. $("#list").jqGrid("hideCol","FL10");
  241. }else{
  242. $("#list").jqGrid("showCol","FL10");
  243. }
  244. if(loadfl11 == 0){
  245. $("#list").jqGrid("hideCol","FL11");
  246. }else{
  247. $("#list").jqGrid("showCol","FL11");
  248. }
  249. if(loadfl12 == 0){
  250. $("#list").jqGrid("hideCol","FL12");
  251. }else{
  252. $("#list").jqGrid("showCol","FL12");
  253. }
  254. if(loadfl13 == 0){
  255. $("#list").jqGrid("hideCol","FL13");
  256. }else{
  257. $("#list").jqGrid("showCol","FL13");
  258. }
  259. if(loadfl14 == 0){
  260. $("#list").jqGrid("hideCol","FL14");
  261. }else{
  262. $("#list").jqGrid("showCol","FL14");
  263. }
  264. if(loadfl15 == 0){
  265. $("#list").jqGrid("hideCol","FL15");
  266. }else{
  267. $("#list").jqGrid("showCol","FL15");
  268. }
  269. if(loadfl16 == 0){
  270. $("#list").jqGrid("hideCol","FL16");
  271. }else{
  272. $("#list").jqGrid("showCol","FL16");
  273. }
  274. }
  275. //获取服务器数据
  276. function getLists(){
  277. $.ajax({
  278. async: false,
  279. type: 'POST',
  280. dataType:'json', //返回类型json
  281. url: "${contextPath }/admin/recipeplan/lpplandellists.html",
  282. error: function(){alert("系统错误");},
  283. success: function(json){
  284. mydata = json;
  285. }
  286. });
  287. return mydata;
  288. }
  289. function clearLpplan(){
  290. if (confirm("确定清空吗?")){
  291. $.ajax({
  292. async: false,
  293. type: 'POST',
  294. dataType:'json', //返回类型json
  295. url: "${contextPath }/admin/recipeplan/cleardplandel.html",
  296. error: function(){alert("系统错误");},
  297. success: function(json){
  298. if(json.status == "success"){
  299. parent.hsClose();
  300. }
  301. }
  302. });
  303. }
  304. }
  305. </script>
  306. </head>
  307. <body style="background-color: #E0E0E0">
  308. <div>
  309. <input type="button" value="清空" onclick="clearLpplan()" class="sysub" />
  310. <table id="list"></table>
  311. </div>
  312. </body>
  313. </html>