flow_modify.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:11k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" %>
  2. <%@ page import="cn.js.fan.util.*"%>
  3. <%@ page import="cn.js.fan.web.*"%>
  4. <%@ page import="java.util.*"%>
  5. <%@ page import="com.redmoon.oa.flow.*"%>
  6. <%@ page import="com.redmoon.oa.task.TaskDb"%>
  7. <%@ page import="com.redmoon.oa.person.*"%>
  8. <link href="common.css" rel="stylesheet" type="text/css">
  9. <link href="admin/default.css" rel="stylesheet" type="text/css">
  10. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  11. <%
  12. String priv="read";
  13. if (!privilege.isUserPrivValid(request,priv))
  14. {
  15. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  16. return;
  17. }
  18. int flow_id = ParamUtil.getInt(request, "flowId");
  19. WorkflowMgr wfm = new WorkflowMgr();
  20. WorkflowDb wf = wfm.getWorkflowDb(flow_id);
  21. WorkflowRuler wr = new WorkflowRuler();
  22. if (!privilege.isUserPrivValid(request, "admin.flow")) {
  23. LeafPriv lp = new LeafPriv(wf.getTypeCode());
  24. // 判断是否拥有管理权
  25. if (!lp.canUserSee(privilege.getUser(request))) {
  26. // 判断是否参与了流程
  27. if (!wf.isUserAttended(privilege.getUser(request))) {
  28. out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  29. return;
  30. }
  31. }
  32. }
  33. boolean isStarted = wf.isStarted();
  34. String op = ParamUtil.get(request, "op");
  35. if (op.equals("discard")) {
  36. boolean re = false;
  37. try {
  38. re = wfm.discard(request, flow_id);
  39. }
  40. catch (ErrMsgException e) {
  41. out.print(StrUtil.Alert(e.getMessage()));
  42. }
  43. if (re)
  44. out.print(StrUtil.Alert(SkinUtil.LoadString(request, "info_op_success")));
  45. }
  46. com.redmoon.oa.person.UserMgr um = new com.redmoon.oa.person.UserMgr();
  47. %>
  48. <title>处理流程</title>
  49. <script src="inc/flow_dispose_js.jsp"></script>
  50. <script>
  51. function Operate() {
  52. alert("当前未处在修改状态!");
  53. }
  54. function openWin(url,width,height)
  55. {
  56.   var newwin=window.open(url,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=50,left=120,width="+width+",height="+height);
  57. }
  58. </script>
  59.   <%
  60.    com.redmoon.oa.Config cfg = new com.redmoon.oa.Config();
  61. String canUserSeeDesignerWhenDispose = cfg.get("canUserSeeDesignerWhenDispose");
  62. String canUserModifyFlow = cfg.get("canUserModifyFlow");
  63. String mode = "user";
  64. if (canUserModifyFlow.equals("true"))
  65. mode = "user";
  66. else
  67. mode = "view";
  68.   %>
  69. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  70.   <tr>
  71.     <td width="83%" height="23" background="images/top-right.gif" class="right-title">&nbsp;&nbsp;<span>修改 / 查看流程&nbsp;&nbsp;<%=wf.getTitle()%></span></td>
  72.     <td width="17%" background="images/top-right.gif" class="right-title">&nbsp;</td>
  73.   </tr>
  74.   <tr>
  75.     <td colspan="2" valign="top" class="main"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
  76.         <tr>
  77.           <td colspan="2" align="center"><object id="Designer" classid="CLSID:ADF8C3A0-8709-4EC6-A783-DD7BDFC299D7" codebase="<%=request.getContextPath()%>/activex/Designer.CAB" style="width:0px; height:0px">
  78.             <param name="Workflow" value="<%=wf.getFlowString()%>" />
  79.             <param name="Mode" value="view" />
  80.             <!--debug user initiate complete-->
  81.             <param name="CurrentUser" value="<%=privilege.getUser(request)%>" />
  82.           </object></td>
  83.         </tr>
  84.           <tr>
  85.             <td height="12" colspan="2" align="center"></td>
  86.           </tr>
  87.           
  88.           <tr>
  89.             <td width="2%" height="35" align="left">&nbsp;</td>
  90.             <td width="98%" align="left"><strong class="p14">
  91.               <%
  92. int doc_id = wf.getDocId();
  93. DocumentMgr dm = new DocumentMgr();
  94. Document doc = dm.getDocument(doc_id);
  95. %>
  96.               <%=doc.getTitle()%></strong>&nbsp;&nbsp;发起人:<%=um.getUserDb(wf.getUserName()).getRealName()%>&nbsp;&nbsp;状态:<%=wf.getStatusDesc()%></td>
  97.           </tr>
  98.           <tr>
  99.             <td colspan="2"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
  100.               <tr>
  101.                 <td align="center">&nbsp;</td>
  102.               </tr>
  103.               <tr>
  104.                 <td align="left">
  105. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  106.   <form id="flowForm" name="flowForm" action="">
  107.                   <tr>
  108.                     <td>
  109. <%
  110. Render rd = new Render(request, wf, doc);
  111. out.print(rd.report());
  112. %> </td>
  113.                   </tr>
  114.   </form>
  115.                 </table>
  116. <br>
  117.                   <%
  118.   if (doc!=null) {
  119.   java.util.Vector attachments = doc.getAttachments(1);
  120.   java.util.Iterator ir = attachments.iterator();
  121.   while (ir.hasNext()) {
  122.    Attachment am = (Attachment) ir.next(); %>
  123.                   <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  124.                     <tr>
  125.                       <td width="16%" align="right"><img src=images/attach.gif></td>
  126.                       <td width="84%">&nbsp; <a target=_blank href="flow_getfile.jsp?attachId=<%=am.getId()%>&amp;flowId=<%=flow_id%>"><%=am.getName()%></a> </td>
  127.                     </tr>
  128.                   </table>
  129.                 <%}
  130.   }
  131.   %>
  132. <%
  133. String sql = "select id from flow_my_action where flow_id=" + flow_id + " order by receive_date asc";
  134. MyActionDb mad = new MyActionDb();
  135. Vector v = mad.list(sql);
  136. %>
  137.                 <br />
  138.                 <table width="99%" align="center" cellpadding="3" cellspacing="1" bgcolor="#ACA38A">
  139.                   <tbody>
  140.                     <tr>
  141.                       <td width="16%" align="center" nowrap="nowrap" class="thead" style="PADDING-LEFT: 10px"><strong>处理人</strong></td>
  142.                       <td width="34%" align="center" nowrap="nowrap" class="thead" style="PADDING-LEFT: 10px">任务</td>
  143.                       <td width="9%" align="center" nowrap="nowrap" class="thead">到达状态</td>
  144.                       <td width="16%" align="center" nowrap="nowrap" class="thead"><strong>开始时间</strong></td>
  145.                       <td width="17%" align="center" nowrap="nowrap" class="thead"><strong>处理时间</strong></td>
  146.                       <td width="8%" align="center" nowrap="nowrap" class="thead"><strong>当前状态</strong></td>
  147.                       </tr>
  148.                     <%
  149. java.util.Iterator ir = v.iterator();
  150. Directory dir = new Directory();
  151. while (ir.hasNext()) {
  152.   mad = (MyActionDb)ir.next();
  153. WorkflowDb wfd = new WorkflowDb();
  154. wfd = wfd.getWorkflowDb((int)mad.getFlowId());
  155. String userName = wfd.getUserName();
  156. String userRealName = "";
  157. if (userName!=null) {
  158. UserDb user = um.getUserDb(mad.getUserName());
  159. userRealName = user.getRealName();
  160. }
  161. WorkflowActionDb wad = new WorkflowActionDb();
  162. wad = wad.getWorkflowActionDb((int)mad.getActionId());
  163. %>
  164.                     <tr class="row" style="BACKGROUND-COLOR: #ffffff">
  165.                       <td style="PADDING-LEFT: 10px">&nbsp;&nbsp;<%=userRealName%></td>
  166.                       <td style="PADDING-LEFT: 10px"><%=wad.getTitle()%></td>
  167.                       <td><%=WorkflowActionDb.getStatusName(mad.getActionStatus())%> </td>
  168.                       <td><%=DateUtil.format(mad.getReceiveDate(), "yy-MM-dd HH:mm:ss")%> </td>
  169.                       <td><%=DateUtil.format(mad.getCheckDate(), "yy-MM-dd HH:mm:ss")%> </td>
  170.                       <td><%=mad.isChecked()?"已处理":"未处理"%></td>
  171.                       </tr>
  172.                     <%}%>
  173.                   </tbody>
  174.                 </table>
  175.                 <br>
  176. <%
  177. String strActionId = ParamUtil.get(request, "actionId");
  178. if (!strActionId.equals("")) {
  179. long actionId = Long.parseLong(strActionId);
  180. WorkflowActionDb wa = new WorkflowActionDb();
  181. wa = wa.getWorkflowActionDb((int)actionId);
  182. if ( wa==null ) {
  183. out.print(SkinUtil.makeErrMsg(request, "流程中的相应动作不存在!"));
  184. return;
  185. }
  186. Vector vto = wa.getLinkToActions();
  187. Iterator toir = vto.iterator();
  188. out.print("办理完毕时间:" + DateUtil.format(wa.getCheckDate(), "yyyy-MM-dd HH:mm:ss") + "<BR>");
  189. if (vto.size()>0)
  190. out.print("正在办理中的下一节点的人员:<BR>");
  191. while (toir.hasNext()) {
  192. WorkflowActionDb towa = (WorkflowActionDb)toir.next();
  193. if (towa.getStatus()==towa.STATE_DOING) {
  194. String[] users = StrUtil.split(towa.getUserName(), ",");
  195. String[] userRealNames = StrUtil.split(towa.getUserRealName(), ",");
  196. int len = users.length;
  197. for (int i=0; i<len; i++) {
  198. %>
  199. <%=userRealNames[i]%>&nbsp;&nbsp;<a href="#" onClick="openWin('message_oa/myreply.jsp?receiver=<%=StrUtil.UrlEncode(users[i])%>&title=<%=StrUtil.UrlEncode("请尽快办理:" + wf.getTitle())%>', 320, 262)">催办</a>
  200. <% }
  201. }
  202. }
  203. }
  204. %>
  205.                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  206.                   <tr>
  207.                     <td height="28" align="center">
  208. <%
  209. if (wr.canMonitor(request, wf)) {
  210. if (wr.canUserModifyFlow(request, wf)) {%>
  211. <input name="button" type="button" class="button1" onclick="window.location.href='flow_modify1.jsp?flowId=<%=flow_id%>'" value=" 修 改 " />
  212. <!--&nbsp;&nbsp;&nbsp;&nbsp;
  213. <input name="button" type="button" class="button1" onclick="window.location.href='flow_modify3.jsp?flowId=<%=flow_id%>'" value=" 修改流程 " />
  214. &nbsp;&nbsp;&nbsp;&nbsp;
  215. <input name="Submit22" type="button" class="button1" onclick="window.location.href='?op=discard&flowId=<%=flow_id%>'" value="放弃流程"/>
  216. -->
  217. <%}%>
  218. <%if (wr.canUserDelFlow(request, wf)) {%>
  219. <!--&nbsp;&nbsp;&nbsp;&nbsp;
  220. <input name="button" type=button class="button1" onclick="window.location.href='flow_del.jsp?flow_id=<%=flow_id%>'" value=" 删 除 " />
  221. -->
  222. <%}%>
  223. <!--&nbsp;&nbsp;&nbsp;&nbsp;
  224. <input name="Submit2" type="button" class="button1" onclick="window.location.href='flow_monitor.jsp?flowId=<%=flow_id%>'" value="监控人员"/>
  225. -->
  226.                     <%}%>
  227. <%if (wr.canUserStartFlow(request, wf)) {%>
  228. <!--&nbsp;&nbsp;&nbsp;&nbsp;
  229. <input name="button" type=button class="button1" onclick="window.location.href='flow_dispose.jsp?flowId=<%=flow_id%>'" value=" 办 理 " />-->
  230. <%}%>
  231. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  232. <input name="Submit" type="button" class="button1" onclick="showFormReport()" value="打印表单"/>
  233. &nbsp;&nbsp;&nbsp;
  234. <%if (canUserSeeDesignerWhenDispose.equals("true")) {%>
  235. <input name="btnShowDesigner" type="button" class="button1" onclick="ShowDesigner()" value="显示流程" />
  236. <%}%></td>
  237.                   </tr>
  238.                 </table>
  239.                 <br></td>
  240.               </tr>
  241.             </table>            </td>
  242.           </tr>
  243.     </table></td>
  244.   </tr>
  245. </table>
  246. <script>
  247. function showFormReport() {
  248. var preWin=window.open('preview','','left=0,top=0,width=550,height=400,resizable=1,scrollbars=1, status=1, toolbar=1, menubar=1');
  249. preWin.document.open();
  250. preWin.document.write("<style>TD{ TABLE-LAYOUT: fixed; FONT-SIZE: 12px; WORD-BREAK: break-all; FONT-FAMILY:}</style>" + formDiv.innerHTML);
  251. preWin.document.close();
  252. preWin.document.title="表单";
  253. preWin.document.charset="UTF-8";
  254. }
  255. function ShowDesigner() {
  256. if (Designer.style.width=="0px") {
  257. Designer.style.width = 740;
  258. Designer.style.height = 338;
  259. btnShowDesigner.value = "隐藏流程";
  260. }
  261. else {
  262. Designer.style.width = 0;
  263. Designer.style.height = 0;
  264. btnShowDesigner.value = "显示流程";
  265. }
  266. }
  267. </script>