123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <%@ page contentType="text/html; charset=utf-8" session="false" %>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
- <head>
- <title>我的工作台</title>
- <%@ include file="../common/header.jsp" %>
- <script type="text/javascript" src="${contextPath }/js/calendar/WdatePicker.js"></script>
- <script type="text/javascript" language="javascript" src="${contextPath}/js/highslide.js"></script>
- <script type="text/javascript">
- var type = "link",operCount=0;
- $(document).ready( function() {
- $("input.datebox").bind("click", function() {WdatePicker();});
- setNowDate();
- queryDate();
- });
-
- $(window).resize(function(){
- $("#list").jqGrid("setGridHeight",$(window).height() - 130);
- $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
- });
-
- //初始化日期
- function setNowDate(){
- var myDate = new Date();
- var year = myDate.getFullYear();
- var month = myDate.getMonth()+1;
- var day = myDate.getDate();
- var nowdate = year + "-" + month + "-" + day;
- $("#endDate").val(nowdate);
- var lastmonth = myDate.getMonth();
- var lastdate = year + "-" + lastmonth + "-" + day;
- $("#beginDate").val(lastdate);
- }
- function leftDate(){
- var beginDate = $("#beginDate").val();
- var endDate = $("#endDate").val();
- var newbDate = checkDate(beginDate,"left");
- var neweDate = checkDate(endDate,"left");
- $("#beginDate").val(newbDate);
- $("#endDate").val(neweDate);
- queryDate();
- }
- function rightDate(){
- var beginDate = $("#beginDate").val();
- var endDate = $("#endDate").val();
- var newbDate = checkDate(beginDate,"");
- var neweDate = checkDate(endDate,"");
- $("#beginDate").val(newbDate);
- $("#endDate").val(neweDate);
- queryDate();
- }
- //查询数据
- function queryDate(){
- var beginDate = $("#beginDate").val();
- var endDate = $("#endDate").val();
- var feedId = $("#feedId").val();
- var fsType = $("#fsType").val();
-
- if(beginDate==""){
- alert("请选择开始日期");
- $("#beginDate").focus();
- }else if(endDate==""){
- alert("请选择结束日期");
- $("#endDate").focus();
- }else{
- if(type == "link"){
- loadList(); //第一次加载jqgrid
- type = "query";
- }else{
- //重新加载json类型
- jQuery("#list").jqGrid("setGridParam",{
- url:"${contextPath }/admin/produce/feedstoragelist.html",
- postData:{"beginDate":beginDate,"endDate":endDate,"feedId":feedId,"fsType":fsType}
- }
- ).trigger("reloadGrid");
- }
- }
- $("#list").jqGrid("setGridHeight",$(window).height() - 135);
- $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
- }
-
- //jqgrid初始化
- function loadList(){
-
- var beginDate = $("#beginDate").val();
- var endDate = $("#endDate").val();
- var feedId = $("#feedId").val();
- var fsType = $("#fsType").val();
-
- jQuery("#list").jqGrid({
- url: "${contextPath }/admin/produce/feedstoragelist.html?beginDate="+beginDate+"&endDate="+endDate+"&feedId="+feedId+"&fsType="+fsType,
- datatype: "json", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
- colNames:["主键","饲料ID","日期","饲料名称","计划重量","实际重量","调整重量","操作重量","库存量","操作类型","备注","创建人"], //列名
- colModel:[
- {name: "FeedStorageId",index: "FeedStorageId",align: "center",hidden: true},
- {name: "FeedId",index: "FeedId", align: "center",hidden: true},
- {name: "CreateDate",index: "CreateDate",width:"100px", align: "center",sortable:false},
- {name: "FeedName",index: "FeedName", align: "center",sortable:false},
- {name: "PlanWeight",index: "PlanWeight", align: "center",sortable:false},
- {name: "ActualWeight",index: "ActualWeight", align: "center",sortable:false},
- {name: "ConfirmWeight",index: "ConfirmWeight", align: "center",sortable:false},
- {name: "OperateWeight",index: "OperateWeight", align: "center",sortable:false},
- {name: "StockWeight",index: "StockWeight", align: "center",sortable:false},
- {name: "fsType",index: "fsType", align: "center",sortable:false},
- {name: "Remark",index: "Remark", align: "center",sortable:false},
- {name: "CreateBy",index: "CreateBy", align: "center",sortable:false},
- ],
- caption: "库存量", //标题
- pager: "#page", //#page分页控件绑定的位置对象
- rowNum: 15, //每页显示条数
- rowList: [15,30,50], //分页下拉选项内容
- viewrecords: true, //是否显示总条数
- emptyrecords: "无数据", //服务器返回空列表时显示的内容
- autowidth: true, //自动调节宽度
-
- toolbar: [true,"top"],
-
- jsonReader: {
- root: "rows", //数据行
- page: "page", // 当前页
- total: "total", // 总页数
- records: "records", //总共有几条记录
- repeatitems: false, // 设置成false,在后台设置值的时候,可以乱序。且并非每个值都得设
- cell: "cell",
- id: "FeedStorageId"
- }
-
- });
-
- if(operCount == 0){
- $("#page_left").append("<input type='button' value='新增' onClick='addRow(this,\"add\")' style='height:30px;width:70px;font-size:12px;' /> ");
- $("#page_left").append("<input type='button' value='修改' onClick='addRow(this,\"modify\")' style='height:30px;width:70px;font-size:12px;' /> ");
- operCount++;
- }
- }
-
- //自定义添加方法
- function addRow(e,type){
- if(type == "modify"){
- var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
- if(selId!=null){
- var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
- iframeBox(e, {
- src:"${contextPath}/admin/produce/addfeedstorage.html?type="+type+"&feedStorageId="+rowData.FeedStorageId,
- width:470,
- height:400
- });
- }else{
- alert("请选择要修改的记录");
- }
- }else{
- iframeBox(e, {
- src:"${contextPath}/admin/produce/addfeedstorage.html?type="+type+"&feedStorageId=",
- width:470,
- height:400
- });
- }
- }
-
- function hsClose(){
- closeBox();
- alert("保存成功");
- queryDate();
- }
- hs.Expander.prototype.onAfterClose = function(htmlExpand) {
- //window.location.reload();
- };
- </script>
- <body style="background-color: #E0E0E0">
- <div>
- <div class="navfrm">
- <span>当前位置:</span>
- <span><a href="${contextPath }/admin/welcome.html">首页</a></span>
- <span> >> </span>
- <span>库存量</span>
- </div>
- <input id="beginDate" name="beginDate" style="width:100px;" class="datebox" value=""/> -
- <input id="endDate" name="endDate" style="width:100px;" class="datebox" value=""/>
- <input type="button" value="<" onclick="leftDate();" /><input type="button" value=">" onclick="rightDate();" />
- 饲料:
- <select id="feedId">
- <option value="">全部</option>
- <c:forEach items="${feeds }" var="feed">
- <option value="${feed.ID }">
- <c:out value="${feed.FNAME }" />
- </option>
- </c:forEach>
- </select>
- 操作类型:
- <select id="fsType">
- <option value="">全部</option>
- <option value="0">入库</option>
- <option value="1">损耗</option>
- <option value="2">用料</option>
- </select>
- <input type="button" value="查询" onclick="queryDate()" class="sysub" />
- <table id="list"></table>
- <div id="page" style="height:30px;"></div>
- </div>
- </body>
- </html>
|