lpplandate.jsp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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. <link type="text/css" rel="stylesheet" href="${contextPath}/css/style.css" />
  8. <script type="text/javascript" src="${contextPath}/js/redips-drag-min.js"></script>
  9. <script type="text/javascript" src="${contextPath}/js/script.js"></script>
  10. <script type="text/javascript">
  11. var mydata,operCount=0,flCount=2,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,feedpSize = "${feedpSize}",lastrow,lastcell,UserFeedp = 0;
  12. $(document).ready( function() {
  13. getUserFeedp();//查询该登录用户是否有关联栏舍
  14. loadList(); //加载jqgrid
  15. var count = feedpSize / 15;
  16. if(count <= 1){
  17. $("#list").jqGrid("setGridHeight",$(window).height() - 70);
  18. }else if(count > 1 && count <= 2){
  19. $("#list").jqGrid("setGridHeight",$(window).height() - 110);
  20. }else if(count > 2 && count <= 3){
  21. $("#list").jqGrid("setGridHeight",$(window).height() - 140);
  22. }else if(count > 3 && count <= 4){
  23. $("#list").jqGrid("setGridHeight",$(window).height() - 180);
  24. }else if(count > 4 && count <= 5){
  25. $("#list").jqGrid("setGridHeight",$(window).height() - 210);
  26. }else if(count > 5 && count <= 6){
  27. $("#list").jqGrid("setGridHeight",$(window).height() - 250);
  28. }else if(count > 6 && count <= 7){
  29. $("#list").jqGrid("setGridHeight",$(window).height() - 280);
  30. }else if(count > 7 && count <= 8){
  31. $("#list").jqGrid("setGridHeight",$(window).height() - 320);
  32. }else if(count > 8 && count <= 9){
  33. $("#list").jqGrid("setGridHeight",$(window).height() - 350);
  34. }else if(count > 9 && count <= 10){
  35. $("#list").jqGrid("setGridHeight",$(window).height() - 390);
  36. }
  37. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  38. });
  39. $(window).resize(function(){
  40. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  41. var count = feedpSize / 15;
  42. if(count <= 1){
  43. $("#list").jqGrid("setGridHeight",$(window).height() - 90);
  44. }else if(count > 1 && count <= 2){
  45. $("#list").jqGrid("setGridHeight",$(window).height() - 120);
  46. }else if(count > 2 && count <= 3){
  47. $("#list").jqGrid("setGridHeight",$(window).height() - 160);
  48. }else if(count > 3 && count <= 4){
  49. $("#list").jqGrid("setGridHeight",$(window).height() - 190);
  50. }else if(count > 4 && count <= 5){
  51. $("#list").jqGrid("setGridHeight",$(window).height() - 220);
  52. }else if(count > 5 && count <= 6){
  53. $("#list").jqGrid("setGridHeight",$(window).height() - 260);
  54. }else if(count > 6 && count <= 7){
  55. $("#list").jqGrid("setGridHeight",$(window).height() - 290);
  56. }else if(count > 7 && count <= 8){
  57. $("#list").jqGrid("setGridHeight",$(window).height() - 330);
  58. }else if(count > 8 && count <= 9){
  59. $("#list").jqGrid("setGridHeight",$(window).height() - 360);
  60. }else if(count > 9 && count <= 10){
  61. $("#list").jqGrid("setGridHeight",$(window).height() - 400);
  62. }
  63. });
  64. //jqgrid初始化
  65. function loadList(){
  66. jQuery("#list").jqGrid({
  67. datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  68. height: "50%", //高度
  69. colNames:["主键","生效","选择班次","时间","发料1","发料2","发料3","发料4","发料5","发料6","发料7","发料8","发料9","发料10","发料11","发料12","发料13","发料14","发料15","发料16","isTNSame","isSelFeedpSame"], //列名
  70. colModel:[
  71. {name: "ID",index: "ID",width: 1,align: "center",sorttype: "string",hidden: true},
  72. {name: "Sel",index: "Sel",width: 50,align: "center",sorttype: "string",editable: true,editrules: {required:true},formatter: "checkbox",formatoptions: {disabled:false},edittype: "checkbox",editoptions: {value:"Yes:No"}},
  73. {name: "selTimes",index: "selTimes",width: 70,align: "center",sorttype: "int",editable: true,edittype: "select",editoptions:{dataUrl: "${contextPath }/admin/recipeplan/selselect.html"}},
  74. {name: "beginTime",index: "beginTime",width: 70,align: "center",sorttype: "string",editable: true},
  75. {name: "FL1",index: "FL1",width: 80,align: "center"},
  76. {name: "FL2",index: "FL2",width: 80,align: "center",sorttype: "string"},
  77. {name: "FL3",index: "FL3",width: 80,align: "center",sorttype: "string"},
  78. {name: "FL4",index: "FL4",width: 80,align: "center",sorttype: "string"},
  79. {name: "FL5",index: "FL5",width: 80,align: "center"},
  80. {name: "FL6",index: "FL6",width: 80,align: "center",sorttype: "string"},
  81. {name: "FL7",index: "FL7",width: 80,align: "center",sorttype: "string"},
  82. {name: "FL8",index: "FL8",width: 80,align: "center",sorttype: "string"},
  83. {name: "FL9",index: "FL9",width: 80,align: "center",sorttype: "string"},
  84. {name: "FL10",index: "FL10",width: 80,align: "center",sorttype: "string"},
  85. {name: "FL11",index: "FL11",width: 80,align: "center",sorttype: "string"},
  86. {name: "FL12",index: "FL12",width: 80,align: "center",sorttype: "string"},
  87. {name: "FL13",index: "FL13",width: 80,align: "center",sorttype: "string"},
  88. {name: "FL14",index: "FL14",width: 80,align: "center",sorttype: "string"},
  89. {name: "FL15",index: "FL15",width: 80,align: "center",sorttype: "string"},
  90. {name: "FL16",index: "FL16",width: 80,align: "center",sorttype: "string"},
  91. {name: "isTNSame",index: "isTNSame",align: "center",sorttype: "string",hidden: true},
  92. {name: "isSelFeedpSame",index: "isSelFeedpSame",align: "center",sorttype: "string",hidden: true}
  93. ],
  94. cellEdit: true,
  95. cellsubmit: "clientArray", //当单元格发生变化后不直接发送请求、"remote"默认直接发送请求
  96. /**
  97. * 设置水平滚动条 begin
  98. **/
  99. shrinkToFit:false,
  100. autoScroll: true,
  101. autowidth: true, //自动调节宽度
  102. rowNum: 1000, //每页显示条数
  103. /**
  104. * 设置水平滚动条 end
  105. **/
  106. toolbar: [true,"top"],
  107. beforeEditCell:function(rowid,cellname,v,iRow,iCol){
  108. lastrow = iRow;
  109. lastcell = iCol;
  110. },
  111. afterInsertRow: function(rowid,rowdata,rowelem){
  112. //配方模版是否相同:1、不相同,0相同。不相同加标注
  113. if(rowdata.isTNSame == 1){
  114. $("#list").setCell(rowid,16,"",{background:'#FFE66F'});
  115. }
  116. //不同车次有相同班次相同栏舍提示:0不提示,1、班次1有相同栏舍,2、班次2有相同栏舍……。相同加标注
  117. if(rowdata.isSelFeedpSame > 0){
  118. if(rowdata.isSelFeedpSame == 1){
  119. $("#list").setCell(rowid,8,"",{background:'#FFB5B5'});
  120. }else if(rowdata.isSelFeedpSame == 2){
  121. $("#list").setCell(rowid,9,"",{background:'#FFB5B5'});
  122. }else if(rowdata.isSelFeedpSame == 3){
  123. $("#list").setCell(rowid,10,"",{background:'#FFB5B5'});
  124. }else if(rowdata.isSelFeedpSame == 4){
  125. $("#list").setCell(rowid,11,"",{background:'#FFB5B5'});
  126. }else if(rowdata.isSelFeedpSame == 5){
  127. $("#list").setCell(rowid,12,"",{background:'#FFB5B5'});
  128. }else if(rowdata.isSelFeedpSame == 6){
  129. $("#list").setCell(rowid,13,"",{background:'#FFB5B5'});
  130. }
  131. }
  132. }
  133. });
  134. //获取数据集
  135. mydata = getLists();
  136. if(mydata!=null){
  137. for(var i=0;i<=mydata.length;i++){
  138. jQuery("#list").jqGrid('addRowData',i+1,mydata[i]);
  139. }
  140. jQuery("#list").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
  141. }
  142. if(operCount == 0){
  143. if(UserFeedp == 0){
  144. $("#t_list").append("<input class='sysub' type='button' value='新增车次' onClick='addLpplan()' style='font-size:-2'/> ");
  145. $("#t_list").append("<input class='sysub' type='button' value='删除车次' onClick='delLpplan()' style='font-size:-2'/> ");
  146. }
  147. $("#t_list").append("<input class='sysub' type='button' value='添加发料' onClick='addFL()' style='font-size:-2'/> ");
  148. $("#t_list").append("<input class='sysub' type='button' value='减少发料' onClick='delFL()' style='font-size:-2'/> ");
  149. $("#t_list").append("<input class='sysub' type='button' value='确认保存' onClick='saveLpplan()' style='font-size:-2'/>");
  150. $("#t_list").append("&nbsp;&nbsp;名称:<input id='lpplanName' name='lpplanName' style='width:60px;font-size:12px;' value='' />&nbsp;&nbsp;");
  151. $("#t_list").append("<input class='sysub' type='button' value='备份' onClick='backLpplan()' style='font-size:-2'/>");
  152. $("#t_list").append("&nbsp;&nbsp;提取:<select id='tqLpplanId'><c:forEach items='${lpplanbacklist }' var='lpplanback'><option value='${lpplanback.lpplandatebackId }'><c:out value='${lpplanback.ProjName }' /></option></c:forEach></select>&nbsp;&nbsp;");
  153. $("#t_list").append("<input class='sysub' type='button' value='提取' onClick='tqLpplan()' style='font-size:-2'/>");
  154. operCount++;
  155. }
  156. var ids = $("#list").jqGrid("getDataIDs");
  157. for ( var i = 0; i < ids.length; i++) {
  158. var rowData = $("#list").jqGrid("getRowData",ids[i]);
  159. var FL2 = rowData.FL2.indexOf("</div>");
  160. var FL3 = rowData.FL3.indexOf("</div>");
  161. var FL4 = rowData.FL4.indexOf("</div>");
  162. var FL5 = rowData.FL5.indexOf("</div>");
  163. var FL6 = rowData.FL6.indexOf("</div>");
  164. var FL7 = rowData.FL7.indexOf("</div>");
  165. var FL8 = rowData.FL8.indexOf("</div>");
  166. var FL9 = rowData.FL9.indexOf("</div>");
  167. var FL10 = rowData.FL10.indexOf("</div>");
  168. var FL11 = rowData.FL11.indexOf("</div>");
  169. var FL12 = rowData.FL12.indexOf("</div>");
  170. var FL13 = rowData.FL13.indexOf("</div>");
  171. var FL14 = rowData.FL14.indexOf("</div>");
  172. var FL15 = rowData.FL15.indexOf("</div>");
  173. var FL16 = rowData.FL16.indexOf("</div>");
  174. if(FL2 > 0){
  175. loadfl2++;
  176. flCount = 3;
  177. }
  178. if(FL3 > 0){
  179. loadfl3++;
  180. flCount = 4;
  181. }
  182. if(FL4 > 0){
  183. loadfl4++;
  184. flCount = 5;
  185. }
  186. if(FL5 > 0){
  187. loadfl5++;
  188. flCount = 6;
  189. }
  190. if(FL6 > 0){
  191. loadfl6++;
  192. flCount = 7;
  193. }
  194. if(FL7 > 0){
  195. loadfl7++;
  196. flCount = 8;
  197. }
  198. if(FL8 > 0){
  199. loadfl8++;
  200. flCount = 9;
  201. }
  202. if(FL9 > 0){
  203. loadfl9++;
  204. flCount = 10;
  205. }
  206. if(FL10 > 0){
  207. loadfl10++;
  208. flCount = 11;
  209. }
  210. if(FL11 > 0){
  211. loadfl11++;
  212. flCount = 12;
  213. }
  214. if(FL12 > 0){
  215. loadfl12++;
  216. flCount = 13;
  217. }
  218. if(FL13 > 0){
  219. loadfl13++;
  220. flCount = 14;
  221. }
  222. if(FL14 > 0){
  223. loadfl14++;
  224. flCount = 15;
  225. }
  226. if(FL15 > 0){
  227. loadfl15++;
  228. flCount = 16;
  229. }
  230. if(FL16 > 0){
  231. loadfl16++;
  232. }
  233. }
  234. if(loadfl2 == 0){
  235. $("#list").jqGrid("hideCol","FL2");
  236. }
  237. if(loadfl3 == 0){
  238. $("#list").jqGrid("hideCol","FL3");
  239. }
  240. if(loadfl4 == 0){
  241. $("#list").jqGrid("hideCol","FL4");
  242. }
  243. if(loadfl5 == 0){
  244. $("#list").jqGrid("hideCol","FL5");
  245. }
  246. if(loadfl6 == 0){
  247. $("#list").jqGrid("hideCol","FL6");
  248. }
  249. if(loadfl7 == 0){
  250. $("#list").jqGrid("hideCol","FL7");
  251. }
  252. if(loadfl8 == 0){
  253. $("#list").jqGrid("hideCol","FL8");
  254. }
  255. if(loadfl9 == 0){
  256. $("#list").jqGrid("hideCol","FL9");
  257. }
  258. if(loadfl10 == 0){
  259. $("#list").jqGrid("hideCol","FL10");
  260. }
  261. if(loadfl11 == 0){
  262. $("#list").jqGrid("hideCol","FL11");
  263. }
  264. if(loadfl12 == 0){
  265. $("#list").jqGrid("hideCol","FL12");
  266. }
  267. if(loadfl13 == 0){
  268. $("#list").jqGrid("hideCol","FL13");
  269. }
  270. if(loadfl14 == 0){
  271. $("#list").jqGrid("hideCol","FL14");
  272. }
  273. if(loadfl15 == 0){
  274. $("#list").jqGrid("hideCol","FL15");
  275. }
  276. if(loadfl16 == 0){
  277. $("#list").jqGrid("hideCol","FL16");
  278. }
  279. }
  280. //获取服务器数据
  281. function getLists(){
  282. $.ajax({
  283. async: false,
  284. type: 'POST',
  285. dataType:'json', //返回类型json
  286. url: "${contextPath }/admin/recipeplan/lpplandatelist.html",
  287. error: function(){alert("系统错误");},
  288. success: function(json){
  289. mydata = json;
  290. }
  291. });
  292. return mydata;
  293. }
  294. //自定义添加方法
  295. function addLpplan(){
  296. var ids = $("#list").jqGrid("getDataIDs");
  297. $("#list").jqGrid("addRowData",ids.length+1,{},"first");
  298. $.ajax({
  299. async: false,
  300. type: "POST",
  301. dataType:"json", //返回类型jsond
  302. data: "oper=add&selId=",
  303. url: "${contextPath }/admin/recipeplan/lpplandateupdate.html",
  304. error: function(){alert("系统错误");},
  305. success: function(json){
  306. $("#list").clearGridData(); //清空原grid数据
  307. loadList(); //重新载入服务器数据
  308. }
  309. });
  310. }
  311. //自定义删除方法
  312. function delLpplan(){
  313. var row = $("#list").jqGrid("getGridParam","selrow");
  314. if(row!=null){
  315. var flag = confirm("您确定要删除吗?");
  316. if(flag){
  317. var selRow = $("#list").jqGrid("getRowData",row);
  318. $.ajax({
  319. async: false,
  320. type: "POST",
  321. dataType:"json", //返回类型jsond
  322. data: "oper=del&selId="+selRow.ID,
  323. url: "${contextPath }/admin/recipeplan/lpplandateupdate.html",
  324. error: function(){alert("系统错误");},
  325. success: function(json){
  326. $("#list").clearGridData(); //清空原grid数据
  327. loadList(); //重新载入服务器数据
  328. }
  329. });
  330. }
  331. }else{
  332. alert("请选择记录");
  333. }
  334. }
  335. //自定义添加发料
  336. function addFL(){
  337. $("#list").jqGrid("showCol","FL"+flCount);
  338. if(flCount < 17){
  339. flCount++;
  340. }
  341. }
  342. //自定义减少发料
  343. function delFL(){
  344. if(flCount > 2){
  345. flCount--;
  346. }
  347. if(flCount == 2){
  348. if(loadfl2 == 0){
  349. $("#list").jqGrid("hideCol","FL"+flCount);
  350. }else{
  351. flCount++;
  352. }
  353. }else if(flCount == 3){
  354. if(loadfl3 == 0){
  355. $("#list").jqGrid("hideCol","FL"+flCount);
  356. }else{
  357. flCount++;
  358. }
  359. }else if(flCount == 4){
  360. if(loadfl4 == 0){
  361. $("#list").jqGrid("hideCol","FL"+flCount);
  362. }else{
  363. flCount++;
  364. }
  365. }else if(flCount == 5){
  366. if(loadfl5 == 0){
  367. $("#list").jqGrid("hideCol","FL"+flCount);
  368. }else{
  369. flCount++;
  370. }
  371. }else if(flCount == 6){
  372. if(loadfl6 == 0){
  373. $("#list").jqGrid("hideCol","FL"+flCount);
  374. }else{
  375. flCount++;
  376. }
  377. }else if(flCount == 7){
  378. if(loadfl7 == 0){
  379. $("#list").jqGrid("hideCol","FL"+flCount);
  380. }else{
  381. flCount++;
  382. }
  383. }else if(flCount == 8){
  384. if(loadfl8 == 0){
  385. $("#list").jqGrid("hideCol","FL"+flCount);
  386. }else{
  387. flCount++;
  388. }
  389. }else if(flCount == 9){
  390. if(loadfl9 == 0){
  391. $("#list").jqGrid("hideCol","FL"+flCount);
  392. }else{
  393. flCount++;
  394. }
  395. }else if(flCount == 10){
  396. if(loadfl10 == 0){
  397. $("#list").jqGrid("hideCol","FL"+flCount);
  398. }else{
  399. flCount++;
  400. }
  401. }else if(flCount == 11){
  402. if(loadfl11 == 0){
  403. $("#list").jqGrid("hideCol","FL"+flCount);
  404. }else{
  405. flCount++;
  406. }
  407. }else if(flCount == 12){
  408. if(loadfl12 == 0){
  409. $("#list").jqGrid("hideCol","FL"+flCount);
  410. }else{
  411. flCount++;
  412. }
  413. }else if(flCount == 13){
  414. if(loadfl13 == 0){
  415. $("#list").jqGrid("hideCol","FL"+flCount);
  416. }else{
  417. flCount++;
  418. }
  419. }else if(flCount == 14){
  420. if(loadfl14 == 0){
  421. $("#list").jqGrid("hideCol","FL"+flCount);
  422. }else{
  423. flCount++;
  424. }
  425. }else if(flCount == 15){
  426. if(loadfl15 == 0){
  427. $("#list").jqGrid("hideCol","FL"+flCount);
  428. }else{
  429. flCount++;
  430. }
  431. }else if(flCount == 16){
  432. if(loadfl16 == 0){
  433. $("#list").jqGrid("hideCol","FL"+flCount);
  434. }else{
  435. flCount++;
  436. }
  437. }
  438. }
  439. //确认保存
  440. function saveLpplan(){
  441. $("#list").jqGrid("saveCell",lastrow,lastcell);
  442. //编辑后按过回车状态、可以保存
  443. var lpplanStr = "";
  444. var ids = $("#list").jqGrid("getDataIDs");
  445. for ( var i = 0; i < ids.length; i++) {
  446. var rowData = $("#list").jqGrid("getRowData",ids[i]);
  447. var ID = rowData.ID;
  448. var Sel = rowData.Sel;
  449. var selTimes = $.trim(rowData.selTimes);
  450. var beginTime = rowData.beginTime;
  451. var FL1 = rowData.FL1.substring(rowData.FL1.indexOf('>')+1,rowData.FL1.lastIndexOf('<'));
  452. var FL2 = rowData.FL2.substring(rowData.FL2.indexOf('>')+1,rowData.FL2.lastIndexOf('<'));
  453. var FL3 = rowData.FL3.substring(rowData.FL3.indexOf('>')+1,rowData.FL3.lastIndexOf('<'));
  454. var FL4 = rowData.FL4.substring(rowData.FL4.indexOf('>')+1,rowData.FL4.lastIndexOf('<'));
  455. var FL5 = rowData.FL5.substring(rowData.FL5.indexOf('>')+1,rowData.FL5.lastIndexOf('<'));
  456. var FL6 = rowData.FL6.substring(rowData.FL6.indexOf('>')+1,rowData.FL6.lastIndexOf('<'));
  457. var FL7 = rowData.FL7.substring(rowData.FL7.indexOf('>')+1,rowData.FL7.lastIndexOf('<'));
  458. var FL8 = rowData.FL8.substring(rowData.FL8.indexOf('>')+1,rowData.FL8.lastIndexOf('<'));
  459. var FL9 = rowData.FL9.substring(rowData.FL9.indexOf('>')+1,rowData.FL9.lastIndexOf('<'));
  460. var FL10 = rowData.FL10.substring(rowData.FL10.indexOf('>')+1,rowData.FL10.lastIndexOf('<'));
  461. var FL11 = rowData.FL11.substring(rowData.FL11.indexOf('>')+1,rowData.FL11.lastIndexOf('<'));
  462. var FL12 = rowData.FL12.substring(rowData.FL12.indexOf('>')+1,rowData.FL12.lastIndexOf('<'));
  463. var FL13 = rowData.FL13.substring(rowData.FL13.indexOf('>')+1,rowData.FL13.lastIndexOf('<'));
  464. var FL14 = rowData.FL14.substring(rowData.FL14.indexOf('>')+1,rowData.FL14.lastIndexOf('<'));
  465. var FL15 = rowData.FL15.substring(rowData.FL15.indexOf('>')+1,rowData.FL15.lastIndexOf('<'));
  466. var FL16 = rowData.FL16.substring(rowData.FL16.indexOf('>')+1,rowData.FL16.lastIndexOf('<'));
  467. if(lpplanStr == ""){
  468. lpplanStr = "ID:"+ID+",Sel:"+Sel+",selTimes:"+selTimes+",beginTime:"+beginTime+",FL1:"+FL1+",FL2:"+FL2+",FL3:"+FL3+",FL4:"+FL4+",FL5:"+FL5+",FL6:"+FL6+",FL7:"+FL7+",FL8:"+FL8+",FL9:"+FL9+",FL10:"+FL10+",FL11:"+FL11+",FL12:"+FL12+",FL13:"+FL13+",FL14:"+FL14+",FL15:"+FL15+",FL16:"+FL16;
  469. }else{
  470. lpplanStr += ";" + "ID:"+ID+",Sel:"+Sel+",selTimes:"+selTimes+",beginTime:"+beginTime+",FL1:"+FL1+",FL2:"+FL2+",FL3:"+FL3+",FL4:"+FL4+",FL5:"+FL5+",FL6:"+FL6+",FL7:"+FL7+",FL8:"+FL8+",FL9:"+FL9+",FL10:"+FL10+",FL11:"+FL11+",FL12:"+FL12+",FL13:"+FL13+",FL14:"+FL14+",FL15:"+FL15+",FL16:"+FL16;
  471. }
  472. }
  473. $.ajax({
  474. async: false,
  475. type: 'POST',
  476. data: "lpplanStr="+lpplanStr,
  477. dataType: 'json',
  478. url: "${contextPath}/admin/recipeplan/updatelpplandateall.html",
  479. error: function(){alert("系统错误");},
  480. success: function(json){
  481. if(json.status == "success"){
  482. if(json.str != ""){
  483. alert(json.str);
  484. }
  485. $("#list").clearGridData(); //清空原grid数据
  486. window.location.reload();
  487. }
  488. }
  489. });
  490. }
  491. //记录移动
  492. function moveLpplan(moveType){
  493. $("#list").jqGrid("saveCell",lastrow,lastcell);
  494. var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
  495. var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
  496. if(selId != null){
  497. $.ajax({
  498. async: false,
  499. type: 'POST',
  500. dataType:'json', //返回类型json
  501. url: "${contextPath }/admin/recipeplan/movelpplan.html?planId="+rowData.ID+"&moveType="+moveType+"&Sort="+rowData.SORT,
  502. error: function(){alert("系统错误");},
  503. success: function(json){
  504. if(json.status == "success"){
  505. if(moveType == "top"){
  506. selId = Number(selId) - 1;
  507. }else{
  508. selId = Number(selId) + 1;
  509. }
  510. $("#list").clearGridData(); //清空原grid数据
  511. loadList(); //加载jqgrid
  512. }else{
  513. alert("请正确移动");
  514. }
  515. }
  516. });
  517. $("#list").jqGrid("setSelection",selId);
  518. }else{
  519. alert("请选择记录");
  520. }
  521. }
  522. //查询该登录用户是否有关联栏舍
  523. function getUserFeedp(){
  524. $.ajax({
  525. async: false,
  526. type: 'POST',
  527. dataType:'json', //返回类型json
  528. url: "${contextPath }/admin/recipeplan/getUserFeedp.html",
  529. error: function(){alert("系统错误");},
  530. success: function(json){
  531. if(json.status == "success"){
  532. UserFeedp = json.count;
  533. }
  534. }
  535. });
  536. }
  537. //备份
  538. function backLpplan(){
  539. var lpplanName = $("#lpplanName").val();
  540. if(lpplanName == ""){
  541. alert("请输入本次备份的计划名称");
  542. $("#lpplanName").focus();
  543. }else{
  544. $.ajax({
  545. async: false,
  546. type: 'POST',
  547. dataType:'json', //返回类型json
  548. url: "${contextPath }/admin/recipeplan/backLpplandate.html?lpplanName="+lpplanName,
  549. error: function(){alert("系统错误");},
  550. success: function(json){
  551. if(json.status == "success"){
  552. if(json.lnamecount == "0"){
  553. alert("备份完成");
  554. }else{
  555. alert("计划名称不能重复");
  556. $("#lpplanName").focus();
  557. $("#lpplanName").select();
  558. }
  559. }
  560. }
  561. });
  562. }
  563. }
  564. //提取
  565. function tqLpplan(){
  566. var tqLpplanId = $("#tqLpplanId").val();
  567. var flag = confirm("提取时,当前页面计划将被清空,您确定提取备份计划吗?");
  568. if (flag){
  569. $.ajax({
  570. async: false,
  571. type: 'POST',
  572. data: "tqLpplanId="+tqLpplanId,
  573. dataType: 'json',
  574. url: "${contextPath}/admin/recipeplan/tqlpplandate.html",
  575. error: function(){alert("系统错误");},
  576. success: function(json){
  577. if(json.status == "success"){
  578. location.reload();
  579. }
  580. }
  581. });
  582. }
  583. }
  584. //自动计划
  585. function autoLpplan(){
  586. var flag = confirm("自动计划时,当前页面计划将被清空,您确定自动计划吗?");
  587. if (flag){
  588. $.ajax({
  589. async: false,
  590. type: 'POST',
  591. dataType: 'json',
  592. url: "${contextPath}/admin/recipeplan/autoLpplan.html",
  593. error: function(){alert("系统错误");},
  594. success: function(json){
  595. if(json.status == "success"){
  596. location.reload();
  597. }
  598. }
  599. });
  600. }
  601. }
  602. </script>
  603. </head>
  604. <body style="background-color: #E0E0E0">
  605. <div>
  606. <div id="drag">
  607. <table width="200px">
  608. <tr style="background-color: #eee">
  609. <c:forEach var="feedp" items="${feedplists}" varStatus="status">
  610. <c:if test="${(status.index+1) mod 15 !=1}">
  611. <td>
  612. <div class="drag t1" style="background-color: #${feedp.tColor };"><c:out value="${feedp.BNAME }" /></div>
  613. </td>
  614. </c:if>
  615. <c:if test="${(status.index+1) mod 15==1}">
  616. </tr>
  617. <tr>
  618. <td>
  619. <div class="drag t1" style="background-color: #${feedp.tColor };"><c:out value="${feedp.BNAME }" /></div>
  620. </td>
  621. </c:if>
  622. </c:forEach>
  623. </tr>
  624. <tr>
  625. </table>
  626. <table id="list"></table>
  627. </div>
  628. <input type="hidden" id="message"/>
  629. <input type="hidden" id="colorValue" value="" />
  630. </div>
  631. </body>
  632. </html>