123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <%@ 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;
- $("#BusinessDate").val(nowdate);
- }
- function leftDate(){
- var BusinessDate = $("#BusinessDate").val();
- var newbDate = checkDate(BusinessDate,"left");
- $("#BusinessDate").val(newbDate);
- queryDate();
- }
- function rightDate(){
- var BusinessDate = $("#BusinessDate").val();
- var newbDate = checkDate(BusinessDate,"");
- $("#BusinessDate").val(newbDate);
- queryDate();
- }
- //查询数据
- function queryDate(){
- var BusinessDate = $("#BusinessDate").val();
- var fsType = $("#fsType").val();
- var feedId = $("#feedId").val();
- var CCID = $("#CCID").val();
- if(BusinessDate==""){
- alert("请选择日期");
- $("#BusinessDate").focus();
- }else{
- if(type == "link"){
- loadList(); //第一次加载jqgrid
- type = "query";
- }else{
- //重新加载json类型
- jQuery("#list").jqGrid("setGridParam",{
- url:"${contextPath }/admin/feedstorage/feedstorageemployeeoutlist.html",
- postData:{"BusinessDate":BusinessDate,"fsType":fsType,"feedId":feedId,"CCID":CCID}
- }
- ).trigger("reloadGrid");
- }
- }
- $("#list").jqGrid("setGridHeight",$(window).height() - 135);
- $("#list").jqGrid("setGridWidth",document.body.clientWidth - 5);
- }
-
- //jqgrid初始化
- function loadList(){
-
- var BusinessDate = $("#BusinessDate").val();
- var fsType = $("#fsType").val();
- var feedId = $("#feedId").val();
- var CCID = $("#CCID").val();
-
- jQuery("#list").jqGrid({
- url: "${contextPath }/admin/feedstorage/feedstorageemployeeoutlist.html?BusinessDate="+BusinessDate+"&fsType="+fsType+"&CCID="+CCID+"&feedId="+feedId,
- datatype: "json", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
- colNames:["主键","饲料ID","出库日期","饲料名称","操作重量","操作类型id","畜牧类别id","审核状态code","操作类型","畜牧类别","备注","创建人"], //列名
- colModel:[
- {name: "FeedStorageId",index: "FeedStorageId",align: "center",hidden: true},
- {name: "FeedId",index: "FeedId", align: "center",hidden: true},
- {name: "BusinessDate",index: "BusinessDate",width:"100px", align: "center",sortable:false},
- {name: "FNAME",index: "FNAME", align: "center",sortable:false},
- {name: "OperateWeight",index: "OperateWeight", align: "center",sortable:false},
- {name: "fsType",index: "fsType", align: "center",sortable:false,hidden: true},
- {name: "CCID",index: "CCID", align: "center",sortable:false,hidden: true},
- {name: "CheckStatus",index: "CheckStatus", align: "center",sortable:false,hidden: true},
- {name: "fsTypeName",index: "fsTypeName", align: "center",sortable:false},
- {name: "CLASSNAME",index: "CLASSNAME", 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\",2)' style='height:30px;width:90px;font-size:12px;' /> ");
- $("#page_left").append("<input type='button' value='新增损耗' onClick='addRow(this,\"add\",1)' style='height:30px;width:70px;font-size:12px;' />");
- operCount++;
- }
- }
-
- //自定义添加方法
- function addRow(e,type,fsType){
- if(type == "modify"){
- var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
- if(selId!=null){
- var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
- iframeBox(e, {
- src:"${contextPath}/admin/feedstorage/addfeedstorageemployeeout.html?type="+type+"&feedStorageId="+rowData.FeedStorageId,
- width:470,
- height:400
- });
- }else{
- alert("请选择要修改的记录");
- }
- }else{
- iframeBox(e, {
- src:"${contextPath}/admin/feedstorage/addfeedstorageemployeeout.html?type="+type+"&fsType="+fsType,
- 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="BusinessDate" name="BusinessDate" style="width:100px;" class="datebox" value=""/>
- <input type="button" value="<" onclick="leftDate();" /><input type="button" value=">" onclick="rightDate();" />
- 操作类型:
- <select id="fsType">
- <option value="">全部</option>
- <option value="1">损耗</option>
- <option value="2">人工用料</option>
- </select>
- 饲料:
- <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="CCID">
- <option value="">全部</option>
- <c:forEach items="${cowClassList }" var="cowClass">
- <option value="${cowClass.ID }">
- <c:out value="${cowClass.CLASSNAME }" />
- </option>
- </c:forEach>
- </select>
- <input type="button" value="查询" onclick="queryDate()" class="sysub" />
- <table id="list"></table>
- <div id="page" style="height:30px;"></div>
- </div>
- </body>
- </html>
|