affairAudit.jsp
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:14k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page language="java" pageEncoding="GBK"%>
  2. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
  3. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
  4. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
  5. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
  6. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  7. <%@ page import="java.text.SimpleDateFormat"%>
  8. <%@ page import="java.util.Date"%>
  9. <link href="<%=request.getContextPath()%>/Css_file/oa.css" rel="stylesheet" type="text/css" />
  10. <script src="<%=request.getContextPath()%>/Js_file/date.js"></script>
  11. <c:set var="step" value="${requestScope.affair.sprestep}"></c:set>
  12. <body <c:if test="${step+1!=requestScope.affair.tstep}">onload="init();"</c:if>>
  13. <html:form action="/affairReq" method="post" styleId="form1" enctype="multipart/form-data">
  14.  <table width="100%" border="1" cellspacing="0" class="myTable"> 
  15.   <tr>
  16.     <td colspan="4" align="center" class="tableHead"><strong>事务发起信息</strong></td>
  17. </tr> 
  18. <tr>
  19.       <td align="right" width="15%">事务等级</td>
  20.       <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>"/>
  21.       </td>
  22.     </tr>
  23.     <tr>
  24.       <td align="right">事务标题</td>
  25.       <td colspan="3"><input name="text" type="text" style="width: 100%" maxlength="45" disabled="disabled" value="${requestScope.req.rtitle}"/></td>
  26.     </tr>
  27.     <tr>
  28.       <td align="right">事务详情</td>
  29.       <td colspan="3"><textarea name="text" cols="70" rows="3" disabled="disabled" value="">${requestScope.req.rdetail}</textarea></td>
  30.     </tr>
  31.     <tr>
  32.       <td align="right">希望下一环节完成时间</td>
  33.       <td colspan="3"><input type="text" name="text" style="width: 100%" disabled="disabled" value="${requestScope.req.rnexttime}"/></td>
  34.     </tr>
  35.     <tr>
  36.       <td align="right">事务发起人</td>
  37.       <td colspan="3">
  38.       <input type="text" name="text" style="width: 100%"  disabled="disabled" value="${requestScope.req.utruename}"/>
  39.       </td>
  40.     </tr>
  41.     <tr>
  42.       <td align="right">事务备注</td>
  43.       <td colspan="3"><textarea name="text" cols="70" rows="3" disabled="disabled" value="">${requestScope.req.rmemo}</textarea></td>
  44.     </tr>
  45.    
  46.   
  47.   <logic:iterate id="alist" name="audit" scope="request">
  48.     <tr class="tableHead">
  49.       <td  colspan="4" align="center" >       
  50.        <strong>事务第${alist.scurrentid}个环节处理信息</strong>      
  51.       </td>
  52.     </tr>
  53.     <tr>
  54.       <td align="right" width="15%">负责人</td>
  55.       <td colspan="3"><input name="text" type="text" style="width: 100%" disabled="disabled" value="${alist.utruename}"/>
  56.       </td>
  57.     </tr>
  58.     <tr>
  59.       <td align="right">处理时间</td>
  60.       <td colspan="3"><input name="text" type="text" style="width: 100%" maxlength="45" disabled="disabled" value="${alist.scurrenttime}"/></td>
  61.     </tr>
  62.     <tr>
  63.       <td align="right">希望下一环节完成时间</td>
  64.       <td colspan="3"><input type="text" name="text" style="width: 100%" disabled="disabled" value="${alist.snexttime}"/></td>
  65.     </tr>    
  66.     <tr>
  67.       <td align="right">附件</td>
  68.       <td colspan="3">
  69.        <logic:empty name="alist" property="sname">
  70.       该环节没有附件
  71.       </logic:empty>
  72.       <c:if test="${alist.sname==null}">
  73.        该环节没有附件
  74.       </c:if>
  75.       <c:if test="${alist.sname!=null}"><strong>【${alist.sname}】</strong>      
  76.       <a href="${pageContext.request.contextPath}/Jsp_file/affair/down.jsp?filename=${alist.sname}">点击下载</a>     
  77.       </c:if>  
  78.       </td>
  79.     </tr>  
  80.     </logic:iterate>
  81.    
  82.  
  83.  
  84.    
  85.  <tr>
  86.     <td colspan="4" align="center" class="tableHead"><strong>事务第${step+1}个环节处理信息</strong></td>
  87.   <>
  88.  </tr> 
  89.   <tr>
  90.       <td align="right">事务类型</td>
  91.       <td>
  92.       <input type="text" name="tname" style="width: 100%"  disabled="disabled" value="${requestScope.affair.tname}"/>
  93.       </td>
  94.       <td align="right" >事务等级</td>
  95.       <td ><select name="rgrade" disabled="disabled">     
  96.   <option value="0" <c:if test="${requestScope.affair.rgrade==0}">selected="selected"</c:if>>一般</option>
  97.   <option value="1" <c:if test="${requestScope.affair.rgrade==1}">selected="selected"</c:if>>重要</option>
  98.   <option value="2" <c:if test="${requestScope.affair.rgrade==2}">selected="selected"</c:if>>紧急</option>
  99.       </select>
  100.       </td>
  101.     </tr>
  102. <tr>
  103.       <td align="right">事务标题</td>
  104.       <td colspan="3"><input name="rtitle" type="text" style="width: 100%" maxlength="45" value="${requestScope.affair.rtitle}" disabled="disabled" /></td>
  105.     </tr>
  106.      <tr>
  107.       <td align="right">事务详情</td>
  108.       <td colspan="3"><textarea name="rdetail" cols="70" rows="3" value="" disabled="disabled" >${requestScope.affair.rdetail}</textarea></td>
  109.     </tr>
  110.     <tr>
  111.       <td align="right">希望总完成时间</td>
  112.       <td <c:if test="${step+1==requestScope.affair.tstep}">colspan="3"</c:if>>
  113.        <input style="width: 100%" type="text" name="rlasttime" disabled="disabled" value="${requestScope.affair.rlasttime}"/></td>
  114.       <c:if test="${step+1!=requestScope.affair.tstep}">
  115.       <td align="right" >希望下一环节完成时间 </td>
  116.       <td><input type="text" style="width: 100%" name="snexttime" onclick="setday(this);" readonly="readonly"/></td>
  117.       </c:if>
  118.     </tr>    
  119.     <c:if test="${step+1!=requestScope.affair.tstep}">
  120.     <tr>
  121.      <td></td>
  122.       <td colspan="3" align="left"><input type="checkbox" name="rolename" onclick="init();" />
  123.       通过选择角色确定下一负责人</td>
  124.     </tr>
  125.     <tr>
  126.       <td align="right">下一环节处理者角色</td>
  127.       <td><select name="roleid" disabled="disabled" onchange="javascript:getUser(this.value);">
  128.   <option value="">请选择</option>
  129.       </select><span id="rolemsg"></span>
  130.       </td>
  131.       <td align="right">下一环节处理者</td>
  132.       <td><select name="userid">
  133.   <option value="">请选择</option>
  134.       </select>
  135.       </td>
  136.     </tr>
  137.     </c:if>
  138.     <tr>
  139.       <td align="right">审核说明</td>
  140.       <td colspan="3"><textarea name="memo" cols="70" rows="4"></textarea></td>
  141.     </tr>
  142.     <tr>
  143.       <td align="right">附件</td>
  144.       <td colspan="3"><html:file style="width: 72%"  property="file" ></html:file></td>
  145.     </tr> 
  146.  
  147.  <tr class="tableHead" align="center">
  148.       <td height="30" colspan="4">
  149.       <input type="hidden" name="stepid"  value="${step+1}"/>
  150.       <input type="hidden" name="sid"  value="${requestScope.affair.sid}"/>
  151.       <input type="hidden" name="tno"  value="${requestScope.affair.tno}"/>
  152.       <input type="hidden" name="rqid"  value="${requestScope.affair.rqid}"/>
  153.       <input type="hidden" name="task" value="doaudit">
  154.       <input type="hidden" name="currentstep" value="${step+1}">
  155.       <c:if test="${step+1!=requestScope.affair.tstep}">     
  156.          <input type="hidden" name="type" value="noEnd">
  157.         <input type="submit" name="Submit" value="审核通过" style="WIDTH:70px;" onclick="return checks();"/>
  158.         <input type="button" name="back" value="审核不通过返回上一节" style="WIDTH:170px;" onclick="return nopass('back');"/>
  159.       </c:if>
  160.       <c:if test="${step+1==requestScope.affair.tstep}">
  161.         <input type="hidden" name="type" value="End">
  162.        <input  type="submit" name="pass" value="审核通过并完结该事务" style="WIDTH:170px;" onclick="return checks();"/>
  163.        <input type="button" name="nopasss" value="审核不通过并完结该事务" style="WIDTH:170px;" onclick="return nopass('nopass');"/>
  164.       </c:if> 
  165.       <input type="button" name="canel" value="取消" onclick="window.history.back();"/></td>
  166.     </tr> 
  167.  </table>
  168.  <a href="<%=request.getContextPath()%>/login.do?method=main"><strong><< 返回首页 <strong></a>
  169. </html:form>
  170. </body>
  171. <script language="javascript">
  172. var xmlhttp_request;
  173. var onecount=0;//定义一个变量,用于记录数组中的长度。
  174. var subcat = new Array();//定义一个二维数组,用于存放用户的ID,名称和对应角色的ID。
  175. function initrequest(){
  176. if(window.XMLHttpRequest){//这种就是Mozilla
  177. xmlhttp_request = new XMLHttpRequest();
  178. }else if(window.ActiveXObject){//这种浏览器是IE
  179. try{
  180. xmlhttp_request = new ActiveXObject("Msxml2.XMLHttp");
  181. }catch(e){
  182. try{
  183. xmlhttp_request = new ActiceXObject("Microsoft.XMLHttp");
  184. }catch(e){
  185. }
  186. }
  187. }
  188. if(!xmlhttp_request){
  189. alert("您的浏览器不支持Ajax");
  190. return false;
  191. }
  192. }
  193. function init(){
  194. initrequest();
  195. var rtid = document.getElementById("tno").value;
  196. if (rtid != ""){
  197. if (document.getElementById("rolename").checked){
  198. var url = "${pageContext.request.contextPath}/affairReq.do?task=getProcessers&rtid="
  199. +rtid+"&type=role&step=0&sessionid="+Math.random();
  200. }else{
  201. var url = "${pageContext.request.contextPath}/affairReq.do?task=getProcessers&rtid="
  202. +rtid+"&type=user&step=0&sessionid="+Math.random();
  203. }
  204. xmlhttp_request.open("get",url,true);
  205. xmlhttp_request.onreadystatechange=getMsg;
  206. xmlhttp_request.send();
  207. }else{
  208. var userids = document.getElementById("userid");
  209. var roleids = document.getElementById("roleid");
  210. var rolenames = document.getElementById("rolename");
  211. userids.disabled="disabled";
  212. userids.innerHTML ="";
  213. roleids.disabled="disabled";
  214. roleids.innerHTML ="";
  215. rolenames.checked=false;
  216. rolenames.disabled=true;
  217. }
  218. }
  219. function getUser(roleidstr){
  220. document.getElementById("userid").length = 0;
  221.     for (var i=0;i<onecount;i++)
  222. {
  223.         if (subcat[i][1] == roleidstr)
  224.              document.getElementById("userid").options[document.getElementById("userid").length] = new Option(subcat[i][0], subcat[i][2]);
  225.         }        
  226.     }
  227. }
  228. function getMsg(){
  229. if (xmlhttp_request.readyState == 4){
  230. if (xmlhttp_request.status == 200){
  231. var xmlText = xmlhttp_request.responseXML;
  232. var userids = document.getElementById("userid");
  233. var roleids = document.getElementById("roleid");
  234. var rolenames = document.getElementById("rolename");
  235. if(!rolenames.checked){
  236. userids.disabled=false;
  237. rolenames.disabled=false;
  238. roleids.disabled=true;
  239. if (document.getElementById("tno").value!=""){
  240. userids.length = 0;
  241. var users = xmlText.getElementsByTagName("userid");
  242. for(var i = 0; i < users.length ;i++){
  243. var id = users[i].getAttribute("id");
  244. var name = users[i].text;
  245. userids.options[i] = new Option(name,id);
  246. }
  247. roleids.length = 0 ;
  248. }else{
  249. userids.innerHTML ="";
  250. }
  251. }else {
  252. roleids.disabled=false;
  253. roleids.length = 0;
  254. userids.length = 0;
  255. var roles = xmlText.getElementsByTagName("roleid");
  256. var users = xmlText.getElementsByTagName("userid");
  257. for(var j= 0 ;j < roles.length; j++){
  258. var id = roles[j].getAttribute("id");
  259. var name =roles[j].getAttribute("rolename");
  260. roleids.options[j] = new Option(name,id);
  261. var userid = roles[j].getElementsByTagName("userid")
  262. for (var k=0;k<userid.length;k++){
  263. if(userid[k].getAttribute("id") != ""){ 
  264. subcat[onecount] = new Array(userid[k].getAttribute("username"),id,userid[k].getAttribute("id"));
  265. onecount = onecount + 1;
  266. }
  267. }
  268. }
  269. if(roles.length>0){
  270. getUser(roles[0].getAttribute("id"));
  271. var test = document.getElementById("rolemsg").innerHTML="";
  272. }else{
  273. var test = document.getElementById("rolemsg").innerHTML="<a style='color: red'>没有相应的角色</a>";
  274. }
  275. }
  276. }else if (xmlhttp_request.status == 404){
  277. alert('地址没有找到');
  278. }else if (xmlhttp_request.status == 500){
  279. alert('服务端出现错误');
  280. }
  281. }
  282. }
  283. function checks(){
  284. if (isEmpty(document.form1.rgrade.value)){
  285. alert("请选择事务等级");
  286. document.form1.rgrade.focus();
  287. return false;
  288. }
  289. if (isEmpty(document.form1.rtitle.value)){
  290. alert("请填写事务标题");
  291. document.form1.rtitle.focus();
  292. return false;
  293. }
  294. if (isEmpty(document.form1.rdetail.value)){
  295. alert("请填写事务详情");
  296. document.form1.rdetail.focus();
  297. return false;
  298. }
  299. <c:if test="${step+1!=requestScope.affair.tstep}">
  300. if (isEmpty(document.form1.snexttime.value)){
  301. alert("请填写下一环节希望完成时间");
  302. document.form1.snexttime.focus();
  303. return false;
  304. }
  305. <%
  306. SimpleDateFormat  simple=new SimpleDateFormat("yyyy-MM-dd");
  307. String datetime=simple.format(new Date());
  308. %>
  309. if (document.form1.snexttime.value <"<%=datetime%>"){
  310. alert("希望下一环节完成时间不能小于当天时间!");
  311. document.form1.snexttime.focus();
  312. return false;
  313. }
  314. if (document.form1.userid.value == ""){
  315. alert("请选择下一环节处理者");
  316. document.form1.userid.focus();
  317. return false;
  318. }
  319. </c:if>
  320. return true;
  321. }
  322. function nopass(str){
  323. document.form1.task.value = "doaudit2";
  324. if (str =="back"){
  325. document.form1.type.value = "back";
  326.     document.form1.submit();
  327. }else if (str =="nopass"){
  328. if (checks()){
  329. document.form1.type.value = "nopass";
  330. document.form1.submit();
  331. }
  332. }
  333. }
  334. //去左右空格;
  335. function trim(s){
  336.      return rtrim(ltrim(s));
  337. }
  338. //去左空格;
  339. function ltrim(s){
  340.      return s.replace( /^s*/, "");
  341. }
  342. //去右空格;
  343. function rtrim(s){
  344.      return s.replace( /s*$/, "");
  345. }
  346. //验证信息;
  347. //空字符值;
  348. function isEmpty(s){
  349.     s = trim(s);
  350.     return s.length == 0;
  351. }
  352. </script>