editaffairtype.jsp
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:8k
源码类别:
Jsp/Servlet
开发平台:
Java
- <%@ page language="java" pageEncoding="GBK"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
- <link href="<%=request.getContextPath()%>/Css_file/oa.css" rel="stylesheet" type="text/css" />
- <body onload="init();">
- <html:form action="/affairType" styleId="form1">
- <table width="100%" class="myTable">
- <tr class="tableHead">
- <td colspan="4" align="center" >修改事务定制</td>
- </tr>
- <tr>
- <td width="77" align="center" >事务名称</td>
- <td colspan=2>
- <html:text style='width:100%' maxlength="15" property="tname" onblur="checktname();"/>
- </td>
- <td width="97"><span id="msg" align="center" ></span></td>
- </tr>
- <tr>
- <td width="77" align="center" >权限角色</td>
- <td colspan=2>
- <input type="hidden" name="transroleid0" value="${transrole.roleid}"/>
- <textarea name="transrole0" rows="2" style="width:100%" readonly="readonly">${transrole.rolename}</textarea>
- </td>
- <td width="97" align="center"><a href="javascript:select('transrole',0);"><strong>修改权限角色<strong></a></td>
- </tr>
- <tbody id="ttb">
- </tbody>
- <tr class="tableHead">
- <td colspan="4" align="center">
- <input type="hidden" value="" name="tstep">
- <INPUT type="hidden" value="editedtype" name="task">
- <input type="hidden" value="${rtid}" name="rtid">
- <input type="hidden" value="edit" name="type">
- <input type="submit" name="Submit" value="提交" onclick="return check();"/>
- <INPUT type="button" onclick="return searchclear();" value="重置"/>
- </td>
- </tr>
- </table>
- <a href="#" onclick="window.history.back();"><strong> 上一页<strong></a> |
- <a href="<%=request.getContextPath()%>/login.do?method=main"><strong> 返回首页<strong></a>
- </html:form>
- </body>
- <script language="javascript">
- var stepId =1;
- var flag = 2;
- var xmlhttp_request = false;
- function init(){
- <logic:iterate name="translist" scope="request" id="translist">
- addStep("${translist.userid}","${translist.username}","${translist.roleid}","${translist.rolename}");
- </logic:iterate>
- }
- function addStep(userid,username,roleid,rolename){
- var tr1 = document.createElement("tr");
- tr1.id = stepId;
- <!--添加标题-->
- var td1 = document.createElement("td");
- td1.setAttribute("align","center");
- var text1 = document.createTextNode("环节"+stepId);
- td1.appendChild(text1);
- var td2 = document.createElement("td");
- <!--列中的超链接及其链接内容-->
- var d1 = document.createElement("div");
- d1.style.background="#ccc";
- var a1 = document.createElement("a");
- a1.setAttribute("href","javascript:select('user',"+(stepId-1)+");");
- var a1text = document.createTextNode("选择权限用户");
- var s1 = document.createElement("strong");
- s1.appendChild(a1text);
- a1.appendChild(s1);
- d1.appendChild(a1);
- td2.appendChild(d1);
- var div1 = document.createElement("div");
- td2.setAttribute("align","center");
- div1.innerHTML = "<input type='hidden' name='userid"+(stepId-1)+"' value='"+userid+"'>"
- +"<textarea name='user"+(stepId-1)+"' rows='3' style='width:100%' readonly='readonly'>"+username+"</textarea>";
- td2.appendChild(div1);
- var td3 = document.createElement("td");
- <!--列中的超链接及其链接内容-->
- var d2 = document.createElement("div");
- d2.style.background="#ccc";
- var a2 = document.createElement("a");
- a2.setAttribute("href","javascript:select('role',"+(stepId-1)+");");
- var a2text = document.createTextNode("选择权限角色");
- var s2 = document.createElement("strong");
- s2.appendChild(a2text);
- a2.appendChild(s2);
- d2.appendChild(a2);
- td3.appendChild(d2);
- var div2 = document.createElement("div");
- td3.setAttribute("align","center");
- div2.innerHTML = "<input type='hidden' name='roleid"+(stepId-1)+"' value='"+roleid+"'>"
- +"<textarea name='role"+(stepId-1)+"' rows='3' style='width:100%' readonly='readonly'>"+rolename+"</textarea>";
- td3.appendChild(div2);
- if(stepId==1){
- <!-- 添加增加环节超链接 -->
- var td4 = document.createElement("td");
- td4.setAttribute("align","center");
- var a3 = document.createElement("a");
- a3.setAttribute("href","javascript:addStep();");
- var text2 = document.createTextNode("增加环节");
- var s3 = document.createElement("strong");
- }else{
- <!-- 添加删除环节超链接 -->
- var td4 = document.createElement("td");
- td4.setAttribute("align","center");
- var a3 = document.createElement("a");
- a3.setAttribute("href","javascript:del("+tr1.id+");");
- var text2 = document.createTextNode("删除环节");
- var s3 = document.createElement("strong");
- }
- s3.appendChild(text2);
- a3.appendChild(s3);
- td4.appendChild(a3);
- <!-- 将环节添加到TR和TBODY中 -->
- tr1.appendChild(td1);
- tr1.appendChild(td2);
- tr1.appendChild(td3);
- tr1.appendChild(td4);
- document.getElementById("ttb").appendChild(tr1);
- stepId++;
- }
- function del(trid){
- if (confirm("确认要删除该环节吗?")){
- var tList = document.getElementById("ttb");
- var len = tList.rows.length;
- var i=0
- for(i=0; i<len; i++)
- {
- if(tList.rows[i].id == trid)
- {
- tList.deleteRow(i);
- break;
- }
- }
- var tList2 = document.getElementById("ttb");
- var len2 = tList2.rows.length;
- for(var j=i; j<len2; j++)
- {
- document.getElementById(tList.rows[j].id).cells(0).innerText = "环节"+(--tList.rows[j].id);
- document.getElementById(tList.rows[j].id).cells(3).innerHTML ="<a href='javascript:del("+tList.rows[j].id+")'><strong>删除环节</strong></a>"
- }
- stepId--;
- }
- }
- function select(type,name){
- var url = "${pageContext.request.contextPath}/affairType.do?task=getUserRole&name="+name+"&type="+type;
- var feather="width=350 height=200 status=0 location=no,directories=no,menubar=no,scrollbars=no resizable=no Menubar=no toolbar=no ";
- ok=window.open(url,"权限选择",feather);
- ok.moveTo(300,200);
- }
- function initrequest(){
- if(window.XMLHttpRequest){//这种就是Mozilla
- xmlhttp_request = new XMLHttpRequest();
- }else if(window.ActiveXObject){//这种浏览器是IE
- try{
- xmlhttp_request = new ActiveXObject("Msxml2.XMLHttp");
- }catch(e){
- try{
- xmlhttp_request = new ActiceXObject("Microsoft.XMLHttp");
- }catch(e){
- }
- }
- }
- if(!xmlhttp_request){
- alert("您的浏览器不支持Ajax");
- return false;
- }
- }
- function getMsg(){
- if (xmlhttp_request.readyState == 4){
- if (xmlhttp_request.status == 200){
- var text = xmlhttp_request.responseText;
- document.getElementById("msg").innerHTML = text;
- if ((text == "<a style='color: #00cc00' >名称可以使用</a>")||(text =="<a style='color: #00cc00' >名称可以修改</a>")){
- flag = 2;
- }else {
- flag = 1;
- }
- }else if (xmlhttp_request.status == 404){
- alert('地址没有找到');
- }else if (xmlhttp_request.status == 500){
- alert('服务端出现错误');
- }
- }
- }
- function check(){
- if (flag == 0){
- alert("事务名称不能为空,请输入");
- document.form1.tname.focus();
- return false;
- }
- else if (flag == 1){
- alert("事务名称已经存在,请重新输入");
- document.form1.tname.value = "";
- document.form1.tname.focus();
- return false;
- }
- else if (document.all("transrole0").value==""){
- alert("请填写事务的使用权限");
- return false;
- }
- for (var i=0;i<stepId-1;i++){
- var vrole = document.all("role"+i);
- var vuser = document.all("user"+i);
- if ( vrole.value=="" && vuser.value=="" ){
- alert("请选择环节"+(i+1)+"的事务审核权限");
- return false;
- }
- }
- document.form1.tstep.value =(stepId-1);
- return true;
- }
- function checktname(){
- initrequest();
- var name = document.getElementById("tname").value;
- if (name != ""){
- var url = "${pageContext.request.contextPath}/affairType.do?task=checkname&tname="+name+"&sessionid="+Math.random()+"&type=edit"+"&rtid="+${rtid};
- xmlhttp_request.open("post",url,true);
- xmlhttp_request.onreadystatechange=getMsg;
- xmlhttp_request.send(null);
- }else {
- flag = 0;
- document.getElementById("msg").innerHTML = "<a style='color: red'>名称不能为空</a>";
- }
- }
- </script>