bpmNodeScriptEdit.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/commons/include/html_doctype.html" %>
  3. <html>
  4. <head>
  5. <title>流程事件脚本编辑</title>
  6. <%@include file="/commons/include/form.jsp" %>
  7. <script type="text/javascript" src="${ctx}/servlet/ValidJs?form=bpmNodeScript"></script>
  8. <script type="text/javascript" src="${ctx}/js/lg/plugins/ligerTab.js" ></script>
  9. <script type="text/javascript" src="${ctx}/js/hotent/platform/system/ScriptDialog.js" ></script>
  10. <script type="text/javascript" src="${ctx}/js/hotent/platform/bpm/FlowVarWindow.js" ></script>
  11. <script type="text/javascript" src="${ctx}/js/javacode/codemirror.js"></script>
  12. <script type="text/javascript" src="${ctx}/js/javacode/InitMirror.js"></script>
  13. <script type="text/javascript">
  14. /*KILLDIALOG*/
  15. var dialog = frameElement.dialog; //调用页面的dialog对象(ligerui对象)
  16. var defId="${defId}";
  17. function showRequest(formData, jqForm, options) {
  18. return true;
  19. }
  20. $(function() {
  21. //Tab
  22. valid(showRequest,function(){});
  23. $("#tabScript").ligerTab({height:300});
  24. $("#btnSearch").click(save);
  25. });
  26. function handFlowVars(obj,txtId){
  27. var val=$(obj).val();
  28. InitMirror.editor.insertCode(val);
  29. }
  30. function slectVars(txtId){
  31. FlowVarWindow({defId:defId,callback:function(varKey,varName){
  32. InitMirror.editor.insertCode(varKey);
  33. }});
  34. }
  35. function slectScript(txtId){
  36. ScriptDialog({callback:function(script){
  37. InitMirror.editor.insertCode(script);
  38. }});
  39. }
  40. function save() {
  41. InitMirror.save();
  42. var rtn = $("#bpmNodeScriptForm").valid();
  43. if (!rtn)
  44. return;
  45. var url = __ctx + "/platform/bpm/bpmNodeScript/save.ht";
  46. var para = $('#bpmNodeScriptForm').serialize();
  47. $.post(url, para, showResult);
  48. }
  49. function showResult(responseText) {
  50. var obj = new com.hotent.form.ResultMessage(responseText);
  51. if (!obj.isSuccess()) {
  52. $.ligerDialog.err('出错信息',"流程事件脚本编辑失败",obj.getMessage());
  53. return;
  54. } else {
  55. $.ligerDialog.success('流程事件脚本编辑成功!','提示信息',function() {
  56. dialog.close();
  57. });
  58. }
  59. }
  60. </script>
  61. <style type="text/css">
  62. html { overflow-y: hidden; }
  63. </style>
  64. </head>
  65. <body>
  66. <c:set var="preModel" value="${map.type1}"></c:set>
  67. <c:set var="afterModel" value="${map.type2}"></c:set>
  68. <c:set var="assignModel" value="${map.type4}"></c:set>
  69. <c:set var="scrptModel" value="${map.type3}"></c:set>
  70. <c:set var="preBeforeModel" value="${map.type5}"></c:set>
  71. <c:set var="afterBeforeModel" value="${map.type6}"></c:set>
  72. <c:set var="signScriptModel" value="${map.type7}"></c:set>
  73. <div class="panel">
  74. <div class="panel-top">
  75. <div class="tbar-title">
  76. <span class="tbar-label">
  77. 流程事件脚本编辑
  78. </span>
  79. </div>
  80. <div class="panel-toolbar">
  81. <div class="toolBar">
  82. <div class="group"><a class="link save" id="btnSearch"><span></span>保存</a></div>
  83. <div class="l-bar-separator"></div>
  84. <div class="group"><a class="link del" onclick="dialog.close()"><span></span>关闭</a></div>
  85. </div>
  86. </div>
  87. </div>
  88. <div class="panel-body">
  89. <form id="bpmNodeScriptForm" method="post" action="save.ht">
  90. <div id="tabScript" >
  91. <c:if test="${type eq 'startEvent' || type eq 'subProcess' || type eq 'subStartEvent' }">
  92. <div tabid="startEvent" title="开始事件">
  93. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  94. <tr>
  95. <th width="20%">说明:<span class="required">*</span> </th>
  96. <td>
  97. 该脚本在流程启动时执行,用户可以使用<span class="red">execution</span>做操作。
  98. 例如设置流程变量:execution.setVariable("total", 100);
  99. <input type="hidden" name="scriptType" value="1" class="inputText"/>
  100. </td>
  101. </tr>
  102. <tr>
  103. <th width="20%" >脚本:<span class="required">*</span> </th>
  104. <td>
  105. <div>
  106. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('startScript')">常用脚本</a>
  107. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'startScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  108. </div>
  109. <textarea id="startScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${preModel.script}</textarea>
  110. </td>
  111. </tr>
  112. </table>
  113. </div>
  114. </c:if>
  115. <c:if test="${type eq 'endEvent' || type eq 'subProcess'}">
  116. <div tabid="endEvent" title="结束事件">
  117. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" >
  118. <tr>
  119. <th width="20%">脚本描述:<span class="required">*</span> </th>
  120. <td>
  121. 该脚本在<span class="red">流程结束</span>时执行,用户可以使用<span class="red">execution</span>做操作。
  122. 例如设置流程变量:execution.setVariable("total", 100);
  123. <input type="hidden" name="scriptType" value="2" />
  124. </td>
  125. </tr>
  126. <tr>
  127. <th width="20%" >脚本:<span class="required">*</span> </th>
  128. <td>
  129. <div>
  130. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('endScript')">常用脚本</a>
  131. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'endScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  132. </div>
  133. <textarea id="endScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${afterModel.script}</textarea>
  134. </td>
  135. </tr>
  136. </table>
  137. </div>
  138. </c:if>
  139. <c:if test="${type eq 'script' }">
  140. <div tabid="ScriptNode" title="脚本代码">
  141. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" style='${type eq "script"?'display:':'display:none'}'>
  142. <tr>
  143. <th width="20%">脚本描述:<span class="required">*</span> </th>
  144. <td>
  145. 这个在脚本任务触发时执行,用户可以使用<span class="red">execution</span>做操作。
  146. 例如设置流程变量:execution.setVariable("total", 100);
  147. <input type="hidden" name="scriptType" value="3" />
  148. </td>
  149. </tr>
  150. <tr>
  151. <th width="20%" >脚本节点:<span class="required">*</span> </th>
  152. <td>
  153. <div>
  154. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('scriptScript')">常用脚本</a>
  155. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'scriptScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  156. </div>
  157. <textarea id="scriptScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${scrptModel.script}</textarea>
  158. </td>
  159. </tr>
  160. </table>
  161. </div>
  162. </c:if>
  163. <c:if test="${type=='multiUserTask'||type=='userTask' }">
  164. <div tabid="startBeforeScript" title="任务创建前置脚本">
  165. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  166. <tr>
  167. <th width="20%">脚本描述:<span class="required">*</span> </th>
  168. <td>
  169. 该事件在<span class="red">启动该任务</span>时执行,用户可以使用<span class="red">task</span>做操作。
  170. 例如设置流程变量:task.setVariable("total", 100);
  171. <input type="hidden" name="scriptType" value="5" />
  172. </td>
  173. </tr>
  174. <tr>
  175. <th width="20%" >脚本:<span class="required">*</span> </th>
  176. <td>
  177. <div>
  178. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('preScript')">常用脚本</a>
  179. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'preScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  180. </div>
  181. <textarea id="preBeforeScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${preBeforeModel.script}</textarea>
  182. </td>
  183. </tr>
  184. </table>
  185. </div>
  186. <div tabid="startScript" title="任务创建后置脚本">
  187. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  188. <tr>
  189. <th width="20%">脚本描述:<span class="required">*</span> </th>
  190. <td>
  191. 该事件在<span class="red">启动该任务</span>时执行,用户可以使用<span class="red">task</span>做操作。
  192. 例如设置流程变量:task.setVariable("total", 100);
  193. <input type="hidden" name="scriptType" value="1" />
  194. </td>
  195. </tr>
  196. <tr>
  197. <th width="20%" >脚本:<span class="required">*</span> </th>
  198. <td>
  199. <div>
  200. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('preScript')">常用脚本</a>
  201. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'preScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  202. </div>
  203. <textarea id="preScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${preModel.script}</textarea>
  204. </td>
  205. </tr>
  206. </table>
  207. </div>
  208. <div tabid="endBeforeScript" title="任务结束前置脚本" >
  209. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  210. <tr>
  211. <th width="20%">脚本描述:<span class="required">*</span> </th>
  212. <td>
  213. 该事件在<span class="red">任务完成</span>时执行,用户可以使用<span class="red">task</span>做操作。
  214. 例如设置流程变量:task.setVariable("total", 100);
  215. <input type="hidden" name="scriptType" value="6" />
  216. </td>
  217. </tr>
  218. <tr>
  219. <th width="20%">脚本:<span class="required">*</span> </th>
  220. <td>
  221. <div>
  222. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('afterScript')">常用脚本</a>
  223. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'afterScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  224. </div>
  225. <textarea id="afterBeforeScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${afterBeforeModel.script}</textarea>
  226. </td>
  227. </tr>
  228. </table>
  229. </div>
  230. <div tabid="endScript" title="任务结束后置脚本" >
  231. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  232. <tr>
  233. <th width="20%">脚本描述:<span class="required">*</span> </th>
  234. <td>
  235. 该事件在<span class="red">任务完成</span>时执行,用户可以使用<span class="red">task</span>做操作。
  236. 例如设置流程变量:task.setVariable("total", 100);<br>
  237. approvalStatus_${nodeId}=1为通过 2-反对。
  238. <input type="hidden" name="scriptType" value="2" />
  239. </td>
  240. </tr>
  241. <tr>
  242. <th width="20%">脚本:<span class="required">*</span> </th>
  243. <td>
  244. <div>
  245. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('afterScript')">常用脚本</a>
  246. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'afterScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  247. </div>
  248. <textarea id="afterScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${afterModel.script}</textarea>
  249. </td>
  250. </tr>
  251. </table>
  252. </div>
  253. <c:if test="${type=='multiUserTask'}" >
  254. <div id="signExecuteScript" title="会签完成事件脚本">
  255. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  256. <tr>
  257. <th width="20%">说明:<span class="required">*</span> </th>
  258. <td>
  259. 该脚本在判断会签是否结束时执行,用户可以使用<span class="red">execution</span>做操作。
  260. 例如设置流程变量:execution.setVariable("total", 100);
  261. 也可以使用<span class="red">isCompleted</span>判断会签是否结束;<br/>
  262. <pre>例如:if(isCompleted){</pre>
  263. <pre> execution.setVariable("total", 100);</pre>
  264. <pre>}
  265. </pre>
  266. <input type="hidden" name="scriptType" value="7" class="inputText"/>
  267. </td>
  268. </tr>
  269. <tr>
  270. <th width="20%" >脚本:<span class="required">*</span> </th>
  271. <td>
  272. <div>
  273. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript()">常用脚本</a>
  274. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this)" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  275. </div>
  276. <textarea id="signExecuteScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${signScriptModel.script}</textarea>
  277. </td>
  278. </tr>
  279. </table>
  280. </div>
  281. </c:if>
  282. </c:if>
  283. <input type="hidden" id="nodeId" name="nodeId" value="${nodeId}" class="inputText"/>
  284. <input type="hidden" id="actDefId" name="actDefId" value="${actDefId}" class="inputText"/>
  285. </div>
  286. </form>
  287. </div>
  288. </div>
  289. </body>
  290. </html>