123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <%@ 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 mydataP2;
- $(document).ready( function() {
- loadFtdetailList(); //加载jqgrid
-
- if(panelStatus == 0){
- panelC = $("body").layout("panel","center").panel();
- $("#list").jqGrid("setGridWidth",$(window).width()*0.33);
- $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
- $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
- $("#list").jqGrid("setGridHeight",panelC.height()-60);
- $("#p1list").jqGrid("setGridHeight",panelC.height()-80);
- $("#p2list").jqGrid("setGridHeight",panelC.height()-80);
- }else{
- panelS = $("body").layout("panel","south").panel();
- panelCHeight = $(window).height() - panelS.height();
- $("#list").jqGrid("setGridHeight",panelCHeight-110);
- $("#p1list").jqGrid("setGridHeight",panelCHeight-130);
- $("#p2list").jqGrid("setGridHeight",panelCHeight-130);
- $("#list").jqGrid("setGridWidth",$(window).width()*0.33);
- $("#p1list").jqGrid("setGridWidth",$(window).width()*0.32);
- $("#p2list").jqGrid("setGridWidth",$(window).width()*0.32);
- }
- });
-
- //jqgrid初始化
- function loadFtdetailList(){
- jQuery("#p2list").jqGrid({
- datatype: "local", //从服务器端返回的数据类型,(表格期望接收的数据类型)。可选类型:xml,xmlstring,json,local,function
- height: 100, //高度
- colNames:["主键","操作编号", "投料位置","计划重量","实际重量", "完成时间", "过程时间", "开始读数重量", "最后读数重量","方式","wc"], //列名
- colModel:[
- {
- name: "ID",
- index: "ID",
- align: "center",
- sorttype: "string",
- hidden: true
- },
- {
- name: "SORT",
- index: "SORT",
- width: 50,
- align: "center",
- sorttype: "string"
- },
- {
- name: "BNAME",
- index: "BNAME",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "LWEIGHT",
- index: "LWEIGHT",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "ActualWeightMinus",
- index: "ActualWeightMinus",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "InTime",
- index: "InTime",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "processTime",
- index: "processTime",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "LastActualWeight",
- index: "LastActualWeight",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "ActualWeight",
- index: "ActualWeight",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "ButtonType",
- index: "ButtonType",
- width: 70,
- align: "center",
- sorttype: "string"
- },
- {
- name: "isWc",
- index: "isWc",
- align: "center",
- sorttype: "string",
- hidden: true
- }
- ],
-
- afterInsertRow: function(rowid,rowdata,rowelem){
- if(rowdata.isWc == 1){
- $("#p2list").setCell(rowid,1,"",{background:'#FFE66F'});
- $("#p2list").setCell(rowid,2,"",{background:'#FFE66F'});
- $("#p2list").setCell(rowid,3,"",{background:'#FFE66F'});
- $("#p2list").setCell(rowid,4,"",{background:'#FFE66F'});
- $("#p2list").setCell(rowid,5,"",{background:'#FFE66F'});
- $("#p2list").setCell(rowid,6,"",{background:'#FFE66F'});
- $("#p2list").setCell(rowid,7,"",{background:'#FFE66F'});
- $("#p2list").setCell(rowid,8,"",{background:'#FFE66F'});
- }
- },
-
- footerrow: true, //统计运算的功能
- gridComplete: completeMethod,
- /**
- * 设置水平滚动条 begin
- **/
- shrinkToFit:false,
- autoScroll: true,
- width: 350,
- //autowidth: true, //自动调节宽度
- rowNum: 1000, //每页显示条数
- /**
- * 设置水平滚动条 end
- **/
- altRows: true, //设置表格是否允许行交替变色值
- altclass:"tdbgmouseover" //自定义隔行变色的样式
-
- });
-
- //获取数据集
- mydataP2 = getFtdetailLists();
-
- if(mydataP2!=null){
- for(var i=0;i<=mydataP2.length;i++){
- jQuery("#p2list").jqGrid('addRowData',i+1,mydataP2[i]);
- }
- }
- }
-
- //获取服务器数据
- function getFtdetailLists(){
- var currentpId = $("#currentpId").val();
- $.ajax({
- async: false,
- type: 'POST',
- dataType:'json', //返回类型json
- url: "${contextPath }/admin/statistics/process2list.html?currentpId="+currentpId,
- error: function(){alert("系统错误");},
- success: function(json){
- mydataP2 = json;
- }
- });
- return mydataP2;
- }
- //页脚统计
- function completeMethod(){
- var sum_lweight=$("#p2list").getCol("LWEIGHT",false,"sum");
- var sum_awm=$("#p2list").getCol("ActualWeightMinus",false,"sum");
- $("#p2list").footerData("set", {SORT:"合计:", LWEIGHT: sum_lweight.toFixed(2)});
- $("#p2list").footerData("set", {ActualWeightMinus: sum_awm.toFixed(2)});
- }
- </script>
- <table id="p2list"></table>
|