activitiInstance.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <div class="plg-tab-container">
  2. <div id="activitiInstance">
  3. <!-- <img id="bpmn"> -->
  4. <div id="activitiProcessInstanceDIV" style="height:600px;">
  5. <div id="activitiProcessInstance" ></div>
  6. </div>
  7. <form id="form1" style="display: none;margin-top: 10px;">
  8. <div class="layui-form-item">
  9. <div class="layui-input-block">
  10. <input type="text" value="删除原因"><input type="text" id="reason" name="reason" lay-verify="required" placeholder="必填" autocomplete="off" class="layui-input">
  11. </div>
  12. </div>
  13. </form>
  14. <!--实例详情-->
  15. <div id="test111" style="display: none;height: 100%;width: 100%;">
  16. <div id="AIdetailinfo" ></div>
  17. <div>
  18. <img id="png">
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <script type="text/javascript">
  24. (function($){
  25. var parent= $("#activitiInstance");
  26. var form=parent.find("#form1");
  27. //渲染流程实例信息页面
  28. var opts = {
  29. skin: "terrace",
  30. columns: [
  31. {id: "id",name: "状态",type: 'ro',width: 150,render:function(v,record){
  32. if(record.endTime == null || record.endTime ==''){
  33. return "进行中";
  34. }else{
  35. return "已完成";
  36. }
  37. }},
  38. {id: "id",name: "id",type: "txt",width: 150},
  39. {id: "name",name: "流程实例名称",type: "ro",width: 150},
  40. {id: "businessKey",name: "业务键",type: 'ro',width: 150},
  41. {id: "processDefinitionId",name: "流程定义id",type: 'ro',width: 150},
  42. {id: "processDefinitionName",name: "流程定义名称",type: 'ro',width: 150},
  43. {id: "processDefinitionKey",name: "流程定义key",type: 'ro',width: 150},
  44. {id: "processDefinitionVersion",name: "流程定义版本",type: 'ro',width: 150},
  45. {id: "startTime",name: "流程开始时间",type: 'ro',width: 150},
  46. {id: "endTime",name: "流程结束时间",type: 'ro',width: 150},
  47. {id: "deleteReason",name: "删除原因",type: 'ro',width: 150},
  48. {id: "description",name: "描述",type: 'ro',width: 150}
  49. ],
  50. imagePath: "/prologui/assets/PlgGrid",
  51. url: "/api/service-activiti/activiti/historyInstanceAll", //数据接口
  52. type: "get", //数据提交方式,默认为get
  53. params: {
  54. pageNum: 1,
  55. pageSize: 10,
  56. instanceName: null,
  57. status:null
  58. }, //查询提交参数,分页参数默认为pageNum,pageSize
  59. multiselect: false, //是否支持多选
  60. page: true, //是否启用分页
  61. toolbar:[
  62. {type:"button", name:"detailBtn", className: "normal", value:"<i class='layui-icon layui-icon-form'></i>详情"},{type: "newcolumn"},
  63. {type:"button", name:"downLoad", className: "normal", value:"<i class='layui-icon layui-icon-download-circle'></i>下载bpmn"},{type: "newcolumn"},
  64. {type:"button", name:"delBtn", className: "danger", value:"<i class='layui-icon layui-icon-delete'></i>删除"},{type: "newcolumn"},
  65. {type: "input", name: 'instanceName', label: '流程定义名称:', placeholder: '请输入流程定义名称', offsetLeft:10},{type: "newcolumn"},
  66. {type: "select", name: "status", label: "完成状态", options:[
  67. {value: "", text: ""},
  68. {value: "running", text: "未完成"},
  69. {value: "over", text: "已完成"}
  70. ], offsetLeft:10},{type: "newcolumn"},
  71. {type:"button", name:"searchBtn", value:"查询", offsetLeft:10 },{type: "newcolumn"}
  72. ],
  73. totalCount: "totalCount" //总记录数字段,默认totalCount
  74. }
  75. var activitiProcessInstance = new PlgGrid(opts);
  76. activitiProcessInstance.renderTo("activitiProcessInstance");
  77. activitiProcessInstance.loadData();
  78. activitiProcessInstance.attachToolBarEvent("onButtonClick", function(name){
  79. if(name == "delBtn"){
  80. delInstance();
  81. }else if(name == "detailBtn"){
  82. detail();
  83. }else if(name == "searchBtn"){
  84. search();
  85. }else if(name == "downLoad"){
  86. downLoadBPMN();
  87. }
  88. });
  89. function downLoadBPMN(){
  90. var processInstanceId = activitiProcessInstance.getSelectedRowId();
  91. if(!processInstanceId){
  92. layer.msg("请选择一条数据");
  93. return;
  94. }
  95. window.location.href = "/api/service-activiti/activiti/resource?modelId="+processInstanceId;
  96. // $.ajax({
  97. // url:"/api/service-activiti/activiti/resource?modelId="+processInstanceId,
  98. // type:"get",
  99. // success:function(res){
  100. // layer.msg("成功");
  101. // },
  102. // error:function(e){
  103. // layer.msg("error");
  104. // }
  105. // });
  106. }
  107. function delInstance(){
  108. var processInstanceId = activitiProcessInstance.getSelectedRowId();
  109. if(!processInstanceId){
  110. layer.msg("请选择一条数据");
  111. return;
  112. }
  113. layer.prompt({title: '请输入删除原因', formType: 2}, function(text, index){
  114. layer.close(index);
  115. $.ajax({
  116. type: 'POST',
  117. url: "/api/service-activiti/activiti/deleteInstance",
  118. data: {
  119. processInstanceId:processInstanceId,
  120. deleteReason:text
  121. },
  122. async: false,
  123. success: function(data) {
  124. layer.closeAll();
  125. activitiProcessInstance.reload();
  126. layer.msg(data.message);
  127. }
  128. });
  129. });
  130. }
  131. var detailOpt = {
  132. skin: "terrace",
  133. columns: [
  134. // {id: "taskDefinitionKey",name: "流程活动",type: "txt",width: 50},
  135. {id: "taskId",name: "id",type: "txt",width: 50},
  136. {id: "taskName",name: "流程活动名称",type: 'ro',width: 150},
  137. {id: "assignee",name: "流程活动定义的处理人",type: 'ro',width: 150},
  138. {id: "startTime",name: "开始时间",type: 'ro',width: 150},
  139. {id: "endTime",name: "结束时间",type: 'ro',width: 150},
  140. {id: "description",name: "描述",type: 'ro',width: '*'}
  141. ],
  142. imagePath: "/prologui/assets/PlgGrid",
  143. url: "/api/service-activiti/activiti/activityInstance", //数据接口
  144. type: "get", //数据提交方式,默认为get
  145. params: {
  146. instanceId:null
  147. }, //查询提交参数,分页参数默认为pageNum,pageSize
  148. multiselect: false, //是否支持多选
  149. page: true, //是否启用分页
  150. totalCount: "totalCount" //总记录数字段,默认totalCount
  151. }
  152. //双击
  153. activitiProcessInstance.on("onRowDblClicked",function(){
  154. detail();
  155. });
  156. //查看流程实例详情信息
  157. function detail(){
  158. var processInstanceId = activitiProcessInstance.getSelectedRowId();
  159. var detailForm = parent.find("#AIdetailinfo");
  160. if(!processInstanceId){
  161. layer.msg("请选择一条数据");
  162. return;
  163. }
  164. //获取png图片路径
  165. var png = null;
  166. $.ajax({
  167. type: 'get',
  168. url: "/api/service-activiti/activiti/png",
  169. data: {
  170. instanceId:processInstanceId,
  171. },
  172. async: false,
  173. success: function(data) {
  174. // alert(data.data);
  175. png = data.data;
  176. //$("#png").attr('src',"file://"+pngsrc);
  177. //$("#png").attr('src',"data:image/png;base64,"+png);
  178. }
  179. });
  180. layer.open({
  181. type:1,
  182. title: '详情页'
  183. ,content: `<div id="activitiInstance-alert-from" style="height:50%;"></div> <div id="png" style="display: inline-block; margin-top: 40px; width: 100%; height: 100%; overflow: auto;"><img id="activitipng" style="height:100%;"></div>`
  184. ,area: ['900px', '600px']
  185. ,anim: 2
  186. ,shadeClose: true
  187. ,success :function(index, layero){
  188. detailOpt.params={
  189. instanceId:processInstanceId
  190. }
  191. //console.log(index)
  192. var detailV9 = new PlgGrid(detailOpt);
  193. detailV9.renderTo("activitiInstance-alert-from");
  194. detailV9.loadData();
  195. //加载图片
  196. $("#activitipng").attr('src',"data:image/png;base64,"+png);
  197. },
  198. yes:function(index, layero){
  199. layer.close(index);
  200. }
  201. });
  202. }
  203. function downpng(){
  204. }
  205. function search(){
  206. // var instanceName = parent.find("#instanceName").val();
  207. // var am = activitiProcessInstance.getParams();
  208. // am.deployName = deployName;
  209. // activitiProcessInstance.loadData();
  210. var instanceName = $("input[name='instanceName']").val();
  211. var status = $("select[name='status']").val();
  212. var am = activitiProcessInstance.getParams();
  213. am.instanceName = instanceName;
  214. if(!(status == null || status == "")){
  215. am.status = status;
  216. }
  217. activitiProcessInstance.reload();
  218. }
  219. })($)
  220. </script>