<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.common.util.DateWork" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.queryengine.mode.QUERY_CONFIG_TABLE"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.queryengine.service.QueryConfig"%>


<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
DateWork dw=new DateWork();
QUERY_CONFIG_TABLE[] querys = null;
QueryConfig QueryManage = new QueryConfig();
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<!--WEB组件样式和js-->
<link rel="stylesheet" type="text/css" media="all" href="../../ZrwebGui/sigma_grid/grid/calendar/calendar-blue.css" >
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/calendar/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/gt_grid.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/vista/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/pink/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/mac/skinstyle.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_const.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_grid_all.js"></script>

<!--WEB组件样式和js结束-->
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/html5/css/style_tables.css">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/html5/script/jquery-2.0.3.min.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/html5/layer/layer.js"></SCRIPT>
<%}%>
 <%
    //得到查询的记录集
     querys = QueryManage.All_Query_List("");

      String strshow_data="";
     if (querys!=null && querys.length>0){

        strshow_data = strshow_data + "[";
        for(int i=0;i<querys.length;i++){

            strshow_data = strshow_data + "[";

            strshow_data = strshow_data + "\""+querys[i].getID()+"\",";

               if (i <querys.length-1 )
         {
            strshow_data = strshow_data + "\""+querys[i].getNAME()+"\"],\r\n";
         }else
         {
            strshow_data = strshow_data + "\""+querys[i].getNAME()+"\"]";
         }

        }

        strshow_data = strshow_data + "]";
    }else
    {
        strshow_data = "null";
    }
%>
</HEAD>
<script type="text/javascript" >
var css = "<%=user.getUserCSS()%>";
var skincss = "vista";

if (css=="Blue.css")
{skincss = "vista";}
if (css=="Public.css")
{skincss = "default";}
if (css=="Window.css" || css=="nBlue.css")
{skincss = "mac";}
if (css=="Yellow.css")
{skincss = "pink";}


var grid_demo_id = "myGrid1" ;
var show_data= <%=strshow_data%>;

var dsOption= {

	fields :[
		{name : 'ID'  },
		{name : 'NAME'  }
	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'ID' , header: "<center>配置编号</center>" , width :80 , align : 'left'  },
           {id: 'NAME' , header: "<center>配置名称</center>" , width :400,  align : 'center' }
];


var gridOption={
	id : grid_demo_id,
	width: "99%",
	height: "92%",
	container : 'gridbox',
	replaceContainer : true,
	dataset : dsOption ,
	columns : colsOption,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,


        onCellDblClick:function(value, record , cell, row,  colNO, rowNO,columnObj,grid){

           edit();

        },

       showIndexColumn : true
};
<%if(!"6".equals(user.getUserWINDOWTYPE())){ %>
var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid));
<%}%>
</script>
<BODY class="BodyMain">
<form name="recordfrm" action="list.jsp">

<TABLE height='31' cellSpacing='0' cellPadding='0' border='0'>
 <TR>

  <%=userUI.ClickButton("新增配置","JavaScript:add();","IcoAdd.gif",user.getUserImage())%>
  <%=userUI.ClickButton("修改配置","JavaScript:edit();","IcoEdit.gif",user.getUserImage())%>
  <%=userUI.ClickButton("复制配置","JavaScript:copy();","buttonSure.gif",user.getUserImage())%>

  </tr></table>

<%if(!"6".equals(user.getUserWINDOWTYPE())){ %>
 <div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:600px;width:800px;" ></div>
<%}else{ %>
<div id="mianRole" style="height: 90%;overflow: auto;">
  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:5%;">序号</th>
<th style="width:10%;">配置编码</th>
<th style="width:85%;">配置名称</th>
</tr>
</thead>

<%
if (querys!=null && querys.length>0){
  for(int i=0;i<querys.length;i++){
     %>
     <tr onclick="click_color(this,'<%=querys[i].getID() %>');">
        <td style="text-align:center;"><%=i+1%></td>
        <td style="text-align:center;"><%=querys[i].getID() %></td>
        <td ><%=querys[i].getNAME() %></td>
     </tr>
     <%
  }
}

 %>
</table></div>
<%} %>


  </form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<!--
var allvalue="";
function clickValue(value){
    allvalue=value;
}
function add(){

    location.href="ManageConfig.jsp?Operate=Add&SelectedItems=";
}
function edit(){
   <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
           location.href="ManageConfig.jsp?SelectedItems="+strID;
        }else{
          parent.parent.layer.alert('请选择要操作的数据!', {icon: 7});
        }
    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
   var strID = allvalue.split(",")[0];
      if (strID==null||strID=="")
    {alert("请先选择编辑的记录!");
    }else
    {location.href="ManageConfig.jsp?SelectedItems="+strID;}
    <%}%>

}
function c2(){
 <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
           OpenPopWindow('Menu.jsp?Menu_No='+strID);
        }else{
          parent.parent.layer.alert('请先选择发布的记录!', {icon: 7});
        }
    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
   var strID = allvalue.split(",")[0];
      if (strID==null||strID=="")
    {alert("请先选择发布的记录!");
    }else
    {OpenPopWindow('Menu.jsp?Menu_No='+strID);}
    <%}%>

}
function copy(){
   <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;

        if(strID!=""){
           Opencopy("copy.jsp?ID="+strID);
        }else{
          layer.alert('请先选择要复制的记录!', {icon: 7});
        }
    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
   var strID = allvalue.split(",")[0];
      if (strID==null||strID=="")
    {alert("请先选择要复制的记录!");
    }else
    {
       if (confirm("真的要复制吗?")){
         Opencopy("copy.jsp?ID="+strID);
      }
    }
    <%}%>

}
function Opencopy(url){
  var name="PopWindow";
  var ShowPopWindow = null;
  var status="toolbar=no,location=No,resizable=no,directories=no,status=no,menubar=no,scrollbars=yes,width=260,height=100";
  ShowPopWindow = window.open(url,name,status);
  ShowPopWindow.moveTo(280,260);
  ShowPopWindow.focus();
}
//-->
</script>
</HTML>
