RoadFlow2.1 临时演示

Default.aspx 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebForm.Platform.WorkFlowRun.Default" %>
  2. <!DOCTYPE html>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <title></title>
  7. </head>
  8. <body>
  9. <%
  10. string flowid = Request.QueryString["flowid"];
  11. string instanceid = Request.QueryString["instanceid"];
  12. string taskid = Request.QueryString["taskid"];
  13. string stepid = Request.QueryString["stepid"];
  14. string groupid = Request.QueryString["groupid"];
  15. string display = Request.QueryString["display"] ?? "0";
  16. RoadFlow.Platform.WorkFlow bworkFlow = new RoadFlow.Platform.WorkFlow();
  17. RoadFlow.Platform.WorkFlowTask btask = new RoadFlow.Platform.WorkFlowTask();
  18. RoadFlow.Platform.WorkFlowButtons bworkFlowButtons = new RoadFlow.Platform.WorkFlowButtons();
  19. RoadFlow.Platform.AppLibrary bappLibrary = new RoadFlow.Platform.AppLibrary();
  20. Guid flowID;
  21. if (!flowid.IsGuid(out flowID))
  22. {
  23. Response.Write("流程ID为空!");
  24. Response.End();
  25. }
  26. var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowID);
  27. if (wfInstalled == null)
  28. {
  29. Response.Write("未找到流程运行时!");
  30. Response.End();
  31. }
  32. else if (wfInstalled.Status == 3)
  33. {
  34. Response.Write("该流程已被卸载,不能发起新的流程实例!");
  35. Response.End();
  36. }
  37. else if (wfInstalled.Status == 4)
  38. {
  39. Response.Write("该流程已被删除,不能发起新的实例!");
  40. Response.End();
  41. }
  42. Guid stepID;
  43. if (!stepid.IsGuid(out stepID))
  44. {
  45. stepID = wfInstalled.FirstStepID;
  46. }
  47. RoadFlow.Data.Model.WorkFlowInstalledSub.Step currentStep = wfInstalled.Steps.ToList().Find(p => p.ID == stepID);
  48. if (currentStep == null)
  49. {
  50. Response.Write("未找到流程步骤!");
  51. Response.End();
  52. }
  53. int isArchives = currentStep.Archives;//是否要归档
  54. string query = string.Format("flowid={0}&instanceid={1}&taskid={2}&stepid={3}&groupid={4}&appid={5}&tabid={6}",
  55. flowID, instanceid, taskid, stepID, groupid, Request.QueryString["appid"], Request.QueryString["tabid"]);
  56. //是否是抄送任务
  57. bool isCopyFor = false;
  58. //更新打开时间
  59. Guid taskgid;
  60. //如果是执行,并且任务ID为GUID,则更新打开时间和状态,检查当前任务是否可以执行。
  61. if ("0" == display && taskid.IsGuid(out taskgid))
  62. {
  63. btask.UpdateOpenTime(taskgid, RoadFlow.Utility.DateTimeNew.Now, true);
  64. var task = btask.Get(taskgid);
  65. if (task != null)
  66. {
  67. if ("1" != display && task.Status.In(2, 3, 4, 5))
  68. {
  69. Response.Write("<script type='text/javascript'>alert('该任务已处理,请刷新您的待办列表!');top.mainTab.closeTab();</script>");
  70. Response.End();
  71. }
  72. else if ("1" != display && task.ReceiveID != RoadFlow.Platform.Users.CurrentUserID)
  73. {
  74. Response.Write("<script type='text/javascript'>alert('您不能处理当前任务,请刷新您的待办列表!');top.mainTab.closeTab();</script>");
  75. Response.End();
  76. }
  77. isCopyFor = task.Type == 5;
  78. }
  79. }
  80. var form = currentStep.Forms.First();//目前只显示一个表单
  81. var appLibrary = bappLibrary.Get(form.ID, true);
  82. string src = appLibrary == null ? "" : WebForm.Common.Tools.BaseUrl + appLibrary.Address;
  83. bool isCustomeForm = appLibrary != null && appLibrary.Code.IsNullOrEmpty();//是否是自定义表单
  84. int debugType = wfInstalled.Debug;
  85. wfInstalled.DebugUsers.RemoveAll(p => p == null);
  86. bool isDebug = (debugType == 1 || debugType == 2) && wfInstalled.DebugUsers.Exists(p => p.ID == RoadFlow.Platform.Users.CurrentUserID);
  87. bool isSign = currentStep.SignatureType == 1 || currentStep.SignatureType == 2;//是否有意见
  88. int signType = currentStep.SignatureType;
  89. %>
  90. <form id="mainform" name="mainform" method="post" target="submiter">
  91. <%if ("0" == display){ //display为0表示执行,1表示查看 %>
  92. <div class="toolbar" style="margin-top:0; border-top:none 0; position:fixed; top:0; left:0; right:0; margin-left:auto; z-index:999; width:100%; margin-right:auto; height:26px;">
  93. <div>
  94. <%
  95. //如果是抄送,只显示完成按钮
  96. List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button> buttons = new List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button>();
  97. if (isCopyFor)
  98. {
  99. buttons.Add(new RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button()
  100. {
  101. ID = "954EFFA8-03B8-461A-AAA8-8727D090DCB9",
  102. Note = "完成",
  103. Sort = 0
  104. });
  105. }
  106. else
  107. {
  108. foreach (var button in currentStep.Buttons)
  109. {
  110. buttons.Add(button);
  111. }
  112. }
  113. foreach (var button in buttons)
  114. {
  115. if (button == null)
  116. {
  117. continue;
  118. }
  119. Guid buttonID;
  120. if (button.ID.IsGuid(out buttonID))
  121. {
  122. var button1 = bworkFlowButtons.Get(buttonID, true);
  123. if (button1 == null)
  124. {
  125. continue;
  126. }
  127. var funName = string.Concat("fun_", button1.ID.ToString("N"), "()");
  128. %>
  129. <a href="#" onclick="<%=funName %>;return false;" title="<%=!button.Note.IsNullOrEmpty() ? button.Note : button1.Note.IsNullOrEmpty() ? "" : button1.Note.Replace("\"", "'") %>">
  130. <span style="background:url(../../<%=button1.Ico%>) no-repeat left center;"><%=button1.Title %></span>
  131. </a>
  132. <script type="text/javascript">
  133. function <%=funName + "{" + button1.Script + "}" %>
  134. </script>
  135. <%}else if (string.Compare(button.ID, "other_splitline", true) == 0){ //显示其它特定按钮如分隔线| %>
  136. <span class="toolbarsplit">&nbsp;</span>
  137. <%}%>
  138. <%}%>
  139. </div>
  140. </div>
  141. <input type="hidden" name="instanceid" id="instanceid" value="" />
  142. <input type="hidden" name="params" id="params" value="" />
  143. <%if (isDebug && debugType == 1){%>
  144. <br /><br />
  145. <iframe name="submiter" style="width:99%; height:200px; border:1px solid #666; margin-left:4px; overflow:auto;"></iframe>
  146. <%}else{%>
  147. <iframe name="submiter" style="width:99%; height:1px; margin:0; display:none;"></iframe>
  148. <%}%>
  149. <%} %>
  150. <!--表单主体-->
  151. <div style="<%=isCustomeForm?"":"margin:8px;"%>" id="form_body_div">
  152. <%
  153. if (!src.IsNullOrEmpty())
  154. {
  155. if (!isCustomeForm)
  156. {
  157. System.Text.StringBuilder sb = new System.Text.StringBuilder();
  158. System.IO.TextWriter tw = new System.IO.StringWriter(sb);
  159. Server.Execute(src, tw);
  160. Response.Write(sb.ToString().RemovePageTag());
  161. }
  162. else
  163. {
  164. Response.Write("<input type=\"hidden\" id=\"Form_TitleField\" name=\"Form_TitleField\" value=\"customformtitle\" />");
  165. Response.Write("<input type=\"hidden\" id=\"customformtitle\" name=\"customformtitle\" value=\"\" />");
  166. Response.Write("<input type=\"hidden\" id=\"Form_AutoSaveData\" name=\"Form_AutoSaveData\" value=\"0\" />");
  167. //Response.Write("<input type=\"hidden\" id=\"instanceid\" name=\"instanceid\" value=\"\" />");
  168. src = src.IndexOf('?') >= 0 ? src + Request.Url.Query.Substring(1) : src + Request.Url.Query;
  169. Response.Write("<iframe src=\"" + (src.StartsWith("/") ? src : "/" + src) + "\" id=\"customeformiframe\" style=\"border:none 0;padding:0;width:100%;margin-top:28px;\"></iframe>");
  170. }
  171. }
  172. %>
  173. </div>
  174. <!--表单主体-->
  175. <!--意见处理栏-->
  176. <%
  177. if (isSign && "0" == display && !isCopyFor)
  178. {
  179. string commentsOptions = new RoadFlow.Platform.WorkFlowComment().GetOptionsStringByUserID(RoadFlow.Platform.Users.CurrentUserID);
  180. %>
  181. <div style="height:12px; margin:16px 8px 8px 8px; border-bottom:1px dashed #ccc;"></div>
  182. <div style="height:30px; margin:15px auto 8px auto; text-align:left; width:96%;">
  183. 处理意见:<select class="myselect" id="mycomment" style="margin-right:6px; width:100px;" onchange="$('#comment').val(this.value);"><option value=""></option><%=commentsOptions %></select>&nbsp;<input type="text" class="mytext" id="comment" name="comment" value="" style="width:70%; margin-right:6px;" />
  184. <%if (signType == 2){%>
  185. <input type="hidden" value="" id="issign" name="issign" />
  186. <input type="button" class="mybutton" id="signbutton" onclick="sign();" value="&nbsp;&nbsp;签&nbsp;&nbsp;章&nbsp;&nbsp;"/>
  187. <%
  188. string signFile = string.Concat(Server.MapPath("../../Files/UserSigns/"), RoadFlow.Platform.Users.CurrentUserID, ".gif");
  189. string signSrc = string.Concat("../../Files/UserSigns/", RoadFlow.Platform.Users.CurrentUserID, ".gif");
  190. if (!System.IO.File.Exists(signFile))
  191. {
  192. System.Drawing.Bitmap img = new RoadFlow.Platform.WorkFlow().CreateSignImage(RoadFlow.Platform.Users.CurrentUserName);
  193. if (img != null)
  194. {
  195. img.Save(signFile, System.Drawing.Imaging.ImageFormat.Gif);
  196. }
  197. }
  198. %>
  199. <img alt="" src="<%=signSrc %>" id="signimg" style="vertical-align:middle; display:none;" />
  200. <%}%>
  201. </div>
  202. <%}%>
  203. <!--意见处理栏-->
  204. <!--历史意见显示-->
  205. <div id="form_commentlist_div">
  206. <%
  207. if (currentStep.OpinionDisplay == 1)//如果步骤设置为要显示意见
  208. {
  209. Server.Execute("ShowComment.aspx");
  210. }
  211. %>
  212. </div>
  213. <!--历史意见显示-->
  214. <!--归档内容-->
  215. <textarea id="form_body_div_textarea" name="form_body_div_textarea" style="display:none;"></textarea>
  216. <textarea id="form_commentlist_div_textarea" name="form_commentlist_div_textarea" style="display:none;"></textarea>
  217. <!--归档内容-->
  218. </form>
  219. <script type="text/javascript">
  220. var isDebug = '<%=isDebug%>' == 'True' && '1' == '<%=debugType%>';
  221. var isSign = '<%=isSign%>' == 'True';
  222. var signType = '<%=signType%>';
  223. var iframeid = '<%=Request.QueryString["tabid"]%>';
  224. var isShow = "0" != "<%=display%>";//是否是查看模式
  225. var appid = '<%=Request.QueryString["appid"]%>';
  226. var query = '<%=query%>';
  227. var isSystemDetermine = '<%=currentStep.Behavior.FlowType==0?"1":"0"%>';//当前步骤的后续流转类型是否是系统判断
  228. var instanceid='<%=instanceid%>';
  229. var isCustomeForm = '<%=isCustomeForm?"1":"0"%>';
  230. $(function(){
  231. if("1" == "<%=isArchives%>")
  232. {
  233. $("#form_body_div_textarea").val($("#form_body_div").html());
  234. $("#form_commentlist_div_textarea").val($("#form_commentlist_div").html());
  235. }
  236. if("1"==isCustomeForm)
  237. {
  238. $("#customeformiframe").height($(window).height()-32);
  239. }
  240. });
  241. </script>
  242. <script type="text/javascript" src="Scripts/common.js" ></script>
  243. </body>
  244. </html>