affairAudit.jsp
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:14k
源码类别:
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" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
- <%@ page import="java.text.SimpleDateFormat"%>
- <%@ page import="java.util.Date"%>
- <link href="<%=request.getContextPath()%>/Css_file/oa.css" rel="stylesheet" type="text/css" />
- <script src="<%=request.getContextPath()%>/Js_file/date.js"></script>
- <c:set var="step" value="${requestScope.affair.sprestep}"></c:set>
- <body <c:if test="${step+1!=requestScope.affair.tstep}">onload="init();"</c:if>>
- <html:form action="/affairReq" method="post" styleId="form1" enctype="multipart/form-data">
- <table width="100%" border="1" cellspacing="0" class="myTable">
- <tr>
- <td colspan="4" align="center" class="tableHead"><strong>事务发起信息</strong></td>
- </tr>
- <tr>
- <td align="right" width="15%">事务等级</td>
- <td colspan="3"><input name="text" type="text" style="width: 100%" disabled="disabled" value="<c:if test="${requestScope.req.rgrade==0}">一般</c:if><c:if test="${requestScope.req.rgrade==1}">重要</c:if><c:if test="${requestScope.req.rgrade==2}">紧急</c:if>"/>
- </td>
- </tr>
- <tr>
- <td align="right">事务标题</td>
- <td colspan="3"><input name="text" type="text" style="width: 100%" maxlength="45" disabled="disabled" value="${requestScope.req.rtitle}"/></td>
- </tr>
- <tr>
- <td align="right">事务详情</td>
- <td colspan="3"><textarea name="text" cols="70" rows="3" disabled="disabled" value="">${requestScope.req.rdetail}</textarea></td>
- </tr>
- <tr>
- <td align="right">希望下一环节完成时间</td>
- <td colspan="3"><input type="text" name="text" style="width: 100%" disabled="disabled" value="${requestScope.req.rnexttime}"/></td>
- </tr>
- <tr>
- <td align="right">事务发起人</td>
- <td colspan="3">
- <input type="text" name="text" style="width: 100%" disabled="disabled" value="${requestScope.req.utruename}"/>
- </td>
- </tr>
- <tr>
- <td align="right">事务备注</td>
- <td colspan="3"><textarea name="text" cols="70" rows="3" disabled="disabled" value="">${requestScope.req.rmemo}</textarea></td>
- </tr>
- <logic:iterate id="alist" name="audit" scope="request">
- <tr class="tableHead">
- <td colspan="4" align="center" >
- <strong>事务第${alist.scurrentid}个环节处理信息</strong>
- </td>
- </tr>
- <tr>
- <td align="right" width="15%">负责人</td>
- <td colspan="3"><input name="text" type="text" style="width: 100%" disabled="disabled" value="${alist.utruename}"/>
- </td>
- </tr>
- <tr>
- <td align="right">处理时间</td>
- <td colspan="3"><input name="text" type="text" style="width: 100%" maxlength="45" disabled="disabled" value="${alist.scurrenttime}"/></td>
- </tr>
- <tr>
- <td align="right">希望下一环节完成时间</td>
- <td colspan="3"><input type="text" name="text" style="width: 100%" disabled="disabled" value="${alist.snexttime}"/></td>
- </tr>
- <tr>
- <td align="right">附件</td>
- <td colspan="3">
- <logic:empty name="alist" property="sname">
- 该环节没有附件
- </logic:empty>
- <c:if test="${alist.sname==null}">
- 该环节没有附件
- </c:if>
- <c:if test="${alist.sname!=null}"><strong>【${alist.sname}】</strong>
- <a href="${pageContext.request.contextPath}/Jsp_file/affair/down.jsp?filename=${alist.sname}">点击下载</a>
- </c:if>
- </td>
- </tr>
- </logic:iterate>
- <tr>
- <td colspan="4" align="center" class="tableHead"><strong>事务第${step+1}个环节处理信息</strong></td>
- <>
- </tr>
- <tr>
- <td align="right">事务类型</td>
- <td>
- <input type="text" name="tname" style="width: 100%" disabled="disabled" value="${requestScope.affair.tname}"/>
- </td>
- <td align="right" >事务等级</td>
- <td ><select name="rgrade" disabled="disabled">
- <option value="0" <c:if test="${requestScope.affair.rgrade==0}">selected="selected"</c:if>>一般</option>
- <option value="1" <c:if test="${requestScope.affair.rgrade==1}">selected="selected"</c:if>>重要</option>
- <option value="2" <c:if test="${requestScope.affair.rgrade==2}">selected="selected"</c:if>>紧急</option>
- </select>
- </td>
- </tr>
- <tr>
- <td align="right">事务标题</td>
- <td colspan="3"><input name="rtitle" type="text" style="width: 100%" maxlength="45" value="${requestScope.affair.rtitle}" disabled="disabled" /></td>
- </tr>
- <tr>
- <td align="right">事务详情</td>
- <td colspan="3"><textarea name="rdetail" cols="70" rows="3" value="" disabled="disabled" >${requestScope.affair.rdetail}</textarea></td>
- </tr>
- <tr>
- <td align="right">希望总完成时间</td>
- <td <c:if test="${step+1==requestScope.affair.tstep}">colspan="3"</c:if>>
- <input style="width: 100%" type="text" name="rlasttime" disabled="disabled" value="${requestScope.affair.rlasttime}"/></td>
- <c:if test="${step+1!=requestScope.affair.tstep}">
- <td align="right" >希望下一环节完成时间 </td>
- <td><input type="text" style="width: 100%" name="snexttime" onclick="setday(this);" readonly="readonly"/></td>
- </c:if>
- </tr>
- <c:if test="${step+1!=requestScope.affair.tstep}">
- <tr>
- <td></td>
- <td colspan="3" align="left"><input type="checkbox" name="rolename" onclick="init();" />
- 通过选择角色确定下一负责人</td>
- </tr>
- <tr>
- <td align="right">下一环节处理者角色</td>
- <td><select name="roleid" disabled="disabled" onchange="javascript:getUser(this.value);">
- <option value="">请选择</option>
- </select><span id="rolemsg"></span>
- </td>
- <td align="right">下一环节处理者</td>
- <td><select name="userid">
- <option value="">请选择</option>
- </select>
- </td>
- </tr>
- </c:if>
- <tr>
- <td align="right">审核说明</td>
- <td colspan="3"><textarea name="memo" cols="70" rows="4"></textarea></td>
- </tr>
- <tr>
- <td align="right">附件</td>
- <td colspan="3"><html:file style="width: 72%" property="file" ></html:file></td>
- </tr>
- <tr class="tableHead" align="center">
- <td height="30" colspan="4">
- <input type="hidden" name="stepid" value="${step+1}"/>
- <input type="hidden" name="sid" value="${requestScope.affair.sid}"/>
- <input type="hidden" name="tno" value="${requestScope.affair.tno}"/>
- <input type="hidden" name="rqid" value="${requestScope.affair.rqid}"/>
- <input type="hidden" name="task" value="doaudit">
- <input type="hidden" name="currentstep" value="${step+1}">
- <c:if test="${step+1!=requestScope.affair.tstep}">
- <input type="hidden" name="type" value="noEnd">
- <input type="submit" name="Submit" value="审核通过" style="WIDTH:70px;" onclick="return checks();"/>
- <input type="button" name="back" value="审核不通过返回上一节" style="WIDTH:170px;" onclick="return nopass('back');"/>
- </c:if>
- <c:if test="${step+1==requestScope.affair.tstep}">
- <input type="hidden" name="type" value="End">
- <input type="submit" name="pass" value="审核通过并完结该事务" style="WIDTH:170px;" onclick="return checks();"/>
- <input type="button" name="nopasss" value="审核不通过并完结该事务" style="WIDTH:170px;" onclick="return nopass('nopass');"/>
- </c:if>
- <input type="button" name="canel" value="取消" onclick="window.history.back();"/></td>
- </tr>
- </table>
- <a href="<%=request.getContextPath()%>/login.do?method=main"><strong><< 返回首页 <strong></a>
- </html:form>
- </body>
- <script language="javascript">
- var xmlhttp_request;
- var onecount=0;//定义一个变量,用于记录数组中的长度。
- var subcat = new Array();//定义一个二维数组,用于存放用户的ID,名称和对应角色的ID。
- 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 init(){
- initrequest();
- var rtid = document.getElementById("tno").value;
- if (rtid != ""){
- if (document.getElementById("rolename").checked){
- var url = "${pageContext.request.contextPath}/affairReq.do?task=getProcessers&rtid="
- +rtid+"&type=role&step=0&sessionid="+Math.random();
- }else{
- var url = "${pageContext.request.contextPath}/affairReq.do?task=getProcessers&rtid="
- +rtid+"&type=user&step=0&sessionid="+Math.random();
- }
- xmlhttp_request.open("get",url,true);
- xmlhttp_request.onreadystatechange=getMsg;
- xmlhttp_request.send();
- }else{
- var userids = document.getElementById("userid");
- var roleids = document.getElementById("roleid");
- var rolenames = document.getElementById("rolename");
- userids.disabled="disabled";
- userids.innerHTML ="";
- roleids.disabled="disabled";
- roleids.innerHTML ="";
- rolenames.checked=false;
- rolenames.disabled=true;
- }
- }
- function getUser(roleidstr){
- document.getElementById("userid").length = 0;
- for (var i=0;i<onecount;i++)
- {
- if (subcat[i][1] == roleidstr)
- {
- document.getElementById("userid").options[document.getElementById("userid").length] = new Option(subcat[i][0], subcat[i][2]);
- }
- }
- }
- function getMsg(){
- if (xmlhttp_request.readyState == 4){
- if (xmlhttp_request.status == 200){
- var xmlText = xmlhttp_request.responseXML;
- var userids = document.getElementById("userid");
- var roleids = document.getElementById("roleid");
- var rolenames = document.getElementById("rolename");
- if(!rolenames.checked){
- userids.disabled=false;
- rolenames.disabled=false;
- roleids.disabled=true;
- if (document.getElementById("tno").value!=""){
- userids.length = 0;
- var users = xmlText.getElementsByTagName("userid");
- for(var i = 0; i < users.length ;i++){
- var id = users[i].getAttribute("id");
- var name = users[i].text;
- userids.options[i] = new Option(name,id);
- }
- roleids.length = 0 ;
- }else{
- userids.innerHTML ="";
- }
- }else {
- roleids.disabled=false;
- roleids.length = 0;
- userids.length = 0;
- var roles = xmlText.getElementsByTagName("roleid");
- var users = xmlText.getElementsByTagName("userid");
- for(var j= 0 ;j < roles.length; j++){
- var id = roles[j].getAttribute("id");
- var name =roles[j].getAttribute("rolename");
- roleids.options[j] = new Option(name,id);
- var userid = roles[j].getElementsByTagName("userid")
- for (var k=0;k<userid.length;k++){
- if(userid[k].getAttribute("id") != ""){
- subcat[onecount] = new Array(userid[k].getAttribute("username"),id,userid[k].getAttribute("id"));
- onecount = onecount + 1;
- }
- }
- }
- if(roles.length>0){
- getUser(roles[0].getAttribute("id"));
- var test = document.getElementById("rolemsg").innerHTML="";
- }else{
- var test = document.getElementById("rolemsg").innerHTML="<a style='color: red'>没有相应的角色</a>";
- }
- }
- }else if (xmlhttp_request.status == 404){
- alert('地址没有找到');
- }else if (xmlhttp_request.status == 500){
- alert('服务端出现错误');
- }
- }
- }
- function checks(){
- if (isEmpty(document.form1.rgrade.value)){
- alert("请选择事务等级");
- document.form1.rgrade.focus();
- return false;
- }
- if (isEmpty(document.form1.rtitle.value)){
- alert("请填写事务标题");
- document.form1.rtitle.focus();
- return false;
- }
- if (isEmpty(document.form1.rdetail.value)){
- alert("请填写事务详情");
- document.form1.rdetail.focus();
- return false;
- }
- <c:if test="${step+1!=requestScope.affair.tstep}">
- if (isEmpty(document.form1.snexttime.value)){
- alert("请填写下一环节希望完成时间");
- document.form1.snexttime.focus();
- return false;
- }
- <%
- SimpleDateFormat simple=new SimpleDateFormat("yyyy-MM-dd");
- String datetime=simple.format(new Date());
- %>
- if (document.form1.snexttime.value <"<%=datetime%>"){
- alert("希望下一环节完成时间不能小于当天时间!");
- document.form1.snexttime.focus();
- return false;
- }
- if (document.form1.userid.value == ""){
- alert("请选择下一环节处理者");
- document.form1.userid.focus();
- return false;
- }
- </c:if>
- return true;
- }
- function nopass(str){
- document.form1.task.value = "doaudit2";
- if (str =="back"){
- document.form1.type.value = "back";
- document.form1.submit();
- }else if (str =="nopass"){
- if (checks()){
- document.form1.type.value = "nopass";
- document.form1.submit();
- }
- }
- }
- //去左右空格;
- function trim(s){
- return rtrim(ltrim(s));
- }
- //去左空格;
- function ltrim(s){
- return s.replace( /^s*/, "");
- }
- //去右空格;
- function rtrim(s){
- return s.replace( /s*$/, "");
- }
- //验证信息;
- //空字符值;
- function isEmpty(s){
- s = trim(s);
- return s.length == 0;
- }
- </script>