flowJs.jsp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
  2. <%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
  3. <script>
  4. /* *************************** 模块初始化 ***************************** */
  5. var flow = {
  6. grid: null,
  7. $searchStatusName: $('#status'),//转台文本匡对象
  8. $searchBtn: $('.l-trigger-search'),//搜索按钮
  9. dialog: null,
  10. init: function () {
  11. this.bindEvents();
  12. this.initForm();
  13. },
  14. initForm: function () {
  15. var me = this;
  16. $('.m-retrieve-area').show();
  17. $("#txtName").ligerSearch({
  18. onClick:function(value){
  19. me.reloadGrid();
  20. }});
  21. var flowValid = liger.get("statusName").value;
  22. if(flowValid ==undefined || flowValid ==null || flowValid.length<=0){
  23. liger.get("statusName").selectValue("");
  24. }
  25. me.grid = $("#div_grid").ligerGrid({
  26. url: '${contextRoot}/flow/getFlowList',
  27. parms: {
  28. name: $('#txtName').val(),
  29. valid:flowValid
  30. },
  31. columns: [
  32. {display: '流程名称', id: 'id', name: 'name', width: '20%'},
  33. {display: '文件类型', id: 'fileType', name: 'fileType', width: '20%'},
  34. {display: '状态', name: 'valid', width: '20%',align: 'center', render: function (rowdata, rowindex, value) {
  35. if(rowdata.valid==1 ){
  36. return ' <div style="vertical-align:middle;margin-top: 10px;"><span>有效 </span></div>';
  37. }else if(rowdata.valid==0){
  38. return ' <div style="222;margin-top: 10px;"><span>无效 </span></div>';
  39. }
  40. }},
  41. {
  42. display: '操作', name: 'operator', width: '40%', render: function (row) {
  43. var html = '<div class="m-inline-buttons" style="width:350px;vertical-align:middle;">';
  44. html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"flow.showFlow('"+row.id+"')\">查看流程图</a>";
  45. html += "<a class=\"m-btn-edit\" onclick=\"flow.editorDialog('"+row.id+"')\"></a>";
  46. html += "<a class=\"m-btn-delete\" onclick=\"flow.delete('"+row.id+"','"+row.chart+"')\"></a>";
  47. html += '</div>';
  48. return html;
  49. }
  50. }
  51. ],
  52. onDblClickRow: function (row) {
  53. me.editorDialog(row.id);
  54. }
  55. });
  56. },
  57. showFlow:function (id) {
  58. indexPage.openChildPage("",'${contextRoot}/process/initial?flowId='+id);
  59. },
  60. bindEvents: function () {
  61. var me = this;
  62. var flag = false;
  63. $('#div_new_record').click(function () {
  64. me.editorDialog();
  65. });
  66. $("#statusName").ligerComboBox({data : [{"value":"全部","code":""},{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
  67. cancelable:false,
  68. onSelected: function (value)
  69. {
  70. if (flag) {
  71. me.reloadGrid();
  72. } else {
  73. flag = true;
  74. }
  75. },
  76. onSuccess:function(data){
  77. }});
  78. $(".l-text").css("display","inline-block");
  79. $(".l-text-wrapper").css("display","inline-block");
  80. //查看流程图
  81. // $('#assignmentDataGrid').on('click','.flowChart-btn',function () {
  82. // var imgurl=$(this).data("flowimg");
  83. // var ImgObj = new Image(); //判断图片是否存在
  84. // if(!Util.isStrEmpty(imgurl)){
  85. // ImgObj.src = imgurl;
  86. // }else{
  87. // jJKZL.Tips.success("当前暂无流程图!");
  88. // return false;
  89. // }
  90. // //没有图片,则返回-1
  91. // $("#div_flow_chart").attr("src","../../.."+$(this).data("flowimg"));
  92. // jJKZL.popUp({popUpId: "flowChartCornPup", title: "查看流程图", width: "800px", ok: function () {
  93. // }});
  94. // });
  95. },
  96. delete:function(id,chart){
  97. var message = "流程删除后无法恢复,是否确认删除?";
  98. jQuery.ligerDialog.confirm(message, function (confirm) {
  99. if (confirm)
  100. {
  101. _deleteFileAfterUpdate(chart);
  102. $.ajax({ //ajax处理
  103. type: "POST",
  104. url : "${contextRoot}/flow/deleteFlow",
  105. dataType : "json",
  106. data:{id:id},
  107. cache:false,
  108. success :function(data){
  109. if(data.successFlg) {
  110. $.ligerDialog.success(data.message);
  111. flow.grid.reload();
  112. }
  113. else{
  114. $.ligerDialog.error(data.message);
  115. }
  116. },
  117. error :function(data){
  118. $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
  119. }
  120. });
  121. }
  122. });
  123. },
  124. //刷新列表数据
  125. reloadGrid: function () {
  126. this.grid.set({
  127. parms: {name: $('#txtName').val(),valid:$('#statusName_val').val()}
  128. });
  129. this.grid.reload();
  130. },
  131. //编辑弹窗
  132. editorDialog: function (id) {
  133. var me = this;
  134. var title = "新增流程";
  135. var params = null;
  136. if (id != undefined && id != null) {
  137. title = "编辑流程";
  138. params = {"id": id};
  139. }
  140. me.dialog = $.ligerDialog.open({
  141. height: 800,
  142. width: 800,
  143. title: title,
  144. url: '${contextRoot}/flow/editorFlow',
  145. //load: true,
  146. urlParms: params
  147. });
  148. },
  149. showImage: function (chart) {
  150. var me = this;
  151. var title = "流程图";
  152. var url = chart;
  153. $("#divedit").show();
  154. $("#divImg").attr("src",url);
  155. me.dialog = $.ligerDialog.open({
  156. height: 500,
  157. width: 500,
  158. target:$("#divedit"),
  159. title: title
  160. });
  161. },
  162. anthorize: function (id) {
  163. },
  164. //弹窗返回
  165. dialogSuccess: function (message) {
  166. $.ligerDialog.success(message);
  167. flow.reloadGrid();
  168. flow.dialog.close();
  169. }
  170. };
  171. //删除旧文件
  172. function _deleteFileAfterUpdate(fileId){
  173. if(null == fileId || fileId.length == 0){
  174. return;
  175. }
  176. var url = "${dfs}/" + fileId;
  177. $.ajax({
  178. url: url,
  179. type: 'DELETE',
  180. async: false,
  181. success: function(){
  182. console.log("旧文件删除成功");
  183. }
  184. });
  185. }
  186. $(function () {
  187. flow.init();
  188. });
  189. </script>