<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import="zr.zrpower.dbmanage.service.FieldService"%>
<%@ page import="zr.zrpower.dbmanage.*"%>
<%@ page import=" zr.zrpower.entity.sys.CODE_YWXT"%>
<%@ page import ="zr.zrpower.ejb.sys.UdictService"%>
<%@ page import = "zr.zrpower.dbmanage.service.TableService" %>

<%@ page import = "zr.zrpower.common.util.DateWork" %>
<%@ page import = "java.lang.Object"%>


<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
DateWork dw=new DateWork();
BPIP_FIELD[] TC = null;
BPIP_FIELD[] TC1 = null;
CODE_YWXT[] DC= null;
UdictService Udict = new UdictService();
FieldService Field = new FieldService();
TableService Table = new TableService();

String strtableid = request.getParameter("TABLEID");
if (strtableid==null){strtableid = "";}

if (strtableid.length()==0)
{
   //得到最小的表编号
   strtableid = Table.GetMinTABLEID1();
}

String strshow_data = "";
DC = Udict.GetCodeList(strtableid);

if (DC!=null && DC.length>0){
  strshow_data = strshow_data + "[";
  for(int i=0;i<DC.length;i++){
         strshow_data = strshow_data + "[";
         strshow_data = strshow_data + "\""+DC[i].getCODE()+"\",";
         strshow_data = strshow_data + "\""+DC[i].getNAME()+"\",";
         strshow_data = strshow_data + "\""+DC[i].getSPELL()+"\",";

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

  strshow_data = strshow_data + "]";
}else
{
   strshow_data = "null";
}

%>
<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()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>

<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>
<%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>
<%}%>


<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 : 'code'  },
		{name : 'name'  },
		{name : 'spell'  },
		{name : 'isshow'  }
	],

	recordType : 'array',
	data : show_data
}



var colsOption = [
           {id: 'code' , header: "<center>编号</center>" , width :80 , align : 'center'  },
           {id: 'name' , header: "<center>名称</center>" , width :260,  align : 'center'  },
	   {id: 'spell' , header: "<center>拼音首字母</center>" , width :100 ,align : 'center'  },
	   {id: 'isshow' , header: "<center>是否禁用</center>" , width :100 , align : 'center'   }
];


var gridOption={
	id : grid_demo_id,
	width: "570",
	height: "400",
	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 : false
};

<%if(!"6".equals(user.getUserWINDOWTYPE())){ %>
var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid));
<%}%>
</script>

</HEAD>
<BODY class="BodyMain">
<form name="recordfrm" action="">
<input type="hidden" name="setall" value="0">
<!--HTML 功能标题显示[显示内容,图标文件,宽度,用户肤色的图片文件夹]-->
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
      <br/>
   <%}%>

<TABLE width="100%" height='100%' cellSpacing='0' cellPadding='0' border='0'><tr><td>
<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></td></tr><tr><td valign="top">

  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  <div id="mianRole" style="height: 300px;overflow: auto;">
  <table class="bordered" id="html5_table">


<tr>
<th style="width:10%;">编号</th>
<th style="width:60%;">名称</th>
<th style="width:15%;">拼音首字母</th>
<th style="width:15%;">是否禁用</th>
</tr>


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

 %>
</table></div>
  <%}else{ %>
  <div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:200px;width:700px;" ></div>
  <% }%>

</td></tr></TABLE>
</form>
</BODY>

<script language="JavaScript" type="text/JavaScript">
<!--
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
 var h=$(document.body).height();//浏览器当前窗口文档body的高度
 h=h*1-100;
 $('div').css('height',h);
<%}%>

var allvalue="";
function clickValue(value){
    allvalue=value;
}


function add(){
    location.href="UDictAddFrm.jsp?TABLEID=<%=strtableid%>";
}
function edit(){
    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID!=""){
           location.href="UDictEditFrm.jsp?ID="+strID+"&TABLEID=<%=strtableid%>";
        }else{
          layer.alert('请选择要操作的数据!', {icon: 7});
        }
    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
        var strID = allvalue.split(",")[0];
        location.href="UDictEditFrm.jsp?ID="+strID+"&TABLEID=<%=strtableid%>";
    <%}%>
}
//--
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
TC = null;
TC1 = null;
Udict = null;
DC = null;
Field = null;
%>
