Commit f8b34d5b6db4ee2a01cc17ec1319c73af52f93b2

Authored by YunaiV
1 parent 509e11a7

完成流程定义的列表的实现

yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/ProcessDefinitionController.java
@@ -2,12 +2,11 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.definition; @@ -2,12 +2,11 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.definition;
2 2
3 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageItemRespVO; 3 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageItemRespVO;
4 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageReqVO; 4 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageReqVO;
5 -import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp;  
6 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmDefinitionService; 5 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmDefinitionService;
7 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 6 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
8 import cn.iocoder.yudao.framework.common.pojo.PageResult; 7 import cn.iocoder.yudao.framework.common.pojo.PageResult;
9 -import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;  
10 import io.swagger.annotations.Api; 8 import io.swagger.annotations.Api;
  9 +import io.swagger.annotations.ApiImplicitParam;
11 import io.swagger.annotations.ApiOperation; 10 import io.swagger.annotations.ApiOperation;
12 import org.springframework.validation.annotation.Validated; 11 import org.springframework.validation.annotation.Validated;
13 import org.springframework.web.bind.annotation.GetMapping; 12 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -16,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestParam;
16 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
17 16
18 import javax.annotation.Resource; 17 import javax.annotation.Resource;
19 -import javax.servlet.http.HttpServletResponse;  
20 -import java.io.IOException;  
21 18
22 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 19 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
23 20
@@ -38,6 +35,7 @@ public class ProcessDefinitionController { @@ -38,6 +35,7 @@ public class ProcessDefinitionController {
38 return success(bpmDefinitionService.getDefinitionPage(pageReqVO)); 35 return success(bpmDefinitionService.getDefinitionPage(pageReqVO));
39 } 36 }
40 37
  38 + // TODO 芋艿:需要重写该方法
41 @GetMapping(value = "/getStartForm") 39 @GetMapping(value = "/getStartForm")
42 public CommonResult<String> getStartForm(@RequestParam("processKey") String processKey){ 40 public CommonResult<String> getStartForm(@RequestParam("processKey") String processKey){
43 // final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery(). 41 // final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().
@@ -47,11 +45,12 @@ public class ProcessDefinitionController { @@ -47,11 +45,12 @@ public class ProcessDefinitionController {
47 return success("/flow/leave/apply"); 45 return success("/flow/leave/apply");
48 } 46 }
49 47
50 - @GetMapping ("/export")  
51 - @ApiOperation(value = "流程定义的bpmnXml导出")  
52 - public void getDefinitionPage(@RequestParam String processDefinitionId, HttpServletResponse response) throws IOException {  
53 - FileResp fileResp = bpmDefinitionService.export(processDefinitionId);  
54 - ServletUtils.writeAttachment(response, fileResp.getFileName(), fileResp.getFileByte()); 48 + @GetMapping ("/get-bpmn-xml")
  49 + @ApiOperation(value = "获得流程定义的 BPMN XML")
  50 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = String.class)
  51 + public CommonResult<String> getDefinitionBpmnXML(@RequestParam("id") String id) {
  52 + String bpmnXML = bpmDefinitionService.getDefinitionBpmnXML(id);
  53 + return success(bpmnXML);
55 } 54 }
56 55
57 } 56 }
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmDefinitionConvert.java
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmPro @@ -5,6 +5,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmPro
5 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; 5 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO;
6 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmDefinitionCreateReqDTO; 6 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmDefinitionCreateReqDTO;
7 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; 7 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  8 +import org.activiti.engine.impl.persistence.entity.SuspensionState;
8 import org.activiti.engine.repository.Deployment; 9 import org.activiti.engine.repository.Deployment;
9 import org.activiti.engine.repository.ProcessDefinition; 10 import org.activiti.engine.repository.ProcessDefinition;
10 import org.mapstruct.Mapper; 11 import org.mapstruct.Mapper;
@@ -36,6 +37,7 @@ public interface BpmDefinitionConvert { @@ -36,6 +37,7 @@ public interface BpmDefinitionConvert {
36 default BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean, Deployment deployment, 37 default BpmProcessDefinitionPageItemRespVO convert(ProcessDefinition bean, Deployment deployment,
37 BpmProcessDefinitionDO processDefinitionDO, BpmFormDO form) { 38 BpmProcessDefinitionDO processDefinitionDO, BpmFormDO form) {
38 BpmProcessDefinitionPageItemRespVO respVO = convert(bean); 39 BpmProcessDefinitionPageItemRespVO respVO = convert(bean);
  40 + respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode());
39 if (deployment != null) { 41 if (deployment != null) {
40 respVO.setDeploymentTime(deployment.getDeploymentTime()); 42 respVO.setDeploymentTime(deployment.getDeploymentTime());
41 } 43 }
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmDefinitionService.java
1 package cn.iocoder.yudao.adminserver.modules.bpm.service.definition; 1 package cn.iocoder.yudao.adminserver.modules.bpm.service.definition;
2 2
3 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageItemRespVO; 3 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageItemRespVO;
4 -import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp;  
5 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageReqVO; 4 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageReqVO;
6 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmDefinitionCreateReqDTO; 5 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmDefinitionCreateReqDTO;
7 import cn.iocoder.yudao.framework.common.pojo.PageResult; 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; 7 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  8 +import org.activiti.bpmn.model.BpmnModel;
9 import org.activiti.engine.repository.Deployment; 9 import org.activiti.engine.repository.Deployment;
10 import org.activiti.engine.repository.ProcessDefinition; 10 import org.activiti.engine.repository.ProcessDefinition;
11 11
@@ -31,12 +31,20 @@ public interface BpmDefinitionService { @@ -31,12 +31,20 @@ public interface BpmDefinitionService {
31 PageResult<BpmProcessDefinitionPageItemRespVO> getDefinitionPage(BpmProcessDefinitionPageReqVO pageReqVO); 31 PageResult<BpmProcessDefinitionPageItemRespVO> getDefinitionPage(BpmProcessDefinitionPageReqVO pageReqVO);
32 32
33 /** 33 /**
34 - * 导出流程 bpmn 模型  
35 - * @param processDefinitionId 分页入参  
36 - * @return 分页model 34 + * 获得流程定义对应的 BPMN XML
  35 + *
  36 + * @param id 流程定义编号
  37 + * @return BPMN XML
  38 + */
  39 + String getDefinitionBpmnXML(String id);
  40 +
  41 + /**
  42 + * 获得 Bpmn 模型
  43 + *
  44 + * @param processDefinitionId 流程定义的编号
  45 + * @return Bpmn 模型
37 */ 46 */
38 - // TODO 芋艿:考虑下重写  
39 - FileResp export(String processDefinitionId); 47 + BpmnModel getBpmnModel(String processDefinitionId);
40 48
41 /** 49 /**
42 * 获得编号对应的 ProcessDefinition 50 * 获得编号对应的 ProcessDefinition
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmDefinitionServiceImpl.java
@@ -48,6 +48,8 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService { @@ -48,6 +48,8 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService {
48 48
49 private static final String BPMN_FILE_SUFFIX = ".bpmn"; 49 private static final String BPMN_FILE_SUFFIX = ".bpmn";
50 50
  51 + private static final BpmnXMLConverter BPMN_XML_CONVERTER = new BpmnXMLConverter();
  52 +
51 @Resource 53 @Resource
52 private RepositoryService repositoryService; 54 private RepositoryService repositoryService;
53 @Resource 55 @Resource
@@ -92,14 +94,18 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService { @@ -92,14 +94,18 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService {
92 } 94 }
93 95
94 @Override 96 @Override
95 - public FileResp export(String processDefinitionId) {  
96 - BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);  
97 -  
98 - byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(bpmnModel);  
99 - FileResp fileResp = new FileResp();  
100 - fileResp.setFileName( "export");  
101 - fileResp.setFileByte(bpmnBytes);  
102 - return fileResp; 97 + public String getDefinitionBpmnXML(String id) {
  98 + BpmnModel bpmnModel = repositoryService.getBpmnModel(id);
  99 + if (bpmnModel == null) {
  100 + return null;
  101 + }
  102 + byte[] bpmnBytes = BPMN_XML_CONVERTER.convertToXML(bpmnModel);
  103 + return StrUtil.utf8Str(bpmnBytes);
  104 + }
  105 +
  106 + @Override
  107 + public BpmnModel getBpmnModel(String processDefinitionId) {
  108 + return repositoryService.getBpmnModel(processDefinitionId);
103 } 109 }
104 110
105 @Override 111 @Override
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/impl/BpmFormServiceImpl.java
@@ -20,8 +20,8 @@ import java.util.HashMap; @@ -20,8 +20,8 @@ import java.util.HashMap;
20 import java.util.List; 20 import java.util.List;
21 import java.util.Map; 21 import java.util.Map;
22 22
23 -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_FORM_FIELD_REPEAT;  
24 -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_FORM_NOT_EXISTS; 23 +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.FORM_FIELD_REPEAT;
  24 +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.FORM_NOT_EXISTS;
25 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 25 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
26 26
27 /** 27 /**
@@ -66,7 +66,7 @@ public class BpmFormServiceImpl implements BpmFormService { @@ -66,7 +66,7 @@ public class BpmFormServiceImpl implements BpmFormService {
66 66
67 private void validateFormExists(Long id) { 67 private void validateFormExists(Long id) {
68 if (formMapper.selectById(id) == null) { 68 if (formMapper.selectById(id) == null) {
69 - throw exception(BPM_FORM_NOT_EXISTS); 69 + throw exception(FORM_NOT_EXISTS);
70 } 70 }
71 } 71 }
72 72
@@ -106,7 +106,7 @@ public class BpmFormServiceImpl implements BpmFormService { @@ -106,7 +106,7 @@ public class BpmFormServiceImpl implements BpmFormService {
106 continue; 106 continue;
107 } 107 }
108 // 如果存在,则报错 108 // 如果存在,则报错
109 - throw exception(BPM_FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel()); 109 + throw exception(FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel());
110 } 110 }
111 } 111 }
112 112
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java
@@ -109,7 +109,7 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -109,7 +109,7 @@ public class BpmModelServiceImpl implements BpmModelService {
109 // 校验流程标识已经存在 109 // 校验流程标识已经存在
110 Model keyModel = this.getModelByKey(createReqVO.getKey()); 110 Model keyModel = this.getModelByKey(createReqVO.getKey());
111 if (keyModel != null) { 111 if (keyModel != null) {
112 - throw exception(BPM_MODEL_KEY_EXISTS, createReqVO.getKey()); 112 + throw exception(MODEL_KEY_EXISTS, createReqVO.getKey());
113 } 113 }
114 114
115 // 创建流程定义 115 // 创建流程定义
@@ -129,7 +129,7 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -129,7 +129,7 @@ public class BpmModelServiceImpl implements BpmModelService {
129 // 校验流程模型存在 129 // 校验流程模型存在
130 Model model = repositoryService.getModel(updateReqVO.getId()); 130 Model model = repositoryService.getModel(updateReqVO.getId());
131 if (model == null) { 131 if (model == null) {
132 - throw exception(BPMN_MODEL_NOT_EXISTS); 132 + throw exception(MODEL_NOT_EXISTS);
133 } 133 }
134 134
135 // 修改流程定义 135 // 修改流程定义
@@ -146,11 +146,11 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -146,11 +146,11 @@ public class BpmModelServiceImpl implements BpmModelService {
146 // 校验流程模型存在 146 // 校验流程模型存在
147 Model model = repositoryService.getModel(id); 147 Model model = repositoryService.getModel(id);
148 if (ObjectUtils.isEmpty(model)) { 148 if (ObjectUtils.isEmpty(model)) {
149 - throw exception(BPMN_MODEL_NOT_EXISTS); 149 + throw exception(MODEL_NOT_EXISTS);
150 } 150 }
151 byte[] bpmnBytes = repositoryService.getModelEditorSource(model.getId()); 151 byte[] bpmnBytes = repositoryService.getModelEditorSource(model.getId());
152 if (bpmnBytes == null) { 152 if (bpmnBytes == null) {
153 - throw exception(BPMN_MODEL_NOT_EXISTS); 153 + throw exception(MODEL_NOT_EXISTS);
154 } 154 }
155 155
156 // 创建流程定义 156 // 创建流程定义
@@ -169,7 +169,7 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -169,7 +169,7 @@ public class BpmModelServiceImpl implements BpmModelService {
169 // 校验流程模型存在 169 // 校验流程模型存在
170 Model model = repositoryService.getModel(id); 170 Model model = repositoryService.getModel(id);
171 if (model == null) { 171 if (model == null) {
172 - throw exception(BPMN_MODEL_NOT_EXISTS); 172 + throw exception(MODEL_NOT_EXISTS);
173 } 173 }
174 // 执行删除 174 // 执行删除
175 repositoryService.deleteModel(id); 175 repositoryService.deleteModel(id);
@@ -181,7 +181,7 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -181,7 +181,7 @@ public class BpmModelServiceImpl implements BpmModelService {
181 181
182 private void checkKeyNCName(String key) { 182 private void checkKeyNCName(String key) {
183 if (!ValidationUtils.isXmlNCName(key)) { 183 if (!ValidationUtils.isXmlNCName(key)) {
184 - throw exception(BPMN_MODEL_KEY_VALID); 184 + throw exception(MODEL_KEY_VALID);
185 } 185 }
186 } 186 }
187 187
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormServiceTest.java
@@ -13,7 +13,7 @@ import org.springframework.context.annotation.Import; @@ -13,7 +13,7 @@ import org.springframework.context.annotation.Import;
13 13
14 import javax.annotation.Resource; 14 import javax.annotation.Resource;
15 15
16 -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_FORM_NOT_EXISTS; 16 +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.FORM_NOT_EXISTS;
17 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; 17 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
18 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 18 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
19 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; 19 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@@ -72,7 +72,7 @@ public class BpmFormServiceTest extends BaseDbUnitTest { @@ -72,7 +72,7 @@ public class BpmFormServiceTest extends BaseDbUnitTest {
72 BpmFormUpdateReqVO reqVO = randomPojo(BpmFormUpdateReqVO.class); 72 BpmFormUpdateReqVO reqVO = randomPojo(BpmFormUpdateReqVO.class);
73 73
74 // 调用, 并断言异常 74 // 调用, 并断言异常
75 - assertServiceException(() -> formService.updateForm(reqVO), BPM_FORM_NOT_EXISTS); 75 + assertServiceException(() -> formService.updateForm(reqVO), FORM_NOT_EXISTS);
76 } 76 }
77 77
78 @Test 78 @Test
@@ -95,7 +95,7 @@ public class BpmFormServiceTest extends BaseDbUnitTest { @@ -95,7 +95,7 @@ public class BpmFormServiceTest extends BaseDbUnitTest {
95 Long id = randomLongId(); 95 Long id = randomLongId();
96 96
97 // 调用, 并断言异常 97 // 调用, 并断言异常
98 - assertServiceException(() -> formService.deleteForm(id), BPM_FORM_NOT_EXISTS); 98 + assertServiceException(() -> formService.deleteForm(id), FORM_NOT_EXISTS);
99 } 99 }
100 100
101 @Test 101 @Test
yudao-admin-ui/src/api/bpm/definition.js
@@ -8,9 +8,9 @@ export function getDefinitionPage(query) { @@ -8,9 +8,9 @@ export function getDefinitionPage(query) {
8 }) 8 })
9 } 9 }
10 10
11 -export function exportProcessDefinition(query) { 11 +export function getDefinitionBpmnXML(id) {
12 return request({ 12 return request({
13 - url: '/workflow/process/definition/export?processDefinitionId='+query.id, 13 + url: '/bpm/definition/get-bpmn-xml?id=' + id,
14 method: 'get' 14 method: 'get'
15 }) 15 })
16 } 16 }
yudao-admin-ui/src/views/bpm/definition/index.vue
@@ -2,10 +2,57 @@ @@ -2,10 +2,57 @@
2 <div class="app-container"> 2 <div class="app-container">
3 <!-- 列表 --> 3 <!-- 列表 -->
4 <el-table v-loading="loading" :data="list"> 4 <el-table v-loading="loading" :data="list">
5 - <el-table-column label="ID" align="center" prop="id" />  
6 - <el-table-column label="流程名字" align="center" prop="name" /> 5 + <el-table-column label="定义编号" align="center" prop="id" />
  6 + <el-table-column label="定义名称" align="center" prop="name" width="200">
  7 + <template slot-scope="scope">
  8 + <el-button type="text" @click="handleBpmnDetail(scope.row)">
  9 + <span>{{ scope.row.name }}</span>
  10 + </el-button>
  11 + </template>
  12 + </el-table-column>
  13 + <el-table-column label="定义分类" align="center" prop="category" width="100">
  14 + <template slot-scope="scope">
  15 + <span>{{ getDictDataLabel(DICT_TYPE.BPM_MODEL_CATEGORY, scope.row.category) }}</span>
  16 + </template>
  17 + </el-table-column>
  18 + <el-table-column label="表单信息" align="center" prop="formId">
  19 + <template slot-scope="scope">
  20 + <el-button v-if="scope.row.formId" type="text" @click="handleFormDetail(scope.row)">
  21 + <span>{{ scope.row.formName }}</span>
  22 + </el-button>
  23 + <label v-else>暂无表单</label>
  24 + </template>
  25 + </el-table-column>
  26 + <el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80">
  27 + <template slot-scope="scope">
  28 + <el-tag size="medium" v-if="scope.row">v{{ scope.row.version }}</el-tag>
  29 + <el-tag size="medium" type="warning" v-else>未部署</el-tag>
  30 + </template>
  31 + </el-table-column>
  32 + <el-table-column label="激活状态" align="center" prop="version" width="80">
  33 + <template slot-scope="scope">
  34 + <el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag>
  35 + <el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag>
  36 + </template>
  37 + </el-table-column>
  38 + <el-table-column label="部署时间" align="center" prop="deploymentTime" width="180">
  39 + <template slot-scope="scope">
  40 + <span>{{ parseTime(scope.row.deploymentTime) }}</span>
  41 + </template>
  42 + </el-table-column>
  43 + <el-table-column label="定义描述" align="center" prop="description" width="300" show-overflow-tooltip />
7 </el-table> 44 </el-table>
8 45
  46 + <!-- 流程表单配置详情 -->
  47 + <el-dialog title="表单详情" :visible.sync="detailOpen" width="50%" append-to-body>
  48 + <parser :key="new Date().getTime()" :form-conf="detailForm" />
  49 + </el-dialog>
  50 +
  51 + <!-- 流程模型图的预览 -->
  52 + <el-dialog title="流程图" :visible.sync="showBpmnOpen" width="80%" append-to-body>
  53 + <my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" />
  54 + </el-dialog>
  55 +
9 <!-- 分页组件 --> 56 <!-- 分页组件 -->
10 <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" 57 <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
11 @pagination="getList"/> 58 @pagination="getList"/>
@@ -13,10 +60,17 @@ @@ -13,10 +60,17 @@
13 </template> 60 </template>
14 61
15 <script> 62 <script>
16 -import {getDefinitionPage} from "@/api/bpm/definition"; 63 +import {getDefinitionBpmnXML, getDefinitionPage} from "@/api/bpm/definition";
  64 +import {DICT_TYPE, getDictDatas} from "@/utils/dict";
  65 +import {getForm} from "@/api/bpm/form";
  66 +import {decodeFields} from "@/utils/formGenerator";
  67 +import Parser from '@/components/parser/Parser'
17 68
18 export default { 69 export default {
19 name: "processDefinition", 70 name: "processDefinition",
  71 + components: {
  72 + Parser
  73 + },
20 data() { 74 data() {
21 return { 75 return {
22 // 遮罩层 76 // 遮罩层
@@ -29,7 +83,23 @@ export default { @@ -29,7 +83,23 @@ export default {
29 queryParams: { 83 queryParams: {
30 pageNo: 1, 84 pageNo: 1,
31 pageSize: 10 85 pageSize: 10
32 - } 86 + },
  87 +
  88 + // 流程表单详情
  89 + detailOpen: false,
  90 + detailForm: {
  91 + fields: []
  92 + },
  93 +
  94 + // BPMN 数据
  95 + showBpmnOpen: false,
  96 + bpmnXML: null,
  97 + bpmnControlForm: {
  98 + prefix: "activiti"
  99 + },
  100 +
  101 + // 数据字典
  102 + categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY),
33 }; 103 };
34 }, 104 },
35 created() { 105 created() {
@@ -50,7 +120,33 @@ export default { @@ -50,7 +120,33 @@ export default {
50 } 120 }
51 ); 121 );
52 }, 122 },
  123 + /** 流程表单的详情按钮操作 */
  124 + handleFormDetail(row) {
  125 + getForm(row.formId).then(response => {
  126 + // 设置值
  127 + const data = response.data
  128 + this.detailForm = {
  129 + ...JSON.parse(data.conf),
  130 + fields: decodeFields(data.fields)
  131 + }
  132 + // 弹窗打开
  133 + this.detailOpen = true
  134 + })
  135 + },
  136 + /** 流程图的详情按钮操作 */
  137 + handleBpmnDetail(row) {
  138 + getDefinitionBpmnXML(row.id).then(response => {
  139 + this.bpmnXML = response.data
  140 + // 弹窗打开
  141 + this.showBpmnOpen = true
  142 + })
  143 + },
53 } 144 }
54 }; 145 };
55 </script> 146 </script>
56 147
  148 +<style lang="scss">
  149 +.my-process-designer {
  150 + height: calc(100vh - 200px);
  151 +}
  152 +</style>
yudao-admin-ui/src/views/bpm/model/index.vue
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <el-row :gutter="10" class="mb8"> 26 <el-row :gutter="10" class="mb8">
27 <el-col :span="1.5"> 27 <el-col :span="1.5">
28 <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" 28 <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
29 - v-hasPermi="['infra:config:create']">新建流程</el-button> 29 + v-hasPermi="['infra:config:create']">新建流程模型</el-button>
30 </el-col> 30 </el-col>
31 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 31 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
32 </el-row> 32 </el-row>
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 :active-value="1" :inactive-value="2" @change="handleStatusChange(scope.row)" /> 72 :active-value="1" :inactive-value="2" @change="handleStatusChange(scope.row)" />
73 </template> 73 </template>
74 </el-table-column> 74 </el-table-column>
75 - <el-table-column label="部署时间" align="center" prop="createTime" width="180"> 75 + <el-table-column label="部署时间" align="center" prop="deploymentTime" width="180">
76 <template slot-scope="scope"> 76 <template slot-scope="scope">
77 <span v-if="scope.row.processDefinition">{{ parseTime(scope.row.processDefinition.deploymentTime) }}</span> 77 <span v-if="scope.row.processDefinition">{{ parseTime(scope.row.processDefinition.deploymentTime) }}</span>
78 </template> 78 </template>
@@ -256,9 +256,7 @@ export default { @@ -256,9 +256,7 @@ export default {
256 </script> 256 </script>
257 257
258 <style lang="scss"> 258 <style lang="scss">
259 -  
260 .my-process-designer { 259 .my-process-designer {
261 height: calc(100vh - 200px); 260 height: calc(100vh - 200px);
262 } 261 }
263 -  
264 </style> 262 </style>