<%@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.ejb.sys.SecurityService"%>

<%@page import="zr.zrpower.common.util.DateWork"%>
<%@page import="zr.zrpower.queryengine.service.QueryConfig"%>
<%@page import="zr.zrpower.queryengine.service.QueryButton"%>
<%@page import="zr.zrpower.queryengine.mode.*"%>
<%@page import="java.lang.Object"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>


<%

  int i=0;
  SessionUser user = (SessionUser) session.getAttribute("userinfo");
  UIService userUI = new UIService();
  String ID =request.getParameter("SelectedItems");
  String QITEMTYPE = "1";
  String QTABLETYPE = "1";



  if (ID==null){ID="";}
  QueryConfig queryConfig = new QueryConfig();


  QUERY_CONFIG_TABLE objConfigTable=null;

   if (ID.length()>0 && request.getParameter("Operate") == null) {
    objConfigTable = queryConfig.GetConfigByID(ID);
    QITEMTYPE = objConfigTable.getQITEMTYPE();
    QTABLETYPE = objConfigTable.getQTABLETYPE();
    if (QITEMTYPE==null){QITEMTYPE="";}
    if (QITEMTYPE.length()==0){QITEMTYPE="1";}
    if (QTABLETYPE==null){QTABLETYPE="";}
    if (QTABLETYPE.length()==0){QTABLETYPE="1";}

  }
  else
  {
    objConfigTable=new QUERY_CONFIG_TABLE();
    objConfigTable.setID("");
    objConfigTable.setNAME("");
    objConfigTable.setMAINTABLE("");
    objConfigTable.setTYPE("1");
    objConfigTable.setIFFIRSTDATA("1");
    objConfigTable.setIFMULSEL("0");
    objConfigTable.setIFCOMBTN("1");

  }

  int row1=0;
  String show_data1 = null;
  int jnum1=0;
  int row2=0;
  String show_data2 = null;
  int jnum2=0;
  int row3=0;
  String show_data3 = null;
  int jnum3=0;
  int row4=0;
  String show_data4 = null;
  int jnum4=0;
  int row5=0;
  String show_data5 = null;
  int jnum5=0;
  int row6=0;
  String show_data6 = null;
  int jnum6=0;

  //关联表属性
  QUERY_CONFIG_CONNECTION[] connectionList;
  connectionList=queryConfig.GetConfigConnectionByWhere(" FID='"+objConfigTable.getID()+"'");

  jnum1=8;
  show_data1 = "[";
  if (connectionList!=null)
  {
        row1=connectionList.length;
        jnum1=8-connectionList.length;

        for(int x=0;x<connectionList.length;x++){

              show_data1 = show_data1 + "['','','','','','','','','',''],\r\n";

        }
        if (connectionList.length>=8){show_data1 = show_data1.substring(0,show_data1.length()-3);}
  }



  for(int x=0;x<jnum1;x++)
  {
       if (x <jnum1-1)
       {
          show_data1 = show_data1 + "['','','','','','','','','',''],\r\n";
       }else
       {
          show_data1 = show_data1 + "['','','','','','','','','','']";
       }
  }
  show_data1 = show_data1 + "]";
  row1=row1-1;


  //初始条件属性
  QUERY_CONFIG_INIT[]   whereList;
  whereList=queryConfig.GetConfigInitByWhere(" FID='"+objConfigTable.getID()+"'");

  jnum2=8;
  show_data2 = "[";
  if (whereList!=null)
  {
        row2=whereList.length;
        jnum2=8-whereList.length;

        for(int x=0;x<whereList.length;x++){

              show_data2 = show_data2 + "['','','','','','','','','',''],\r\n";

        }
        if (whereList.length>=8){show_data2 = show_data2.substring(0,show_data2.length()-3);}
  }



  for(int x=0;x<jnum2;x++)
  {
       if (x <jnum2-1)
       {
          show_data2 = show_data2 + "['','','','','','','','','',''],\r\n";
       }else
       {
          show_data2 = show_data2 + "['','','','','','','','','','']";
       }
  }
  show_data2 = show_data2 + "]";
  row2=row2-1;



  //查询列属性
  QUERY_CONFIG_QUERYFIELD[] queryFieldList;
  queryFieldList=queryConfig.GetQueryFieldByWhere(" FID='"+objConfigTable.getID()+"'");

  //结果列属性
  QUERY_CONFIG_SHOWFIELD[] resultFieldList;
  resultFieldList=queryConfig.GetResultFieldByWhere(" FID='"+objConfigTable.getID()+"'");

  jnum3=100;
  show_data3 = "[";
  if (resultFieldList!=null)
  {
        row3=resultFieldList.length;
        jnum3=100-resultFieldList.length;

        for(int x=0;x<resultFieldList.length;x++){

              show_data3 = show_data3 + "['','','','',''],\r\n";

        }
        if (resultFieldList.length>=100){show_data3 = show_data3.substring(0,show_data3.length()-3);}
  }


  for(int x=0;x<jnum3;x++)
  {
       if (x <jnum3-1)
       {
          show_data3 = show_data3 + "['','','','',''],\r\n";
       }else
       {
          show_data3 = show_data3 + "['','','','','']";
       }
  }
  show_data3 = show_data3 + "]";
  row3=row3-1;




 //明细参数属性
  QUERY_CONFIG_PARAMETER[] detailParameterList;
  detailParameterList=queryConfig.GetDetailParameterFieldByWhere(" FID='"+objConfigTable.getID()+"'");

  jnum4=8;
  show_data4 = "[";
  if (detailParameterList!=null)
  {
        row4=detailParameterList.length;
        jnum4=8-detailParameterList.length;

        for(int x=0;x<detailParameterList.length;x++){

              show_data4 = show_data4 + "['','','','','','','','','',''],\r\n";

        }
        if (detailParameterList.length>=8){show_data4 = show_data4.substring(0,show_data4.length()-3);}
  }



  for(int x=0;x<jnum4;x++)
  {
       if (x <jnum4-1)
       {
          show_data4 = show_data4 + "['','','','','','','','','',''],\r\n";
       }else
       {
          show_data4 = show_data4 + "['','','','','','','','','','']";
       }
  }
  show_data4 = show_data4 + "]";
  row4=row4-1;


  show_data5 = show_data4;
  row5=row4;


  QUERY_CONFIG_BUTTON[] buttonAll = null;
  QUERY_CONFIG_BUTTON[] buttonConfig = null;
  QueryButton queryButton = new QueryButton();
  buttonAll=queryButton.GetShowButton(objConfigTable.getID());
  buttonConfig=queryButton.GetButtonList(" ID In(Select BID from QUERY_CONFIG_BRELATION Where FID='"+objConfigTable.getID()+"')");
 buttonConfig=queryButton.GetButtonByFID(objConfigTable.getID());

 //排序属性
 QUERY_CONFIG_ORDER[] orderList=null;
 orderList=queryConfig.GetSortByWhere(" FID='"+objConfigTable.getID()+"'");

  jnum6=6;
  show_data6 = "[";
  if (orderList!=null)
  {
        row6=orderList.length;
        jnum6=6-orderList.length;

        for(int x=0;x<orderList.length;x++){

              show_data6 = show_data6 + "['','','','',''],\r\n";

        }
        if (orderList.length>=6){show_data6 = show_data6.substring(0,show_data6.length()-3);}
  }



  for(int x=0;x<jnum6;x++)
  {
       if (x <jnum6-1)
       {
          show_data6 = show_data6 + "['','','','',''],\r\n";
       }else
       {
          show_data6 = show_data6 + "['','','','','']";
       }
  }
  show_data6 = show_data6 + "]";
  row6=row6-1;



%>

<HTML>
<HEAD>
<TITLE><%=SysPreperty.getProperty().SystemName%><%=SysPreperty.getProperty().Versoin%></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 type='text/javascript' src="../../zrsysmanage/script/Public.js"></SCRIPT>
<SCRIPT type='text/javascript' src="../../zrsysmanage/script/DealList.js"></SCRIPT>
<script type='text/javascript' src='../../dwr/engine.js'></script>
<script type='text/javascript' src='../../dwr/util.js'></script>
<script type='text/javascript' src='../../dwr/interface/QueryCfgBean.js'></script>


<%if("6".equals(user.getUserImage())){ %>
<link rel="stylesheet" type="text/css" media="all" href="../../ZrwebGui/sigma_grid_html/grid/calendar/calendar-blue.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/calendar/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/gt_grid.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/skin/vista/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/skin/pink/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/skin/mac/skinstyle.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/gt_const.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/gt_grid_all.js"></script>
<%}else{ %>
<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())){ %>
<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" src="../../ZrwebGui/tab/tab.js"></script>
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/tab/tab.css">

<STYLE type=text/css>
#con { FONT-SIZE: 12px; MARGIN: 0px auto; WIDTH: 98% }
#tags { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0px 10px; WIDTH: 98% ; PADDING-TOP: 0px; HEIGHT: 23px }
#tags LI { BACKGROUND: url(../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/tagleft.gif) no-repeat left bottom; FLOAT: left; MARGIN-RIGHT: 1px; LIST-STYLE-TYPE: none; HEIGHT: 23px }
#tags LI A { PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: url(../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/tagright.gif) no-repeat right bottom; FLOAT: left; PADDING-BOTTOM: 0px; COLOR: #999;
LINE-HEIGHT: 23px; PADDING-TOP: 0px; HEIGHT: 23px; TEXT-DECORATION: none }
.tagContent { PADDING-RIGHT: 10px; DISPLAY: none; PADDING-LEFT: 10px; BACKGROUND: url(../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/bg.gif) repeat-x; PADDING-BOTTOM: 10px; WIDTH: 100%; COLOR: #474747;
PADDING-TOP: 10px; HEIGHT: 450 }
</STYLE>


<script type="text/javascript" >
var css = "<%=user.getUserCSS()%>";
var skincss = "vista";

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

//关联表------------------------
var grid_demo_id1 = "myGrid1" ;
var show_data1= <%=show_data1%>;

var dsOption1= {

	fields :[
		{name : 'NAME1'  },
		{name : 'NAME2'  },
		{name : 'NAME3'  },
                {name : 'NAME4'  },
                {name : 'NAME5'  },
		{name : 'NAME6'  },
		{name : 'NAME7'  },
                {name : 'NAME8'  },
                {name : 'NAME9'  },
		{name : 'NAME10' }

	],

	recordType : 'array',
	data : show_data1
}



var colsOption1 = [

           {id: 'NAME1' , header: "<center>左关联表</center>" , width :145 , align : 'center',sortable:false  },
           {id: 'NAME2' , header: "<center>左关联字段</center>" , width :145,  align : 'center',sortable:false  },
	   {id: 'NAME3' , header: "<center>右关联表</center>" , width :145 ,align : 'center',sortable:false  },
           {id: 'NAME4' , header: "<center>右关联字段</center>" , width :145 ,align : 'center',sortable:false  },
           {id: 'NAME5' , header: "<center>关联属性</center>" , width :145 , align : 'center',sortable:false },
           {id: 'NAME6' , header: "-" , width :10,hidden:true },
	   {id: 'NAME7' , header: "-" , width :10,hidden:true  },
           {id: 'NAME8' , header: "-" , width :10,hidden:true  },
           {id: 'NAME9' , header: "-" , width :10,hidden:true  },
	   {id: 'NAME10' , header: "-" , width :10,hidden:true  }
];


var gridOption1={
	id : grid_demo_id1,
	width: "860",
	height: "210",
	container : 'gridbox1',
	replaceContainer : true,
	dataset : dsOption1 ,
	columns : colsOption1,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

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

           crow1 = rowNO;
           gridRelationTableClick();
        },

       showIndexColumn : false
};

 var mygrid1 = new Sigma.Grid( gridOption1 );
 Sigma.Util.onLoad( Sigma.Grid.render(mygrid1));


//初始条件------------------------
var grid_demo_id2 = "myGrid2" ;
var show_data2= <%=show_data2%>;

var dsOption2= {

	fields :[
		{name : 'NAME1'  },
		{name : 'NAME2'  },
		{name : 'NAME3'  },
                {name : 'NAME4'  },
                {name : 'NAME5'  },
		{name : 'NAME6'  },
		{name : 'NAME7'  },
                {name : 'NAME8'  },
                {name : 'NAME9'  },
		{name : 'NAME10' }

	],

	recordType : 'array',
	data : show_data2
}



var colsOption2 = [

           {id: 'NAME1' , header: "<center>左括号</center>" , width :136 , align : 'center',sortable:false  },
           {id: 'NAME2' , header: "<center>条件列</center>" , width :136,  align : 'center',sortable:false  },
	   {id: 'NAME3' , header: "<center>条件符</center>" , width :136 ,align : 'center',sortable:false  },
           {id: 'NAME4' , header: "<center>条件值</center>" , width :136 ,align : 'center',sortable:false  },
           {id: 'NAME5' , header: "<center>右括号</center>" , width :136 , align : 'center',sortable:false },
           {id: 'NAME6' , header: "<center>逻辑符</center>" , width :136 , align : 'center',sortable:false },
	   {id: 'NAME7' , header: "左括号(f)" , width :10,hidden:true  },
           {id: 'NAME8' , header: "条件列(f)" , width :10,hidden:true  },
           {id: 'NAME9' , header: "右括号(f)" , width :10,hidden:true  },
	   {id: 'NAME10' , header: "逻辑符(f)" , width :10,hidden:true  }
];


var gridOption2={
	id : grid_demo_id2,
	width: "860",
	height: "210",
	container : 'gridbox2',
	replaceContainer : true,
	dataset : dsOption2 ,
	columns : colsOption2,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

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

           crow2 = rowNO;
           gridWhereFieldClick();
        },

       showIndexColumn : false
};

var mygrid2=new Sigma.Grid( gridOption2 );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid2));


//显示列表格------------------------
var grid_demo_id3 = "myGrid3" ;
var show_data3= <%=show_data3%>;

var dsOption3= {

	fields :[
		{name : 'NAME1'  },
		{name : 'NAME2'  },
		{name : 'NAME3'  },
                {name : 'NAME4'  },
                {name : 'NAME5'  }

	],

	recordType : 'array',
	data : show_data3
}



var colsOption3 = [
           {id: 'NAME1' , header: "<center>字段</center>" , width :240 , align : 'center',sortable:false  },
           {id: 'NAME2' , header: "<center>宽度</center>" , width :70,  align : 'center',sortable:false  },
	   {id: 'NAME3' , header: "FIELD" , width :1 ,align : 'center',hidden:true  },
           {id: 'NAME4' , header: "<center>导出转数字</center>" , width :80 ,align : 'center',sortable:false  },
           {id: 'NAME5' , header: "<center>对齐方式</center>" , width :80 , align : 'center',sortable:false }
];

var gridOption3={
	id : grid_demo_id3,
	width: "510",
	height: "145",
	container : 'gridbox3',
	replaceContainer : true,
	dataset : dsOption3 ,
	columns : colsOption3,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

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

           crow3 = rowNO;
           gridResultColClick();
        },

       showIndexColumn : false
};

var mygrid3 = new Sigma.Grid(gridOption3);
Sigma.Util.onLoad( Sigma.Grid.render(mygrid3));


//显示按钮参数隐藏表格------------------------
var grid_demo_id4 = "myGrid4" ;
var show_data4= <%=show_data4%>;

var dsOption4= {

	fields :[
		{name : 'NAME1'  },
		{name : 'NAME2'  },
		{name : 'NAME3'  },
                {name : 'NAME4'  },
                {name : 'NAME5'  }

	],

	recordType : 'array',
	data : show_data4
}



var colsOption4 = [
           {id: 'NAME1' , header: "ID" , width :10 , align : 'center',hidden:true  },
           {id: 'NAME2' , header: "<center>参数名</center>" , width :100,  align : 'center',sortable:false  },
	   {id: 'NAME3' , header: "<center>字段</center>" , width :250 ,align : 'center',sortable:false  },
           {id: 'NAME4' , header: "字段(En)" , width :10 ,align : 'center',hidden:true  },
           {id: 'NAME5' , header: "按钮(En)" , width :10 , align : 'center',hidden:true }
];

var gridOption4={
	id : grid_demo_id4,
	width: "400",
	height: "100",
	container : 'gridbox4',
	replaceContainer : true,
	dataset : dsOption4 ,
	columns : colsOption4,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

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

           crow4 = rowNO;

        },

       showIndexColumn : false
};

var mygrid4 = new Sigma.Grid(gridOption4);
Sigma.Util.onLoad( Sigma.Grid.render(mygrid4));

//显示按钮参数表格------------------------
var grid_demo_id5 = "myGrid5" ;
var show_data5= <%=show_data5%>;

var dsOption5= {

	fields :[
		{name : 'NAME1'  },
		{name : 'NAME2'  },
		{name : 'NAME3'  },
                {name : 'NAME4'  },
                {name : 'NAME5'  }

	],

	recordType : 'array',
	data : show_data5
}



var colsOption5 = [
           {id: 'NAME1' , header: "ID" , width :10 , align : 'center',hidden:true  },
           {id: 'NAME2' , header: "<center>参数名</center>" , width :100,  align : 'center',sortable:false  },
	   {id: 'NAME3' , header: "<center>字段</center>" , width :250 ,align : 'center',sortable:false  },
           {id: 'NAME4' , header: "字段(En)" , width :10 ,align : 'center',hidden:true  },
           {id: 'NAME5' , header: "按钮(En)" , width :10 , align : 'center',hidden:true }
];

var gridOption5={
	id : grid_demo_id5,
	width: "380",
	height: "180",
	container : 'gridbox5',
	replaceContainer : true,
	dataset : dsOption5 ,
	columns : colsOption5,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

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

           crow5 = rowNO;
           gridDetailParameterClick();
        },

       showIndexColumn : false
};

var mygrid5 = new Sigma.Grid(gridOption5);
Sigma.Util.onLoad( Sigma.Grid.render(mygrid5));

//显示排序表格------------------------
var grid_demo_id6 = "myGrid6" ;
var show_data6= <%=show_data6%>;

var dsOption6= {

	fields :[
		{name : 'NAME1'  },
		{name : 'NAME2'  },
		{name : 'NAME3'  },
                {name : 'NAME4'  },
                {name : 'NAME5'  }

	],

	recordType : 'array',
	data : show_data6
}



var colsOption6 = [
           {id: 'NAME1' , header: "ID" , width :10 , align : 'center',hidden:true  },
           {id: 'NAME2' , header: "<center>排序字段</center>" , width :480,  align : 'center',sortable:false  },
	   {id: 'NAME3' , header: "<center>类型</center>" , width :360 ,align : 'center',sortable:false  },
           {id: 'NAME4' , header: "FIELD(En)" , width :10 ,align : 'center',hidden:true  },
           {id: 'NAME5' , header: "TYPE(En)" , width :10 , align : 'center',hidden:true }
];

var gridOption6={
	id : grid_demo_id6,
	width: "880",
	height: "180",
	container : 'gridbox6',
	replaceContainer : true,
	dataset : dsOption6 ,
	columns : colsOption6,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

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

           crow6 = rowNO;
           gridSortClick();
        },

       showIndexColumn : false
};

var mygrid6 = new Sigma.Grid(gridOption6);
Sigma.Util.onLoad( Sigma.Grid.render(mygrid6));

</script>

</HEAD>
<BODY class="BodyMain">
<FORM name="RegForm" method="post" action="../../queryconfig.do">
<input type="hidden" name="RelationInfoStr"/>
<input type="hidden" name="WhereInfoStr"/>
<input type="hidden" name="QueryFieldInfoStr"/>
<input type="hidden" name="ResultDisFieldInfoStr"/>
<input type="hidden" name="ResultHidFieldInfoStr"/>
<input type="hidden" name="DetailParameterInfoStr"/>
<input type="hidden" name="BRelationInfoStr"/>
<input type="hidden" name="SortInfoStr"/>

<input type="hidden" name="Act1" value="">
<input type="hidden" name="ID" value="<%=objConfigTable.getID()%>"/>
  <!--HTML Head表单头显示[显示内容，用户肤色的图片文件夹]-->
<%=userUI.ShowHeadHtml("查询配置管理",user.getUserImage())%>  <!--HTML Body Start显示表单开始部分-->
<%=userUI.ShowBodyStartHtml()%>
<table width="100%">
  <tr>
    <td height="450" valign="top">



  <DIV id="con">
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  <UL id="tags">
    <LI >
    <a style="" onClick="selectTag('tagContent0',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
      基本属性
    </a>
    </LI>
     <LI>
     <a style="" onClick="selectTag('tagContent1',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
      关联表属性
    </a>

     </LI>
     <LI>
     <a style="" onClick="selectTag('tagContent2',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
       初始条件属性
    </a>

     </LI>
     <LI>
     <a style="" onClick="selectTag('tagContent3',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
       查询列属性
    </a>

     </LI>
     <LI>
     <a style="" onClick="selectTag('tagContent4',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
       结果列属性
    </a>

     </LI>
     <LI>
     <a style="" onClick="selectTag('tagContent5',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
       按钮属性
    </a>

     </LI>
     <LI>
     <a style="" onClick="selectTag('tagContent6',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
      排序属性
    </a>

     </LI>
  </UL>
  <%}else{ %>
  <UL id="tags">
    <LI class="selectTag">
      <A onClick="selectTag('tagContent0',this)"  href="javascript:void(0)">
      <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
      基本属性
      </A>
    </LI>
     <LI>
       <A onClick="selectTag('tagContent1',this)" href="javascript:void(0)">
       <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         关联表属性
       </A>
     </LI>
     <LI>
       <A onClick="selectTag('tagContent2',this)" href="javascript:void(0)">
       <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         初始条件属性
       </A>
     </LI>
     <LI>
       <A onClick="selectTag('tagContent3',this)" href="javascript:void(0)">
       <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         查询列属性
       </A>
     </LI>
     <LI>
       <A onClick="selectTag('tagContent4',this)" href="javascript:void(0)">
       <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         结果列属性
       </A>
     </LI>
     <LI>
       <A onClick="selectTag('tagContent5',this)" href="javascript:void(0)">
       <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         按钮属性
       </A>
     </LI>
     <LI>
       <A onClick="selectTag('tagContent6',this)" href="javascript:void(0)">
       <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         排序属性
       </A>
     </LI>
  </UL>
  <%} %>
  <DIV id="tagContent">
    <DIV class="tagContent selectTag" id="tagContent0">

    <br>
            &nbsp;
            <fieldset style="width: 920">
              <legend>基本属性管理</legend>
              <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                <tr>
                  <td colspan=2 height=23></td>
                </tr>
                <tr>
                  <td class="PutdSet" width="30%">配置名称：</td>
                  <td>
                    <input class="text" type="text" name="NAME" size="50" maxlength="50" value="<%=objConfigTable.getNAME()%>" >
                    <Font class="WriteSign">*</Font>
                  </td>
                </tr>
                <tr>
                  <td colspan=2 height=10>                  </td>
                </tr>
                <tr>
                  <td class="PutdSet">
                    <%if (ID.length()==0){%>
                    主&nbsp;&nbsp;&nbsp;&nbsp;表：
                    <%}%>
                  </td>
                  <td>

                 <%if (ID.length()==0){%>

                 <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <td>
                 <select id="MAINTABLE" name="MAINTABLE" style=" WIDTH: 320px"  onchange='GetAllRelTableFieldInfo();'>
                    </select>
                 </td>
                 <%=userUI.ClickButton("选择","JavaScript:ShowModalTableTree();","buttonSelect.gif",user.getUserImage())%>
                 </tr></table>

                 <%}else{%>
                 <div style="display:'none'">
                 <select  id="MAINTABLE" name="MAINTABLE" style="WIDTH: 320px"  onchange='GetAllRelTableFieldInfo();'>
                    </select>
                  </div>
                 <%}%>
                  </td>
                </tr>
                <tr>
                  <td colspan=2 height=10>    </td>
                </tr>
                <tr>
                  <td class="PutdSet">默认查询方式：</td>
                  <td>
                    <select id="TYPE" name="TYPE" style=" WIDTH: 320px"  >
                     <option value="1" <%if(objConfigTable.getTYPE().equals("1")){ out.print("selected");}%>>一般查询</option>
                     <option value="2" <%if(objConfigTable.getTYPE().equals("2")){out.print("selected");}%>>操作查询</option>
                     <option value="3" <%if(objConfigTable.getTYPE().equals("3")){ out.print("selected");}%>>显示列表</option>
                     <option value="4" <%if(objConfigTable.getTYPE().equals("4")){ out.print("selected");}%>>嵌入Iframe</option>
                     <option value="5" <%if(objConfigTable.getTYPE().equals("5")){ out.print("selected");}%>>分离结果页面</option>
                    </select>
                  </td>
                </tr>
                <tr>
                  <td colspan=2 height=10>    </td>
               </tr>
               <tr>
                  <td class="PutdSet">单击结果表格执行的按钮：</td>
                  <td>
                    <select name="CID" style=" WIDTH: 320px">
                     <option value=" " selected="selected"></option>
                       <%if(buttonAll!=null)
                         {
                          for(i=0;i<buttonAll.length;i++)
                          {
                       %>
                          <option value="<%=buttonAll[i].getID()%>"><%=buttonAll[i].getNAME()%></option>
                       <%
                          }
                         }
                       %>
                    </select>
                  </td>
                </tr>

                <tr>
                  <td class="PutdSet">双击结果表格执行的按钮：</td>
                  <td>
                    <select id="BID" name="BID" style=" WIDTH: 320px"  >
                     <option value=" " selected="selected"></option>
                       <%if(buttonAll!=null)
                         {
                          for(i=0;i<buttonAll.length;i++)
                          {
                       %>
                          <option value="<%=buttonAll[i].getID()%>"><%=buttonAll[i].getNAME()%></option>
                       <%
                          }
                         }
                       %>
                    </select>
                  </td>
                </tr>
                   <tr>
                  <td class="PutdSet" width="30%">首次是否显示第一页的数据：</td>
                  <td>
                   <input type="radio" name="IFFIRSTDATA" value=1 <% if (objConfigTable.getIFFIRSTDATA().equals("1")) {out.print("checked");}%> >
                    是　
                    <input type="radio" name="IFFIRSTDATA" value=0 <%if (objConfigTable.getIFFIRSTDATA().equals("0")) {out.print("checked");}%>>
                    否
                  </td>
                </tr>
                 <tr>
                  <td class="PutdSet" width="30%">是否可选：</td>
                  <td>
                   <input type="radio" name="IFMULSEL" value=0 <%if (objConfigTable.getIFMULSEL().equals("0")) {out.print("checked");}%>>
                    无
                   <input type="radio" name="IFMULSEL" value=1 <% if (objConfigTable.getIFMULSEL().equals("1")) {out.print("checked");}%> >
                    多选　
                   <input type="radio" name="IFMULSEL" value=2 <% if (objConfigTable.getIFMULSEL().equals("2")) {out.print("checked");}%> >
                    单选　
                  </td>
                </tr>
                 <tr>
                  <td class="PutdSet" width="30%">是否显示公共按钮：</td>
                  <td>
                   <input type="radio" name="IFCOMBTN" value=1 <% if (objConfigTable.getIFCOMBTN().equals("1")) {out.print("checked");}%> >
                    是　
                    <input type="radio" name="IFCOMBTN" value=0 <%if (objConfigTable.getIFCOMBTN().equals("0")) {out.print("checked");}%>>
                    否
                  </td>
                </tr>
                 <tr>
                  <td class="PutdSet">查询列展示方式：</td>
                  <td>
                    <select id="QITEMTYPE" name="QITEMTYPE" style=" WIDTH: 320px"  >
                     <option value="1" <%if(QITEMTYPE.equals("1")){out.print("selected");}%>>每行两列</option>
                     <option value="2" <%if(QITEMTYPE.equals("2")){out.print("selected");}%>>每行三列</option>
                    </select>
                  </td>
                </tr>
                <tr>
                  <td class="PutdSet">查询结果表格样式：</td>
                  <td>
                    <select id="QTABLETYPE" name="QTABLETYPE" style=" WIDTH: 320px"  >
                     <option value="1" <%if(QTABLETYPE.equals("1")){out.print("selected");}%>>样式一</option>
                     <option value="2" <%if(QTABLETYPE.equals("2")){out.print("selected");}%>>样式二</option>
                    </select>
                  </td>
                </tr>

              </table>
              <br>
            </fieldset>

    </DIV>
    <DIV class="tagContent" id="tagContent1">

    <br>
            &nbsp;
            <fieldset style="width:920">
              <legend>关联表属性管理</legend>
                <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
              <tr>
                <td colspan=2 height=150>
                  <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                  <tr>
                    <td align=right width="12%" height="25">左关联表：</td>
                    <td width="38%" align=left>


                 <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <td>
                 <select id="CFIELD_TABLE" name="CFIELD_TABLE" style="width:228px" onchange='loadRelationFieldList(this.value)'>
                     </select>
                 </td>
                 <%=userUI.ClickButton("选择","JavaScript:ShowModalTableTree1();","buttonSelect.gif",user.getUserImage())%>
                 </tr></table>



                    </td>
                    <td align=right width="12%">左关联字段:</td>
                    <td width="38%">
                     <select id="CFIELD_FIELD" name="CFIELD_FIELD" style="width:228px">
                     </select>
                    </td>
                   </tr>
                    <tr>
                    <td align=right width="12%" height="25">右关联表：</td>
                    <td width="38%" align=left>



                 <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <td>
                  <select id="MFIELD_TABLE" name="MFIELD_TABLE" style="width:228px" onchange='loadRightRelationFieldList(this.value)'>
                     </select>
                 </td>
                 <%=userUI.ClickButton("选择","JavaScript:ShowModalTableTree2();","buttonSelect.gif",user.getUserImage())%>
                 </tr></table>


                    </td>
                    <td align=right width="12%">右关联字段:</td>
                    <td width="38%">
                     <select id="MFIELD_FIELD" name="MFIELD_FIELD" style="width:228px">
                     </select>
                    </td>
                   </tr>
                   <tr>
                    <td align=right width="10%" height="25">关联类型：</td>
                    <td width="40%" align=left colspan="3">
                     <select id="JOINTYPE" name="JOINTYPE"  style="width:228px" >
                     <option  value="1" selected="selected">一般相等关联</option>
                     <option value="2">左外关联</option>
                     <option value="3" >右外关联</option>
                     </select>
                    </td>
                   </tr>

                <tr>
                 <td colspan="4" align="center" height="25">
                   <table cellspacing="0" cellpadding="0" border='0'>
                   <tr>
                     <%=userUI.ClickButton("增加行","JavaScript:gridRelationTableAddRow();","IcoAdd.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("删除行","JavaScript:gridRelationTableDeleteRow();","buttonDelete.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("更  新","JavaScript:gridRelationTableUpdateRow();","buttonCancel.gif",user.getUserImage())%>
                  </tr>
              </table>
                 </td>
                </tr>
              <tr>
                 <td colspan="4" height="2">
                 </td>
                </tr>
             </table>


              <div id="gridbox1" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:300px;width:800px;" ></div>
              <br><br>


         </td>
         </tr>
         </table>
            </fieldset>
            <br>

    </DIV>
    <DIV class="tagContent" id="tagContent2">

    <br>
            &nbsp;
            <fieldset style="width:920">
              <legend>初始条件属性</legend>
            <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
              <tr>
                <td colspan=2 height=150>
                  <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                  <tr>
                    <td align=right width="12%" height="25">左括号：</td>
                    <td  align=left >
                    <select name="selLeft"  style="width: 250;">
                    <option  value="0">无</option>
                    <option value="(" selected="selected">(</option>
                    <option value="((" >((</option>
                    <option value="(((" >(((</option>
                    <option value="((((">((((</option>
                    <option value="(((((">(((((</option>

                    </select>
                    <td align="right"> 条件列：</td>
                    <td>
                     <select id="selFIELD" name="selFIELD"  style="width:250;" onchange='getSymbolByConField(this);'>
                    </select>
                    </td>

                   </tr>
                   <tr>
                   <td align="right"> 条件符：</td>
                   <td align="left">
                      <select name="selSYMBOL"  style="width:250" >
                     </select>
                   </td>
                    <td align=right  height="25">条件值：</td>

                    <td  align="left">
                     <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text" name="txtWHEREVALUE" id="txtWHEREVALUE" size="39" > <%=userUI.ClickButton("设置","JavaScript:ShowModal();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
                   </table>
                    </td>
                   </tr>
                    <tr>
                    <td align=right height="25">右括号：</td>
                    <td  align="left" >
                    <select name="selRight"  style="width:250">
                    <option value="0">无</option>
                    <option value=")" selected="selected">)</option>
                    <option value="))">))</option>
                    <option value=")))">)))</option>
                    <option value="))))">))))</option>
                    <option value=")))))">)))))</option>

                    </select>
                   </td>
                      <td align=right height="25">逻辑符：</td>
                    <td  align="left" >
                    <select name="selLOGIC"  style="width:250">
                     <option value="1" selected="selected">与</option>
                     <option value="2">或</option>
                     <option value="0">无</option>
                    </select>
                   </td>
                </tr>
                <tr>
                 <td colspan="4" align="center" height="25">
                   <table cellspacing="0" cellpadding="0" border='0'>
                   <tr>
                     <%=userUI.ClickButton("增加行","JavaScript:gridWhereFieldAddRow();","IcoAdd.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("删除行","JavaScript:gridWhereFieldDeleteRow();","buttonDelete.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("更  新","JavaScript:gridWhereFieldUpdateRow();","buttonCancel.gif",user.getUserImage())%>
                  </tr>

              </table>
                 </td>
                </tr>
                 <tr>
                 <td colspan="4" height="2">
                 </td>
                </tr>
             </table>

          <div id="gridbox2" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:300px;width:800px;" ></div>
          <br><br>

         </td>
         </tr>
         </table>

     </fieldset>


    </DIV>
    <DIV class="tagContent" id="tagContent3">

    <br>
            &nbsp;
            <fieldset style="width:920">
              <legend>查询列属性</legend>
              <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                <tr>
                  <td colspan=2 height=23>                  </td>
                </tr>
                <tr>
                  <td colspan="2">
                    <table border='0' width="98%" cellspacing="0" cellpadding="0" align=center>
                      <tr>
                        <td colspan=3 height=23>                        </td>
                      </tr>
                      <tr>
                        <td width="43%" align="center" height=23>
                          <font class="AlertSign">待选字段</font>
                        </td>
                        <td width="15%" align="center">
                          <font class="AlertSign">操作</font>
                        </td>
                        <td width="43%" align="center">
                          <font class="AlertSign">已选字段</font>
                        </td>
                      </tr>
                      <tr>
                        <td>
                          <%if("6".equals(user.getUserWINDOWTYPE())){ %>
                          <select id="QueryFieldSrcList" name="QueryFieldSrcList"  class='SelectStyle2' style="width: 300;height: 200" size=15 multiple>
                          </select>
                          <%}else{ %>
                          <select id="QueryFieldSrcList" name="QueryFieldSrcList"  class='SelectStyle' style="width: 300;height: 200" size=15 multiple>
                          </select>
                          <%} %>

                          <br>
                          <input type="checkbox" name="SelAllX" onClick="JavaScript:CheckBoxSel(this.checked,'QueryFieldSrcList');">
                          全选
                          &nbsp;&nbsp;
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font>
                          <br>
                          <br><br><br>
                        </td>
                        <td align=center>
                        <%if("6".equals(user.getUserWINDOWTYPE())){ %>
                        <a class="btn1 btn-medium btn-green btn-radius" href="#" onClick="javascript:upItemSelection(window.RegForm.QueryFieldDestList);">上移</a>
					 <a class="btn1 btn-medium btn-orange  btn-radius" href="#" onClick="javascript:addSrcToDestListPu(window.RegForm.QueryFieldSrcList,window.RegForm.QueryFieldDestList);">增加</a>
					 <a class="btn1 btn-medium btn-red btn-radius" href="#" onClick="javascript:deleteFromDestListPu(window.RegForm.QueryFieldDestList);">删除</a>
					 <a class="btn1 btn-medium btn-gray btn-radius" href="#" onClick="javascript:downItemSelection(window.RegForm.QueryFieldDestList);">下移</a>

                          <%}else{ %>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_U.gif" style="cursor:pointer" title="上移" onClick="javascript:upItemSelection(window.RegForm.QueryFieldDestList);"><br><br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_R.gif" style="cursor:pointer" title="增加功能" onClick="javascript:addSrcToDestListPu(window.RegForm.QueryFieldSrcList,window.RegForm.QueryFieldDestList);">
                          <br>
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_L.gif" style="cursor:pointer" title="删除功能" onClick="javascript:deleteFromDestListPu(window.RegForm.QueryFieldDestList);">
                          <br>
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_D.gif"  style="cursor:pointer" title="下移" onClick="javascript:downItemSelection(window.RegForm.QueryFieldDestList);">

                          <%} %>

                        </td>
                        <td>
                        <%if("6".equals(user.getUserWINDOWTYPE())){ %>
                        <select id="QueryFieldDestList" name="QueryFieldDestList" ondblclick="setprecision();" class='SelectStyle2' size=15 multiple>
                          </select>
                          <%}else{ %>
                          <select id="QueryFieldDestList" name="QueryFieldDestList" ondblclick="setprecision();" class='SelectStyle' size=15 multiple>
                          </select>
                          <%} %>

                          <br>
                          <input type="checkbox" name="SelAllX" onClick="JavaScript:CheckBoxSel(this.checked,'QueryFieldDestList');">
                          全选
                          &nbsp;&nbsp;
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font>
                          <br><br>
                          <Font class="WriteSign">注：双击字段设置字符型的查询字段是否为精<br>确查询和是否为必填,日期型字段的日期范围。</Font>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
              <br>
            </fieldset>

    </DIV>
    <DIV class="tagContent" id="tagContent4">

            &nbsp;
            <fieldset style="width:99%">
              <legend>结果列属性管理</legend>
                <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                <tr>
                  <td colspan="2">
                    <table border='0' width="95%" cellspacing="0" cellpadding="0" align=center>
                      <tr>
                        <td width="25%" align="left" height=23>
                          <font class="AlertSign">待选字段</font>
                        </td>
                        <td width="15%" align="center">
                          <font class="AlertSign">显示列设置</font>
                        </td>
                        <td width="60%" align="center">
                          <font class="AlertSign">已选字段</font>
                        </td>
                      </tr>
                      <tr>
                        <td>
                        <%if("6".equals(user.getUserWINDOWTYPE())){ %>
                          <select id="resultDisFieldSrcList" name="resultDisFieldSrcList"  class='SelectStyle2' size=13 multiple>
                          </select>
                          <%}else{ %>
                          <select id="resultDisFieldSrcList" name="resultDisFieldSrcList" class='SelectStyle' size=13 multiple>
                          </select>
                          <%} %>

                          <br>
                          <input type="checkbox" name="SelAllX" onClick="JavaScript:CheckBoxSel(this.checked,'resultDisFieldSrcList');">
                          全选
                          &nbsp;&nbsp;
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font>

                        </td>
                        <td align=center>
                        <%if("6".equals(user.getUserWINDOWTYPE())){ %>
                        <a class="btn1 btn-medium btn-green btn-radius" href="#" onClick="javascript:gridMoveRowUp();">上移</a>
					 <a class="btn1 btn-medium btn-orange  btn-radius" href="#" onClick="javascript:gridResultColAddRow();">增加</a>
					 <a class="btn1 btn-medium btn-red btn-radius" href="#" onClick="javascript:gridResultColDeleteRow();">删除</a>
					 <a class="btn1 btn-medium btn-gray btn-radius" href="#" onClick="javascript:gridMoveRowDown();">下移</a>

                        <%}else{ %>
                       <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_U.gif" style="cursor:pointer" title="上移" onClick="javascript:gridMoveRowUp();"><br><br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_R.gif" style="cursor:pointer" title="增加功能" onClick="javascript:gridResultColAddRow();">
                          <br>
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_L.gif" style="cursor:pointer" title="删除功能" onClick="javascript:gridResultColDeleteRow();">
                          <br>
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_D.gif"  style="cursor:pointer" title="下移" onClick="javascript:gridMoveRowDown();">

                        <%} %>

                        </td>
                 <td valign="top">
                  <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                  <tr height="30">
                    <td align=right width="10%">字段：</td>
                    <td width="40%" align=left>
                     <input type="text" readonly="true" class="text" id="resultColName" name="resultColName" style="width:100%;" >
                    </td>
                    <td align=right width="10%">宽度：</td>
                    <td width="20%">
                     <input type="text" class="text" id="resultColWidth" name="resultColWidth" style="width:100%;"  maxlength="4" onKeyPress="event.returnValue=CheckNumber();" >
					 </td>
					 <td>
					  <%=userUI.ClickButton("更新","JavaScript:gridResultColUpdateRow();","IcoAdd.gif",user.getUserImage())%>
				   </td>
                   </tr>
				   </table>
                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                   导出excel时是否转换成数字：
                                   <select name="ISNUMBER" style=" WIDTH:50px">
                                   <option value="1">是</option>
                                   <option value="0" selected>否</option>
                                   </select>
                                   &nbsp;&nbsp;
                                   对齐方式：
                                   <select name="QALIGN" style=" WIDTH:50px">
                                   <option value="0" selected>居左</option>
                                   <option value="1" >居中</option>
                                   <option value="2" >居右</option>
                                   </select>


                <div id="gridbox3" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:145px;width:380px;" ></div>


    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
    <select id="resultDisFieldDestList" name="resultDisFieldDestList" class='SelectStyle3' size=1 multiple style="display:none;">  </select>
    <%}else{ %>
    <select id="resultDisFieldDestList" name="resultDisFieldDestList" class='SelectStyle' size=1 multiple style="display:none;">  </select>
    <%} %>

                          <br>

                        </td>
                      </tr>
                     <tr>
                        <td  align="center" height=23>
                          <font class="AlertSign">待选字段</font>
                        </td>
                        <td  align="center">
                          <font class="AlertSign">隐藏列设置</font>
                        </td>
                        <td  align="center">
                          <font class="AlertSign">已选字段</font>
                        </td>
                      </tr>
                      <tr>
                        <td>
   <%if("6".equals(user.getUserWINDOWTYPE())){ %>
   <select id="resultHidFieldSrcList" name="resultHidFieldSrcList" class='SelectStyle3' size=5 multiple style="width:100%;">
                          </select>
    <%}else{ %>
    <select id="resultHidFieldSrcList" name="resultHidFieldSrcList" class='SelectStyle' size=5 multiple>
                          </select>
    <%} %>

                          <br>
                          <input type="checkbox" name="SelAllX" onClick="JavaScript:CheckBoxSel(this.checked,'resultHidFieldSrcList');">
                          全选
                          &nbsp;&nbsp;
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font>
                        </td>
                        <td align=center>
   <%if("6".equals(user.getUserWINDOWTYPE())){ %>
    <a class="btn1 btn-medium btn-green btn-radius" href="#" onClick="javascript:upItemSelection(window.RegForm.resultHidFieldDestList);">上移</a>
					 <a class="btn1 btn-medium btn-orange  btn-radius" href="#"  onClick="javascript:AddHidCol();">增加</a>
					 <a class="btn1 btn-medium btn-red btn-radius" href="#" onClick="javascript:deleteFromDestListPu(window.RegForm.resultHidFieldDestList);">删除</a>
					 <a class="btn1 btn-medium btn-gray btn-radius" href="#" onClick="javascript:downItemSelection(window.RegForm.resultHidFieldDestList);">下移</a>

    <%}else{ %>
    <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_U.gif" style="cursor:pointer" title="上移" onClick="javascript:upItemSelection(window.RegForm.resultHidFieldDestList);"><br><br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_R.gif" style="cursor:pointer" title="增加功能" onClick="javascript:AddHidCol();">
                          <br>
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_L.gif" style="cursor:pointer" title="删除功能" onClick="javascript:deleteFromDestListPu(window.RegForm.resultHidFieldDestList);">
                          <br>
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_D.gif"  style="cursor:pointer" title="下移" onClick="javascript:downItemSelection(window.RegForm.resultHidFieldDestList);">

    <%} %>

                        </td>
                        <td>
   <%if("6".equals(user.getUserWINDOWTYPE())){ %>
    <select id="resultHidFieldDestList" name="resultHidFieldDestList" class='SelectStyle3' size=5  multiple style="width:100%;">
                          </select>
    <%}else{ %>
     <select id="resultHidFieldDestList" name="resultHidFieldDestList" class='SelectStyle' size=5  multiple style="width:100%;">
                          </select>
    <%} %>

                          <br>
                          <input type="checkbox" name="SelAllX" onClick="JavaScript:CheckBoxSel(this.checked,'resultHidFieldDestList');">
                          全选
                          &nbsp;&nbsp;
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
              <br>
            </fieldset>


    </DIV>
    <DIV class="tagContent" id="tagContent5">
       <br>
            &nbsp;
            <fieldset style="width:920">
              <legend>按钮属性管理</legend>
            <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
              <tr>
                <td colspan=2>
                  <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                   <tr>
                    <td align=right width="20%" height="25">参数名称：</td>
                    <td  align=left width="30%">
                      <input class="text" type="text" name="txtParameterNAME" size="35"   maxlength="50">
                    <td align="right" width="10%"> 参数字段：</td>
                    <td  align=left width="40%">
                     <select id="selParameterField"  name="selParameterField"  style="width:250px" >
                    </select>
                    </td>
                  </tr>

                <tr>
                 <td colspan="4" align="center" height="30" valign="bottom">
                   <table cellspacing="0" cellpadding="0" border='0'>
                   <tr>
                     <%=userUI.ClickButton("增加参数","JavaScript:gridDetailParameterAddRow();","IcoAdd.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("删除参数","JavaScript:gridDetailParameterDeleteRow();","buttonDelete.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("设置私有按钮","JavaScript:setbutton();","IcoAdd.gif",user.getUserImage())%>
                  </tr>
                </table>
                 </td>
                </tr>
             </table>
               </td>
         </tr>
    <tr>
     <td colspan="4">
          <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                      <tr>
                        <td colspan=4 height=23>                        </td>
                      </tr>
                      <tr>
                        <td width="25%" align="center" height=23>
                          <font class="AlertSign">待分配按钮</font>
                        </td>
                        <td width="10%" align="center">
                          <font class="AlertSign">操作</font>
                        </td>
                        <td width="25%" align="center">
                          <font class="AlertSign">已分配按钮</font>
                        </td>
                        <td  valign="top" width="55%">
                          <font class="AlertSign"> 当前按钮的参数:</font>
                        </td>
                      </tr>
                      <tr>
                        <td align="center" valign="top">
    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
    <select id="ButtonSrcList" name="ButtonSrcList" class='SelectStyle3' size=15 multiple style="width:170px">
                          </select>
    <%}else{ %>
    <select id="ButtonSrcList" name="ButtonSrcList" class='SelectStyle' size=15 multiple style="width:170px">
                          </select>
    <%} %>

                          <br>
                          <input type="checkbox" name="SelAllX" onClick="JavaScript:CheckBoxSel(this.checked,'ButtonSrcList');">
                          全选
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font>
                          <br>
                        </td>
                        <td align=center valign="middle">
    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
    <a class="btn1 btn-medium btn-green btn-radius" href="#" onClick="javascript:upItemSelection(window.RegForm.ButtonDestList);">上移</a>
					 <a class="btn1 btn-medium btn-orange  btn-radius" href="#"  onClick="javascript:addSrcToDestListPu(window.RegForm.ButtonSrcList,window.RegForm.ButtonDestList);">增加</a>
					 <a class="btn1 btn-medium btn-red btn-radius" href="#" onClick="javascript:if(GetMultiListSelectedNum(window.RegForm.ButtonDestList)==1){deleteParamByDestList();deleteFromDestListPu(window.RegForm.ButtonDestList);}else{alert('请选择一项已分配按钮!');}">删除</a>
					 <a class="btn1 btn-medium btn-gray btn-radius" href="#" onClick="javascript:downItemSelection(window.RegForm.ButtonDestList);">下移</a>

    <%}else{ %>
    <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_U.gif" style="cursor:pointer" title="上移" onClick="javascript:upItemSelection(window.RegForm.ButtonDestList);">
                            <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_R.gif" style="cursor:pointer" title="增加功能" onClick="javascript:addSrcToDestListPu(window.RegForm.ButtonSrcList,window.RegForm.ButtonDestList);">
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_L.gif" style="cursor:pointer" title="删除功能" onClick="javascript:if(GetMultiListSelectedNum(window.RegForm.ButtonDestList)==1){deleteParamByDestList();deleteFromDestListPu(window.RegForm.ButtonDestList);}else{alert('请选择一项已分配按钮!');}">
                          <br>
                          <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_D.gif"  style="cursor:pointer" title="下移" onClick="javascript:downItemSelection(window.RegForm.ButtonDestList);">
                          <br>
                          <br />
    <%} %>

                        </td>
                        <td align="center"  valign="top">
    <%if("6".equals(user.getUserWINDOWTYPE())){ %>
    <select id="ButtonDestList" name="ButtonDestList" class='SelectStyle3' size=15 multiple  style="width:170px" onChange="JavaScript:getDetailParameterByButton();"  >
                          </select>
    <%}else{ %>
    <select id="ButtonDestList" name="ButtonDestList" class='SelectStyle' size=15 multiple  style="width:170px" onChange="JavaScript:getDetailParameterByButton();"  >
                          </select>
    <%} %>

                          <br />
                          <br />
                          <br />
                          <!--input type="checkbox" name="SelAllX" onClick="JavaScript:CheckBoxSel(this.checked,'ButtonDestList');">
                          全选
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font-->
                          <br />
                        </td>
           <td valign="top">


           <div id="bigbox" style="margin:15px;display:none;">

            <div id="gridbox4" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:400px;width:100px;" ></div>

           </div>

           <div id="gridbox5" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:400px;width:100px;" ></div>


           </td>
          </tr>

        </table>
      </td>
     </tr>
 </table>
</fieldset>


    </DIV>
    <DIV class="tagContent" id="tagContent6">

    <br>
            &nbsp;
            <fieldset style="width:920">
              <legend>排序属性管理</legend>
                <table border='0' width="880" cellspacing="0" cellpadding="0" align=center>
              <tr>
                <td colspan=2 height=150>
                  <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                  <tr>
                    <td align=right width="12%" height="25">排序字段：</td>
                    <td width="38%" align=left>
                      <select id="SORT_FIELD" name="SORT_FIELD" style="width:228px">
                     </select>
                    </td>
                    <td align=right width="12%">类型：</td>
                    <td width="38%" align=left>
                     <select name="SORT_TYPE" style="width:228px">
                     <OPtion value="1" selected="selected">升序</Option>
                     <OPtion value="2">降序</Option>

                     </select>
                    </td>
                   </tr>


                <tr>
                 <td colspan="4" align="center" height="25">
                   <table cellspacing="0" cellpadding="0" border='0'>
                   <tr>
                     <%=userUI.ClickButton("增加行","JavaScript:gridSortAddRow();","IcoAdd.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("删除行","JavaScript:gridSortDeleteRow();","buttonDelete.gif",user.getUserImage())%>
                  </tr>
              </table>
                 </td>
                </tr>
                <tr>
                 <td colspan="4" height="2">
                 </td>
                </tr>
             </table>


           <div id="gridbox6" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:180px;width:880px;" ></div>
           <br><br>

         </td>
         </tr>
         </table>
            </fieldset>
            <br>


    </DIV>
  </DIV>
</DIV>




    </td>
  </tr>
  <tr valign="bottom" >
    <td valign="bottom">
      <center>
        <br />
        <br />
        <table cellspacing="0" cellpadding="0" border='0'>
          <tr>
            <%=userUI.ClickButton("保 存","JavaScript:if(Check(document.RegForm)){window.RegForm.Act1.value='Save';document.RegForm.submit();}","buttonSave.gif",user.getUserImage())%>
            <%=userUI.ClickButton("删 除","JavaScript:if(confirm('确定要删除吗?')){window.RegForm.Act1.value='Delete';document.RegForm.submit();}","buttonDelete.gif",user.getUserImage())%>
            <%=userUI.ClickButton("返 回","JavaScript:location='List.jsp';","buttonReturn.gif",user.getUserImage())%>
          </tr>
        </table>
      </center>
    </td>
  </tr>
</table>
  <!--HTML Foot显示表单尾-->
<%=userUI.ShowFootHtml()%>
<SCRIPT LANGUAGE="javascript">

/**************************开始定义全局变量*************************************/
//所有的相关表
var allRelTableStr;
var srow = 0;
var row1 = <%=row1%>;
var crow1 = 0;
var row2 = <%=row2%>;
var crow2 = 0;
var row3 = <%=row3%>;
var crow3 = 0;
var row4 = <%=row4%>;
var crow4 = 0;
var row5 = <%=row5%>;
var crow5 = 0;
var row6 = <%=row6%>;
var crow6 = 0;

/**************************结束定义全局变量*************************************/




<%
  if(objConfigTable != null)
  {
%>
   RegForm.TYPE.value="<%=objConfigTable.getTYPE()%>";
   RegForm.BID.value="<%=objConfigTable.getBID()%>";
   RegForm.CID.value="<%=objConfigTable.getCID()%>";

<%
  }
%>







//加载主表信息
function loadMainTableList()
{
    QueryCfgBean.GetTableList("",
      function(items){
        ClearList("MAINTABLE");

        dwr.util.addOptions("MAINTABLE",items,0,1);

       if(RegForm.MAINTABLE.length>0)
      {
       RegForm.MAINTABLE.selectedIndex=0;

      <%
       if(objConfigTable.getMAINTABLE().length()>0)
       {
      %>
        RegForm.MAINTABLE.value="<%=objConfigTable.getMAINTABLE()%>";
     <%
      }
     %>


       loadRelationTableList();
	   loadRightRelationTableList();


     }


      }
   );



}



function loadRelationTableList()
{

      QueryCfgBean.GetTableList("",
      function(items){
               ClearList("CFIELD_TABLE");
               dwr.util.addOptions("CFIELD_TABLE",items,0,1);
               if(RegForm.CFIELD_TABLE.length>0)
               {

	           <%
               if(objConfigTable.getMAINTABLE().length()>0)
               {
               %>
               RegForm.CFIELD_TABLE.value="<%=objConfigTable.getMAINTABLE()%>";
               <%
	           }
		       else
		       {
		       %>
		       RegForm.CFIELD_TABLE.selectedIndex=0;
		       <%
		       }
	           %>

               loadRelationFieldList(RegForm.CFIELD_TABLE.value);
               }

      }
      );

}



 // 加载左关联字段下拉列表。
    function loadRelationFieldList(TableName){
        if(TableName==null||TableName==''){
        ClearList("CFIELD_FIELD");
        return;
        }

        QueryCfgBean.GetFieldList(TableName,
        function(items){
              ClearList("CFIELD_FIELD");

              dwr.util.addOptions("CFIELD_FIELD",items,0,1);
              if(RegForm.CFIELD_FIELD.length>0)
              {

                 RegForm.CFIELD_FIELD.selectedIndex=0;
              }

	          GetAllRelTableFieldInfo();

        }
        );

    }



//加载右关联表信息

    function loadRightRelationTableList()
    {

       QueryCfgBean.GetTableList("",
       function(items){

           ClearList("MFIELD_TABLE");
           dwr.util.addOptions("MFIELD_TABLE",items,0,1);
           if(RegForm.MFIELD_TABLE.length>0)
           {
             RegForm.MFIELD_TABLE.selectedIndex=0;
             loadRightRelationFieldList(RegForm.MFIELD_TABLE.value);
           }
       }
       );
    }




 // 加载右关联字段下拉列表。
    function loadRightRelationFieldList(TableName){
        if(TableName==null||TableName==''){
        ClearList("MFIELD_FIELD");
        return;
        }

        QueryCfgBean.GetFieldList(TableName,
        function(items){
              ClearList("MFIELD_FIELD");
              dwr.util.addOptions("MFIELD_FIELD",items,0,1);
              if(RegForm.MFIELD_FIELD.length>0)
              {
                RegForm.MFIELD_FIELD.selectedIndex=0;
              }

	          GetAllRelTableFieldInfo();

        }
        );

    }



function loadAllRelTableFieldInfo()
{
	  QueryCfgBean.GetTableFieldList(allRelTableStr,false,
      function(items){
              //填充查询列待选信息
              ClearList("QueryFieldSrcList");
              dwr.util.addOptions("QueryFieldSrcList",items,0,1);

              //填充结果列待选信息
              ClearList("resultDisFieldSrcList");
              dwr.util.addOptions("resultDisFieldSrcList",items,0,1);
              ClearList("resultHidFieldSrcList");
              dwr.util.addOptions("resultHidFieldSrcList",items,0,1);

              //填充明细待选参数字段
              ClearList("selParameterField");
              dwr.util.addOptions("selParameterField",items,0,1);

              //排序待选字段
              ClearList("SORT_FIELD");
              dwr.util.addOptions("SORT_FIELD",items,0,1);

      }
      );
}

function loadinitWhereTableFieldInfo()
{
    QueryCfgBean.GetTableFieldList(allRelTableStr,true,
      function(items){

        //填充初始条件列下拉列表
        ClearList("selFIELD");
        dwr.util.addOptions("selFIELD",items,0,1);
        if(RegForm.selFIELD.length>0)
        {
         RegForm.selFIELD.selectedIndex=0;
         getSymbolByConField(RegForm.selFIELD);
        }
      }
    );

}





    function ClearList(ObjId){
        dwr.util.removeAllOptions(ObjId);
    }




function Check(theForm)
{

  if(trim(RegForm.NAME.value).length==0)
  {
    alert("基本属性配置名称未录入！");
    return false;

  }


   //准备服务器端处理的关联表信息
  fillgridRelationTableToInfoStr();

  //准备服务器端处理的初始条件属性
  fillgridWhereFieldToInfoStr();

  //准备服务器端处理的查询列属性
  fillSelectValueToField(theForm.QueryFieldDestList,theForm.QueryFieldInfoStr);

  //准备服务器端处理的结果列属性
  fillDisColVaueToField();
  fillSelectValueToField(theForm.resultHidFieldDestList,theForm.ResultHidFieldInfoStr);


  //准备服务器端处理的按钮属性
  fillgridDetailParameterToInfoStr();
  fillSelectValueToField(theForm.ButtonDestList,theForm.BRelationInfoStr);

 //准备服务器端处理的排序属性
  fillgridSortToInfoStr();


  return true;
}

//
function ShowModal()
{
  var url='ConValueSetup.jsp';
  var status='dialogHeight:450px;dialogWidth:850px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'条件值设置',
     area: ['800px', '408px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'?zdid=txtWHEREVALUE'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     RegForm.txtWHEREVALUE.value=rtnResult;
   }
   <%}%>
}


//给主表关联表数组赋值
function GetAllRelTableFieldInfo()
{

  allRelTableStr= RegForm.MAINTABLE.value+".";//从主表开始

      //处理其他关联表
  for(row=0;row<=row1;row++)
  {
    if (mygrid1.getCellValue("NAME1",row1).length>0)
    {
      if(allRelTableStr.indexOf(mygrid1.getCellValue("NAME6",row1)+".")==-1)
      {
        allRelTableStr=allRelTableStr+mygrid1.getCellValue("NAME6",row1)+".";
      }

       if(allRelTableStr.indexOf(mygrid1.getCellValue("NAME8",row1)+".")==-1)
      {
        allRelTableStr=allRelTableStr+mygrid1.getCellValue("NAME8",row1)+".";
      }
    }
  }

  loadinitWhereTableFieldInfo();
  loadAllRelTableFieldInfo();



 //按钮信息填入选择列表中
 listButtonDetailParameterBind();



}






//---------------------------------------------------//

/**
 * 作用或功能 ：填充条件符下拉列表
 * @objSymbolList  需填充的条件符下拉列表
 * @类型标识符 1,2,3,4,5,6,7中的一个
 */
function fillSymbolList(objSymbolList,symbol)
{

  //记录字段类型及条件符
  // 1  VARCHAR2；2 FLOAT； 3 BLOB； 4 DATE ; 5 DATETIME ; 6 NUMBER ； 7 CLOB

var fieldTypeSymbol="1.>&1.>=&1.=&1.<&1.<=&1.Like&1.Not Like&1.In&1.Not In&1.!=&1.Is&"
                   +"2.>&2.>=&2.=&2.<&2.<=&2.In&2.Not In&2.!=&2.Is&"
                   +"4.>&4.>=&4.=&4.<&4.<=&4.!=&4.Is&"
                   +"5.>&5.>=&5.=&5.<&5.<=&5.!=&5.Is&"
                   +"6.>&6.>=&6.=&6.<&6.<=&6.In&6.Not In&6.!=&6.Is&"
                   +"7.Like&7.Not Like&7.Is";


var tempArray=fieldTypeSymbol.split("&");
var tempArray2;
var len=0;
objSymbolList.length=0;
  for(i=0;i<tempArray.length;i++)
   {
     tempArray2=tempArray[i].split(".");


     if(tempArray2[0]==symbol)
     {
       objSymbolList.options[len]=new Option(tempArray2[1],tempArray2[1]);
       len++;
     }
   }


}


function getSymbolByConField(objFieldList)
{

   var strTemp= objFieldList.options[objFieldList.selectedIndex].value;

   var symbol=strTemp.split(".")[2];


   if(symbol== "3" )
   {
     alert("类型为'BLOB'的条件列不能参与条件运算!");
     return;
   }

   fillSymbolList(RegForm.selSYMBOL,symbol);

}

//==============================================================================//


//根据 "表名(EN).字段名(EN)" 得到 "表名(CN).字段名(CN)"
function GetTableFieldCnNameByEn(tableFieldName)
{
   var _resultStr="";
   this.getString = function()
    {
        //设置成同步
        dwr.engine.setAsync(false);

        QueryCfgBean.GetTableFieldCnNameByEn(tableFieldName,
        function(resultStr){
               _resultStr = resultStr;
        }
        );


        //重新设置为异步方式
        dwr.engine.setAsync(true);

        return _resultStr;
    }



}

//============================================================================//





/*******开始***********************关联表属性表格信息*****************************/

//将关联表信息填入表格组件中
function gridRelationTableBind()
{

  var row=0;
  var tableFieldName;
  var tableFieldCnName;
  var joinTypeCnName;
  <%
  String joinTypeCnName="";
  if(connectionList!=null)
  {
    for(i=0;i<connectionList.length;i++)
    {
      %>


      tableFieldName="<%=connectionList[i].getCFIELD()%>";  //处理左关联表

      getTableFieldCnNameByEn = new  GetTableFieldCnNameByEn(tableFieldName);
      tableFieldCnName=getTableFieldCnNameByEn.getString();

      mygrid1.setCellValue("NAME1",<%=i%>,tableFieldCnName.split(".")[0]);
      mygrid1.setCellValue("NAME2",<%=i%>,tableFieldCnName.split(".")[1]);

      mygrid1.setCellValue("NAME6",<%=i%>,tableFieldName.split(".")[0]);
      mygrid1.setCellValue("NAME7",<%=i%>,tableFieldName.split(".")[1]);

      tableFieldName="<%=connectionList[i].getMFIELD()%>";  //处理右关联表
      getTableFieldCnNameByEn = new  GetTableFieldCnNameByEn(tableFieldName);
      tableFieldCnName=getTableFieldCnNameByEn.getString();

      mygrid1.setCellValue("NAME3",<%=i%>,tableFieldCnName.split(".")[0]);
      mygrid1.setCellValue("NAME4",<%=i%>,tableFieldCnName.split(".")[1]);

      mygrid1.setCellValue("NAME8",<%=i%>,tableFieldName.split(".")[0]);
      mygrid1.setCellValue("NAME9",<%=i%>,tableFieldName.split(".")[1]);

      <%
        if(connectionList[i].getJOINTYPE().equals("1"))
        {
          joinTypeCnName="一般相等关联";
        }
        else if(connectionList[i].getJOINTYPE().equals("2"))
        {
           joinTypeCnName="左外关联";
        }else if(connectionList[i].getJOINTYPE().equals("3"))
        {
            joinTypeCnName="右外关联";
        }else
        {
           joinTypeCnName="一般相等关联";
        }
      %>

        mygrid1.setCellValue("NAME5",<%=i%>,"<%=joinTypeCnName%>");
        mygrid1.setCellValue("NAME10",<%=i%>,"<%=connectionList[i].getJOINTYPE()%>");
        mygrid1.refresh();

      <%
    }
  }
  %>
}



function gridRelationTableAddRow()  //增加行
{
  row1 = row1+1;
  InputRowInfogridRelationTable();
}


function gridRelationTableDeleteRow() //删除行
{

  if(confirm("确定要删除选中的行吗?"))
  {
    mygrid1.setCellValue("NAME1",crow1,"");
    mygrid1.setCellValue("NAME2",crow1,"");
    mygrid1.setCellValue("NAME3",crow1,"");
    mygrid1.setCellValue("NAME4",crow1,"");
    mygrid1.setCellValue("NAME5",crow1,"");
    mygrid1.setCellValue("NAME6",crow1,"");
    mygrid1.setCellValue("NAME7",crow1,"");
    mygrid1.setCellValue("NAME8",crow1,"");
    mygrid1.setCellValue("NAME9",crow1,"");
    mygrid1.setCellValue("NAME10",crow1,"");
    mygrid1.refresh();

    GetAllRelTableFieldInfo();  //更新关联数组项
  }

}


function gridRelationTableUpdateRow() //更新行
{
   var relationTableCnName=RegForm.CFIELD_TABLE.options[RegForm.CFIELD_TABLE.selectedIndex].text;
  var relationTableEnName=RegForm.CFIELD_TABLE.options[RegForm.CFIELD_TABLE.selectedIndex].value;

  var relationFieldCnName=RegForm.CFIELD_FIELD.options[RegForm.CFIELD_FIELD.selectedIndex].text;
  var relationFieldEnName=RegForm.CFIELD_FIELD.options[RegForm.CFIELD_FIELD.selectedIndex].value;


  var relationRightTableCnName=RegForm.MFIELD_TABLE.options[RegForm.MFIELD_TABLE.selectedIndex].text;
  var relationRightTableEnName=RegForm.MFIELD_TABLE.options[RegForm.MFIELD_TABLE.selectedIndex].value;

  var relationRightFieldCnName=RegForm.MFIELD_FIELD.options[RegForm.MFIELD_FIELD.selectedIndex].text;
  var relationRightFieldEnName=RegForm.MFIELD_FIELD.options[RegForm.MFIELD_FIELD.selectedIndex].value;

  var joinTypeCnName=RegForm.JOINTYPE.options[RegForm.JOINTYPE.selectedIndex].text;
  var joinTypeEnName=RegForm.JOINTYPE.options[RegForm.JOINTYPE.selectedIndex].value;


  mygrid1.setCellValue("NAME1",crow1,relationTableCnName);
  mygrid1.setCellValue("NAME2",crow1,relationFieldCnName);
  mygrid1.setCellValue("NAME3",crow1,relationRightTableCnName);
  mygrid1.setCellValue("NAME4",crow1,relationRightFieldCnName);
  mygrid1.setCellValue("NAME5",crow1,joinTypeCnName);
  mygrid1.setCellValue("NAME6",crow1,relationTableEnName);
  mygrid1.setCellValue("NAME7",crow1,relationFieldEnName);
  mygrid1.setCellValue("NAME8",crow1,relationRightTableEnName);
  mygrid1.setCellValue("NAME9",crow1,relationRightFieldEnName);
  mygrid1.setCellValue("NAME10",crow1,joinTypeEnName);

  mygrid1.refresh();



   //更新关联字段项
  GetAllRelTableFieldInfo();


  if (row1<crow1){row1=crow1;}
}


function gridRelationTableClick()  //点击表格处理
{
   row=crow1;
   if (mygrid1.getCellValue("NAME6",row).length>0)
   {
     RegForm.CFIELD_TABLE.value=mygrid1.getCellValue("NAME6",row);
     loadRelationFieldList(RegForm.CFIELD_TABLE.value);
     RegForm.CFIELD_FIELD.value=mygrid1.getCellValue("NAME7",row);

     RegForm.MFIELD_TABLE.value=mygrid1.getCellValue("NAME8",row);
     loadRightRelationFieldList(RegForm.MFIELD_TABLE.value);
     RegForm.MFIELD_FIELD.value=mygrid1.getCellValue("NAME9",row);

     RegForm.JOINTYPE.value=mygrid1.getCellValue("NAME10",row);
   }
}


//将表格中的信息按约定格式填入隐藏域中，以便服务器端处理
//左关联表名#左关联字段#右关联表名#右关联字段#关联类型&
function fillgridRelationTableToInfoStr()
{
   var strResult="";
  for(row=0;row<=row1;row++)
  {
    if (mygrid1.getCellValue("NAME1",row).length>0)
    {
    strResult+=mygrid1.getCellValue("NAME6",row)+"#"+
               mygrid1.getCellValue("NAME7",row)+"#"+
               mygrid1.getCellValue("NAME8",row)+"#"+
               mygrid1.getCellValue("NAME9",row)+"#"+
               mygrid1.getCellValue("NAME10",row)+"&";
    }

  }

  RegForm.RelationInfoStr.value=strResult;
}

function InputRowInfogridRelationTable()  //将录入框中的信息填入表格列表
{
  var relationTableCnName=RegForm.CFIELD_TABLE.options[RegForm.CFIELD_TABLE.selectedIndex].text;
  var relationTableEnName=RegForm.CFIELD_TABLE.options[RegForm.CFIELD_TABLE.selectedIndex].value;

  var relationFieldCnName=RegForm.CFIELD_FIELD.options[RegForm.CFIELD_FIELD.selectedIndex].text;
  var relationFieldEnName=RegForm.CFIELD_FIELD.options[RegForm.CFIELD_FIELD.selectedIndex].value;


  var relationRightTableCnName=RegForm.MFIELD_TABLE.options[RegForm.MFIELD_TABLE.selectedIndex].text;
  var relationRightTableEnName=RegForm.MFIELD_TABLE.options[RegForm.MFIELD_TABLE.selectedIndex].value;

  var relationRightFieldCnName=RegForm.MFIELD_FIELD.options[RegForm.MFIELD_FIELD.selectedIndex].text;
  var relationRightFieldEnName=RegForm.MFIELD_FIELD.options[RegForm.MFIELD_FIELD.selectedIndex].value;

  var joinTypeCnName=RegForm.JOINTYPE.options[RegForm.JOINTYPE.selectedIndex].text;
  var joinTypeEnName=RegForm.JOINTYPE.options[RegForm.JOINTYPE.selectedIndex].value;


  mygrid1.setCellValue("NAME1",row1,relationTableCnName);
  mygrid1.setCellValue("NAME2",row1,relationFieldCnName);
  mygrid1.setCellValue("NAME3",row1,relationRightTableCnName);
  mygrid1.setCellValue("NAME4",row1,relationRightFieldCnName);
  mygrid1.setCellValue("NAME5",row1,joinTypeCnName);
  mygrid1.setCellValue("NAME6",row1,relationTableEnName);
  mygrid1.setCellValue("NAME7",row1,relationFieldEnName);
  mygrid1.setCellValue("NAME8",row1,relationRightTableEnName);
  mygrid1.setCellValue("NAME9",row1,relationRightFieldEnName);
  mygrid1.setCellValue("NAME10",row1,joinTypeEnName);

  mygrid1.refresh();



   //更新关联字段项
  GetAllRelTableFieldInfo();



}
/*******结束***********************关联表属性表格信息*****************************/

////////////////////////////////////////////////////////////////////////////////

/*******开始***********************初始条件属性信息*******************************/

//将关联表信息填入表格组件中
function gridWhereFieldBind()
{
  var row=0;
  var strTempEn,strTempCn;
  <%
  if(whereList!=null)
  {
    for(i=0;i<whereList.length;i++)
    {
      %>

      //左括号
      strTempEn="<%=whereList[i].getQLEFT()%>";
      if(strTempEn=="0")
        strTempCn="无";
      else
        strTempCn=strTempEn;


     mygrid2.setCellValue("NAME1",row,strTempCn);
     mygrid2.setCellValue("NAME7",row,strTempEn);

     //条件列
     strTempEn="<%=whereList[i].getFIELD()%>";
     strTempCn="<%=queryConfig.GetTableFieldCnNameByEn(whereList[i].getFIELD())%>";

     mygrid2.setCellValue("NAME2",row,strTempCn);
     mygrid2.setCellValue("NAME8",row,strTempEn);

     //条件符
     mygrid2.setCellValue("NAME3",row,"<%=whereList[i].getSYMBOL()%>");
     //条件值
     mygrid2.setCellValue("NAME4",row,"<%=whereList[i].getWHEREVALUE()%>");
     //右括号
     strTempEn="<%=whereList[i].getQRIGHT()%>";

      if(strTempEn=="0")
        strTempCn="无";
      else
        strTempCn=strTempEn;


     mygrid2.setCellValue("NAME5",row,strTempCn);
     mygrid2.setCellValue("NAME9",row,strTempEn);

    //逻辑符
     strTempEn="<%=whereList[i].getLOGIC()%>";

     if(strTempEn=="1")
        strTempCn="与";
     if(strTempEn=="2")
        strTempCn="或";
    if(strTempEn=="0")
        strTempCn="无";


     mygrid2.setCellValue("NAME6",row,strTempCn);
     mygrid2.setCellValue("NAME10",row,strTempEn);


     mygrid2.refresh();
     row++;
      <%
    }
  }
  %>
}



function gridWhereFieldAddRow()  //增加行
{
 if(RegForm.txtWHEREVALUE.value.length == 0)
 {
   alert("条件值未录入！");
   return;
 }
  row2 = row2+1;
  InputRowInfogridWhereField();
}


function gridWhereFieldDeleteRow() //删除行
{

  if(confirm("确定要删除选中的行吗?"))
  {
    mygrid2.setCellValue("NAME1",crow2,"");
    mygrid2.setCellValue("NAME2",crow2,"");
    mygrid2.setCellValue("NAME3",crow2,"");
    mygrid2.setCellValue("NAME4",crow2,"");
    mygrid2.setCellValue("NAME5",crow2,"");
    mygrid2.setCellValue("NAME6",crow2,"");
    mygrid2.setCellValue("NAME7",crow2,"");
    mygrid2.setCellValue("NAME8",crow2,"");
    mygrid2.setCellValue("NAME9",crow2,"");
    mygrid2.setCellValue("NAME10",crow2,"");
    mygrid2.refresh();

  }

}


function gridWhereFieldUpdateRow() //更新行
{

  if(RegForm.txtWHEREVALUE.value.length == 0)
 {
   alert("条件值未录入！");
   return;
 }

 var tempStr;
  var objList;

  objList=RegForm.selLeft; //左括号
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME1",crow2,tempStr);

  tempStr=objList.value;
  mygrid2.setCellValue("NAME7",crow2,tempStr);

  objList=RegForm.selFIELD;//条件列
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME2",crow2,tempStr);
  tempStr=objList.value;
  tempStr=tempStr.substring(0,tempStr.length-2);//最后两位为".类型代码，故将其去掉"
  mygrid2.setCellValue("NAME8",crow2,tempStr);

  objList=RegForm.selSYMBOL; //条件符
  tempStr=objList.value;
  mygrid2.setCellValue("NAME3",crow2,tempStr);

  objList=RegForm.txtWHEREVALUE; //条件值
  tempStr=objList.value;
  mygrid2.setCellValue("NAME4",crow2,tempStr);

  objList=RegForm.selRight; //右括号
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME5",crow2,tempStr);
  tempStr=objList.value;
  mygrid2.setCellValue("NAME9",crow2,tempStr);

  objList=RegForm.selLOGIC; //逻辑符
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME6",crow2,tempStr);
  tempStr=objList.value;

  mygrid2.setCellValue("NAME10",crow2,tempStr);
  mygrid2.refresh();


}


function gridWhereFieldClick()  //点击表格处理
{
  var strTemp;
  var objList;

  if (mygrid2.getCellValue("NAME7",crow2).length>0)
  {
  RegForm.selLeft.value=mygrid2.getCellValue("NAME7",crow2);             //左括号

  strTemp=mygrid2.getCellValue("NAME8",crow2);                           //条件列
  objList=RegForm.selFIELD;
  if(objList.value.indexOf(strTemp)==-1)
  {
    for(i=0;i<objList.options.length-1;i++)
    {
      if(objList.options[i].value.indexOf(strTemp)>-1)
      {
        objList.selectedIndex=i;
        break;
      }
    }
  }

  RegForm.selSYMBOL.value=mygrid2.getCellValue("NAME3",crow2);           //条件符
  RegForm.txtWHEREVALUE.value=mygrid2.getCellValue("NAME4",crow2);       //条件值
  RegForm.selRight.value=mygrid2.getCellValue("NAME9",crow2);           //右括号
  RegForm.selLOGIC.value=mygrid2.getCellValue("NAME10",crow2);           //逻辑符
}
}


//将表格中的信息按约定格式填入隐藏域中，以便服务器端处理
//左括号#条件列#条件符#条件值#右括号#逻辑符&
function fillgridWhereFieldToInfoStr()
{
   var strResult="";
  for(row=0;row<=row2;row++)
  {
    if (mygrid2.getCellValue("NAME1",row).length>0)
    {
    strResult+=mygrid2.getCellValue("NAME7",row)+"#"+
               mygrid2.getCellValue("NAME8",row)+"#"+
               mygrid2.getCellValue("NAME3",row)+"#"+
               mygrid2.getCellValue("NAME4",row)+"#"+
               mygrid2.getCellValue("NAME9",row)+"#"+
               mygrid2.getCellValue("NAME10",row)+"&";
    }

  }
  RegForm.WhereInfoStr.value=strResult;
}


function InputRowInfogridWhereField()  //将录入框中的信息填入表格列表
{
  var tempStr;
  var objList;

  objList=RegForm.selLeft; //左括号
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME1",row2,tempStr);

  tempStr=objList.value;
  mygrid2.setCellValue("NAME7",row2,tempStr);

  objList=RegForm.selFIELD;//条件列
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME2",row2,tempStr);
  tempStr=objList.value;
  tempStr=tempStr.substring(0,tempStr.length-2);//最后两位为".类型代码，故将其去掉"
  mygrid2.setCellValue("NAME8",row2,tempStr);

  objList=RegForm.selSYMBOL; //条件符
  tempStr=objList.value;
  mygrid2.setCellValue("NAME3",row2,tempStr);

  objList=RegForm.txtWHEREVALUE; //条件值
  tempStr=objList.value;
  mygrid2.setCellValue("NAME4",row2,tempStr);

  objList=RegForm.selRight; //右括号
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME5",row2,tempStr);
  tempStr=objList.value;
  mygrid2.setCellValue("NAME9",row2,tempStr);

  objList=RegForm.selLOGIC; //逻辑符
  tempStr=objList.options[objList.selectedIndex].text;
  mygrid2.setCellValue("NAME6",row2,tempStr);
  tempStr=objList.value;

  mygrid2.setCellValue("NAME10",row2,tempStr);
  mygrid2.refresh();
}

/*******结束***********************初始条件属性信息*******************************/

////////////////////////////////////////////////////////////////////////////////

/*******开始***********************查询列属性信息*********************************/

//填充查询已选字段
function fillQueryFieldDestList()
{
var objFieldList=RegForm.QueryFieldDestList;
objFieldList.length=0;
var len=0;
  <%
  if(queryFieldList!=null)
  {
    for(i=0;i<queryFieldList.length;i++)
    {
      %>
        objFieldList.options[len]=new Option("<%=queryConfig.GetTableFieldCnNameByEn(queryFieldList[i].getFIELD())%>","<%=queryFieldList[i].getFIELD()%>");
        len++;
      <%
    }
  }
  %>
}
/*******结束***********************查询列属性信息*********************************/


////////////////////////////////////////////////////////////////////////////////

/*******开始***********************结果列属性信息*********************************/


//判断即将添加的显示列是否属于隐藏列
function checkDisAddSelection()
{
  var srcList=RegForm.resultDisFieldSrcList;
  var destList=RegForm.resultHidFieldDestList;

  if(isExistSelection(srcList,destList))
  {
    alert("隐藏列不能同时添加为显示列!");
    return false;
  }

  return true;
}


//填充查询已选字段
function fillResultFieldDestList()
{
var objHidFieldList=RegForm.resultHidFieldDestList;
objHidFieldList.length=0;
var lenDis=0;
var lenHid=0;
  <%
  if(resultFieldList!=null)
  {
    for(i=0;i<resultFieldList.length;i++)
    {
      if(resultFieldList[i].getISSHOW().equals("1"))
      {
        %>
       lenDis++;
        <%
      }
      else
      {
        %>
        objHidFieldList.options[lenHid]=new Option("<%=queryConfig.GetTableFieldCnNameByEn(resultFieldList[i].getFIELD())%>","<%=resultFieldList[i].getFIELD()%>");
        lenHid++;
        <%
      }
    }
  }
  %>
}

//将结果列信息填入表格组件中
function gridResultColBind()
{

  var row=0;
  var tableFieldName;
  <%
  String ISNUMBER="否";
  String QALIGN ="居左";
  if(resultFieldList!=null)
  {
    for(i=0;i<resultFieldList.length;i++)
    {
      if(resultFieldList[i].getISSHOW().equals("1"))
      {
        if (resultFieldList[i].getISNUMBER()==null)
        {
          ISNUMBER="否";
        }else
        {
          if (resultFieldList[i].getISNUMBER().equals("1"))
          {
             ISNUMBER="是";
          }else
          {
             ISNUMBER="否";
          }


        }

         if (resultFieldList[i].getQALIGN()==null)
          {
            QALIGN="居左";
          }else
          {
          if (resultFieldList[i].getQALIGN().equals("0"))
          {
             QALIGN="居左";
          }
          if (resultFieldList[i].getQALIGN().equals("1"))
          {
             QALIGN="居中";
          }
          if (resultFieldList[i].getQALIGN().equals("2"))
          {
             QALIGN="居右";
          }
          }
        %>

        tableFieldName="<%=resultFieldList[i].getFIELD()%>";

        mygrid3.setCellValue("NAME1",row,"<%=queryConfig.GetTableFieldCnNameByEn(resultFieldList[i].getFIELD())%>");
        mygrid3.setCellValue("NAME2",row,"<%=resultFieldList[i].getCOLWIDTH()%>");
        mygrid3.setCellValue("NAME3",row,tableFieldName);
        mygrid3.setCellValue("NAME4",row,"<%=ISNUMBER%>");
        mygrid3.setCellValue("NAME5",row,"<%=QALIGN%>");

         mygrid3.refresh();
         row++;


        <%
      }
    }
  }
  %>
}

//将设置输入的结果列宽更新到表格gridResultCol中
function gridResultColUpdateRow()
{

  if(trim(RegForm.resultColWidth.value).length==0)
 {
   alert("宽度未录入！");
   return;
 }
 mygrid3.setCellValue("NAME2",crow3,RegForm.resultColWidth.value);

 var isnumber = RegForm.ISNUMBER.value;
 if (isnumber=="1")
 {
    mygrid3.setCellValue("NAME4",crow3,"是");
 }else
 {
    mygrid3.setCellValue("NAME4",crow3,"否");
 }
 var QALIGN = RegForm.QALIGN.value;
 if (QALIGN=="0")
 {
    mygrid3.setCellValue("NAME5",crow3,"居左");
 }
 if (QALIGN=="1")
 {
    mygrid3.setCellValue("NAME5",crow3,"居中");
 }
 if (QALIGN=="2")
 {
    mygrid3.setCellValue("NAME5",crow3,"居右");
 }
 mygrid3.refresh();
}

function gridResultColClick()  //点击表格处理
{
  if (mygrid3.getCellValue("NAME1",crow3).length>0)
  {
   RegForm.resultColName.value=mygrid3.getCellValue("NAME1",crow3);
   RegForm.resultColWidth.value=mygrid3.getCellValue("NAME2",crow3);
   var isnumber = mygrid3.getCellValue("NAME4",crow3);
   if (isnumber=="是")
   {
       RegForm.ISNUMBER.value = "1";
   }else
   {
       RegForm.ISNUMBER.value = "0";
   }
   var QALIGN = mygrid3.getCellValue("NAME5",crow3);

   if (QALIGN=="居左")
   {
       RegForm.QALIGN.value = "0";
   }
   if (QALIGN=="居中")
   {
       RegForm.QALIGN.value = "1";
   }
   if (QALIGN=="居右")
   {
       RegForm.QALIGN.value = "2";
   }
  }
}

function gridResultColDeleteRow() //删除行
{

  if(confirm("确定要删除选中的行吗?"))
  {
      mygrid3.setCellValue("NAME1",crow3,"");
      mygrid3.setCellValue("NAME2",crow3,"");
      mygrid3.setCellValue("NAME3",crow3,"");
      mygrid3.setCellValue("NAME4",crow3,"");
      mygrid3.setCellValue("NAME5",crow3,"");
      mygrid3.refresh();
  }

}

function gridResultColAddRow()
{
  var row,lrow;
  if(!checkDisAddSelection())
  {
    return;  //已经有选中的行属于隐藏列
  }

 var srcList=RegForm.resultDisFieldSrcList;
 for(var i = 0; i < srcList.length; i++)
 {
   if ((srcList.options[i] != null) && (srcList.options[i].selected))
   {
     if(!checkExistGrid(srcList.options[i].value))
     {

       if (mygrid3.getCellValue("NAME1",crow3).length==0)
       {
          row = crow3;
          if(row>0)
          {lrow = row-1;}
          else
          {lrow = 0 ;}

          while (mygrid3.getCellValue("NAME1",lrow).length==0 && lrow>0)
          {
             row = row -1;
             lrow = row-1;
          }

       }else
       {
          row = row3;

          if(row>0)
          {lrow = row-1;}
          else
          {lrow = 0 ;}
          while (mygrid3.getCellValue("NAME1",lrow).length==0 && lrow>0)
          {
             row = row -1;
             lrow = row-1;
          }
       }

       mygrid3.setCellValue("NAME1",row,srcList.options[i].text);
       mygrid3.setCellValue("NAME2",row,"120");
       mygrid3.setCellValue("NAME3",row,srcList.options[i].value);
       mygrid3.setCellValue("NAME4",row,"否");
       mygrid3.setCellValue("NAME5",row,"居左");

       mygrid3.refresh();

       if (row3==-1){row3=0;}
       row3++;
     }
   }
 }
}

//增加隐藏列
function AddHidCol()
{
  var srcList=RegForm.resultHidFieldSrcList;
  var destList=RegForm.resultHidFieldDestList;
  var len = destList.length;
  for(var i = 0; i < srcList.length; i++)
 {
   if ((srcList.options[i] != null) && (srcList.options[i].selected))
   {
     if(checkExistGrid(srcList.options[i].value))
     {
       alert("显示列不能同时添加为隐藏列!");
       continue;
     }

       var found = false;
	for(var count = 0; count < len; count++)
        {
	    if (destList.options[count] != null)
            {
			if (srcList.options[i].text == destList.options[count].text)
                        {
						found = true;
						break;
			 }
            }
	}
	if (found != true)
        {
            destList.options[len] = new Option(srcList.options[i].text,srcList.options[i].value);
	    len++;
	}
   }
 }
}

//检查选中项的值是否存在表格中
function checkExistGrid(selectedValue)
{
     for(var row = 0; row < row3; row++)
     {
	   if (mygrid3.getCellValue("NAME3",row) == selectedValue)
           {
		return true;
           }
    }

 return false;
}

function fillDisColVaueToField()
{
  var tmpStr="";

    for(var row = 0; row <= row3; row++)
     {
         if (mygrid3.getCellValue("NAME1",row).length>0)
         {
	   tmpStr+= mygrid3.getCellValue("NAME3",row) +"#"+mygrid3.getCellValue("NAME2",row)+"#"+mygrid3.getCellValue("NAME4",row)+"#"+mygrid3.getCellValue("NAME5",row)+",";
         }
     }
  RegForm.ResultDisFieldInfoStr.value=tmpStr;

}

/*******结束***********************结果列属性信息*********************************/

/////////////////////////////////////////////////////////////////////////////////


/*******开始***********************明细参数属性表格信息*****************************/

//将按钮参数信息填入表格组件中
function gridDetailParameterBind()
{

 var row=0;
  var tableFieldName;
  <%
  if(detailParameterList!=null)
  {
    for(i=0;i<detailParameterList.length;i++)
    {
      %>

       tableFieldName="<%=detailParameterList[i].getFIELD()%>";

       mygrid4.setCellValue("NAME1",row,"<%=detailParameterList[i].getID()%>");
       mygrid4.setCellValue("NAME2",row,"<%=detailParameterList[i].getNAME()%>");
       mygrid4.setCellValue("NAME3",row,"<%=queryConfig.GetTableFieldCnNameByEn(detailParameterList[i].getFIELD())%>");
       mygrid4.setCellValue("NAME4",row,tableFieldName);
       mygrid4.setCellValue("NAME5",row,"<%=detailParameterList[i].getBID()%>");

       mygrid4.refresh();
       row++;


      <%
    }
  }
  %>
}

//按钮信息填入选择列表中
function listButtonDetailParameterBind()
{
  var len=0;
  RegForm.ButtonSrcList.length=0;
  <%
    if(buttonAll!=null)
    {
     for(i=0;i<buttonAll.length;i++)
     {
       %>
       RegForm.ButtonSrcList.options[len]=new Option("<%=buttonAll[i].getNAME()%>","<%=buttonAll[i].getID()%>");
       len++;
       <%
     }
   }
  %>

   RegForm.ButtonDestList.length=0;
   len=0;
  <%
    if(buttonConfig!=null)
    {
     for(i=0;i<buttonConfig.length;i++)
     {
       %>
       RegForm.ButtonDestList.options[len]=new Option("<%=buttonConfig[i].getNAME()%>","<%=buttonConfig[i].getID()%>");
       len++;
       <%
     }
   }
  %>
}

if(RegForm.ButtonDestList.options.length>0)
{
  RegForm.ButtonDestList.selectedIndex=0;
  getDetailParameterByButton();
}


function gridDetailParameterAddRow()  //增加行
{


 if(trim(RegForm.txtParameterNAME.value).length==0)
 {
   alert("参数名称未录入！");
   return;
 }

 if(GetMultiListSelectedNum(RegForm.ButtonDestList) != 1)
  {
    alert("请选择一项已分配按钮!");
    return;
  }

  InputDetailParameterTable();
}


function gridDetailParameterDeleteRow() //删除行
{
  var row=0;
  var idStr="";

  idStr=mygrid5.getCellValue("NAME5",crow5);
  if(confirm("确定要删除选中的行吗?"))
  {

     mygrid5.setCellValue("NAME1",crow5,"");
     mygrid5.setCellValue("NAME2",crow5,"");
     mygrid5.setCellValue("NAME3",crow5,"");
     mygrid5.setCellValue("NAME4",crow5,"");
     mygrid5.setCellValue("NAME5",crow5,"");
     mygrid5.refresh();

     for(row=0;row<=row4;row++)
     {
       if(mygrid4.getCellValue("NAME1",row)==idStr)
       {
          mygrid4.setCellValue("NAME1",row,"");
          mygrid4.setCellValue("NAME2",row,"");
          mygrid4.setCellValue("NAME3",row,"");
          mygrid4.setCellValue("NAME4",row,"");
          mygrid4.setCellValue("NAME5",row,"");

          mygrid4.refresh();

       }
     }

  }
}




function gridDetailParameterClick()  //点击表格处理
{

   RegForm.txtParameterNAME.value=mygrid5.getCellValue("NAME2",crow5);
   RegForm.selParameterField.value=mygrid5.getCellValue("NAME4",crow5);

}


//将表格中的信息按约定格式填入隐藏域中，以便服务器端处理
//参数名#参数字段名#按钮ID&
function fillgridDetailParameterToInfoStr()
{
   var strResult="";
  for(row=0;row<=row4;row++)
  {
    if (mygrid4.getCellValue("NAME1",row).length>0)
    {
       strResult+=mygrid4.getCellValue("NAME2",row)+"#"+
               mygrid4.getCellValue("NAME4",row)+"#"+
               mygrid4.getCellValue("NAME5",row)+"&";

    }
  }
  RegForm.DetailParameterInfoStr.value=strResult;
}


function InputDetailParameterTable()  //将录入框中的信息填入表格列表
{
  var idStr;
  var row=crow5;

  idStr=mygrid5.getCellValue("NAME5",row);
  //更新行时，将gridDetailParameterHid中对应的行置为当前行
   for(row=0;row<=row4;row++)
     {
       if(mygrid4.getCellValue("NAME1",row)==idStr)
       {
          crow4=row;
       }
     }

  idStr=(new  Date()).valueOf();


  var tableName=RegForm.selParameterField.options[RegForm.selParameterField.selectedIndex].text;

  if (mygrid5.getCellValue("NAME5",crow5).length>0)
  {
     crow5++;
     while (mygrid5.getCellValue("NAME5",crow5).length>0)
     {
        crow5++;
     }
  }

  mygrid5.setCellValue("NAME5",crow5,idStr);
  mygrid5.setCellValue("NAME2",crow5,RegForm.txtParameterNAME.value);
  mygrid5.setCellValue("NAME3",crow5,tableName);
  mygrid5.setCellValue("NAME4",crow5,RegForm.selParameterField.value);
  mygrid5.refresh();


  if (mygrid4.getCellValue("NAME1",crow4).length>0)
  {
     crow4++;
     while (mygrid4.getCellValue("NAME1",crow4).length>0)
     {
        crow4++;
     }
  }
  mygrid4.setCellValue("NAME1",crow4,idStr);
  mygrid4.setCellValue("NAME2",crow4,RegForm.txtParameterNAME.value);
  mygrid4.setCellValue("NAME3",crow4,tableName);
  mygrid4.setCellValue("NAME4",crow4,RegForm.selParameterField.value);
  mygrid4.setCellValue("NAME5",crow4,RegForm.ButtonDestList.value);
  mygrid4.refresh();

  row4=row4+1;
  row5=row5+1;

}

function getDetailParameterByButton()
{
  var BID=RegForm.ButtonDestList.value;
  var row1=0;

  for(row=0;row<=row5;row++)
  {
     mygrid5.setCellValue("NAME1",row,"");
     mygrid5.setCellValue("NAME2",row,"");
     mygrid5.setCellValue("NAME3",row,"");
     mygrid5.setCellValue("NAME4",row,"");
     mygrid5.setCellValue("NAME5",row,"");
     mygrid5.refresh();
  }

   for(row=0;row<=row4;row++)
  {

    if(mygrid4.getCellValue("NAME5",row)==BID)
    {

      mygrid5.setCellValue("NAME5",row1,mygrid4.getCellValue("NAME1",row));
      mygrid5.setCellValue("NAME2",row1,mygrid4.getCellValue("NAME2",row));
      mygrid5.setCellValue("NAME3",row1,mygrid4.getCellValue("NAME3",row));
      mygrid5.setCellValue("NAME4",row1,mygrid4.getCellValue("NAME4",row));
      row1 = row1+1;

    }

  }

}


function deleteParamByDestList()
{
  var BID=RegForm.ButtonDestList.value;
  var deleteFlag=true;


  for(row=0;row<=row5;row++)
  {
     mygrid5.setCellValue("NAME1",row,"");
     mygrid5.setCellValue("NAME2",row,"");
     mygrid5.setCellValue("NAME3",row,"");
     mygrid5.setCellValue("NAME4",row,"");
     mygrid5.setCellValue("NAME5",row,"");
     mygrid5.refresh();
  }


  while(deleteFlag==true)
  {
    deleteFlag=false;
     for(row=0;row<=row4;row++)
     {
       if(mygrid4.getCellValue("NAME5",row)==BID)
       {
          deleteFlag=true;
          crow4=row;

          mygrid4.setCellValue("NAME1",row,"");
          mygrid4.setCellValue("NAME2",row,"");
          mygrid4.setCellValue("NAME3",row,"");
          mygrid4.setCellValue("NAME4",row,"");
          mygrid4.setCellValue("NAME5",row,"");
          mygrid4.refresh();

       }
     }

  }


}


/*******结束***********************明细参数属性表格信息*****************************/

////////////////////////////////////////////////////////////////////////////////

/*******开始***********************排序属性信息************************************/
//将排序信息填入表格组件中
function gridSortBind()
{
  var sortTypeEn;
  var row=0;
  <%
  if(orderList!=null)
  {
    for(i=0;i<orderList.length;i++)
    {
      %>

      tableFieldName="<%=orderList[i].getFIELD()%>";
      sortTypeEn="<%=orderList[i].getTYPE()%>";

      mygrid6.setCellValue("NAME1",row,"<%=orderList[i].getID()%>");
      mygrid6.setCellValue("NAME2",row,"<%=queryConfig.GetTableFieldCnNameByEn(orderList[i].getFIELD())%>");

      if(sortTypeEn=="1")
      {mygrid6.setCellValue("NAME3",row,"升序");}
      else
      {mygrid6.setCellValue("NAME3",row,"降序");}

      mygrid6.setCellValue("NAME4",row,tableFieldName);
      mygrid6.setCellValue("NAME5",row,sortTypeEn);

      mygrid6.refresh();
      row = row + 1;

      <%
    }
  }
  %>
}



function gridSortAddRow()  //增加行
{
  InputRowInfogridSort();
}


function gridSortDeleteRow() //删除行
{
  if(confirm("确定要删除选中的行吗?"))
  {
      mygrid6.setCellValue("NAME1",crow6,"");
      mygrid6.setCellValue("NAME2",crow6,"");
      mygrid6.setCellValue("NAME3",crow6,"");
      mygrid6.setCellValue("NAME4",crow6,"");
      mygrid6.setCellValue("NAME5",crow6,"");
      mygrid6.refresh();
  }
}




function gridSortClick()  //点击表格处理
{

   RegForm.SORT_FIELD.value= mygrid6.getCellValue("NAME4",crow6);
   RegForm.SORT_TYPE.value = mygrid6.getCellValue("NAME5",crow6);

}


//将表格中的信息按约定格式填入隐藏域中，以便服务器端处理
//排序字段#类型&
function fillgridSortToInfoStr()
{
   var strResult="";
  for(row=0;row<=row6;row++)
  {
      if (mygrid6.getCellValue("NAME4",row).length>0)
      {
         strResult+=mygrid6.getCellValue("NAME4",row)+"#"+
               mygrid6.getCellValue("NAME5",row)+"&";

      }
  }
  RegForm.SortInfoStr.value=strResult;
}

function InputRowInfogridSort()  //将录入框中的信息填入表格列表
{
  var fieldCnName=RegForm.SORT_FIELD.options[RegForm.SORT_FIELD.selectedIndex].text;
  var fieldEnName=RegForm.SORT_FIELD.options[RegForm.SORT_FIELD.selectedIndex].value;

  var sortCnName=RegForm.SORT_TYPE.options[RegForm.SORT_TYPE.selectedIndex].text;
  var sortEnName=RegForm.SORT_TYPE.options[RegForm.SORT_TYPE.selectedIndex].value;

  if (mygrid6.getCellValue("NAME2",crow6).length>0)
  {
     crow6++;
     while (mygrid6.getCellValue("NAME2",crow6).length>0)
     {
        crow6++;
     }
  }

  mygrid6.setCellValue("NAME2",crow6,fieldCnName);
  mygrid6.setCellValue("NAME3",crow6,sortCnName);
  mygrid6.setCellValue("NAME4",crow6,fieldEnName);
  mygrid6.setCellValue("NAME5",crow6,sortEnName);
  mygrid6.refresh();

  row6=row6+1;

}

/*******结束***********************排序属性信息************************************/

function ShowModalTableTree()
{
  var url="SelectTableTree.jsp";
  var status="dialogHeight:450px;dialogWidth:250px;status:0;help:no;center:yes";
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title: '选择表',
     area: ['250px', '450px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'?zdid=MAINTABLE'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
  if (rtnResult!=null)
  {
     document.RegForm.MAINTABLE.value = rtnResult;
  }
  <%}%>
}
function ShowModalTableTree1()
{
  var url="SelectTableTree.jsp";
  var status="dialogHeight:450px;dialogWidth:250px;status:0;help:no;center:yes";
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title: '选择表',
     area: ['250px', '450px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'?zdid=CFIELD_TABLE'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
  if (rtnResult!=null)
  {
     document.RegForm.CFIELD_TABLE.value = rtnResult;
  }
  <%}%>
}
function ShowModalTableTree2()
{
  var url="SelectTableTree.jsp";
  var status="dialogHeight:450px;dialogWidth:250px;status:0;help:no;center:yes";
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title: '选择表',
     area: ['250px', '450px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'?zdid=MFIELD_TABLE'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
  if (rtnResult!=null)
  {
     document.RegForm.MFIELD_TABLE.value = rtnResult;
  }
  <%}%>
}
function setprecision()
{
   var sid = document.RegForm.ID.value;
   if (sid.length==0)
   {
      alert("请先保存配置后再进行设置！");
      return false;
   }
   var svalue = document.RegForm.QueryFieldDestList.value;
   if (svalue.length>0)
   {
      var strURL = "setprecision.jsp?id="+sid+"&field="+svalue;
      var w,h,s;
      var MenuWindow = null;
      w = 320;
      h = 230;
      s = "directories=no,left=0,top=0,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=" + w + ",height=" + h;
      <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     area: ['850px', '550px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=EXPRESSIONSWHERE'
   });
  <%}else{%>
      MenuWindow = window.open(strURL,"_blank",s);
      MenuWindow.moveTo(320,260);
      MenuWindow.focus();
      <%}%>
   }
}


function startinit()
{

loadMainTableList();

//关联表属性
gridRelationTableBind();

//初始条件属性
gridWhereFieldBind();


//填充查询列待选信息
fillQueryFieldDestList();

//填充结果列已选信息
fillResultFieldDestList();
gridResultColBind();


//按钮属性
gridDetailParameterBind();


//排序属性
gridSortBind();



}



function setbutton()
{
   var gid = document.RegForm.ID.value;
   //alert(document.RegForm.ID.value);
   if (gid != "")
   {
     var mFileUrl = "../ButtonConfig/List.jsp?FID="+ gid;
     var name="btWindow";
     var ShowbtWindow = null;
     var status="toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=700,height=300";
     <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'设置私有按钮',
     area: ['850px', '450px'],
     fix: false, //不固定
     maxmin: false,
     content: mFileUrl+'&zdid=EXPRESSIONSWHERE'
   });
  <%}else{%>
     ShowbtWindow = window.open(mFileUrl,name,status);
     ShowbtWindow.moveTo(120,80);
     ShowbtWindow.focus();
     <%}%>
   }
}
//结果列表格上移
function gridMoveRowUp()
{
   var cv1 = mygrid3.getCellValue("NAME1",crow3);
   var cv2 = mygrid3.getCellValue("NAME2",crow3);
   var cv3 = mygrid3.getCellValue("NAME3",crow3);
   var cv4 = mygrid3.getCellValue("NAME4",crow3);
   var cv5 = mygrid3.getCellValue("NAME4",crow3);


   if (cv1.length>0 && crow3>0)
   {
     srow = crow3-1;
     var yv1 = mygrid3.getCellValue("NAME1",srow);
     var yv2 = mygrid3.getCellValue("NAME2",srow);
     var yv3 = mygrid3.getCellValue("NAME3",srow);
     var yv4 = mygrid3.getCellValue("NAME4",srow);
     var yv5 = mygrid3.getCellValue("NAME4",srow);

     mygrid3.setCellValue("NAME1",srow,cv1);
     mygrid3.setCellValue("NAME2",srow,cv2);
     mygrid3.setCellValue("NAME3",srow,cv3);
     mygrid3.setCellValue("NAME4",srow,cv4);
     mygrid3.setCellValue("NAME5",srow,cv5);

     mygrid3.setCellValue("NAME1",crow3,yv1);
     mygrid3.setCellValue("NAME2",crow3,yv2);
     mygrid3.setCellValue("NAME3",crow3,yv3);
     mygrid3.setCellValue("NAME4",crow3,yv4);
     mygrid3.setCellValue("NAME5",crow3,yv5);
     mygrid3.refresh();

     crow3 = crow3 - 1;
     setTimeout("gridMoveRowUp_select()",300);


   }
}
function gridMoveRowUp_select()
{

     mygrid3.unselectAllRow();
     mygrid3.selectRow(srow, true);
}

//结果列表格下移
function gridMoveRowDown()
{
   var cv1 = mygrid3.getCellValue("NAME1",crow3);
   var cv2 = mygrid3.getCellValue("NAME2",crow3);
   var cv3 = mygrid3.getCellValue("NAME3",crow3);
   var cv4 = mygrid3.getCellValue("NAME4",crow3);
   var cv5 = mygrid3.getCellValue("NAME4",crow3);


   if (cv1.length>0 && mygrid3.getCellValue("NAME1",srow+1).length>0)
   {
     srow = crow3+1;
     var yv1 = mygrid3.getCellValue("NAME1",srow);
     var yv2 = mygrid3.getCellValue("NAME2",srow);
     var yv3 = mygrid3.getCellValue("NAME3",srow);
     var yv4 = mygrid3.getCellValue("NAME4",srow);
     var yv5 = mygrid3.getCellValue("NAME4",srow);

     mygrid3.setCellValue("NAME1",srow,cv1);
     mygrid3.setCellValue("NAME2",srow,cv2);
     mygrid3.setCellValue("NAME3",srow,cv3);
     mygrid3.setCellValue("NAME4",srow,cv4);
     mygrid3.setCellValue("NAME5",srow,cv5);

     mygrid3.setCellValue("NAME1",crow3,yv1);
     mygrid3.setCellValue("NAME2",crow3,yv2);
     mygrid3.setCellValue("NAME3",crow3,yv3);
     mygrid3.setCellValue("NAME4",crow3,yv4);
     mygrid3.setCellValue("NAME5",crow3,yv5);
     mygrid3.refresh();

     crow3 = crow3 + 1;
     setTimeout("gridMoveRowDown_select()",300);


   }
}
function gridMoveRowDown_select()
{

     mygrid3.unselectAllRow();
     mygrid3.selectRow(srow, true);
}


setTimeout("startinit()",300);
</SCRIPT>
</FORM>
</BODY>
</HTML>

