⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deptadd.jsp

📁 这是一个法律事务所系统源码
💻 JSP
字号:
<%--
模块名称:行政管理
模块功能:部门增加
版    本:V1.0
著 作 人:蔡静
著作日期:2001-10-24
使用说明:
主要技术说明:
参考文献:法律事务设计书
修改历史:= = = = = = = = = = = = = = = = = = = = = = = = = =
	修改日期:
	修 改 人:
	修改理由:
	修改出处:
	= = = = = = = = = = = = = = = = = = = = = = = = = =

--%>
<%@ page contentType= "text/html; charset=gb2312" %>
<%@ page language="java" import="java.sql.*" %>
<%@ page import="system.*" %>
<jsp:useBean id="db" class="dbconnection.DbConnection" scope="page" />
<%
  Security auth = new Security();
  String employee_id = (String)session.getAttribute("employee_id");
  if(employee_id == null || employee_id.equals(""))
  {
    response.sendRedirect(response.encodeRedirectURL("../index.htm"));
  }
  String modelid = "Off021";
  int authflag = auth.popedom(employee_id, modelid);
  if(authflag == 0 || authflag == 2 || authflag == -1)
  {
%>
  <jsp:forward page="../inc/noauth.jsp" >
  </jsp:forward>
<%
  }
%>
<%
  GetID gid = new GetID();
  ExtendString es = new ExtendString();
  String did = "BM" + es.digitToString(gid.getIDNumber("dept_id")+1,2);
  String str = request.getParameter("save");
  if (str!=null) {
    String dept_id, dept_name, parent_dept;
    dept_id = request.getParameter("dept_id");
    dept_name = new String(request.getParameter("dept_name").getBytes("ISO8859_1"));   
    parent_dept = request.getParameter("parent_dept");  
    dept_name = dept_name.trim();                              
    ResultSet rs = db.executeQuery("select * from t_dept where dept_name='" + dept_name + "'");
    if(rs.next())
    {   %>
     	<script language="javascript">
 	      alert("部门名称已经存在!");	
     	</script>
     <% 
    }else{	//1
    String sql = "insert into t_dept(dept_id, dept_name, parent_dept) values ('";
    sql = sql + dept_id + "','" + dept_name + "','" + parent_dept + "')";
    int num = db.executeUpdate(sql);
    if (num <= 0) {%>  
		<script language="javascript">
  		alert("新增失败!");
		</script>
  	<%}
    else {
      gid.setIDNumber("dept_id", gid.getIDNumber("dept_id")+1);
      did = "BM" + es.digitToString(gid.getIDNumber("dept_id")+1,2);
    }
    }		//1
  }
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>部门增加</title>
<%@ include file="../inc/config.jsp" %>
</head>

<body class=page onLoad="setFocus();">
<script language="javascript">
  function checkForm() {    
    if (document.form1.dept_id.value=="") {
      alert("请输入部门编号!");
      document.form1.dept_id.focus();
      return false;
    }
    if (document.form1.dept_name.value=="") {
      alert("请输入部门名称!");
      document.form1.dept_name.focus();
      return false;
    }   
    return true;
  }                          
  
  function setFocus()
  {
   	document.form1.dept_name.focus();
  }
</script>
<!--显示工具条-->
<table width="98%" align="center" cellspacing="0" cellpadding="0" border="0">
  <tr>
    <td><a href="Dept.jsp"><img src="../images/all.gif" height="22" border="0" alt="显示所有内容"></a>
    <a href="DeptAdd.jsp"><img src="../images/add.gif" alt="增加内容" width="79" height="22" border="0" style="cursor:hand" ></a>
    <img src="../images/delete.gif" alt="删除选中的内容" onClick="return selectID();" style="cursor:hand" width="79" height="22"></td>
    <td width="108" height="30" align="center"> <img src="../images/back.gif" width="50" height="22" onClick="window.history.back()" style="cursor:hand" alt="返回"></td>
  </tr>
</table>
<table width="98%" background="../images/line.gif" border="0" cellspacing="0" cellpadding="0" height="12" align="center">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<!--显示工具条结束-->
<form name="form1" method="post" action="DeptAdd.jsp">
<table border="0" width="98%" cellspacing="1" cellpadding="5" class="table_bg" align="center">
  <tr align="center" >
    <td width="18%" class="title_bg">部门编号</td>
    <td width="27%" class="tr_bg1">
      <input type="text" name="dept_id" size="20" maxlength="20" class="input" value=<%=did%> readOnly>
      </td>
  </tr>
  <tr  align="center">
    <td width="18%" class="title_bg">部门名称</td>
    <td width="27%" class="tr_bg1">
      <input type="text" name="dept_name" size="18" maxlength="20" class="input">     
      <font color="#FF0000">*</font>
    </td>
  </tr>
  <tr align="center">
    <td width="18%" class="title_bg">上级部门</td>
    <td width="27%" class="tr_bg1">
      <select size="1" name="parent_dept">
      <%
      ResultSet rs = db.executeQuery("select dept_name from t_dept where dept_id='root'");
      String dept = "总单位";
      if(rs.next()) dept = rs.getString("dept_name");
      %>
        <option value="root" selected><%=dept%></option>     
        <option value=""> _______________ </option>
      </select>
    </td>
  </tr>
</table><br>

<div align="center">
  <input type="submit" value="保存新增" name="save" class="button" onclick="return checkForm();window.close()">
</div>
</form>
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -