bpmNodeScriptEdit_ie6.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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">
  13. var defId="${defId}";
  14. var currentTextarea=null;
  15. function showRequest(formData, jqForm, options) {
  16. return true;
  17. }
  18. $(function() {
  19. //Tab
  20. valid(showRequest,function(){});
  21. $("#tabScript").ligerTab({height:300});
  22. $("#btnSearch").click(save);
  23. $("textarea").click(function(){
  24. currentTextarea=this;
  25. });
  26. });
  27. function handFlowVars(obj,txtId){
  28. var val=$(obj).val();
  29. $(currentTextarea).append(val);
  30. }
  31. function slectVars(txtId){
  32. FlowVarWindow({defId:defId,callback:function(varKey,varName){
  33. $(currentTextarea).append(varKey);
  34. }});
  35. }
  36. function slectScript(txtId){
  37. ScriptDialog({callback:function(script){
  38. $(currentTextarea).append(script);
  39. }});
  40. }
  41. function 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. window.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. <div class="panel">
  71. <div class="panel-top">
  72. <div class="tbar-title">
  73. <span class="tbar-label">
  74. <c:choose>
  75. <c:when test="${nodeId==0}">
  76. 添加流程事件脚本
  77. </c:when>
  78. <c:otherwise>
  79. 流程事件脚本编辑
  80. </c:otherwise>
  81. </c:choose>
  82. </span>
  83. </div>
  84. <div class="panel-toolbar">
  85. <div class="toolBar">
  86. <div class="group"><a class="link save" id="btnSearch"><span></span>保存</a></div>
  87. <div class="l-bar-separator"></div>
  88. <div class="group"><a class="link del" onclick="window.close()"><span></span>关闭</a></div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="panel-body">
  93. <form id="bpmNodeScriptForm" method="post" action="save.ht">
  94. <c:if test="${type eq 'startEvent' || type eq 'subProcess' }">
  95. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  96. <tr>
  97. <th width="20%">说明:<span class="required">*</span> </th>
  98. <td>
  99. 该脚本在流程启动时执行,用户可以使用<span class="red">execution</span>做操作。
  100. 例如设置流程变量:execution.setVariable("total", 100);
  101. <input type="hidden" name="scriptType" value="1" class="inputText"/>
  102. </td>
  103. </tr>
  104. <tr>
  105. <th width="20%" >脚本:<span class="required">*</span> </th>
  106. <td>
  107. <div>
  108. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('startScript')">常用脚本</a>
  109. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'startScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  110. </div>
  111. <textarea id="startScript" name="script" rows="10" cols="80" >${preModel.script}</textarea>
  112. </td>
  113. </tr>
  114. </table>
  115. </c:if>
  116. <c:if test="${type eq 'endEvent' || type eq 'subProcess'}">
  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" rows="10" cols="80" >${afterModel.script}</textarea>
  134. </td>
  135. </tr>
  136. </table>
  137. </c:if>
  138. <c:if test="${type eq 'script' }">
  139. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" style='${type eq "script"?'display:':'display:none'}'>
  140. <tr>
  141. <th width="20%">脚本描述:<span class="required">*</span> </th>
  142. <td>
  143. 这个在脚本任务触发时执行,用户可以使用<span class="red">execution</span>做操作。
  144. 例如设置流程变量:execution.setVariable("total", 100);
  145. <input type="hidden" name="scriptType" value="3" />
  146. </td>
  147. </tr>
  148. <tr>
  149. <th width="20%" >脚本节点:<span class="required">*</span> </th>
  150. <td>
  151. <div>
  152. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('scriptScript')">常用脚本</a>
  153. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'scriptScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  154. </div>
  155. <textarea id="scriptScript" name="script" rows="10" cols="80" >${scrptModel.script}</textarea>
  156. </td>
  157. </tr>
  158. </table>
  159. </c:if>
  160. <c:if test="${type=='multiUserTask'||type=='userTask' }">
  161. <div id="tabScript" >
  162. <div tabid="startScript" title="前置脚本">
  163. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  164. <tr>
  165. <th width="20%">脚本描述:<span class="required">*</span> </th>
  166. <td>
  167. 该事件在<span class="red">启动该任务</span>时执行,用户可以使用<span class="red">task</span>做操作。
  168. 例如设置流程变量:task.setVariable("total", 100);
  169. <input type="hidden" name="scriptType" value="1" />
  170. </td>
  171. </tr>
  172. <tr>
  173. <th width="20%" >脚本:<span class="required">*</span> </th>
  174. <td>
  175. <div>
  176. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('preScript')">常用脚本</a>
  177. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'preScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  178. </div>
  179. <textarea id="preScript" name="script" rows="10" cols="80" >${preModel.script}</textarea>
  180. </td>
  181. </tr>
  182. </table>
  183. </div>
  184. <div tabid="endScript" title="后置脚本" >
  185. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  186. <tr>
  187. <th width="20%">脚本描述:<span class="required">*</span> </th>
  188. <td>
  189. 该事件在<span class="red">任务完成</span>时执行,用户可以使用<span class="red">task</span>做操作。
  190. 例如设置流程变量:task.setVariable("total", 100);
  191. <input type="hidden" name="scriptType" value="2" />
  192. </td>
  193. </tr>
  194. <tr>
  195. <th width="20%">脚本:<span class="required">*</span> </th>
  196. <td>
  197. <div>
  198. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('afterScript')">常用脚本</a>
  199. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'afterScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  200. </div>
  201. <textarea id="afterScript" name="script" rows="10" cols="80" >${afterModel.script}</textarea>
  202. </td>
  203. </tr>
  204. </table>
  205. </div>
  206. <div tabid="assignScript" title="分配脚本" >
  207. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  208. <tr>
  209. <th width="20%">脚本描述:<span class="required">*</span> </th>
  210. <td>
  211. 该事件在任务<span class="red">设置执行人</span>时执行,用户可以使用<span class="red">task</span>做操作。
  212. 例如设置流程变量:task.setVariable("total", 100);
  213. <input type="hidden" name="scriptType" value="4" class="inputText"/>
  214. </td>
  215. </tr>
  216. <tr>
  217. <th width="20%">脚本:<span class="required">*</span> </th>
  218. <td>
  219. <div>
  220. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript('assignScript')">常用脚本</a>
  221. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this,'assignScript')" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  222. </div>
  223. <textarea id="assignScript" name="script" rows="10" cols="80" >${assignModel.script}</textarea>
  224. </td>
  225. </tr>
  226. </table>
  227. </div>
  228. </div>
  229. </c:if>
  230. <c:if test="${type eq 'signExecute'}">
  231. <!-- 会签执行事件脚本 -->
  232. <div id="signExecuteScript" title="会签执行事件脚本">
  233. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  234. <tr>
  235. <th width="20%">说明:<span class="required">*</span> </th>
  236. <td>
  237. 该脚本在判断会签是否结束时执行,用户可以使用<span class="red">execution</span>做操作。
  238. 例如设置流程变量:execution.setVariable("total", 100);
  239. 也可以使用isCompleted判断会签是否结束;
  240. <input type="hidden" name="scriptType" value="5" class="inputText"/>
  241. </td>
  242. </tr>
  243. <tr>
  244. <th width="20%" >脚本:<span class="required">*</span> </th>
  245. <td>
  246. <div>
  247. <a href="javascript:;" class="link var" title="常用脚本" onclick="slectScript()">常用脚本</a>
  248. 表单变量:<f:flowVar defId="${defId}" change="handFlowVars(this)" controlName="selFlowVar" parentActDefId="${parentActDefId}"></f:flowVar>
  249. </div>
  250. <textarea id="signExecuteScript" name="script" codemirror="true" mirrorheight="200px" rows="10" cols="80" >${signScriptModel.script}</textarea>
  251. </td>
  252. </tr>
  253. </table>
  254. </div>
  255. </c:if>
  256. <input type="hidden" id="nodeId" name="nodeId" value="${nodeId}" class="inputText"/>
  257. <input type="hidden" id="actDefId" name="actDefId" value="${actDefId}" class="inputText"/>
  258. </form>
  259. </div>
  260. </div>
  261. </body>
  262. </html>