123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <%@ page contentType="text/html; charset=utf-8" session="false" %>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <script type="text/javascript">
- var mydataFpdetail;
- $(document).ready( function() {
- fpdetailList(); //加载jqgrid
- panelS = $("body").layout("panel","south").panel();
- $("#fpdetaillist").jqGrid("setGridHeight",panelS.height()-60);
- $("#fpdetaillist").jqGrid("setGridWidth",document.body.clientWidth - 30);
- });
-
- //jqgrid初始化
- function fpdetailList(){
- jQuery("#fpdetaillist").jqGrid({
- datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
- height: 120, //高度
- colNames:["主键","饲料名称","是否补料","重量","早班1重量","早班1载重", "早班2重量","早班2载重","中班1重量","中班1载重","中班2重量","中班2载重", "晚班1重量","晚班1载重","晚班2重量","晚班2载重"], //列名
- colModel:[
- {
- name: "ID",
- index: "ID",
- align: "center",
- sorttype: "string",
- editable: false,
- hidden: true
- //editoptions:{readonly:true} 如果要显示该列可以设置只读
- },
- {
- name: "FNAME",
- index: "FNAME",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "isSupplyFeed",
- index: "isSupplyFeed",
- align: "center",
- sorttype: "string",
- editable: false,hidden: true
- },
- {
- name: "FWEIGHR",
- index: "FWEIGHR",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "w1",
- index: "w1",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "w1sum",
- index: "w1sum",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "w2",
- index: "w2",
- align: "center",
- sorttype: "string",
- editable: false,hidden: true
- },
- {
- name: "w2sum",
- index: "w2sum",
- align: "center",
- sorttype: "string",
- editable: false,hidden: true
- },
- {
- name: "w3",
- index: "w3",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "w3sum",
- index: "w3sum",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "w4",
- index: "w4",
- align: "center",
- sorttype: "string",
- editable: false,hidden: true
- },
- {
- name: "w4sum",
- index: "w4sum",
- align: "center",
- sorttype: "string",
- editable: false,hidden: true
- },
- {
- name: "w5",
- index: "w5",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "w5sum",
- index: "w5sum",
- align: "center",
- sorttype: "string",
- editable: false
- },
- {
- name: "w6",
- index: "w6",
- align: "center",
- sorttype: "string",
- editable: false,hidden: true
- },
- {
- name: "w6sum",
- index: "w6sum",
- align: "center",
- sorttype: "string",
- editable: false,hidden: true
- }
- ],
- pager: "#page1", //#page分页控件绑定的位置对象
- pginput: false, //不显示分页文本框
- pgbuttons: false, //不显示翻页按钮
- rowNum: 1000, //每页显示条数
- autowidth: true //自动调节宽度
- });
-
- //获取数据集
- mydataFpdetail = getFpdetailLists();
-
- if(mydataFpdetail!=null){
- for(var i=0;i<=mydataFpdetail.length;i++){
- jQuery("#fpdetaillist").jqGrid('addRowData',i+1,mydataFpdetail[i]);
- }
- jQuery("#fpdetaillist").jqGrid().trigger("reloadGrid"); //添加完数据后客户端自动刷新一次、实现客户端数据与服务器数据的完全分离
- }
-
- var isEnableSupplyFeed = $("#isEnableSupplyFeed").val();
- var isMorningPart = $("#isMorningPart").val();
- var isNoonPart = $("#isNoonPart").val();
- var isNightPart = $("#isNightPart").val();
-
- if(isEnableSupplyFeed == 1){
- $("#fpdetaillist").jqGrid("showCol","isSupplyFeed");
- }
- if(isMorningPart == 1){
- $("#fpdetaillist").jqGrid("showCol","w2");
- $("#fpdetaillist").jqGrid("showCol","w2sum");
- }
- if(isNoonPart == 1){
- $("#fpdetaillist").jqGrid("showCol","w4");
- $("#fpdetaillist").jqGrid("showCol","w4sum");
- }
- if(isNightPart == 1){
- $("#fpdetaillist").jqGrid("showCol","w6");
- $("#fpdetaillist").jqGrid("showCol","w6sum");
- }
-
- }
-
- //获取服务器数据
- function getFpdetailLists(){
- var currentFpId = $("#currentFpId").val();
- $.ajax({
- async: false,
- type: 'POST',
- dataType:'json', //返回类型json
- url: "${contextPath }/admin/recipeplan/fpdetaillist.html?currentFpId="+currentFpId,
- error: function(){alert("系统错误");},
- success: function(json){
- mydataFpdetail = json;
- }
- });
- return mydataFpdetail;
- }
-
- </script>
- <input type="hidden" id="currentFpId" name="currentFpId" value="${currentFpId }" />
- <input type="hidden" id="isEnableSupplyFeed" name="isEnableSupplyFeed" value="${isEnableSupplyFeed }" />
- <input type="hidden" id="isMorningPart" name="isMorningPart" value="${isMorningPart }" />
- <input type="hidden" id="isNoonPart" name="isNoonPart" value="${isNoonPart }" />
- <input type="hidden" id="isNightPart" name="isNightPart" value="${isNightPart }" />
- <table id="fpdetaillist"></table>
- <div id="page1"></div>
|