feedstorageemployeeout.jsp 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. <script type="text/javascript" language="javascript" src="${contextPath}/js/highslide.js"></script>
  9. <script type="text/javascript">
  10. var type = "link",operCount=0;
  11. $(document).ready( function() {
  12. $("input.datebox").bind("click", function() {WdatePicker();});
  13. setNowDate();
  14. queryDate();
  15. });
  16. $(window).resize(function(){
  17. $("#list").jqGrid("setGridHeight",$(window).height() - 130);
  18. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  19. });
  20. //初始化日期
  21. function setNowDate(){
  22. var myDate = new Date();
  23. var year = myDate.getFullYear();
  24. var month = myDate.getMonth()+1;
  25. var day = myDate.getDate();
  26. var nowdate = year + "-" + month + "-" + day;
  27. $("#BusinessDate").val(nowdate);
  28. }
  29. function leftDate(){
  30. var BusinessDate = $("#BusinessDate").val();
  31. var newbDate = checkDate(BusinessDate,"left");
  32. $("#BusinessDate").val(newbDate);
  33. queryDate();
  34. }
  35. function rightDate(){
  36. var BusinessDate = $("#BusinessDate").val();
  37. var newbDate = checkDate(BusinessDate,"");
  38. $("#BusinessDate").val(newbDate);
  39. queryDate();
  40. }
  41. //查询数据
  42. function queryDate(){
  43. var BusinessDate = $("#BusinessDate").val();
  44. var fsType = $("#fsType").val();
  45. var feedId = $("#feedId").val();
  46. var CCID = $("#CCID").val();
  47. if(BusinessDate==""){
  48. alert("请选择日期");
  49. $("#BusinessDate").focus();
  50. }else{
  51. if(type == "link"){
  52. loadList(); //第一次加载jqgrid
  53. type = "query";
  54. }else{
  55. //重新加载json类型
  56. jQuery("#list").jqGrid("setGridParam",{
  57. url:"${contextPath }/admin/feedstorage/feedstorageemployeeoutlist.html",
  58. postData:{"BusinessDate":BusinessDate,"fsType":fsType,"feedId":feedId,"CCID":CCID}
  59. }
  60. ).trigger("reloadGrid");
  61. }
  62. }
  63. $("#list").jqGrid("setGridHeight",$(window).height() - 135);
  64. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  65. }
  66. //jqgrid初始化
  67. function loadList(){
  68. var BusinessDate = $("#BusinessDate").val();
  69. var fsType = $("#fsType").val();
  70. var feedId = $("#feedId").val();
  71. var CCID = $("#CCID").val();
  72. jQuery("#list").jqGrid({
  73. url: "${contextPath }/admin/feedstorage/feedstorageemployeeoutlist.html?BusinessDate="+BusinessDate+"&fsType="+fsType+"&CCID="+CCID+"&feedId="+feedId,
  74. datatype: "json", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  75. colNames:["主键","饲料ID","出库日期","饲料名称","操作重量","操作类型id","畜牧类别id","审核状态code","操作类型","畜牧类别","备注","创建人"], //列名
  76. colModel:[
  77. {name: "FeedStorageId",index: "FeedStorageId",align: "center",hidden: true},
  78. {name: "FeedId",index: "FeedId", align: "center",hidden: true},
  79. {name: "BusinessDate",index: "BusinessDate",width:"100px", align: "center",sortable:false},
  80. {name: "FNAME",index: "FNAME", align: "center",sortable:false},
  81. {name: "OperateWeight",index: "OperateWeight", align: "center",sortable:false},
  82. {name: "fsType",index: "fsType", align: "center",sortable:false,hidden: true},
  83. {name: "CCID",index: "CCID", align: "center",sortable:false,hidden: true},
  84. {name: "CheckStatus",index: "CheckStatus", align: "center",sortable:false,hidden: true},
  85. {name: "fsTypeName",index: "fsTypeName", align: "center",sortable:false},
  86. {name: "CLASSNAME",index: "CLASSNAME", align: "center",sortable:false},
  87. {name: "Remark",index: "Remark", align: "center",sortable:false},
  88. {name: "CreateBy",index: "CreateBy", align: "center",sortable:false},
  89. ],
  90. caption: "人工用量", //标题
  91. pager: "#page", //#page分页控件绑定的位置对象
  92. rowNum: 15, //每页显示条数
  93. rowList: [15,30,50], //分页下拉选项内容
  94. viewrecords: true, //是否显示总条数
  95. emptyrecords: "无数据", //服务器返回空列表时显示的内容
  96. autowidth: true, //自动调节宽度
  97. toolbar: [true,"top"],
  98. jsonReader: {
  99. root: "rows", //数据行
  100. page: "page", // 当前页
  101. total: "total", // 总页数
  102. records: "records", //总共有几条记录
  103. repeatitems: false, // 设置成false,在后台设置值的时候,可以乱序。且并非每个值都得设
  104. cell: "cell",
  105. id: "FeedStorageId"
  106. }
  107. });
  108. if(operCount == 0){
  109. $("#page_left").append("&nbsp;<input type='button' value='新增人工用料' onClick='addRow(this,\"add\",2)' style='height:30px;width:90px;font-size:12px;' />&nbsp; ");
  110. $("#page_left").append("<input type='button' value='新增损耗' onClick='addRow(this,\"add\",1)' style='height:30px;width:70px;font-size:12px;' />");
  111. operCount++;
  112. }
  113. }
  114. //自定义添加方法
  115. function addRow(e,type,fsType){
  116. if(type == "modify"){
  117. var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
  118. if(selId!=null){
  119. var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
  120. iframeBox(e, {
  121. src:"${contextPath}/admin/feedstorage/addfeedstorageemployeeout.html?type="+type+"&feedStorageId="+rowData.FeedStorageId,
  122. width:470,
  123. height:400
  124. });
  125. }else{
  126. alert("请选择要修改的记录");
  127. }
  128. }else{
  129. iframeBox(e, {
  130. src:"${contextPath}/admin/feedstorage/addfeedstorageemployeeout.html?type="+type+"&fsType="+fsType,
  131. width:470,
  132. height:400
  133. });
  134. }
  135. }
  136. function hsClose(){
  137. closeBox();
  138. alert("保存成功");
  139. queryDate();
  140. }
  141. hs.Expander.prototype.onAfterClose = function(htmlExpand) {
  142. //window.location.reload();
  143. };
  144. </script>
  145. <body style="background-color: #E0E0E0">
  146. <div>
  147. <div class="navfrm">
  148. <span>当前位置:</span>
  149. <span><a href="${contextPath }/admin/welcome.html">首页</a></span>
  150. <span>&nbsp;>>&nbsp;</span>
  151. <span>人工用量</span>
  152. </div>
  153. 日期:<input id="BusinessDate" name="BusinessDate" style="width:100px;" class="datebox" value=""/>
  154. <input type="button" value="<" onclick="leftDate();" /><input type="button" value=">" onclick="rightDate();" />
  155. 操作类型:
  156. <select id="fsType">
  157. <option value="">全部</option>
  158. <option value="1">损耗</option>
  159. <option value="2">人工用料</option>
  160. </select>
  161. 饲料:
  162. <select id="feedId">
  163. <option value="">全部</option>
  164. <c:forEach items="${feeds }" var="feed">
  165. <option value="${feed.ID }">
  166. <c:out value="${feed.FNAME }" />
  167. </option>
  168. </c:forEach>
  169. </select>
  170. 畜牧类别:
  171. <select id="CCID">
  172. <option value="">全部</option>
  173. <c:forEach items="${cowClassList }" var="cowClass">
  174. <option value="${cowClass.ID }">
  175. <c:out value="${cowClass.CLASSNAME }" />
  176. </option>
  177. </c:forEach>
  178. </select>
  179. <input type="button" value="查询" onclick="queryDate()" class="sysub" />
  180. <table id="list"></table>
  181. <div id="page" style="height:30px;"></div>
  182. </div>
  183. </body>
  184. </html>