123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <%@ 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;
- if(month<10){
- month="0"+month;
- }
- var day = myDate.getDate();
- if(day<10){
- day="0"+day;
- }
- //var bdate = year + "-" + month + "-01";
- var nowdate = year + "-" + month + "-" + day;
-
- var bdate = checkDate(nowdate);//当前日期减30天
-
- $("#beginDate").val(bdate);
- $("#endDate").val(nowdate);
- }
-
- //当前日期减30天
- function checkDate(date){
- var bdate = date.split("-");
- var cd = bdate[1]+"/"+bdate[2]+"/"+bdate[0];
- var nd = new Date(cd);
- nd = nd.valueOf();
- nd = nd - 24 * 60 * 60 * 1000 * 30; // * 167 是天数
- nd = new Date(nd);
- var y = nd.getFullYear();
- var m = nd.getMonth() + 1;
- if(m<10){
- m="0"+m;
- }
- var d = nd.getDate();
- if(d<10){
- d="0"+d;
- }
- var newdate = y+"-"+m+"-"+d;
- return newdate;
- }
-
-
-
- //查询数据
- function queryDate(){
- var beginDate = $("#beginDate").val();
- var endDate = $("#endDate").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/feedstorage/feedInventoryList.html",
- postData:{"beginDate":beginDate,"endDate":endDate}
- }
- ).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();
-
- jQuery("#list").jqGrid({
- url: "${contextPath }/admin/feedstorage/feedInventoryList.html?beginDate="+beginDate+"&endDate="+endDate,
- datatype: "json", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
- colNames:["主键","盘点日期","盘点人","备注"], //列名
- colModel:[
- {name: "invid",index: "invid",align: "center",hidden: true},
- {name: "inventorydate",index: "inventorydate",width:"100px", align: "center",sortable:false},
- {name: "createuser",index: "createuser", align: "center",sortable:false},
- {name: "remark",index: "remark", 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='toSavefeedInventory(this,\"add\")' style='height:30px;width:70px;font-size:12px;' /> ");
- $("#page_left").append("<input type='button' value='打开盘点单' onClick='toSavefeedInventory(this,\"open\")' style='height:30px;width:70px;font-size:12px;' /> ");
- operCount++;
- }
- }
-
- //自定义添加方法
- function toSavefeedInventory(e,type){
- if(type == "open"){
- var selId = $("#list").jqGrid("getGridParam","selrow"); //获取当前选中行号
- if(selId!=null){
- var rowData = $("#list").jqGrid("getRowData",selId); //获取当前选中行真实对象
- iframeBox(e, {
- src:"${contextPath}/admin/feedstorage/addFeedInventory.html?type="+type+"&invid="+rowData.invid,
- width:1000,
- height:600
- });
- }else{
- alert("请选择要查看的记录");
- }
- }else{
- iframeBox(e, {
- src:"${contextPath}/admin/feedstorage/addFeedInventory.html?type="+type+"&invid=",
- width:1000,
- height:600
- });
- }
- }
-
- 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="queryDate()" class="sysub" />
- <table id="list"></table>
- <div id="page" style="height:30px;"></div>
- </div>
- </body>
- </html>
|