taskApprovalItemsEdit.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <%--
  2. time:2012-03-16 10:53:20
  3. desc:edit the 常用语管理
  4. --%>
  5. <%@page language="java" pageEncoding="UTF-8" %>
  6. <%@include file="/commons/include/html_doctype.html"%>
  7. <html>
  8. <head>
  9. <%@include file="/commons/include/form.jsp" %>
  10. <title>编辑 常用语</title>
  11. <script type="text/javascript" src="${ctx}/servlet/ValidJs?form=taskApprovalItems"></script>
  12. <script type="text/javascript">
  13. var isAdmin='${isAdmin}';
  14. $(function(){
  15. //点击返回
  16. $("a.back").click(function(){
  17. location.href='list.ht?isAdmin='+isAdmin;
  18. })
  19. //TaskReminder form Edit Layout
  20. tab=$("#reminder-div-tab").ligerTab({
  21. });
  22. })
  23. function save(){
  24. //获取那个是选择的tab
  25. var id=tab.getSelectedTabItemID();
  26. var selectDiv=$("div[tabid='"+id+"']");
  27. var type=$("#type",selectDiv).val();
  28. var approvalItem=$("#approvalItem",selectDiv).val();
  29. var flowTypeId,defKey;
  30. if(type==2){
  31. var aryTypeId = [];
  32. $("span[id^='type_']",selectDiv).each(function (i,ch){
  33. aryTypeId.push($(ch).attr("typeId"));
  34. });
  35. flowTypeId=aryTypeId.join(",");
  36. }else if(type==3){
  37. var aryDefKey = [];
  38. $("span[id^='ref_']",selectDiv).each(function (i,ch){
  39. aryDefKey.push($(ch).attr("referKey"));
  40. });
  41. defKey=aryDefKey.join(",");
  42. }
  43. var param={type:type,approvalItem:approvalItem,flowTypeId:flowTypeId,defKey:defKey}
  44. var url=__ctx+"/platform/bpm/taskApprovalItems/save.ht";
  45. $.post(url,param,function(msg){
  46. var obj=new com.hotent.form.ResultMessage(msg);
  47. if(obj.isSuccess()){
  48. $.ligerDialog.confirm('操作成功,继续操作吗?','提示',function(rtn){
  49. if(!rtn){
  50. location.href='list.ht?isAdmin='+isAdmin;
  51. }
  52. else{
  53. location.href=location.href.getNewUrl();
  54. }
  55. });
  56. }else{
  57. $.ligerDialog.err("提示信息","常用语保存失败!",obj.getMessage());
  58. }
  59. });
  60. }
  61. function referDefinition(){
  62. var url=__ctx +'/platform/bpm/bpmDefinition/defReferSelector.ht?defId=${bpmDefinition.defId}';
  63. referDef = $.ligerDialog.open({
  64. title:'选择流程',
  65. mask:true,
  66. isResize:true,
  67. height: 500,
  68. url:url,
  69. width:700,
  70. buttons:[
  71. { text: '确定', onclick: function (item, dialog) {
  72. var contents=$("iframe",dialog.dialog).contents()
  73. var chKeys=contents.find("input.pk[name=defKey]:checked");
  74. var defId=contents.find("#bpmDefId").val();
  75. var aryDefKey = [];
  76. var json={};
  77. var defKeyTemp,subjectTmep,spanHtml='';
  78. $.each(chKeys,function(i,ch){
  79. aryDefKey.push($(ch).val());
  80. json[$(ch).val()]=$(ch).attr("defSubject");
  81. });
  82. var defKeyJson=$("input#refDefKey").val();
  83. if(defKeyJson){
  84. //处理先选择的数据和以前的数据是否有重复,去除重复
  85. var jsontemp=JSON2.parse(defKeyJson);
  86. for(var i in jsontemp){
  87. //console.info(jsontemp[i]);
  88. for(var j in json){
  89. if(i!=j){
  90. json[i]=jsontemp[i];
  91. }
  92. }
  93. }
  94. }
  95. for(var k in json){
  96. spanHtml=spanHtml+"<span id='ref_"+k+"' referKey="+k+">"+json[k]+"<a href='javascript:void(0);' onclick='delRefer(\""+k+"\")'>删除</a>&nbsp;&nbsp;&nbsp;&nbsp;</span>"
  97. }
  98. if(aryDefKey.length > 0){
  99. $("span#refDefArray").html(spanHtml);
  100. $("input#refDefKey").val(JSON2.stringify(json));
  101. dialog.close();
  102. }else{
  103. $.ligerDialog.warn('请选择引用流程!','提示');
  104. }
  105. }
  106. },
  107. { text: '取消', onclick: function (item, dialog) { dialog.close(); } }
  108. ]});
  109. };
  110. function delRefer(refKey){
  111. $('#ref_'+refKey).remove();
  112. var jsonTemp=$("input#refDefKey").val();
  113. var json=JSON2.parse(jsonTemp);
  114. //删除json对应的数据
  115. delete json[refKey];
  116. $("input#refDefKey").val(JSON2.stringify(json));
  117. }
  118. function flowTypeSelector(){
  119. var url=__ctx +'/platform/system/globalType/flowTypeSelector.ht';
  120. referDef = $.ligerDialog.open({
  121. title:'选择流程分类',
  122. mask:true,
  123. isResize:true,
  124. height: 500,
  125. url:url,
  126. width:700,
  127. buttons:[
  128. { text: '确定', onclick: function (item, dialog) {
  129. var contents=$("iframe",dialog.dialog).contents()
  130. var chIds=contents.find("input.pk[name=typeId]:checked");
  131. var arytypeId = [];
  132. var json={};
  133. var typeIdTemp,subjectTmep,spanHtml='';
  134. $.each(chIds,function(i,ch){
  135. arytypeId.push($(ch).val());
  136. json[$(ch).val()]=$(ch).attr("defSubject");
  137. });
  138. var flowJson=$("input#refFlowKey").val();
  139. if(flowJson){
  140. //处理先选择的数据和以前的数据是否有重复,去除重复
  141. var jsontemp=JSON2.parse(flowJson);
  142. for(var i in jsontemp){
  143. //console.info(jsontemp[i]);
  144. for(var j in json){
  145. if(i!=j){
  146. json[i]=jsontemp[i];
  147. }
  148. }
  149. }
  150. }
  151. for(var k in json){
  152. spanHtml=spanHtml+"<span id='type_"+k+"' typeId="+k+">"+json[k]+"<a href='javascript:void(0);' onclick='delType(\""+k+"\")'>删除</a>&nbsp;&nbsp;&nbsp;&nbsp;</span>"
  153. }
  154. if(arytypeId.length > 0){
  155. $("span#flowTypeArray").html(spanHtml);
  156. $("input#refFlowKey").val(JSON2.stringify(json));
  157. dialog.close();
  158. }else{
  159. $.ligerDialog.warn('请选择流程分类!','提示');
  160. }
  161. }
  162. },
  163. { text: '取消', onclick: function (item, dialog) { dialog.close(); } }
  164. ]});
  165. }
  166. //删除流程分类
  167. function delType(typeId){
  168. $('#type_'+typeId).remove();
  169. var jsonTemp=$("input#refFlowKey").val();
  170. var json=JSON2.parse(jsonTemp);
  171. //删除json对应的数据
  172. delete json[typeId];
  173. $("input#refFlowKey").val(JSON2.stringify(json));
  174. }
  175. </script>
  176. </head>
  177. <body>
  178. <div class="panel">
  179. <div class="panel-top">
  180. <div class="tbar-title">
  181. <span class="tbar-label">设置常用语</span>
  182. </div>
  183. <div class="panel-toolbar">
  184. <div class="toolBar">
  185. <div class="group"><a class="link save" id="dataFormSave" onclick="save()"><span></span>保存</a></div>
  186. <div class="l-bar-separator"></div>
  187. <div class="group"><a class="link back" href="javascript:;"><span></span>返回</a></div>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="panel-body">
  192. <div class="reminder-layout" id="reminder-layout">
  193. <div class="reminder-edit" position="center">
  194. <div style="height:570px;overflow: auto;">
  195. <form id="taskApprovalItems" method="post" action="save.ht">
  196. <div class="reminder-div" >
  197. <div class="reminder-div-tab" id="reminder-div-tab">
  198. <c:choose>
  199. <c:when test="${isAdmin==1}">
  200. <div class="reminder-div-all" title="全局设置" >
  201. <input type="hidden" name="type" id="type" value="1"/>
  202. <div class="panel-detail">
  203. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  204. <tr>
  205. <th width="20%">常用语: </th>
  206. <td>
  207. <textarea rows="5" cols="60" id="approvalItem" name="approvalItem"
  208. style="margin-top: 5px;margin-bottom: 5px;">${taskApprovalItems.expression}</textarea>
  209. <div class="tipbox"><a class="tipinfo"><span>一行就是一条常用语</span></a></div>
  210. </td>
  211. </tr>
  212. </table>
  213. </div>
  214. </div>
  215. <div class="reminder-div-flow-type" title="根据流程分类设置" >
  216. <input type="hidden" name="type" id="type" value="2"/>
  217. <div class="panel-detail">
  218. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  219. <tr id="trFlowType">
  220. <th width="20%">流程分类: </th>
  221. <td>
  222. <div id="flowTypeDiv">
  223. <%-- <select id="flowType" name="flowType">
  224. <option value="">-请选择-</option>
  225. <c:forEach items="${globalTypeList}" var="globalType">
  226. <c:choose>
  227. <c:when test="${globalType.typeId==taskApprovalItems.typeId }">
  228. <option value="${globalType.typeId}" selected="selected">${globalType.typeName }</option>
  229. </c:when>
  230. <c:otherwise>
  231. <option value="${globalType.typeId }">${globalType.typeName}</option>
  232. </c:otherwise>
  233. </c:choose>
  234. </c:forEach>
  235. </select> --%>
  236. <input type="hidden" id="refFlowKey" name="refFlowKey"/>
  237. <span id="flowTypeArray">
  238. </span>
  239. <a class="link search" href="javascript:void(0);" onclick="flowTypeSelector()">选择流程分类</a>
  240. </div>
  241. </td>
  242. </tr>
  243. <tr>
  244. <th width="20%">常用语: </th>
  245. <td>
  246. <textarea rows="5" cols="60" id="approvalItem" name="approvalItem"
  247. style="margin-top: 5px;margin-bottom: 5px;">${taskApprovalItems.expression}</textarea>
  248. <div class="tipbox"><a class="tipinfo"><span>一行就是一条常用语</span></a></div>
  249. </td>
  250. </tr>
  251. </table>
  252. </div>
  253. </div>
  254. <div class="reminder-div-flow" title="根据流程设置" >
  255. <input type="hidden" name="type" id="type" value="3"/>
  256. <div class="panel-detail">
  257. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  258. <tr>
  259. <th width="20%">流程定义:</th>
  260. <td >
  261. <input type="hidden" id="refDefKey" name="refDefKey"/>
  262. <span id="refDefArray">
  263. </span>
  264. <a class="link search" href="javascript:void(0);" onclick="referDefinition()">选择流程</a>
  265. </td>
  266. </tr>
  267. <tr>
  268. <th width="20%">常用语: </th>
  269. <td>
  270. <textarea rows="5" cols="60" id="approvalItem" name="approvalItem"
  271. style="margin-top: 5px;margin-bottom: 5px;">${taskApprovalItems.expression}</textarea>
  272. <div class="tipbox"><a class="tipinfo"><span>一行就是一条常用语</span></a></div>
  273. </td>
  274. </tr>
  275. </table>
  276. </div>
  277. </div>
  278. </c:when>
  279. <c:when test="${isAdmin==0}">
  280. <div class="reminder-div-all" title="个人常用语设置" >
  281. <input type="hidden" name="type" id="type" value="4"/>
  282. <div class="panel-detail">
  283. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  284. <tr>
  285. <th width="20%">常用语: </th>
  286. <td>
  287. <textarea rows="5" cols="60" id="approvalItem" name="approvalItem"
  288. style="margin-top: 5px;margin-bottom: 5px;">${taskApprovalItems.expression}</textarea>
  289. <div class="tipbox"><a class="tipinfo"><span>一行就是一条常用语</span></a></div>
  290. </td>
  291. </tr>
  292. </table>
  293. </div>
  294. </div>
  295. </c:when>
  296. </c:choose>
  297. </div>
  298. </div>
  299. </form>
  300. </div>
  301. </div>
  302. </div>
  303. </div>
  304. </body>
  305. </html>