Commit f958137dd1aae184728fd0a4653a7ac78c7e555f

Authored by yunlong.li
1 parent bab046f1

完善工作流模型。工作流定义

Showing 20 changed files with 445 additions and 79 deletions
sql/ruoyi-vue-pro.sql
... ... @@ -1194,6 +1194,10 @@ INSERT INTO `sys_menu` VALUES (1122, '请假申请删除', 'oa:leave:delete', 3,
1194 1194 INSERT INTO `sys_menu` VALUES (1123, '请假申请导出', 'oa:leave:export', 3, 5, 1118, '', '', '', 0, '', '2021-09-20 08:51:03', '', '2021-09-20 08:51:03', b'0');
1195 1195 INSERT INTO `sys_menu` VALUES (1124, '待办请假', '', 2, 2, 5, 'todo', 'edit', 'oa/todo/index', 0, '1', '2021-09-20 22:10:09', '1', '2021-09-21 23:17:12', b'0');
1196 1196 INSERT INTO `sys_menu` VALUES (1125, '已办请假', '', 2, 3, 5, 'flow', 'form', 'oa/flow/index', 0, '1', '2021-10-23 22:10:09', '1', '2021-10-23 23:17:12', b'0');
  1197 +INSERT INTO `sys_menu` VALUES (1128, '工作流程定义', '', 2, 2, 1126, 'processDefinition/index', '#', 'bpm/processDefinition/index', 0, '1', '2021-11-19 11:18:38', '1', '2021-11-19 11:18:38', b'0');
  1198 +INSERT INTO `sys_menu` VALUES (1127, '工作流设计', '', 2, 1, 1126, 'model/index', '#', 'bpm/model/index', 0, '1', '2021-11-19 10:59:36', '1', '2021-11-19 11:01:59', b'0');
  1199 +INSERT INTO `sys_menu` VALUES (1126, '工作流管理', '', 1, 5, 0, '/bpm', 'tree-table', NULL, 0, '1', '2021-11-19 10:57:49', '1', '2021-11-19 11:05:05', b'0');
  1200 +
1197 1201 COMMIT;
1198 1202  
1199 1203 -- ----------------------------
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/workflow/ProcessDefinitionController.java
1 1 package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow;
2 2  
  3 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp;
  4 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionPageReqVo;
  5 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionRespVO;
  6 +import cn.iocoder.yudao.adminserver.modules.bpm.service.workflow.BpmProcessDefinitionService;
3 7 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  8 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  9 +import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
  10 +import io.swagger.annotations.ApiOperation;
4 11 import org.activiti.api.process.runtime.ProcessRuntime;
5 12 import org.activiti.engine.RepositoryService;
6 13 import org.springframework.web.bind.annotation.GetMapping;
... ... @@ -9,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestParam;
9 16 import org.springframework.web.bind.annotation.RestController;
10 17  
11 18 import javax.annotation.Resource;
  19 +import javax.servlet.http.HttpServletResponse;
  20 +import java.io.IOException;
12 21  
13 22 // TODO @json:swagger 和 validation 的注解,后续要补全下哈。可以等 workflow 基本写的差不多之后
14 23 @RestController
... ... @@ -20,15 +29,30 @@ public class ProcessDefinitionController {
20 29  
21 30 @Resource
22 31 private ProcessRuntime processRuntime;
  32 + @Resource
  33 + private BpmProcessDefinitionService bpmProcessDefinitionService;
23 34  
24 35  
25 36 @GetMapping(value = "/getStartForm")
26 37 public CommonResult<String> getStartForm(@RequestParam("processKey") String processKey){
27   - //这样查似乎有问题??, 暂时写死
28 38 // final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().
29 39 // processDefinitionKey(processKey).latestVersion().singleResult();
30 40 // processRuntime.processDefinition(processDefinition.getId()).getFormKey();
  41 + //这样查似乎有问题??, 暂时写死
31 42 return CommonResult.success("/flow/leave/apply");
32 43 }
33 44  
  45 + @GetMapping ("/page")
  46 + @ApiOperation(value = "流程定义分页数据")
  47 + public CommonResult<PageResult<ProcessDefinitionRespVO>> pageList(ProcessDefinitionPageReqVo processDefinitionPageReqVo) {
  48 + return CommonResult.success(bpmProcessDefinitionService.pageList(processDefinitionPageReqVo));
  49 + }
  50 +
  51 + @GetMapping ("/export")
  52 + @ApiOperation(value = "流程定义的bpmnXml导出")
  53 + public void pageList(@RequestParam String processDefinitionId, HttpServletResponse response) throws IOException {
  54 + FileResp fileResp = bpmProcessDefinitionService.export(processDefinitionId);
  55 + ServletUtils.writeAttachment(response, fileResp.getFileName(), fileResp.getFileByte());
  56 + }
  57 +
34 58 }
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/workflow/vo/processdefinition/ProcessDefinitionPageReqVo.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +import lombok.ToString;
  9 +
  10 +/**
  11 + * @author yunlong.li
  12 + */
  13 +@Data
  14 +@ToString(callSuper = true)
  15 +@EqualsAndHashCode(callSuper = true)
  16 +@ApiModel("流程定义分页 Request VO")
  17 +public class ProcessDefinitionPageReqVo extends PageParam {
  18 + @ApiModelProperty("流程名字")
  19 + private String name;
  20 +}
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/workflow/vo/processdefinition/ProcessDefinitionRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import lombok.Data;
  5 +
  6 +/**
  7 + * @author yunlong.li
  8 + */
  9 +@Data
  10 +@ApiModel("流程定义数据返回 Request VO")
  11 +public class ProcessDefinitionRespVO {
  12 +
  13 + private String formKey;
  14 + private String id;
  15 + private String key;
  16 + private String name;
  17 + private Integer version;
  18 +}
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/workflow/ProcessDefinitionConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.convert.workflow;
  2 +
  3 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionRespVO;
  4 +import org.activiti.engine.repository.ProcessDefinition;
  5 +import org.mapstruct.Mapper;
  6 +import org.mapstruct.factory.Mappers;
  7 +
  8 +/**
  9 + * @author yunlong.li
  10 + */
  11 +@Mapper
  12 +public interface ProcessDefinitionConvert {
  13 + ProcessDefinitionConvert INSTANCE = Mappers.getMapper(ProcessDefinitionConvert.class);
  14 +
  15 + ProcessDefinitionRespVO convert(ProcessDefinition processDefinition);
  16 +
  17 +}
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/workflow/BpmProcessDefinitionService.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.service.workflow;
  2 +
  3 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp;
  4 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionPageReqVo;
  5 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionRespVO;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +
  8 +/**
  9 + * 流程定义接口
  10 + * @author yunlong.li
  11 + */
  12 +public interface BpmProcessDefinitionService {
  13 + /**
  14 + * 流程定义分页
  15 + * @param processDefinitionPageReqVo 分页入参
  16 + * @return 分页model
  17 + */
  18 + PageResult<ProcessDefinitionRespVO> pageList(ProcessDefinitionPageReqVo processDefinitionPageReqVo);
  19 +
  20 + /**
  21 + * 导出流程 bpmn 模型
  22 + * @param processDefinitionId 分页入参
  23 + * @return 分页model
  24 + */
  25 + FileResp export(String processDefinitionId);
  26 +}
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/workflow/impl/BpmProcessDefinitionServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.service.workflow.impl;
  2 +
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp;
  5 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionPageReqVo;
  6 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.processdefinition.ProcessDefinitionRespVO;
  7 +import cn.iocoder.yudao.adminserver.modules.bpm.convert.workflow.ProcessDefinitionConvert;
  8 +import cn.iocoder.yudao.adminserver.modules.bpm.service.workflow.BpmProcessDefinitionService;
  9 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  10 +import lombok.RequiredArgsConstructor;
  11 +import lombok.extern.slf4j.Slf4j;
  12 +import org.activiti.api.process.runtime.ProcessRuntime;
  13 +import org.activiti.bpmn.converter.BpmnXMLConverter;
  14 +import org.activiti.bpmn.model.BpmnModel;
  15 +import org.activiti.engine.RepositoryService;
  16 +import org.activiti.engine.repository.ProcessDefinition;
  17 +import org.activiti.engine.repository.ProcessDefinitionQuery;
  18 +import org.springframework.stereotype.Service;
  19 +
  20 +import java.util.List;
  21 +import java.util.stream.Collectors;
  22 +
  23 +/**
  24 + * 流程定义实现
  25 + * @author yunlongn
  26 + */
  27 +@Slf4j
  28 +@Service
  29 +@RequiredArgsConstructor
  30 +public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionService {
  31 +
  32 + private final RepositoryService repositoryService;
  33 +
  34 + private final ProcessRuntime processRuntime;
  35 +
  36 + @Override
  37 + public PageResult<ProcessDefinitionRespVO> pageList(ProcessDefinitionPageReqVo processDefinitionPageReqVo) {
  38 + ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
  39 + String likeName = processDefinitionPageReqVo.getName();
  40 + if (StrUtil.isNotBlank(likeName)){
  41 + processDefinitionQuery.processDefinitionNameLike("%"+likeName+"%");
  42 + }
  43 + List<ProcessDefinition> processDefinitions = processDefinitionQuery.orderByProcessDefinitionId().desc()
  44 + .listPage((processDefinitionPageReqVo.getPageNo() - 1) * processDefinitionPageReqVo.getPageSize(),
  45 + processDefinitionPageReqVo.getPageSize());
  46 + final List<ProcessDefinitionRespVO> respVOList = processDefinitions.stream()
  47 + .map(ProcessDefinitionConvert.INSTANCE::convert).collect(Collectors.toList());
  48 + return new PageResult<>(respVOList, processDefinitionQuery.count());
  49 + }
  50 +
  51 + @Override
  52 + public FileResp export(String processDefinitionId) {
  53 + BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
  54 + byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(bpmnModel);
  55 + FileResp fileResp = new FileResp();
  56 + fileResp.setFileName( "export");
  57 + fileResp.setFileByte(bpmnBytes);
  58 + return fileResp;
  59 + }
  60 +}
... ...
yudao-admin-ui/src/api/bpm/processDefinition.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +
  4 +export function page(query) {
  5 + return request({
  6 + url: '/workflow/process/definition/page',
  7 + method: 'get',
  8 + params: query
  9 + })
  10 +}
  11 +
  12 +export function exportProcessDefinition(query) {
  13 + return request({
  14 + url: '/workflow/process/definition/export?processDefinitionId='+query.id,
  15 + method: 'get'
  16 + })
  17 +}
... ...
yudao-admin-ui/src/components/bpmn/VueBpmn.vue
1 1 <template>
2   - <div class="">
  2 + <div class="bpmnclass">
3 3 <ImportDialog :dialogVisibleBool="importXmlShow" @closeShowXmlDialog="closeShowXmlDialog"></ImportDialog>
4 4 <el-row>
5 5 <el-col :span="24">
... ... @@ -28,25 +28,25 @@
28 28 </template>
29 29  
30 30 <script>
31   - import templateXml from "./data/template";
32   - import ImportDialog from "./dialog/ImportDialog";
33   - // import activitiCom from "../provider/activiti";
34   - // import BpmnModeler2 from 'bpmn-js/lib/Modeler';
35   - import BpmnModeler from 'jeeplus-bpmn/lib/Modeler'
36   - import customTranslate from "./data/translate/customTranslate";
37   - import VueHeader from "./Header";
38   - import BpmnPanel from "./panel/index";
39   - import activitiModule from './data/activiti.json'
40   - import flowableModule from './data/flowable.json'
41   - import './assets/css/vue-bmpn.css'
42   - import './assets/css/font-awesome.min.css'
  31 +import templateXml from "./data/template";
  32 +import ImportDialog from "./dialog/ImportDialog";
  33 +// import activitiCom from "../provider/activiti";
  34 +// import BpmnModeler2 from 'bpmn-js/lib/Modeler';
  35 +import BpmnModeler from 'jeeplus-bpmn/lib/Modeler'
  36 +import customTranslate from "./data/translate/customTranslate";
  37 +import VueHeader from "./Header";
  38 +import BpmnPanel from "./panel/index";
  39 +import activitiModule from './data/activiti.json'
  40 +import flowableModule from './data/flowable.json'
  41 +import './assets/css/vue-bmpn.css'
  42 +import './assets/css/font-awesome.min.css'
43 43  
44   - import 'bpmn-js/dist/assets/diagram-js.css'
45   - import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'
46   - import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
47   - import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
48   - import './assets/css/vue-bmpn.css'
49   - export default {
  44 +import 'bpmn-js/dist/assets/diagram-js.css'
  45 +import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'
  46 +import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
  47 +import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
  48 +
  49 +export default {
50 50 name: "VueBpmn",
51 51 data() {
52 52 return {
... ...
yudao-admin-ui/src/components/bpmn/assets/css/vue-bmpn.css
... ... @@ -31,25 +31,25 @@
31 31 .el-collapse-item__header{
32 32 padding-left: 15px;
33 33 }
34   -.djs-direct-editing-parent{
  34 +.bpmnclass .djs-direct-editing-parent{
35 35 /*display: none;*/
36 36 }
37   -.bpmn-panel {
  37 +.bpmnclass .bpmn-panel {
38 38 /*width: 370px;*/
39 39 border: 1px solid #eeeeee;
40 40 padding: 0 5px;
41 41 }
42   -.el-select--small{
  42 +.bpmnclass .el-select--small{
43 43 width: 100%;
44 44 }
45   -.el-dialog > .el-dialog__header{
46   - padding: 5px 20px ;
  45 +.bpmnclass > .is-fullscreen > .el-dialog__header:first-of-type{
  46 + padding: 0 ;
47 47 }
48   -.el-dialog > .el-dialog__body{
  48 +.bpmnclass .el-dialog > .el-dialog__body{
49 49 padding: 0px;
50   - margin: 0 20px;
51   - border: 1px solid #cccccc;
  50 + margin: 0 ;
  51 + /*border: 1px solid #cccccc;*/
52 52 }
53   -.default-undo{
  53 +.bpmnclass .default-undo{
54 54 color: #c0c4cc;
55 55 }
... ...
yudao-admin-ui/src/components/bpmn/dialog/ImportDialog.vue
... ... @@ -67,7 +67,5 @@ export default {
67 67 </script>
68 68  
69 69 <style scoped>
70   -/deep/.el-dialog > .el-dialog__header{
71   - padding: 24px 20px
72   -}
73   -</style>
74 70 \ No newline at end of file
  71 +
  72 +</style>
... ...
yudao-admin-ui/src/components/bpmn/panel/NodePropertyPanel.vue
... ... @@ -129,7 +129,8 @@
129 129 <script>
130 130 import EventListenerDialog from "./dialog/EventListenerDialog"
131 131 import UserSelectDialog from "./dialog/UserSelectDialog"
132   - export default {
  132 +
  133 +export default {
133 134 name: "NodePropertyPanel",
134 135 data() {
135 136 return {
... ... @@ -269,32 +270,32 @@ import UserSelectDialog from &quot;./dialog/UserSelectDialog&quot;
269 270 </script>
270 271  
271 272 <style scoped>
272   -.title span{
  273 +.bpmnclass .title span{
273 274 font-weight: bold;
274 275 margin-left: 5px;
275 276 }
276   -/deep/.el-select .el-input .el-select__caret{
  277 +.bpmnclass .el-select .el-input .el-select__caret{
277 278 margin-top: 5px;
278 279 }
279   -/deep/.el-input__icon{
  280 +.bpmnclass .el-input__icon{
280 281 height: 20px !important;
281 282 line-height: 20px !important;
282 283 }
283   -/deep/.el-input-group__append{
  284 +.bpmnclass .el-input-group__append{
284 285 padding: 0 5px !important;
285 286 }
286   -.icon-div{
  287 +.bpmnclass .icon-div{
287 288 font-size: 1.2em;
288 289 font-weight: bold !important;
289 290 width: 100%;
290 291 }
291   -.icon-div i{
  292 +.bpmnclass .icon-div i{
292 293 padding: 5px;
293 294 }
294   -.icon-div i:hover{
  295 +.bpmnclass .icon-div i:hover{
295 296 cursor:pointer;
296 297 }
297   -.ant-divider-vertical {
  298 +.bpmnclass .ant-divider-vertical {
298 299 position: relative;
299 300 top: -0.08em;
300 301 display: inline-block;
... ... @@ -303,7 +304,7 @@ import UserSelectDialog from &quot;./dialog/UserSelectDialog&quot;
303 304 /*margin: 0 8px;*/
304 305 vertical-align: middle;
305 306 }
306   -.ant-divider {
  307 +.bpmnclass .ant-divider {
307 308 box-sizing: border-box;
308 309 margin: 0;
309 310 padding: 0;
... ...
yudao-admin-ui/src/components/bpmn/panel/ProcessPropertyPanel.vue
... ... @@ -95,9 +95,10 @@
95 95 </template>
96 96  
97 97 <script>
98   - import GlobalEventListenerDialog from "./dialog/GlobalEventListenerDialog"
99   - import EventListenerDialog from "./dialog/EventListenerDialog"
100   - export default {
  98 +import GlobalEventListenerDialog from "./dialog/GlobalEventListenerDialog"
  99 +import EventListenerDialog from "./dialog/EventListenerDialog"
  100 +
  101 +export default {
101 102 name: "ProcessProperty",
102 103 data() {
103 104 return {
... ... @@ -232,7 +233,7 @@
232 233 </script>
233 234  
234 235 <style scoped>
235   -.title span{
  236 +.bpmnclass .title span{
236 237 font-weight: bold;
237 238 margin-left: 5px;
238 239 }
... ...
yudao-admin-ui/src/components/bpmn/panel/StartEventNodePropertyPanel.vue
... ... @@ -67,8 +67,8 @@
67 67  
68 68 <script>
69 69 import EventListenerDialog from "./dialog/EventListenerDialog"
70   -import GlobalEventListenerDialog from "./dialog/GlobalEventListenerDialog";
71   - export default {
  70 +
  71 +export default {
72 72 name: "NodePropertyPanel",
73 73 data() {
74 74 return {
... ... @@ -233,7 +233,7 @@ import GlobalEventListenerDialog from &quot;./dialog/GlobalEventListenerDialog&quot;;
233 233 </script>
234 234  
235 235 <style scoped>
236   -.title span{
  236 +.bpmnclass .title span{
237 237 font-weight: bold;
238 238 margin-left: 5px;
239 239 }
... ...
yudao-admin-ui/src/components/bpmn/panel/dialog/EventListenerDialog.vue
... ... @@ -115,7 +115,5 @@ export default {
115 115 </script>
116 116  
117 117 <style scoped>
118   -/deep/.el-dialog > .el-dialog__header{
119   - padding: 24px 20px
120   -}
  118 +
121 119 </style>
... ...
yudao-admin-ui/src/components/bpmn/panel/dialog/GlobalEventListenerDialog.vue
... ... @@ -111,7 +111,5 @@ export default {
111 111 </script>
112 112  
113 113 <style scoped>
114   -/deep/.el-dialog > .el-dialog__header{
115   - padding: 24px 20px
116   -}
  114 +
117 115 </style>
... ...
yudao-admin-ui/src/components/bpmn/panel/dialog/UserSelectDialog.vue
... ... @@ -167,7 +167,5 @@ export default {
167 167 </script>
168 168  
169 169 <style scoped>
170   -/deep/.el-dialog > .el-dialog__header{
171   - padding: 24px 20px
172   -}
173   -</style>
174 170 \ No newline at end of file
  171 +
  172 +</style>
... ...
yudao-admin-ui/src/router/index.js
1 1 import Vue from 'vue'
2 2 import Router from 'vue-router'
3   -
4   -Vue.use(Router)
5   -
6 3 /* Layout */
7 4 import Layout from '@/layout'
8   -import ParentView from '@/components/ParentView';
  5 +
  6 +Vue.use(Router)
9 7  
10 8 /**
11 9 * Note: 路由配置项
... ... @@ -99,19 +97,6 @@ export const constantRoutes = [
99 97 ]
100 98 },
101 99 {
102   - path: '/bpmn',
103   - component: Layout,
104   - hidden: true,
105   - children: [
106   - {
107   - path: 'model',
108   - component: (resolve) => require(['@/views/bpm/model'], resolve),
109   - name: 'model',
110   - meta: { title: '工作流模型', icon: '' }
111   - }
112   - ]
113   - },
114   - {
115 100 path: '/job',
116 101 component: Layout,
117 102 hidden: true,
... ...
yudao-admin-ui/src/views/bpm/model/index.vue
... ... @@ -50,14 +50,14 @@
50 50  
51 51 <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
52 52 @pagination="getList"/>
53   - <el-dialog :visible.sync="showBpmnBool" :before-close="close" :fullscreen="true">
  53 + <el-dialog class="bpmnclass dialogClass" :visible.sync="showBpmnBool" :before-close="close" :fullscreen="true">
54 54 <vue-bpmn v-if="showBpmnBool" product="activiti" @processSave="processSave" :bpmnXml="bpmnXML" :bpmnData="bpmnData" @beforeClose="close"></vue-bpmn>
55 55 </el-dialog>
56 56 </div>
57 57 </template>
58 58  
59 59 <script>
60   -import { page, exportBpmnXml, modelUpdate, modelSave, modelDelete, modelDeploy } from "@/api/bpm/model";
  60 +import {exportBpmnXml, modelDelete, modelDeploy, modelSave, modelUpdate, page} from "@/api/bpm/model";
61 61 import VueBpmn from "@/components/bpmn/VueBpmn";
62 62  
63 63 export default {
... ... @@ -202,5 +202,8 @@ export default {
202 202 .v-modal{
203 203 z-index: 2000!important;
204 204 }
  205 +.dialogClass{
  206 + padding: 0 ;
  207 +}
205 208 </style>
206 209  
... ...
yudao-admin-ui/src/views/bpm/processDefinition/index.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4 + <el-form-item label="模型名字" prop="name">
  5 + <el-input v-model="queryParams.name" placeholder="请输入模型名字" clearable style="width: 240px;" size="small"
  6 + @keyup.enter.native="handleQuery"/>
  7 + </el-form-item>
  8 + <el-form-item>
  9 + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  10 + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  11 + </el-form-item>
  12 + </el-form>
  13 + <el-row :gutter="10" class="mb8">
  14 + <el-col :span="1.5">
  15 + <el-button
  16 + type="primary"
  17 + icon="el-icon-plus"
  18 + size="mini"
  19 + @click="openBpmn"
  20 + v-hasPermi="['infra:config:create']"
  21 + >新建流程</el-button>
  22 + </el-col>
  23 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  24 + </el-row>
  25 + <el-table v-loading="loading" :data="list">
  26 + <el-table-column label="ID" align="center" prop="id" />
  27 + <el-table-column label="流程名字" align="center" prop="name" />
  28 +<!-- <el-table-column label="创建时间" align="center" prop="createTime" >-->
  29 +<!-- <template slot-scope="scope">-->
  30 +<!-- <span>{{ parseTime(scope.row.createTime) }}</span>-->
  31 +<!-- </template>-->
  32 +<!-- </el-table-column>-->
  33 + <el-table-column label="操作" align="center" >
  34 + <template slot-scope="scope">
  35 +<!-- <el-button size="mini" type="text" icon="el-icon-setting" @click="change(scope.row)">设计流程</el-button>-->
  36 +<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="modelDelete(scope.row)">删除</el-button>-->
  37 +<!-- <el-button size="mini" type="text" icon="el-icon-thumb" @click="modelDeploy(scope.row)">发布</el-button>-->
  38 + </template>
  39 + </el-table-column>
  40 + </el-table>
  41 +
  42 + <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  43 + @pagination="getList"/>
  44 + <el-dialog :visible.sync="showBpmnBool" :before-close="close" :fullscreen="true">
  45 + <vue-bpmn v-if="showBpmnBool" product="activiti" @processSave="processSave" :bpmnXml="bpmnXML" :bpmnData="bpmnData" @beforeClose="close"></vue-bpmn>
  46 + </el-dialog>
  47 + </div>
  48 +</template>
  49 +
  50 +<script>
  51 +import {page} from "@/api/bpm/processDefinition";
  52 +import VueBpmn from "@/components/bpmn/VueBpmn";
  53 +
  54 +export default {
  55 + name: "processDefinition",
  56 + data() {
  57 + return {
  58 + // 遮罩层
  59 + loading: true,
  60 + // 显示搜索条件
  61 + showSearch: true,
  62 + showBpmnBool: false,
  63 + // 总条数
  64 + total: 0,
  65 + // 表格数据
  66 + list: [],
  67 + bpmnXML: null,
  68 + bpmnData: {},
  69 + // 查询参数
  70 + queryParams: {
  71 + pageNo: 1,
  72 + pageSize: 10
  73 + }
  74 + };
  75 + },
  76 + components: {VueBpmn},
  77 + created() {
  78 + this.getList();
  79 + },
  80 + methods: {
  81 + /** 查询登录日志列表 */
  82 + getList() {
  83 + this.loading = true;
  84 + page(this.queryParams).then(response => {
  85 + this.list = response.data.list;
  86 + this.total = response.data.total;
  87 + this.loading = false;
  88 + }
  89 + );
  90 +
  91 + },
  92 + // 登录状态字典翻译
  93 + statusFormat(row, column) {
  94 + return this.selectDictLabel(this.statusOptions, row.status);
  95 + },
  96 + /** 搜索按钮操作 */
  97 + handleQuery() {
  98 + this.queryParams.pageNo = 1;
  99 + this.getList();
  100 + },
  101 + /** 重置按钮操作 */
  102 + resetQuery() {
  103 + this.dateRange = [];
  104 + this.resetForm("queryForm");
  105 + this.handleQuery();
  106 + },
  107 + processSave(data) {
  108 + const that = this;
  109 + // 如果存在id 说明是修改
  110 + if (data.id) {
  111 + let postData = JSON.parse(data.metaInfo)
  112 + postData.bpmnXml = data.bpmnXml
  113 + postData.id = data.id
  114 + postData.name = data.name
  115 + postData.key = data.key
  116 + postData.description = data.description
  117 + modelUpdate(postData).then(response => {
  118 + this.msgSuccess("保存成功");
  119 + })
  120 + this.showBpmnBool = false
  121 + this.getList();
  122 + return
  123 + }
  124 + modelSave(data).then(response => {
  125 + that.bpmnData.id = response.data
  126 + this.msgSuccess("保存成功");
  127 + })
  128 +
  129 + this.showBpmnBool = false
  130 + this.getList();
  131 + },
  132 + openBpmn() {
  133 + this.bpmnData = {}
  134 + this.bpmnXML = ""
  135 + this.showBpmnBool = true
  136 + },
  137 + close() {
  138 + this.showBpmnBool = false
  139 + this.getList();
  140 + },
  141 + change(row) {
  142 + const that = this;
  143 + this.bpmnXML = ""
  144 + this.bpmnData = {}
  145 + exportBpmnXml({
  146 + modelId: row.id
  147 + }).then(response => {
  148 + that.bpmnXML = response
  149 + that.bpmnData = row
  150 + that.showBpmnBool = true
  151 + })
  152 + },
  153 + modelDelete(row) {
  154 + const that = this;
  155 + this.$confirm('是否删除该流程!!', "警告", {
  156 + confirmButtonText: "确定",
  157 + cancelButtonText: "取消",
  158 + type: "warning"
  159 + }).then(function() {
  160 + modelDelete({
  161 + modelId: row.id
  162 + }).then(response => {
  163 + that.getList();
  164 + that.msgSuccess("删除成功");
  165 + })
  166 + })
  167 + },
  168 + modelDeploy(row) {
  169 + const that = this;
  170 + this.$confirm('是否部署该流程!!', "提示", {
  171 + confirmButtonText: "确定",
  172 + cancelButtonText: "取消",
  173 + type: "success"
  174 + }).then(function() {
  175 + modelDeploy({
  176 + modelId: row.id
  177 + }).then(response => {
  178 + that.getList();
  179 + that.msgSuccess("部署成功");
  180 + })
  181 + })
  182 + }
  183 + }
  184 +};
  185 +</script>
  186 +<style>
  187 +.el-dialog > .el-dialog__body{
  188 + margin: 0;
  189 + border: 0;
  190 +}
  191 +.bpmn-viewer-header{
  192 + background: white;
  193 +}
  194 +.v-modal{
  195 + z-index: 2000!important;
  196 +}
  197 +</style>
  198 +
... ...