<%@ page contentType="text/html; charset=GBK"%> <%@ page import="com.tenwa.comm.dataRightmanager.DataRightManager" %> <%@ page import="com.tenwa.officetempalte.util.FileOperatorUtil" %> <%@ page import="com.amarsoft.app.util.XMLDataUtil" %> <%@ include file="/IncludeBegin.jsp"%> <% /* Author:zywei 20050826 Tester: Content: 选择对话框页面 Input Param: Output param: History Log: zywei 2007/10/11 解决大数据量查询引起的响应延迟 xhgao 2009/04/09 增加KeyFilter加快查询速度;增加双击确认 fwang 2009/08/26 增加公共页面搜索可配置化 */ String PG_TITLE = "选择信息"; // 浏览器窗口标题 PG_TITLE //获取参数:查询名称和参数 String sSelName = CurPage.getParameter("SelName"); String sParaString = CurPage.getParameter("ParaString"); String RightType=CurPage.getParameter("RightType"); if(RightType==null&&RightType.length()==0){RightType="default";} sParaString = (sParaString == null)?"":java.net.URLDecoder.decode(sParaString, "UTF-8"); //将空值转化为空字符串 if(sSelName == null) sSelName = ""; if(sParaString == null) sParaString = ""; //定义变量:查询类型、展现方式、参数、隐藏域 String sSelType = "",sSelBrowseMode = "",sSelArgs = "",sSelHideField = ""; //定义变量:代码、字段显示中文名称、表名、主键 String sSelCode = "",sSelFieldName = "",sSelTableName = "",sSelPrimaryKey = ""; //定义变量:字段显示风格、返回值、过滤字段、选择方式 String sSelFieldDisp = "",sSelReturnValue = "",sSelFilterField = "",sMutilOrSingle = ""; //定义变量:显示字段对齐方式、显示字段类型、显示字段检查模式、是否根据检索条件查询、属性5 String sAttribute1 = "",sAttribute2 = "",sAttribute3 = "",sAttribute4 = "",sAttribute5 = ""; //定义变量:数组长度 int l = 0; //定义变量:返回字段的个数 int iReturnFiledNum = 0; String sSql = " select SelType,SelTableName,SelPrimaryKey,SelBrowseMode,SelArgs,SelHideField,SelCode, "+ " SelFieldName,SelFieldDisp,SelReturnValue,SelFilterField,MutilOrSingle, "+ " Attribute1,Attribute2,Attribute3,Attribute4,Attribute5 "+ " from O where SelName =:SelName and IsInUse = '1' "; BizObject bo = JBOFactory.createBizObjectQuery("jbo.sys.SELECT_CATALOG", sSql).setParameter("SelName", sSelName).getSingleResult(false); if(bo != null){ sSelType = bo.getAttribute("SelType").getString(); // × 预留 sSelTableName = bo.getAttribute("SelTableName").getString(); // doTemp.UpdateTable sSelPrimaryKey = bo.getAttribute("SelPrimaryKey").getString(); // doTemp.setKey( sSelBrowseMode = bo.getAttribute("SelBrowseMode").getString(); // 固定Grid sSelArgs = bo.getAttribute("SelArgs").getString(); // × 预留 sParaString sSelHideField = bo.getAttribute("SelHideField").getString(); // doTemp.setVisible(sSelHideField,false) sSelCode = bo.getAttribute("SelCode").getString(); // Sql if(sSelCode.indexOf(".xml")>0) { String xmlPath=application.getRealPath(sSelCode); Map xmlFile=XMLDataUtil.readTableInfoFromXmlFile(xmlPath); sSelCode=xmlFile.get("table_sql"); sSelCode=sSelCode.replaceAll("\r|\n", " "); sSelCode=sSelCode.replaceAll("\t", " "); } sSelFieldName = bo.getAttribute("SelFieldName").getString(); // doTemp.setHeader( sSelFieldDisp = bo.getAttribute("SelFieldDisp").getString(); // doTemp.setHTMLStyle( sSelReturnValue = bo.getAttribute("SelReturnValue").getString(); // sReturnValue sSelFilterField = bo.getAttribute("SelFilterField").getString(); // doTemp.setFilter( sMutilOrSingle = bo.getAttribute("MutilOrSingle").getString(); // doTemp.multiSelectionEnabled sAttribute1 = bo.getAttribute("Attribute1").getString(); // doTemp.setAlign( sAttribute2 = bo.getAttribute("Attribute2").getString(); // doTemp.setType( sAttribute3 = bo.getAttribute("Attribute3").getString(); // doTemp.setCheckFormat( sAttribute4 = bo.getAttribute("Attribute4").getString(); // 若1则 doTemp.WhereClauseNoFilter += " and 1=2 "; sAttribute5 = bo.getAttribute("Attribute5").getString(); // 设置下拉框来源 } //将空值转化为空字符串 if(sSelType == null) sSelType = ""; if(sSelTableName == null) sSelTableName = ""; if(sSelPrimaryKey == null) sSelPrimaryKey = ""; if(sSelBrowseMode == null) sSelBrowseMode = ""; if(sSelArgs == null) sSelArgs = ""; else sSelArgs = sSelArgs.trim(); if(sSelHideField == null) sSelHideField = ""; else sSelHideField = sSelHideField.trim(); if(sSelCode == null) sSelCode = ""; else sSelCode = sSelCode.trim(); if(sSelFieldName == null) sSelFieldName = ""; else sSelFieldName = sSelFieldName.trim(); if(sSelFieldDisp == null) sSelFieldDisp = ""; else sSelFieldDisp = sSelFieldDisp.trim(); if(sSelReturnValue == null) sSelReturnValue = ""; else sSelReturnValue = sSelReturnValue.trim(); if(sSelFilterField == null) sSelFilterField = ""; else sSelFilterField = sSelFilterField.trim(); if(sMutilOrSingle == null) sMutilOrSingle = ""; if(sAttribute1 == null) sAttribute1 = ""; if(sAttribute2 == null) sAttribute2 = ""; if(sAttribute3 == null) sAttribute3 = ""; if(sAttribute4 == null) sAttribute4 = ""; if(sAttribute5 == null) sAttribute5 = ""; //获取返回值 StringTokenizer st = new StringTokenizer(sSelReturnValue,"@"); String [] sReturnValue = new String[st.countTokens()]; while (st.hasMoreTokens()) { sReturnValue[l] = st.nextToken(); l ++; } iReturnFiledNum = sReturnValue.length; //设置显示标题 String sHeaders = sSelFieldName; //将Sql中的变量用相对应的值替换 StringTokenizer stArgs = new StringTokenizer(sParaString,","); while (stArgs.hasMoreTokens()) { try{ String sArgName = stArgs.nextToken().trim(); String sArgValue = stArgs.nextToken().trim(); sSelCode = StringFunction.replace(sSelCode,"#"+sArgName,sArgValue ); }catch(NoSuchElementException ex){ throw new Exception("输入参数格式错误!"); } } //加权限的的条件 String param=FileOperatorUtil.getParam(sSelCode); if(param.length()>0){ String[] params=param.split(","); if(params.length==2){ String sCondtion=DataRightManager.getRightConditionSelect(CurUser,params[0],params[1],"1"); sSelCode = StringFunction.replace(sSelCode,"{"+param+"}",sCondtion ); } } //实例化DataObject ASDataObject doTemp = new ASDataObject(sSelCode); doTemp.UpdateTable = sSelTableName; doTemp.setKey(sSelPrimaryKey,true); doTemp.setHeader(sHeaders); //设置隐藏字段 if(!sSelHideField.equals("")) doTemp.setVisible(sSelHideField,false); //设置对齐格式 StringTokenizer stAlign = new StringTokenizer(sAttribute1,"@"); while (stAlign.hasMoreTokens()) { String sAlignName = stAlign.nextToken().trim(); String sAlignValue = stAlign.nextToken().trim(); doTemp.setAlign(sAlignName,sAlignValue); } //设置类型 StringTokenizer stType = new StringTokenizer(sAttribute2,"@"); while (stType.hasMoreTokens()) { String sTypeName = stType.nextToken().trim(); String sTypeValue = stType.nextToken().trim(); doTemp.setType(sTypeName,sTypeValue); } //设置检查模式 StringTokenizer stCheck = new StringTokenizer(sAttribute3,"@"); while (stCheck.hasMoreTokens()) { String sCheckName = stCheck.nextToken().trim(); String sCheckValue = stCheck.nextToken().trim(); doTemp.setCheckFormat(sCheckName,sCheckValue); } //KeyFilter加快查询速度 StringTokenizer stFilter = new StringTokenizer(sAttribute4,"@"); String sFilter=""; while (stFilter.hasMoreTokens()) { String sFilterValue = stFilter.nextToken().trim(); sFilter=sFilter+"||"+sFilterValue; } if(sFilter.length()>2){ doTemp.setKeyFilter(sSelPrimaryKey); } //设置下拉框来源 StringTokenizer sDrawDownList = new StringTokenizer(sAttribute5,"@"); ArrayList ddwColumn = new ArrayList(); while (sDrawDownList.hasMoreTokens()) { String sFilterOptions = null; String sColumnList = sDrawDownList.nextToken().trim(); String sSourceType = sDrawDownList.nextToken().trim(); String sSource = sDrawDownList.nextToken().trim(); if(sDrawDownList.hasMoreTokens()) sFilterOptions = sDrawDownList.nextToken().trim(); if("Code".equalsIgnoreCase(sSourceType)){ doTemp.setDDDWCode(sColumnList,sSource); }else if("Sql".equalsIgnoreCase(sSourceType)){ doTemp.setDDDWSql(sColumnList,sSource); }else if("CodeTable".equalsIgnoreCase(sSourceType)){ doTemp.setDDDWCodeTable(sColumnList,sSource); } if(sFilterOptions == null) sFilterOptions = " "; ddwColumn.add(sColumnList+"@"+sFilterOptions); } //设置显示格式 StringTokenizer stDisp = new StringTokenizer(sSelFieldDisp,"@"); while (stDisp.hasMoreTokens()) { String sDispName = stDisp.nextToken().trim(); String sDispValue = stDisp.nextToken().trim(); doTemp.setHTMLStyle(sDispName,sDispValue); } //设置检索区 if(!sSelFilterField.equals("")){ String[] sColName= sSelFilterField.split(","); for(int i=0;i0) { doTemp.WhereClauseNoFilter+=" "+sAttribute4; } if(!sMutilOrSingle.equals("Single")) doTemp.multiSelectionEnabled=true; //实例化DataWindow ASDataWindow dwTemp = new ASDataWindow(CurPage,doTemp,Sqlca); dwTemp.Style="1"; //设置DW风格 1:Grid 2:Freeform dwTemp.ReadOnly = "1"; //设置是否只读 1:只读 0:可写 dwTemp.setPageSize(10); //服务器分页 //生成HTMLDataWindow Vector vTemp = dwTemp.genHTMLDataWindow("%"); for(int i=0;i<%@include file="/Resources/CodeParts/List05.jsp"%> <%@ include file="/IncludeEnd.jsp"%>