archive_query_conditionvalue_modify.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:10k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import = "java.net.URLEncoder"%>
  3. <%@ page import = "java.util.*"%>
  4. <%@ page import = "cn.js.fan.util.*"%>
  5. <%@ page import = "cn.js.fan.web.*"%>
  6. <%@ page import = "com.redmoon.oa.archive.*"%>
  7. <%@ page import = "com.redmoon.oa.BasicDataMgr"%>
  8. <html xmlns="http://www.w3.org/1999/xhtml">
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  11. <title>用户档案查询</title>
  12. <link href="../common.css" rel="stylesheet" type="text/css">
  13. <script language="javascript" type="text/javascript">
  14. function selDate(name,condition){ 
  15.    if(name.all.item(condition).value == "1"){
  16.       name.all.item("SEGMENT_DATE_TD").style.display = "none";
  17.       name.all.item("POINT_DATE_TD").style.display = "";
  18.   name.all.item("VAGUE_SEGMENT_YEAR_TD").style.display = "none";
  19.   name.all.item("VAGUE_POINT_YEAR_TD").style.display = "none";  
  20.    }else{
  21.       if(name.all.item(condition).value == "2"){
  22.   name.all.item("SEGMENT_DATE_TD").style.display = "none";
  23.   name.all.item("POINT_DATE_TD").style.display = "none";
  24.   name.all.item("VAGUE_SEGMENT_YEAR_TD").style.display = "";
  25.   name.all.item("VAGUE_POINT_YEAR_TD").style.display = "none";
  26.   }else{
  27.   if(name.all.item(condition).value == "3"){
  28.   name.all.item("SEGMENT_DATE_TD").style.display = "none";
  29.   name.all.item("POINT_DATE_TD").style.display = "none";
  30.   name.all.item("VAGUE_SEGMENT_YEAR_TD").style.display = "none";
  31.   name.all.item("VAGUE_POINT_YEAR_TD").style.display = "";
  32.   }else{
  33.   name.all.item("SEGMENT_DATE_TD").style.display = "";
  34.   name.all.item("POINT_DATE_TD").style.display = "none";
  35.   name.all.item("VAGUE_SEGMENT_YEAR_TD").style.display = "none";
  36.   name.all.item("VAGUE_POINT_YEAR_TD").style.display = "none";
  37.   }
  38.   }
  39.    }
  40. }
  41. function addORCondition(btnObj,name){ 
  42.     var text = "&nbsp;或者&nbsp;<select name='" + name + "'>" + maintable.all.item("option").value + "</select>";
  43. btnObj.insertAdjacentHTML("BeforeBegin", text);
  44. }
  45. function findObj(theObj, theDoc)
  46. {
  47.   var p, i, foundObj;
  48.   
  49.   if(!theDoc) theDoc = document;
  50.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  51.   {
  52.     theDoc = parent.frames[theObj.substring(p+1)].document;
  53.     theObj = theObj.substring(0,p);
  54.   }
  55.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  56.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  57.     foundObj = theDoc.forms[i][theObj];
  58.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  59.     foundObj = findObj(theObj,theDoc.layers[i].document);
  60.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  61.   
  62.   return foundObj;
  63. }
  64. var GetDate=""; 
  65. function SelectDate(ObjName,FormatDate){
  66. var PostAtt = new Array;
  67. PostAtt[0]= FormatDate;
  68. PostAtt[1]= findObj(ObjName);
  69. GetDate = showModalDialog("../util/calendar/calendar.htm", PostAtt ,"dialogWidth:286px;dialogHeight:221px;status:no;help:no;");
  70. }
  71. function SetDate()
  72. findObj(ObjName).value = GetDate; 
  73. }
  74. </script>
  75. </head>
  76. <body>
  77. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  78. <%
  79. if (!privilege.isUserPrivValid(request, "archive.query")) {
  80. out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "pvg_invalid")));
  81. return;
  82. }
  83. %>
  84. <br>
  85. <form name="form1" method="post" action="archive_query_do.jsp?op=modifyConditionFieldCode">
  86.   <table width="95%" border="0">
  87.     <tr>
  88.       <td>
  89. <%
  90.     int queryId = ParamUtil.getInt(request, "id");
  91.     String[] conditionFieldCodeArr = ParamUtil.getParameters(request,"fieldCode");
  92. String tableFullCodeStr = ParamUtil.get(request,"tableFullCodeStr");
  93. BasicDataMgr bdm = new BasicDataMgr("archive");
  94.     String options = "";
  95. String conditionFieldCodeStr = "",sql = "",fieldCode = "",tableShortCode = "",tableFieldCode = "";   
  96. %>
  97.       <table class="tableframe" cellSpacing="1" cellPadding="2" width="95%" align="center" border="0" bgcolor="#FFFFFF" id="maintable">
  98.         <tbody>
  99.           <tr>
  100.             <td colspan="3" class="right-title">综合查询</td>
  101.           </tr>
  102. <%   
  103.     //获得条件字段
  104. int i = 0 ;
  105. while(i < conditionFieldCodeArr.length){
  106.     conditionFieldCodeStr += conditionFieldCodeArr[i];
  107. if(i < conditionFieldCodeArr.length - 1){
  108.    conditionFieldCodeStr += ",";
  109. }
  110. i++;
  111. }
  112. int j = 0;
  113. TableFieldInfoDb tfid = new TableFieldInfoDb(); 
  114. String[] fieldCodeArr = null;
  115. while(j < conditionFieldCodeArr.length){
  116.    fieldCodeArr = conditionFieldCodeArr[j].split("\."); 
  117.    tableShortCode = fieldCodeArr[0];
  118.    fieldCode = fieldCodeArr[1]; 
  119.    sql = ArchiveSQLBuilder.getArchiveTableField(tableShortCode,fieldCode);       
  120.    Vector vt = tfid.list(sql);
  121.    Iterator ir = null;
  122.    ir = vt.iterator();
  123.    if (ir!=null && ir.hasNext()) {
  124.    tfid = (TableFieldInfoDb)ir.next();
  125.            
  126.            //处理文本字段
  127.            if(Integer.parseInt(tfid.getFieldType()) == tfid.INPUT){
  128. %>
  129.           <tr>
  130.             <td width="16%" noWrap><%=tfid.getFieldName()%>:</td>         
  131. <td width="84%" noWrap>
  132.               <table width="100%">
  133.     <tr>
  134.   <td>
  135. <select name="<%=tableShortCode%>_<%=fieldCode%>_SIGN">
  136.   <option value="=">等于</option>
  137.   <option value="like" selected>包含</option>
  138. </select>
  139. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="<%=tableShortCode%>_<%=fieldCode%>" size="20"/>
  140.   </td>
  141.  </tr>
  142.    </table>
  143.  </td>
  144.           </tr>
  145. <%    
  146.    }
  147.    
  148.    //处理列表字段
  149.    if(Integer.parseInt(tfid.getFieldType()) == tfid.SELECTED){
  150.   options = bdm.getOptionsStr(fieldCode);
  151. %>
  152.           <tr>
  153.             <td width="16%" noWrap><%=tfid.getFieldName()%>:</td>         
  154. <td width="84%" noWrap>
  155.               <table width="100%">
  156.    <tr>
  157.     <td>   
  158.   <input type="hidden" value="<%=options%>" name="<%=tableShortCode%>_<%=fieldCode%>_OPTION">
  159.   <select name="<%=tableShortCode%>_<%=fieldCode%>">
  160.  <%=options%>
  161.   </select>   
  162.   <input type="button" onClick='addORConditionSel(this,"<%=tableShortCode%>_<%=fieldCode%>")' value="添加或条件">
  163.     </td>
  164.    </tr>
  165.   </table>
  166.  </td>
  167.           </tr>
  168. <%    
  169.    }    
  170.    //处理日期字段
  171.    if(Integer.parseInt(tfid.getFieldType()) == tfid.SELEDATE){
  172. %>
  173.           <tr>
  174.             <td width="16%" noWrap><%=tfid.getFieldName()%>:</td>         
  175. <td width="84%" noWrap>
  176.  <table id="<%=tableShortCode%>_<%=fieldCode%>_TABLE" width="100%">
  177.    <tr>
  178. <td width="14%">
  179. <select name="<%=tableShortCode%>_<%=fieldCode%>_COND" onChange="selDate(<%=tableShortCode%>_<%=fieldCode%>_TABLE,'<%=tableShortCode%>_<%=fieldCode%>_COND')">
  180. <option value="0" selected>精确段时间</option>
  181. <option value="1">精确点时间</option>
  182. <option value="2">模糊段时间</option>
  183. <option value="3">模糊点时间</option>
  184. </select>
  185. </td>
  186. <td width="70%" align="left" id="SEGMENT_DATE_TD">
  187. 从 
  188.   <input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_FROMDATE" readonly><img style="CURSOR: hand" onClick="SelectDate('<%=tableShortCode%>_<%=fieldCode%>_FROMDATE', 'yyyy-MM-dd')" src="../images/form/calendar.gif" align="absMiddle" border="0" width="26" height="26">
  189. 至 <input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_TODATE" readonly><img style="CURSOR: hand" onClick="SelectDate('<%=tableShortCode%>_<%=fieldCode%>_TODATE', 'yyyy-MM-dd')" src="../images/form/calendar.gif" align="absMiddle" border="0" width="26" height="26">
  190. </td>
  191. <td width="70%" align="left" id="POINT_DATE_TD" style="display:none">
  192. <select name="<%=tableShortCode%>_<%=fieldCode%>_SIGN">
  193. <option value="=" selected>等于</option>
  194. <option value=">">大于</option>
  195. <option value="<">小于</option>
  196. <option value="<=">小于等于</option>
  197. <option value=">=">大于等于</option>
  198. </select>
  199. &nbsp;&nbsp;<input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_DATE" readonly><img style="CURSOR: hand" onClick="SelectDate('<%=tableShortCode%>_<%=fieldCode%>', 'yyyy-MM-dd')" src="../images/form/calendar.gif" align="absMiddle" border="0" width="26" height="26">
  200. </td>
  201.     <td width="70%" align="left" id="VAGUE_SEGMENT_YEAR_TD" style="display:none">
  202.     参照时间 
  203.       <input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_REFERENCE_SEGMENT_YEAR" readonly><img style="CURSOR: hand" onClick="SelectDate('<%=tableShortCode%>_<%=fieldCode%>_REFERENCE_SEGMENT_YEAR', 'yyyy')" src="../images/form/calendar.gif" align="absMiddle" border="0" width="26" height="26">
  204. 从 <input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_FROMYEAR">
  205. 至 <input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_TOYEAR">(周岁或年)
  206. </td>
  207. <td width="70%" align="left" id="VAGUE_POINT_YEAR_TD" style="display:none">
  208.     参照时间 
  209.       <input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_REFERENCE_POINT_YEAR" readonly><img style="CURSOR: hand" onClick="SelectDate('<%=tableShortCode%>_<%=fieldCode%>_REFERENCE_POINT_YEAR', 'yyyy')" src="../images/form/calendar.gif" align="absMiddle" border="0" width="26" height="26">
  210. <select name="<%=tableShortCode%>_<%=fieldCode%>_VAGUE_SIGN">
  211. <option value="=" selected>等于</option>
  212. <option value=">">大于</option>
  213. <option value="<">小于</option>
  214. <option value="<=">小于等于</option>
  215. <option value=">=">大于等于</option>
  216. </select>
  217. &nbsp;&nbsp;<input size="10" name="<%=tableShortCode%>_<%=fieldCode%>_YEAR">
  218. </td>
  219.    </tr>
  220.  </table>
  221. </td>
  222.           </tr>   
  223. <%    
  224.    }
  225.        }
  226.    j++;
  227. }   
  228. %>
  229.         </tbody>
  230.       </table>
  231.       </td>
  232.     </tr>  
  233.     <tr>
  234.       <td align="center"><input value="保存查询条件字段" type="submit">
  235. <input type="hidden" name="conditionFieldCodeStr" value="<%=conditionFieldCodeStr%>"> 
  236. <input type="hidden" name="id" value="<%=queryId%>"> 
  237. <input type="hidden" name="tableFullCodeStr" value="<%=tableFullCodeStr%>">
  238. &nbsp;&nbsp;    </td>
  239.     </tr>
  240.   </table>
  241. </form>
  242. </body>
  243. </html>