表格动态展示与下钻

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String nodeType = request.getParameter("nodeType");

String currId = request.getParameter("currId");

String branchId = (String)request.getSession().getAttribute("branchId");

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

  <head>

    <base href="<%=basePath%>">

    

    <title>评分卡管理</title>

    

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">    

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="This is my page">

    

<link rel="stylesheet" type="text/css" href="css/common.css" />

<script type="text/javascript" src="js/jquery-easyui-1.2.6/jquery-1.7.2.min.js"></script>

<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.2.6/themes/default/easyui.css" />

<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.2.6/themes/icon.css" />

<script type="text/javascript" src="js/jquery-easyui-1.2.6/jquery.easyui.min.js"></script>

<script type="text/javascript" src="js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js"></script>

<!-- <script type="text/javascript" src="js/commons.js"></script> -->

<script type="text/javascript">

$(function(){

var nodeType = "<%=nodeType%>";

var currId = "<%=currId%>";

var maxDate = "";

$.post('<%=request.getContextPath()%>/EstimateGroupManage.do?method=getLatestCalDate',"",

      function(result){

      var rows = result.rows;

      maxDate = rows[0].MAXRUNDATE;

      $('#check_date').datebox('setValue', maxDate);

     

      if(nodeType=="3"){

      $("#ruleOrGroupScoreTable").datagrid({

/* idField:'id' , */

title:'得分明细' ,//没有内容,就会少一个div的标题内容

//width:1300 ,

fit:true ,

height:420 ,

singleSelect:false,

queryParams:{nodeType:nodeType,currId:currId,check_date:maxDate},//表单再次提交时得到的内容为空

url:'<%=request.getContextPath()%>/EstimateGroupManage.do?method=queryCardScore' ,

fitColumns:true ,

rownumbers:false,//显示序号,默认是true

selectOnCheck: true,

checkOnSelect: true,

striped: true ,//隔行变色特性 

//nowrap: false ,//折行显示

loadMsg: '数据正在加载,请耐心的等待...' ,

frozenColumns:[[//冻结列特性 ,不要与fitColumns 特性一起使用 

{

field:'ck' ,

width:30 ,

checkbox: true

}

]],

columns:[[

{

field:'FOLDER_ID' ,//FOLDER_ID 

title:'规则ID' ,

width:40,

hidden: false

},{

field:'FOLDER_NAME' ,

title:'规则名称' ,

width:220,

hidden:false

},{

field:'SCORE' ,

title:'规则得分' ,

width:60,

hidden:false

},{

field:'WEIGHT' ,

title:'实际权重' ,

width:60,

hidden:false

},{

field:'PASS_RATE' ,

title:'通过率' ,

width:60,

hidden:false

},{field:'SYS_ID',title: 'schema',align: 'center',width: 80},  

                     {field:'TABLE_NAME',title: '表名',align: 'center',width: 80},

                     {field:'CHECK_COLUMN_NAME',title: '字段名',align: 'center',width: 80}, 

{

field:'RUNDATE' ,

title:'检查日期' ,

width:80 ,

hidden: false

}

]] ,

toolbar:[

{  

               text:'下载',iconCls:'icon-download',handler:downNodeScore

           },{  

               text:'查看下级',iconCls:'icon-edit',handler:drillRuleOrGroup1

           }

          ],  

pagination: true , 

pageSize: 10 ,

pageList:[10,15,20,50]

});//table data init block

      }else{

      $('#ruleOrGroupScoreTable').datagrid({

/* idField:'id' , */

title:'得分明细' ,//没有内容,就会少一个div的标题内容

//width:1300 ,

fit:true ,

height:420 ,

singleSelect:false,

queryParams:{nodeType:nodeType,currId:currId,check_date:maxDate},//表单再次提交时得到的内容为空

url:'<%=request.getContextPath()%>/EstimateGroupManage.do?method=queryCardScore' ,

fitColumns:true ,

rownumbers:false,//显示序号,默认是true

selectOnCheck: true,

checkOnSelect: true,

striped: true ,//隔行变色特性 

//nowrap: false ,//折行显示

loadMsg: '数据正在加载,请耐心的等待...' ,

frozenColumns:[[//冻结列特性 ,不要与fitColumns 特性一起使用 

{

field:'ck' ,

width:30 ,

checkbox: true

}

]],

columns:[[

{

field:'FOLDER_ID' ,//FOLDER_ID 

title:'评分组ID' ,

width:40,

hidden: false

},{

field:'FOLDER_NAME' ,

title:'评分组名称' ,

width:120,

hidden:false

},{

field:'SCORE' ,

title:'实际得分' ,

width:40,

hidden:false

},

{

field:'MAXSCORE' ,

title:'最高得分' ,

width:40,

hidden:false

},{

field:'SCOREPCT' ,

title:'得分占比(%)' ,

width:40,

hidden:false

},   

{

field:'RUNDATE' ,

title:'检查日期' ,

width:80 ,

hidden: false

}

]] ,

toolbar:[

{  

               text:'下载',iconCls:'icon-download',handler:downNodeScore

           },{  

               text:'查看下级',iconCls:'icon-edit',handler:drillRuleOrGroup1

           }

          ],  

pagination: true , 

pageSize: 10 ,

pageList:[10,15,20,50]

});//table data init block

      }

     },'json');

$('#searchbtn').click(function(){

$('#ruleOrGroupScoreTable').datagrid('reload',serializeForm($('#mysearch')));

});

});//jquery init block

function drillRuleOrGroup1(){

var nodeType = $("input[name='nodeType']").val();

if("3"==nodeType){

drillOrgRuleScore1();

}else{

drillOrgGroupScore1();

}

}

function drillOrgRuleScore1(){

        var rows = $("#ruleOrGroupScoreTable").datagrid("getSelections");

if (rows==null || rows==""){

$.messager.alert("提 示","请选择需要查看的记录!","icon-cancel");

return false;

}

if(rows.length>1){

$.messager.alert("提 示","只能查看一条记录的得分信息!","icon-cancel");

return false;

}

var row = $("#ruleOrGroupScoreTable").datagrid("getSelected");

var nodeId = row.FOLDER_ID;

        $("#drillOrgRuleScoreDiv1").dialog("open").dialog("setTitle",row.FOLDER_NAME);

        var check_date = $("input[name='check_date']").val();

        if(check_date==""){

        $.messager.alert("提 示","请选择检查日期!","icon-cancel");

        return ;

        }

        //加载数据

    $("#drillOrgRuleScoreTable1").datagrid({

                width: 'auto',  

                height: "380",//auto的话表格高度会随着数据的变化而变化               

                striped: true,  

                singleSelect : true,  

                url:'<%=request.getContextPath()%>/EstimateGroupManage.do?method=searchBelowOrgRuleScore&nodeId='+nodeId ,

                queryParams:{check_date:check_date,selOrg:<%=branchId%>}, 

                loadMsg:'数据加载中请稍后……',  

                pagination: true,  

                rownumbers: false,     

                columns:[[  

                {field:'BRANCH_ID',title: '机构代码',align: 'center',width: 120,hidden:false},

                    {field:'BRANCH_NAME',title: '机构名称',align: 'center',width: 250,hidden:false,

                    formatter:function(value,record,index){

                    return "<a style='text-decoration:underline' title='"+record.BRANCH_ID+"#"+value+"' onclick='drillOrgRuleScore2("+nodeId+")'>"+value+"</a>";

                    }

                    },

                    

                    {field:'CHECK_ID',title: '规则ID',align: 'center',width: 80,hidden:true},

                    {field:'SCORE',title: '规则得分',align: 'center',width: 80,hidden:false},  

                    {field:'WEIGHT' ,title:'实际权重' ,width:60,hidden:false},

                    {field:'PASS_RATE' ,title:'通过率' ,width:80,hidden:false},

                    {field:'SYS_ID',title: 'schema',align: 'center',width: 80},  

                    {field:'TABLE_NAME',title: '表名',align: 'center',width: 120},

                    {field:'CHECK_COLUMN_NAME',title: '字段名',align: 'center',width: 80},    

                    {field:'RUNDATE',title: '计算日期',hidden:true,align: 'center',width:200,formatter:function(value , record , index){

var str = value.substring(0,19);

return str;

}}

                ]]  

            }); 

        }

        

        function drillOrgRuleScore2(nodeId){

        var obj = event.srcElement;

var clickOrg = obj.title.split("#")[0];

var check_date = $("input[name='check_date']").val();

        if(check_date==""){

        $.messager.alert("提 示","请选择检查日期!","icon-cancel");

        return ;

        }

        $("#drillOrgRuleScoreDiv2").dialog("open").dialog("setTitle",obj.title.split("#")[1]);

        var check_date = $("input[name='check_date']").val();

        if(check_date==""){

        $.messager.alert("提 示","请选择检查日期!","icon-cancel");

        return ;

        }

        //加载数据

    $("#drillOrgRuleScoreTable2").datagrid({

                width: 'auto',  

                height: "380",//auto的话表格高度会随着数据的变化而变化               

                striped: true,  

                singleSelect : true,  

                url:'<%=request.getContextPath()%>/EstimateGroupManage.do?method=searchBelowOrgRuleScore&nodeId='+nodeId ,

                queryParams:{check_date:check_date,selOrg:clickOrg}, 

                loadMsg:'数据加载中请稍后……',  

                pagination: true,  

                rownumbers: false,     

                columns:[[  

                {field:'BRANCH_ID',title: '机构代码',align: 'center',width: 120,hidden:false},

                    {field:'BRANCH_NAME',title: '机构名称',align: 'center',width: 250,hidden:false},

                    {field:'CHECK_ID',title: '规则ID',align: 'center',width: 80,hidden:true},

                    {field:'SCORE',title: '规则得分',align: 'center',width: 80,hidden:false},  

                    {field:'WEIGHT' ,title:'实际权重' ,width:60,hidden:false},

                    {field:'PASS_RATE' ,title:'通过率' ,width:80,hidden:false},

                    {field:'SYS_ID',title: 'schema',align: 'center',width: 80},  

                    {field:'TABLE_NAME',title: '表名',align: 'center',width: 120},

                    {field:'CHECK_COLUMN_NAME',title: '字段名',align: 'center',width: 80},    

                    {field:'RUNDATE',title: '计算日期',hidden:true,align: 'center',width:200}

                ]]  

            }); 

        }

        

//查看当前机构评分组第一次下钻得分

function drillOrgGroupScore1(){

var rows = $("#ruleOrGroupScoreTable").datagrid("getSelections");

if (rows==null || rows==""){

$.messager.alert("提 示","请选择需要查看的记录!","icon-cancel");

return false;

}

if(rows.length>1){

$.messager.alert("提 示","只能查看一条记录的得分信息!","icon-cancel");

return false;

}

var row = $("#ruleOrGroupScoreTable").datagrid("getSelected");

var nodeId = row.FOLDER_ID;

var check_date = $("input[name='check_date']").val();

        if(check_date==""){

        $.messager.alert("提 示","请选择检查日期!","icon-cancel");

        return ;

        }

       

        $("#nodeIdDown").val(nodeId);

        $("#drillOrgGroupScoreDiv1").dialog("open").dialog("setTitle",row.FOLDER_NAME);

        //加载数据

    $("#drillOrgGroupScoreTable1").datagrid({

                width: 'auto',  

                height: "380",//auto的话表格高度会随着数据的变化而变化               

                striped: true,  

                singleSelect : true,  

                url:'<%=request.getContextPath()%>/EstimateGroupManage.do?method=searchBelowOrgGroupScore&nodeId='+nodeId ,

                queryParams:{check_date:check_date,selOrg:<%=branchId%>},  

                loadMsg:'数据加载中请稍后……',  

                pagination: true,  

                rownumbers: false,     

                columns:[[  

                {field:'ORG_ID',title: '机构代码',align: 'center',width: 110,hidden:false},

                    {field:'ORGNAME',title: '机构名称',align: 'center',width: 300,hidden:false,formatter:function(value,record,index){

                    return "<a style='text-decoration:underline' title='"+record.ORG_ID+"#"+value+"' onclick='drillOrgGroupScore2("+nodeId+")'>"+value+"</a>";

                    }},

                    

                    {field:'SCORE',title: '实际得分',align: 'center',width: 80},

                    {field:'MAXSCORE',title: '最高得分',align: 'center',width: 80,hidden:false},

                    {field:'SCOREPCT',title: '得分占比',align: 'center',width: 80,hidden:false},

                    {field:'RUNDATE',title: '检查日期',align: 'center',hidden:true,width:120,formatter:function(value , record , index){

//var str = value.substring(0,19);

return value;

}}

                                                                

                ]]  

            }); 

}

//当前机构查看分数第一次下钻

function drillOrgGroupScore2(nodeId){

var obj = event.srcElement;

var clickOrg = obj.title.split("#")[0];

var check_date = $("input[name='check_date']").val();

        if(check_date==""){

        $.messager.alert("提 示","请选择检查日期!","icon-cancel");

        return ;

        }

        $("#drillOrgGroupScoreDiv2").dialog("open").dialog("setTitle",obj.title.split("#")[1]);

    $("#drillOrgGroupScoreTable2").datagrid({

                width: 'auto',  

                height: "380",//auto的话表格高度会随着数据的变化而变化               

                striped: true,  

                singleSelect : true,  

                url:'<%=request.getContextPath()%>/EstimateGroupManage.do?method=searchBelowOrgGroupScore&nodeId='+nodeId ,

                queryParams:{check_date:check_date,selOrg:clickOrg},  

                loadMsg:'数据加载中请稍后……',  

                pagination: true,  

                rownumbers: false,     

                columns:[[  

                {field:'ORG_ID',title: '机构代码',align: 'center',width: 120,hidden:false},

                    {field:'ORGNAME',title: '机构名称',align: 'center',width: 300,hidden:false},

                    {field:'SCORE',title: '实际得分',align: 'center',width: 80},

                    {field:'MAXSCORE',title: '最高得分',align: 'center',width: 80,hidden:false},

                    {field:'SCOREPCT',title: '得分占比',align: 'center',width: 80,hidden:false}                                                        

                ]]  

            }); 

}

    

// 表单字段信息的收集

function serializeForm(form){

var obj = {};

$.each(form.serializeArray(),function(index){

// 下面的this是一个表单域的对象

if(obj[this['name']]){

obj[this['name']] = obj[this['name']] + ','+this['value'];

} else {

obj[this['name']] =this['value'];

}

});

return obj;

}

 function downNodeScore() {

       

        $("#mysearch").form('submit',{

       url: '<%=request.getContextPath()%>/EstimateGroupManage.do?method=exportScoreDetail',

       onSubmit: function(param){

       //除了表单的元素,再提交自定义的参数

           return true;

       },

       success: function(result){

       var result = eval('('+result+')');

       

       }

   });

}

</script>

  </head>

  

  <body>

<div id="lay" class="easyui-layout" style="width: 100%;height:100%" >

<div region="north" title="条件过滤" collapsed=false style="height:70px;padding-top:5px" >

<form id="mysearch" method="post">&nbsp;&nbsp;&nbsp;&nbsp;

<input name="nodeType" type="hidden" value="<%=nodeType %>" />

<input name="currId" type="hidden" value="<%=currId %>" />

<input name="nodeIdDown" id="nodeIdDown" type="hidden" value="" style="width:120px" />

检查日期:<input name="check_date" id="check_date" class="easyui-datebox" value="" style="width:120px" />

<!-- 评分卡名称:<input name=FOLDER_NAME class="easyui-validatebox"  style="width:100px" value="" /> -->

<a id="searchbtn" class="easyui-linkbutton" style="margin-left:20px">查询</a>

</form>

</div>

<div region="center" >

<table id="ruleOrGroupScoreTable"></table>

</div>

</div>

 <div id="drillOrgGroupScoreDiv1" class="easyui-dialog" closed="true"

    style="width:700px;height:450px;" buttons="#allBelowOrgScoreButtons">

<div class="ftitle"><!-- title信息,根据增加和修改按钮动态变化 --></div>

<table id="drillOrgGroupScoreTable1"></table> 

</div>

<div id="drillOrgGroupScoreDiv2" class="easyui-dialog" closed="true"

    style="width:700px;height:450px;" buttons="#card_tree_buttons">

<div class="ftitle"><!-- title信息,根据增加和修改按钮动态变化 --></div>

<table id="drillOrgGroupScoreTable2"></table> 

</div>

<div id="drillOrgRuleScoreDiv1" class="easyui-dialog" closed="true"

    style="width:700px;height:450px;" buttons="#card_tree_buttons">

<div class="ftitle"><!-- title信息,根据增加和修改按钮动态变化 --></div>

<table id="drillOrgRuleScoreTable1"></table> 

</div>

<div id="drillOrgRuleScoreDiv2" class="easyui-dialog" closed="true"

    style="width:700px;height:450px;" buttons="#card_tree_buttons">

<div class="ftitle"><!-- title信息,根据增加和修改按钮动态变化 --></div>

<table id="drillOrgRuleScoreTable2"></table> 

</div>

  </body>

</html>

相关推荐