flowJs.jsp 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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.showImage('"+row.chart+"')\">查看流程图</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+"')\"></a>";
  47. html += '</div>';
  48. return html;
  49. }
  50. }
  51. ],
  52. onDblClickRow: function (row) {
  53. me.editorDialog(row.id);
  54. }
  55. });
  56. },
  57. bindEvents: function () {
  58. var me = this;
  59. $('#div_new_record').click(function () {
  60. me.editorDialog();
  61. });
  62. $("#statusName").ligerComboBox({data : [{"value":"全部","code":""},{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
  63. cancelable:false,
  64. onSuccess:function(data){
  65. }});
  66. $(".l-text").css("display","inline-block");
  67. $(".l-text-wrapper").css("display","inline-block");
  68. //查看流程图
  69. // $('#assignmentDataGrid').on('click','.flowChart-btn',function () {
  70. // var imgurl=$(this).data("flowimg");
  71. // var ImgObj = new Image(); //判断图片是否存在
  72. // if(!Util.isStrEmpty(imgurl)){
  73. // ImgObj.src = imgurl;
  74. // }else{
  75. // jJKZL.Tips.success("当前暂无流程图!");
  76. // return false;
  77. // }
  78. // //没有图片,则返回-1
  79. // $("#div_flow_chart").attr("src","../../.."+$(this).data("flowimg"));
  80. // jJKZL.popUp({popUpId: "flowChartCornPup", title: "查看流程图", width: "800px", ok: function () {
  81. // }});
  82. // });
  83. },
  84. delete:function(id){
  85. var message = "流程删除后无法恢复,是否确认删除?";
  86. jQuery.ligerDialog.confirm(message, function (confirm) {
  87. if (confirm)
  88. {
  89. $.ajax({ //ajax处理
  90. type: "POST",
  91. url : "${contextRoot}/flow/deleteFlow",
  92. dataType : "json",
  93. data:{id:id},
  94. cache:false,
  95. success :function(data){
  96. if(data.successFlg) {
  97. $.ligerDialog.success(data.message);
  98. flow.grid.reload();
  99. }
  100. else{
  101. $.ligerDialog.error(data.message);
  102. }
  103. },
  104. error :function(data){
  105. $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
  106. }
  107. });
  108. }
  109. });
  110. },
  111. //刷新列表数据
  112. reloadGrid: function () {
  113. this.grid.set({
  114. parms: {name: $('#txtName').val(),status:$('#statusName_val').val()}
  115. });
  116. this.grid.reload();
  117. },
  118. //编辑弹窗
  119. editorDialog: function (id) {
  120. var me = this;
  121. var title = "新增流程";
  122. var params = null;
  123. if (id != undefined && id != null) {
  124. title = "编辑流程";
  125. params = {"id": id};
  126. }
  127. me.dialog = $.ligerDialog.open({
  128. height: 800,
  129. width: 800,
  130. title: title,
  131. url: '${contextRoot}/flow/editorFlow',
  132. //load: true,
  133. urlParms: params
  134. });
  135. },
  136. showImage: function (chart) {
  137. var me = this;
  138. var title = "流程图";
  139. debugger
  140. var url = "${contextRoot}"+"/"+chart;
  141. $("#divedit").show();
  142. $("#divImg").attr("src",url);
  143. me.dialog = $.ligerDialog.open({
  144. height: 500,
  145. width: 500,
  146. target:$("#divedit"),
  147. title: title
  148. });
  149. },
  150. anthorize: function (id) {
  151. },
  152. //弹窗返回
  153. dialogSuccess: function (message) {
  154. $.ligerDialog.success(message);
  155. flow.reloadGrid();
  156. flow.dialog.close();
  157. }
  158. };
  159. $(function () {
  160. flow.init();
  161. });
  162. </script>