<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.formEngine.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.formCreate.*" %>
<%@ include file="/xml/formEngine2/sessionInfo2.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
    //获取提交的参数
    String name = SzConvert.toSpaceStr(request.getParameter("name"));
    String readonly = "";
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
	  String moduleName = SzConvert.toSpaceStr(request.getParameter("moduleName"));
	  String formName = SzConvert.toSpaceStr(request.getParameter("formName"));
	  BdUserSelect bdUserSelect = new BdUserSelect();
    String str[] = bdUserSelect.getInfo(name);
    
		if (sOPERATOR.equals("add")) {
			str[1] = moduleName;
			str[2] = formName;
			str[10] = "0";
		} else if (sOPERATOR.equals("update")) {
			moduleName = str[1];
			formName = str[2];
		}
   	
    BdFormControl bdFormControl = new BdFormControl();    
    Map fieldMap = bdFormControl.getFieldMap();
    BdFormFieldInfo bdFormFieldInfo = null;
    Collection collFormField = null;
    collFormField = (Collection)fieldMap.get(new String(moduleName + "-" + formName));
    Iterator iterFormField = null;  		
   	String temp = "";
   	int i =0;
%>
<body>

<!-----上面的工具栏------>
<form name="formUpdate" method="post">
  <input type="hidden" name="OPERATOR" value="<%=sOPERATOR%>">
<%@ include file="/xml/formEngine2/title.jsp"%>
<table width="100%">
  <tr>
    <td>
      <%=SzPageHelp.saveButton()%>
      <%=SzPageHelp.backButton()%>
    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="750" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td class="tdClassTitle">名称</td>
    <td colspan="3"><input type="text" name="name" value="<%=str[0]%>" size="10" <%if (sOPERATOR.equals("update")){%> readonly class="txtClass1R"<%}else {%>class="txtClass1"<%} %>> (可用字母、数字、下划线的组合，10个字以内) <font color="red">*</font></td>
  </tr>
  <tr>
    <td class="tdClassTitle">模块名称</td>
    <td><input type="text" name="moduleName" class="txtClass1R" value="<%=str[1]%>"  readonly></td>
    <td class="tdClassTitle">表单名称</td>
    <td><input type="text" name="formName" class="txtClass1R" value="<%=str[2]%>" readonly></td>
  </tr> 
  <tr>
    <td class="tdClassTitle">说明</td>
    <td colspan="3"><input type="text" name="desc" class="txtClass2" value="<%=str[3]%>"></td>
  </tr>
  <tr>
    <td class="tdClassTitle">人员姓名字段</td>
    <td colspan="3">
    <%
    if (collFormField != null) {
    	iterFormField = collFormField.iterator();
    }    
		temp = str[4];
		i = 0;
		out.println("<span style='width:230px;'><input type='radio' name='userName' value='' checked>");
		out.println("不选");
		i ++;
		out.println("</span>");		
		while (iterFormField != null && iterFormField.hasNext()) {
			bdFormFieldInfo = (BdFormFieldInfo) iterFormField.next();	
			if (bdFormFieldInfo.getZDZT() == 2 ) {								 	
					continue;
			}
			if (   	
					bdFormFieldInfo.getZDBJ() == 31
					|| bdFormFieldInfo.getZDBJ() == 32
					|| bdFormFieldInfo.getZDBJ() == 133
					|| bdFormFieldInfo.getZDBJ() == 4
					|| bdFormFieldInfo.getZDBJ() == 42
					|| bdFormFieldInfo.getZDBJ() == 43
					|| bdFormFieldInfo.getZDBJ() == 44) {				 	
					continue;
			}		
			
			out.println("<span style='width:230px;'><input type='radio' name='userName' value='" + bdFormFieldInfo.getZDID() + "'");
			if (temp.equals(bdFormFieldInfo.getZDID())) {
				out.println(" checked ");
			}
			out.println(">");
			out.println(bdFormFieldInfo.getZDID() + " " + bdFormFieldInfo.getZDMC() + " " + bdFormFieldInfo.getZDSM());
			i ++;
			out.println("</span>");
			if (i % 2 == 0) {
				out.println("<br>");
			}
		}
		%>    
    </td>
  </tr>   
  
  <tr>
    <td class="tdClassTitle">人员ID字段</td>
    <td colspan="3">
    <%
    if (collFormField != null) {
    	iterFormField = collFormField.iterator();
    }    
		temp = str[5];
		i = 0;
		out.println("<span style='width:230px;'><input type='radio' name='userId' value='' checked>");
		out.println("不选");
		i ++;
		out.println("</span>");			
		while (iterFormField != null && iterFormField.hasNext()) {
			bdFormFieldInfo = (BdFormFieldInfo) iterFormField.next();			
			if (bdFormFieldInfo.getZDZT() == 2 ) {								 	
				continue;
			}
			if (   	
				bdFormFieldInfo.getZDBJ() == 31
				|| bdFormFieldInfo.getZDBJ() == 32
				|| bdFormFieldInfo.getZDBJ() == 133
				|| bdFormFieldInfo.getZDBJ() == 4
				|| bdFormFieldInfo.getZDBJ() == 42
				|| bdFormFieldInfo.getZDBJ() == 43
				|| bdFormFieldInfo.getZDBJ() == 44) {				 	
				continue;
			}				
			out.println("<span style='width:230px;'><input type='radio' name='userId' value='" + bdFormFieldInfo.getZDID() + "'");
			if (temp.equals(bdFormFieldInfo.getZDID())) {
				out.println(" checked ");
			}
			out.println(">");
			out.println(bdFormFieldInfo.getZDID() + " " + bdFormFieldInfo.getZDMC() + " " + bdFormFieldInfo.getZDSM());
			i ++;
			out.println("</span>");
			if (i % 2 == 0) {
				out.println("<br>");
			}
		}
		%>    
    </td>
  </tr> 

  <tr>
    <td class="tdClassTitle">部门名称字段</td>
    <td colspan="3">
    <%
    if (collFormField != null) {
    	iterFormField = collFormField.iterator();
    }    
		temp = str[6];
		i = 0;
		out.println("<span style='width:230px;'><input type='radio' name='departName' value='' checked>");
		out.println("不选");
		i ++;
		out.println("</span>");			
		while (iterFormField != null && iterFormField.hasNext()) {
			bdFormFieldInfo = (BdFormFieldInfo) iterFormField.next();			
			if (bdFormFieldInfo.getZDZT() == 2 ) {								 	
				continue;
			}
			if (   	
				bdFormFieldInfo.getZDBJ() == 31
				|| bdFormFieldInfo.getZDBJ() == 32
				|| bdFormFieldInfo.getZDBJ() == 133
				|| bdFormFieldInfo.getZDBJ() == 4
				|| bdFormFieldInfo.getZDBJ() == 42
				|| bdFormFieldInfo.getZDBJ() == 43
				|| bdFormFieldInfo.getZDBJ() == 44) {				 	
				continue;
			}				
			out.println("<span style='width:230px;'><input type='radio' name='departName' value='" + bdFormFieldInfo.getZDID() + "'");
			if (temp.equals(bdFormFieldInfo.getZDID())) {
				out.println(" checked ");
			}
			out.println(">");
			out.println(bdFormFieldInfo.getZDID() + " " + bdFormFieldInfo.getZDMC() + " " + bdFormFieldInfo.getZDSM());
			i ++;
			out.println("</span>");
			if (i % 2 == 0) {
				out.println("<br>");
			}
		}
		%>    
    </td>
  </tr> 
  
  <tr>
    <td class="tdClassTitle">部门ID字段</td>
    <td colspan="3">
    <%
    if (collFormField != null) {
    	iterFormField = collFormField.iterator();
    }    
		temp = str[7];
		i = 0;
		out.println("<span style='width:230px;'><input type='radio' name='departId' value='' checked>");
		out.println("不选");
		i ++;
		out.println("</span>");			
		while (iterFormField != null && iterFormField.hasNext()) {
			bdFormFieldInfo = (BdFormFieldInfo) iterFormField.next();							
			if (bdFormFieldInfo.getZDZT() == 2 ) {								 	
				continue;
			}
			if (   	
				bdFormFieldInfo.getZDBJ() == 31
				|| bdFormFieldInfo.getZDBJ() == 32
				|| bdFormFieldInfo.getZDBJ() == 133
				|| bdFormFieldInfo.getZDBJ() == 4
				|| bdFormFieldInfo.getZDBJ() == 42
				|| bdFormFieldInfo.getZDBJ() == 43
				|| bdFormFieldInfo.getZDBJ() == 44) {				 	
				continue;
			}
			out.println("<span style='width:230px;'><input type='radio' name='departId' value='" + bdFormFieldInfo.getZDID() + "'");
			if (temp.equals(bdFormFieldInfo.getZDID())) {
				out.println(" checked ");
			}
			
			out.println(">");
			out.println(bdFormFieldInfo.getZDID() + " " + bdFormFieldInfo.getZDMC() + " " + bdFormFieldInfo.getZDSM());
			i ++;
			out.println("</span>");
			if (i % 2 == 0) {
				out.println("<br>");
			}
		}
		%>    
    </td>
  </tr> 
  
    <tr>
    <td class="tdClassTitle">职务名称字段</td>
    <td  colspan="3">
    <%
    if (collFormField != null) {
    	iterFormField = collFormField.iterator();
    }    
		temp = str[8];
		i = 0;
		out.println("<span style='width:230px;'><input type='radio' name='postName' value='' checked>");
		out.println("不选");
		i ++;
		out.println("</span>");			
		while (iterFormField != null && iterFormField.hasNext()) {
			bdFormFieldInfo = (BdFormFieldInfo) iterFormField.next();			
			if (bdFormFieldInfo.getZDZT() == 2 ) {								 	
				continue;
			}
			if (   	
				bdFormFieldInfo.getZDBJ() == 31
				|| bdFormFieldInfo.getZDBJ() == 32
				|| bdFormFieldInfo.getZDBJ() == 133
				|| bdFormFieldInfo.getZDBJ() == 4
				|| bdFormFieldInfo.getZDBJ() == 42
				|| bdFormFieldInfo.getZDBJ() == 43
				|| bdFormFieldInfo.getZDBJ() == 44) {				 	
				continue;
			}			
			out.println("<span style='width:230px;'><input type='radio' name='postName' value='" + bdFormFieldInfo.getZDID() + "'");
			if (temp.equals(bdFormFieldInfo.getZDID())) {
				out.println(" checked ");
			}
			out.println(">");
			out.println(bdFormFieldInfo.getZDID() + " " + bdFormFieldInfo.getZDMC() + " " + bdFormFieldInfo.getZDSM());
			i ++;
			out.println("</span>");
			if (i % 2 == 0) {
				out.println("<br>");
			}
		}
		%>    
    </td>
  </tr> 
  
  <tr>
    <td class="tdClassTitle">职务ID字段</td>
    <td colspan="3">
    <%
    if (collFormField != null) {
    	iterFormField = collFormField.iterator();
    }    
		temp = str[9];
		i = 0;
		out.println("<span style='width:230px;'><input type='radio' name='postId' value='' checked>");
		out.println("不选");
		i ++;
		out.println("</span>");			
		while (iterFormField != null && iterFormField.hasNext()) {
			bdFormFieldInfo = (BdFormFieldInfo) iterFormField.next();			
			if (bdFormFieldInfo.getZDZT() == 2 ) {								 	
				continue;
			}
			if (   	
				bdFormFieldInfo.getZDBJ() == 31
				|| bdFormFieldInfo.getZDBJ() == 32
				|| bdFormFieldInfo.getZDBJ() == 133
				|| bdFormFieldInfo.getZDBJ() == 4
				|| bdFormFieldInfo.getZDBJ() == 42
				|| bdFormFieldInfo.getZDBJ() == 43
				|| bdFormFieldInfo.getZDBJ() == 44) {				 	
				continue;
			}		
			out.println("<span style='width:230px;'><input type='radio' name='postId' value='" + bdFormFieldInfo.getZDID() + "'");
			if (temp.equals(bdFormFieldInfo.getZDID())) {
				out.println(" checked ");
			}
			out.println(">");
			out.println(bdFormFieldInfo.getZDID() + " " + bdFormFieldInfo.getZDMC() + " " + bdFormFieldInfo.getZDSM());
			i ++;
			out.println("</span>");
			if (i % 2 == 0) {
				out.println("<br>");
			}
		}
		%>    
    </td>
  </tr>   
  <tr>
    <td class="tdClassTitle">选择类型</td>
    <td colspan="3">
      <%
      	String s_id2[] = {"0","1"};
        String s_name2[] = {"单选","多选"};
        out.println(SzPageHelp.radio("selectType", s_id2, s_name2, str[10]));
      %> 
    </td>
  </tr>   
</table>

</form>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
</form>
<script language="javascript" src="../../../share/js/commonTool.js"></script>
<script language="javascript">

  function FormSave(formName, url) {
    if (!notSpace(formName.name, "名称")) {
      return false;
    }  
    var userName = ValueOfCheck(formName.userName);
    var userId = ValueOfCheck(formName.userId);
    var departName = ValueOfCheck(formName.departName);
    var departId = ValueOfCheck(formName.departId);
    var postName = ValueOfCheck(formName.postName);
    var postId = ValueOfCheck(formName.postId);  
      
	if (userName == "" && userId == "" 
	&& departName == "" && departId == ""
	&& postName == "" && postId == ""
	) {
		alert("请至少选择一个人员、部门、职务字段");
		return false;
	} 


    formName.action = "control.jsp";
    formName.submit();
  }
  
 
</script>
</body>
