<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.flowengine.mode.monitor.FLOW_CONFIG_ENTRUST"%>
<%@page import="zr.zrpower.entity.sys.BPIP_USER"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.flowengine.service.FlowMonitor"%>
<%@page import = "zr.zrpower.ejb.sys.UserService"%>


<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
FLOW_CONFIG_ENTRUST[] entrust=null;
FlowMonitor Fmonitor = new FlowMonitor();
String userid=user.getUserID();
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<link REL="stylesheet" type="text/css" href="../../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/script/Public.js"></SCRIPT>
<!--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结束-->
<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>
<LINK rel=stylesheet type="text/css" href="../../../zrsysmanage/html5/dist/css/datepicker.min.css">
<SCRIPT LANGUAGE="Javascript" src="../../Datehtml5/laydate.dev.js"></SCRIPT>

</HEAD>
<%
    String strUnitID = user.getUnitID();

    //得到查询的记录集
     entrust=Fmonitor.GetMonitorList(userid);
 String strshow_data="";
     if (entrust!=null && entrust.length>0){

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

            strshow_data = strshow_data + "[";

            strshow_data = strshow_data + "\""+entrust[i].getID()+"\",";
            strshow_data = strshow_data + "\""+entrust[i].getIUSERNO()+"\",";
            strshow_data = strshow_data + "\""+entrust[i].getSDATE()+"\",";

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

        }

        strshow_data = strshow_data + "]";
    }else
    {
        strshow_data = "null";
    }
%>
<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 : 'IUSERNO'  },
		{name : 'SDATE'  },
		{name : 'EDATE' },

	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'ID' , header: "<center>编号</center>" , width :170 , align : 'left'  },
           {id: 'IUSERNO' , header: "<center>受委托人</center>" , width :300,  align : 'center'  },
	   {id: 'SDATE' , header: "<center>开始日期</center>" , width :180 ,align : 'center'  },
	   {id: 'EDATE' , header: "<center>结束日期</center>" , width :150 , 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(!user.getUserWINDOWTYPE().equals("6")){%>
var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid));
<%}%>
</script>
<BODY class="BodyMain">
<form name="recordfrm" action="EntrustList.jsp">
<input type="hidden" name="page">


<%if(user.getUserWINDOWTYPE().equals("6")){ %>

<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())%>
  </tr></table>



  <div id="mianRole" style="height: 90%;overflow: auto;">
  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:25%;">编号</th>
<th style="width:25%;">受委托人</th>
<th style="width:25%;">开始日期</th>
<th style="width:25%;">结束日期</th>
</tr>
</thead>

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

<%
        }
 }
%>

</table>
<br>
</div>

<%}else{%>




<!--HTML Head表单头显示[显示内容,图标文件,用户肤色的图片文件夹]-->
<%=userUI.ShowHeadHtml("权限委托管理","IcoTitle.gif",user.getUserImage())%>
<!--HTML 功能标题显示[显示内容,图标文件,宽度,用户肤色的图片文件夹]-->
<%=userUI.ShowTitleHtml("","","",user.getUserImage())%>
  <%=userUI.ClickButton("增加委托","JavaScript:add();","IcoAdd.gif",user.getUserImage())%>
  <%=userUI.ClickButton("编辑委托","JavaScript:edit();","IcoEdit.gif",user.getUserImage())%>

<!--HTML 功能标题结束-->
<%=userUI.ShowTitleEndHtml()%>
<!--HTML Body Start显示表单开始部分-->
<%=userUI.ShowBodyStartHtml()%>
 <div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:600px;width:800px;" ></div>

<!--HTML Foot显示表单尾-->
<%=userUI.ShowFootHtml()%>


<%}%>


</form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<!--
var allvalue="";
function clickValue(value){
    allvalue=value;
}
function add(){
    location.href="AddFrm.jsp";
}
function edit(){
   <%if(user.getUserWINDOWTYPE().equals("6")){ %>
     var strID = allvalue;

   <%}else{%>
     var allvalue = mygrid.getSelectedRecords()+",0";
     var strID = allvalue.split(",")[0];
   <%}%>

   if (strID==null||strID=="")
   {
       <%if(user.getUserWINDOWTYPE().equals("6")){ %>
         layer.alert('请先选择编辑的记录!', {icon: 7});
       <%}else{%>
         alert("请先选择编辑的记录!");
       <%}%>

    }else
    {location.href="EditFrm.jsp?SelectedItems="+strID;}
}
//-->
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
entrust = null;
Fmonitor = null;
%>
