<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>

<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.organize.SzDepart" %>
<%@ page import="net.sz600.organize.SzDepartInfo" %>
<%@ include file="/sessionInfo.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 sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
%>
<%
    String sOPERATOR = request.getParameter("OPERATOR");
    String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));
    //读取数据
    SzDepartInfo departInfo = null;
    SzDepart depart = new SzDepart();
    if (!sKEY.equals("0")) {
        departInfo = (SzDepartInfo)depart.getInfoByKey(Integer.parseInt(sKEY));
    } else {
        departInfo = new SzDepartInfo();
    }
    String BMBH = SzLevelNumber.getParentNumber(departInfo.getBMBH());
    
%>

<!-----上面的工具栏------>
<form name="formUpdate" method="post">
<%@ include file="/share/title.jsp" %>
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="OPERATOR" value="<%=sOPERATOR%>">
  <input type="hidden" name="KEY" value="<%=sKEY%>">
  <input type="hidden" name="BMID" value="<%=departInfo.getBMID()%>">
  <input type="hidden" name="BMBH" value="<%=departInfo.getBMBH()%>">
  <input type="hidden" name="BMBZ" value="0" >  
<table width="100%">
  <tr>
    <td>
      <input type="button" name="btnSave" class="btnClass" value="保存" OnClick="javascript:FormSave(formUpdate, 'control.jsp');">
      <input type="button" name="btnBack" class="btnClass" value="返回" OnClick="javascript:FormSubmit(formHidden, 'index.jsp');">
    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="600" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td width="30%" align="right">部门名称</td>
    <td><input type="text" name="BMMC" value="<%=departInfo.getBMMC()%>">
        <font color="red">*</font>
    </td>
  </tr>  
  <tr>
    <td width="30%" align="right">上级部门</td>
    <td>
      <%=SzPageHelp.numberSelectTree("SZXT_BM","BMID","BMMC","BMBH", "BMGSID=" + szCOMPANY_SESSION, "BMBH_SJ", BMBH, "txtClass1")%>    
    </td>
  </tr>
  <tr>
    <td width="30%" align="right">部门负责人职务</td>
    <td>
      <%=SzPageHelp.idSelectTree3("SZXT_ZW","ZWID","ZWMC","ZWDJ", "ZWGSID=" + szCOMPANY_SESSION, "BMFZRY", departInfo.getBMFZRY(), "txtClass1")%>    
    </td>
  </tr>  
  <tr>
    <td width="30%" align="right" valign="top">部门职能</td>
    <td><textarea name="BMZN" class="areaClass2"><%=departInfo.getBMZN()%></textarea></td>
  </tr>
</table>
</form>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
</form>
<script language="javascript">
  //第一个表示对象，form，第二个表示字符串
  function FormSubmit(oFormName, vUrl) {
    oFormName.action = vUrl;
    oFormName.submit();
  }
</script>
<script language="javascript">
  function FormSave(formName, url) {
    //检查是否可以保存
    if (formName.BMMC.value == "") {
      formName.BMMC.focus();
      alert("部门名称不能为空");
      return false;
    }
    //提交
    formName.action = url;
    formName.submit();
  }
</script>