affairreq.jsp
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:10k
源码类别:
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" %>
- <%@ 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>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html:html lang="true">
- <head>
- <html:base />
- <title>事务发起</title>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
- <meta http-equiv="description" content="This is my page">
- </head>
- <body>
- <html:form action="/affairReq" method="post" styleId="form1">
- <table width="100%" border=1 class="myTable">
- <tr class="tableHead" >
- <td colspan="4" align="center">事务发起</td>
- </tr>
- <tr>
- <td colspan="1" align="right">事务标题</td>
- <td colspan="3" >
- <html:text property="rtitle" maxlength="45" style="width: 100%" ></html:text>
- </td>
- </tr>
- <tr>
- <td style="width: 135" align="right">事务类型</td>
- <td>
- <html:select property="tno" onchange="init();">
- <html:option value="">请选择</html:option>
- <logic:iterate name="affair" id="affair" scope="request">
- <option value="${affair.rtid}">${affair.tname}</option>
- </logic:iterate>
- </html:select>
- </td>
- <td style="width: 95" align="right">事务等级</td>
- <td>
- <html:select property="rgrade" >
- <html:option value="">请选择</html:option>
- <html:option value="0">一般</html:option>
- <html:option value="1">重要</html:option>
- <html:option value="2">紧急</html:option>
- </html:select>
- </td>
- </tr>
- <tr>
- <td style="width: 135" align="right" >事务详情</td>
- <td colspan="3">
- <textarea name="rdetail" rows="3" style="width:100%"></textarea>
- </td>
- </tr>
- <tr>
- <td style="width: 135" align="right">事务开始时间</td>
- <td colspan="3">
- <html:text property="rstarttime" onclick="setday(this);" style="width: 100%" maxlength="45" readonly="true"></html:text>
- </td>
- </tr>
- <tr>
- <td style="width: 135" align="right">期望下一环节完成时间</td>
- <td>
- <html:text property="rnexttime" onclick="setday(this);" style="width: 100%" maxlength="45" readonly="true" ></html:text>
- </td>
- <td style="width: 95" align="right">期望总完成时间</td>
- <td>
- <html:text property="rlasttime" onclick="setday(this);" style="width: 100%" maxlength="45" readonly="true" ></html:text>
- </td>
- </tr>
- <tr>
- <td align="right" align="right"></td>
- <td colspan="3" align="left">
- <input type="checkbox" name="rolename" value="" onclick="init();" disabled="disabled"/>通过选择角色确定下一负责人</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" disabled="disabled">
- <option value="">请选择</option>
- </select>
- </td>
- </tr>
- <tr>
- <td align="right">事务备注</td>
- <td colspan="3"><textarea name="rmemo" rows="4" style="width:100%"></textarea></td>
- </tr>
- <tr><td colspan="4" align="center">
- <input type="hidden" value="transreq" name="task">
- <input type="submit" name="Submit" value="提交" onclick="return check();"/>
- <input type="reset" value="重置"/></td></tr>
- <tr class="tableHead" >
- <td colspan="4" align="center"></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 check(){
- <%
- SimpleDateFormat simple=new SimpleDateFormat("yyyy-MM-dd");
- String datetime=simple.format(new Date());
- %>
- if (isEmpty(document.getElementById("rtitle").value)){
- alert("请填写事务标题");
- document.getElementById("rtitle").focus();
- return false;
- }
- if (document.getElementById("tno").value==""){
- alert("请选择事务类型");
- document.getElementById("tno").focus();
- return false;
- }
- if (document.getElementById("rgrade").value==""){
- alert("请填写事务等级");
- document.getElementById("rgrade").focus();
- return false;
- }
- if (isEmpty(document.getElementById("rdetail").value)){
- alert("请填写事务详情");
- document.getElementById("rdetail").focus();
- return false;
- }
- if (isEmpty(document.getElementById("rstarttime").value)){
- alert("请填写事务开始时间");
- document.getElementById("rstarttime").focus();
- return false;
- }
- if (isEmpty(document.getElementById("rnexttime").value)){
- alert("请填写下一环节期望完成时间");
- document.getElementById("rnexttime").focus();
- return false;
- }
- if (isEmpty(document.getElementById("rlasttime").value)){
- alert("请填写期望总完成时间");
- document.getElementById("rlasttime").focus();
- return false;
- }
- if (document.getElementById("userid").value==""){
- alert("请填写下一环节处理者");
- return false;
- }
- if (document.getElementById("rlasttime").value <"<%=datetime%>"){
- alert("期望总完成时间不能小于当天时间!");
- document.getElementById("rlasttime").focus();
- return false;
- }
- if (document.getElementById("rnexttime").value <"<%=datetime%>"){
- alert("期望下一环节完成时间不能小于当天时间!");
- document.getElementById("rnexttime").focus();
- return false;
- }
- if (document.getElementById("rnexttime").value > document.getElementById("rlasttime").value){
- alert("总完成时间不能小于下一环节完成时间!");
- document.getElementById("rlasttime").focus();
- return false;
- }
- return true;
- }
- //去左右空格;
- 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>
- </html:html>