Procházet zdrojové kódy

修改管理员账号可重复新增的问题

limeng před 8 měsíci
rodič
revize
aedb900880

+ 42 - 10
WebRoot/manage/manageAdmin/manageAdminAdd.jsp

@@ -2,6 +2,10 @@
 <%@page import="com.ccgj.database.beans.ZDXB"%>
 <%@page import="com.ccgj.platform.dictionary.ZDBAction"%>
 <%@page import="com.ccgj.database.interfaces.ZDXBIF"%>
+<%@ page import ="com.ccgj.database.factory.DatabaseFactory"%>
+<%@ page import="com.ccgj.database.beans.YHB" %>
+<%@ page import="com.ccgj.database.interfaces.YHBIF" %>
+<%@ page import="com.opensymphony.xwork2.ActionContext" %>
 <%@taglib uri="/struts-tags" prefix="s"%>
 <%
 String path = request.getContextPath();
@@ -30,6 +34,23 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
     <script src="../../ligerui/lib/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
     <script src="../../ligerui/lib/jquery-validation/messages_cn.js" type="text/javascript"></script>
     <script src="../../manage/beiqu/js/jquery.form.js" type="text/javascript"></script>
+	<script>
+		var arr=new Array();
+		<%
+			YHB yhbBeans = (YHB)ActionContext.getContext().getSession().get("zfmb_user");
+            YHBIF yhbIF = DatabaseFactory.getYHBIF();
+			YHB yhbBean = yhbIF.createYHB();
+			yhbBean.setYhsx(3);
+      		yhbBean.setZdbsid(yhbBeans.getZdbsid());
+			List<YHB> listData = yhbIF.getYHBService().getYhbManager().searchListYhbByBean(yhbBean);
+            for(YHB u:listData){
+        %>
+				arr.push("<%=u.getYhzh() %>");
+		<%
+			}
+		%>
+
+	</script>
     <script type="text/javascript">
         var eee;
         $(function ()
@@ -69,15 +90,26 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
             });
 			//表单提交,会把所有有name属性的值提交到后台
 			$("#Button1").click(function () {
-				$("form .l-text,.l-textarea").ligerHideTip();
-				document.yhbManageForm.yhzt.value = $('input:radio:checked').val();
-				$("#yhbManageForm").ajaxSubmit(function (data) {
-					// 关闭弹出窗
-					parent.$.ligerDialog.close();
-					// 去除列表阴影
-					parent.$(".l-dialog,.l-window-mask").css("display","none");
-					parent.window.buttonClick();
-				});
+				alert(1);
+				var ff=true;
+				for(var i=0;i<arr.length;i++){
+					if(arr[i]==$("#yhzh").val()){
+						ff=false;
+					}
+				}
+				if(!ff){
+					$.ligerDialog.error('该账号已存在,请重新填写!');
+				}else{
+					$("form .l-text,.l-textarea").ligerHideTip();
+					document.yhbManageForm.yhzt.value = $('input:radio:checked').val();
+					$("#yhbManageForm").ajaxSubmit(function (data) {
+						// 关闭弹出窗
+						parent.$.ligerDialog.close();
+						// 去除列表阴影
+						parent.$(".l-dialog,.l-window-mask").css("display","none");
+						parent.window.buttonClick();
+					});
+				}
 			});
             $("form").ligerForm();
             $(".l-button-test").click(function ()
@@ -139,7 +171,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
 	  <tr>
 	    <td height="30" align="center" bgcolor="#f3f8f7">用户说明:</td>
 	    <td>
-	    	<textarea rows="15" class="l-textarea" name="yhsm" id="yhsm" style="width:400px" validate="{required:true}" ></textarea>
+	    	<textarea rows="15" class="l-textarea" name="yhsm" id="yhsm" style="width:400px"></textarea>
 	    </td>
 	  </tr>
 	  <tr>

+ 2 - 2
src/com/ccgj/database/manager/WZBManager.java

@@ -1152,8 +1152,8 @@ public class WZBManager
     Session session = getSession();
     try
     {
-      return
-              session.createQuery("select  new USER(id,  username,  userfullname,   userpwd,   px,  department ,  userpost)  from USER  order by px asc").list();
+      List<USER> userList = session.createQuery("select  new USER(id,  username,  userfullname,   userpwd,   px,  department ,  userpost)  from USER  order by px asc").list();
+      return userList;
     }
     catch (Exception e)
     {