feedInventory.jsp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. $("#endDate").val(nowdate);
  28. var lastmonth = myDate.getMonth();
  29. var lastdate = year + "-" + lastmonth + "-" + day;
  30. $("#beginDate").val(lastdate);
  31. }
  32. //查询数据
  33. function queryDate(){
  34. var beginDate = $("#beginDate").val();
  35. var endDate = $("#endDate").val();
  36. if(beginDate==""){
  37. alert("请选择开始日期");
  38. $("#beginDate").focus();
  39. }else if(endDate==""){
  40. alert("请选择结束日期");
  41. $("#endDate").focus();
  42. }else{
  43. if(type == "link"){
  44. loadList(); //第一次加载jqgrid
  45. type = "query";
  46. }else{
  47. //重新加载json类型
  48. jQuery("#list").jqGrid("setGridParam",{
  49. url:"${contextPath }/admin/feedstorage/feedInventoryList.html",
  50. postData:{"beginDate":beginDate,"endDate":endDate}
  51. }
  52. ).trigger("reloadGrid");
  53. }
  54. }
  55. $("#list").jqGrid("setGridHeight",$(window).height() - 135);
  56. $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
  57. }
  58. //jqgrid初始化
  59. function loadList(){
  60. var beginDate = $("#beginDate").val();
  61. var endDate = $("#endDate").val();
  62. jQuery("#list").jqGrid({
  63. url: "${contextPath }/admin/feedstorage/feedInventoryList.html?beginDate="+beginDate+"&endDate="+endDate,
  64. datatype: "json", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
  65. colNames:["主键","盘点日期","盘点人","备注"], //列名
  66. colModel:[
  67. {name: "invid",index: "invid",align: "center",hidden: true},
  68. {name: "inventorydate",index: "inventorydate",width:"100px", align: "center",sortable:false},
  69. {name: "createuser",index: "createuser", align: "center",sortable:false},
  70. {name: "remark",index: "remark", align: "center",sortable:false},
  71. ],
  72. caption: "库存量", //标题
  73. pager: "#page", //#page分页控件绑定的位置对象
  74. rowNum: 15, //每页显示条数
  75. rowList: [15,30,50], //分页下拉选项内容
  76. viewrecords: true, //是否显示总条数
  77. emptyrecords: "无数据", //服务器返回空列表时显示的内容
  78. autowidth: true, //自动调节宽度
  79. toolbar: [true,"top"],
  80. jsonReader: {
  81. root: "rows", //数据行
  82. page: "page", // 当前页
  83. total: "total", // 总页数
  84. records: "records", //总共有几条记录
  85. repeatitems: false, // 设置成false,在后台设置值的时候,可以乱序。且并非每个值都得设
  86. cell: "cell",
  87. id: "FeedStorageId"
  88. }
  89. });
  90. if(operCount == 0){
  91. $("#page_left").append("<input type='button' value='新增盘点单' onClick='toSavefeedInventory(this,\"add\")' style='height:30px;width:70px;font-size:12px;' /> ");
  92. $("#page_left").append("<input type='button' value='打开盘点单' onClick='toSavefeedInventory(this,\"open\")' style='height:30px;width:70px;font-size:12px;' /> ");
  93. operCount++;
  94. }
  95. }
  96. //自定义添加方法
  97. function toSavefeedInventory(e,type){
  98. if(type == "open"){
  99. var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
  100. if(selId!=null){
  101. var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
  102. iframeBox(e, {
  103. src:"${contextPath}/admin/feedstorage/addFeedInventory.html?type="+type+"&invid="+rowData.invid,
  104. width:1000,
  105. height:600
  106. });
  107. }else{
  108. alert("请选择要查看的记录");
  109. }
  110. }else{
  111. iframeBox(e, {
  112. src:"${contextPath}/admin/feedstorage/addFeedInventory.html?type="+type+"&invid=",
  113. width:1000,
  114. height:600
  115. });
  116. }
  117. }
  118. function hsClose(){
  119. closeBox();
  120. alert("保存成功");
  121. queryDate();
  122. }
  123. hs.Expander.prototype.onAfterClose = function(htmlExpand) {
  124. //window.location.reload();
  125. };
  126. </script>
  127. <body style="background-color: #E0E0E0">
  128. <div>
  129. <div class="navfrm">
  130. <span>当前位置:</span>
  131. <span><a href="${contextPath }/admin/welcome.html">首页</a></span>
  132. <span>&nbsp;>>&nbsp;</span>
  133. <span>盘点单</span>
  134. </div>
  135. 日期范围:<input id="beginDate" name="beginDate" style="width:100px;" class="datebox" value=""/> -
  136. <input id="endDate" name="endDate" style="width:100px;" class="datebox" value=""/>
  137. <input type="button" value="查询" onclick="queryDate()" class="sysub" />
  138. <table id="list"></table>
  139. <div id="page" style="height:30px;"></div>
  140. </div>
  141. </body>
  142. </html>