mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 02:08:43 +08:00 
			
		
		
		
	将 Model exportBpmnXml 去除,替换成 getModel 接口
This commit is contained in:
		| @@ -1,21 +1,19 @@ | |||||||
| package cn.iocoder.yudao.adminserver.modules.bpm.controller.model; | package cn.iocoder.yudao.adminserver.modules.bpm.controller.model; | ||||||
|  |  | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | ||||||
|  | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelPageItemRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.ModelPageReqVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.ModelPageReqVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; |  | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.service.model.BpmModelService; | import cn.iocoder.yudao.adminserver.modules.bpm.service.model.BpmModelService; | ||||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
| import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |  | ||||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||||
|  | import io.swagger.annotations.ApiImplicitParam; | ||||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
| import javax.servlet.http.HttpServletResponse; |  | ||||||
| import java.io.IOException; |  | ||||||
|  |  | ||||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||||
|  |  | ||||||
| @@ -31,11 +29,20 @@ public class BpmModelController { | |||||||
|     // TODO @芋艿:权限 |     // TODO @芋艿:权限 | ||||||
|  |  | ||||||
|     @GetMapping ("/page") |     @GetMapping ("/page") | ||||||
|     @ApiOperation(value = "分页数据") |     @ApiOperation(value = "获得模型分页") | ||||||
|     public CommonResult<PageResult<BpmModelRespVO>> getModelPage(ModelPageReqVO pageVO) { |     public CommonResult<PageResult<BpmModelPageItemRespVO>> getModelPage(ModelPageReqVO pageVO) { | ||||||
|        return success(bpmModelService.getModelPage(pageVO)); |        return success(bpmModelService.getModelPage(pageVO)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @GetMapping("/get") | ||||||
|  |     @ApiOperation("获得模型") | ||||||
|  |     @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = String.class) | ||||||
|  | //    @PreAuthorize("@ss.hasPermission('bpm:form:query')") | ||||||
|  |     public CommonResult<BpmModelRespVO> getModel(@RequestParam("id") String id) { | ||||||
|  |         BpmModelRespVO model = bpmModelService.getModel(id); | ||||||
|  |         return success(model); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     @PostMapping("/create") |     @PostMapping("/create") | ||||||
|     @ApiOperation(value = "新建模型") |     @ApiOperation(value = "新建模型") | ||||||
|     public CommonResult<String> createModel(@RequestBody BpmModelCreateReqVO createRetVO) { |     public CommonResult<String> createModel(@RequestBody BpmModelCreateReqVO createRetVO) { | ||||||
| @@ -60,11 +67,4 @@ public class BpmModelController { | |||||||
|        return bpmModelService.deploy(modelId); |        return bpmModelService.deploy(modelId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @GetMapping("/exportBpmnXml") |  | ||||||
|     @ApiOperation(value = "导出模型Xml") |  | ||||||
|     public void export(@RequestParam String modelId, HttpServletResponse response) throws IOException { |  | ||||||
|         FileResp fileResp = bpmModelService.exportBpmnXml(modelId); |  | ||||||
|         ServletUtils.writeAttachment(response, fileResp.getFileName(), fileResp.getFileByte()); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,43 @@ | |||||||
|  | package cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo; | ||||||
|  |  | ||||||
|  | import io.swagger.annotations.ApiModel; | ||||||
|  | import io.swagger.annotations.ApiModelProperty; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.EqualsAndHashCode; | ||||||
|  | import lombok.ToString; | ||||||
|  |  | ||||||
|  | import java.util.Date; | ||||||
|  |  | ||||||
|  | @ApiModel("流程模型的分页的每一项 Response VO") | ||||||
|  | @Data | ||||||
|  | @EqualsAndHashCode(callSuper = true) | ||||||
|  | @ToString(callSuper = true) | ||||||
|  | public class BpmModelPageItemRespVO extends BpmModelBaseVO { | ||||||
|  |  | ||||||
|  |     @ApiModelProperty(value = "编号", required = true, example = "1024") | ||||||
|  |     private String id; | ||||||
|  |  | ||||||
|  |     @ApiModelProperty(value = "表单名字", example = "请假表单") | ||||||
|  |     private String formName; | ||||||
|  |  | ||||||
|  |     @ApiModelProperty(value = "创建时间", required = true) | ||||||
|  |     private Date createTime; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 最新部署的流程定义 | ||||||
|  |      */ | ||||||
|  |     private ProcessDefinition processDefinition; | ||||||
|  |  | ||||||
|  |     @ApiModel("流程定义") | ||||||
|  |     @Data | ||||||
|  |     public static class ProcessDefinition { | ||||||
|  |  | ||||||
|  |         @ApiModelProperty(value = "编号", required = true, example = "1024") | ||||||
|  |         private String id; | ||||||
|  |  | ||||||
|  |         @ApiModelProperty(value = "版本", required = true, example = "1") | ||||||
|  |         private Integer version; | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -6,38 +6,15 @@ import lombok.Data; | |||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
| import lombok.ToString; | import lombok.ToString; | ||||||
|  |  | ||||||
| import java.util.Date; | import javax.validation.constraints.NotEmpty; | ||||||
|  |  | ||||||
| @ApiModel("流程模型 Response VO") | @ApiModel("流程模型的创建 Request VO") | ||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @ToString(callSuper = true) | @ToString(callSuper = true) | ||||||
| public class BpmModelRespVO extends BpmModelBaseVO { | public class BpmModelRespVO extends BpmModelBaseVO { | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "编号", required = true, example = "1024") |     @ApiModelProperty(value = "BPMN XML", required = true) | ||||||
|     private String id; |     private String bpmnXml; | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "表单名字", example = "请假表单") |  | ||||||
|     private String formName; |  | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "创建时间", required = true) |  | ||||||
|     private Date createTime; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 最新部署的流程定义 |  | ||||||
|      */ |  | ||||||
|     private ProcessDefinition processDefinition; |  | ||||||
|  |  | ||||||
|     @ApiModel("流程定义") |  | ||||||
|     @Data |  | ||||||
|     public static class ProcessDefinition { |  | ||||||
|  |  | ||||||
|         @ApiModelProperty(value = "编号", required = true, example = "1024") |  | ||||||
|         private String id; |  | ||||||
|  |  | ||||||
|         @ApiModelProperty(value = "版本", required = true, example = "1") |  | ||||||
|         private Integer version; |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package cn.iocoder.yudao.adminserver.modules.bpm.convert.model; | package cn.iocoder.yudao.adminserver.modules.bpm.convert.model; | ||||||
|  |  | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | ||||||
|  | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelPageItemRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.service.model.dto.BpmModelMetaInfoRespDTO; | import cn.iocoder.yudao.adminserver.modules.bpm.service.model.dto.BpmModelMetaInfoRespDTO; | ||||||
| @@ -25,7 +26,7 @@ public interface ModelConvert { | |||||||
|  |  | ||||||
|     ModelConvert INSTANCE = Mappers.getMapper(ModelConvert.class); |     ModelConvert INSTANCE = Mappers.getMapper(ModelConvert.class); | ||||||
|  |  | ||||||
|     default List<BpmModelRespVO> convertList(List<Model> list, Map<Long, BpmFormDO> formMap, |     default List<BpmModelPageItemRespVO> convertList(List<Model> list, Map<Long, BpmFormDO> formMap, | ||||||
|                                                      Map<String, ProcessDefinition> processDefinitionMap) { |                                                      Map<String, ProcessDefinition> processDefinitionMap) { | ||||||
|         return CollectionUtils.convertList(list, model -> { |         return CollectionUtils.convertList(list, model -> { | ||||||
|             BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); |             BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); | ||||||
| @@ -35,8 +36,8 @@ public interface ModelConvert { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     default BpmModelRespVO convert(Model model, BpmFormDO form, ProcessDefinition processDefinition) { |     default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, ProcessDefinition processDefinition) { | ||||||
|         BpmModelRespVO modelRespVO = new BpmModelRespVO(); |         BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); | ||||||
|         modelRespVO.setId(model.getId()); |         modelRespVO.setId(model.getId()); | ||||||
|         modelRespVO.setName(model.getName()); |         modelRespVO.setName(model.getName()); | ||||||
|         modelRespVO.setKey(model.getKey()); |         modelRespVO.setKey(model.getKey()); | ||||||
| @@ -54,6 +55,8 @@ public interface ModelConvert { | |||||||
|         return modelRespVO; |         return modelRespVO; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     BpmModelRespVO convert(Model model); | ||||||
|  |  | ||||||
|     default void copy(Model model, BpmModelCreateReqVO bean) { |     default void copy(Model model, BpmModelCreateReqVO bean) { | ||||||
|         model.setName(bean.getName()); |         model.setName(bean.getName()); | ||||||
|         model.setKey(bean.getKey()); |         model.setKey(bean.getKey()); | ||||||
| @@ -68,6 +71,6 @@ public interface ModelConvert { | |||||||
|         return metaInfo; |         return metaInfo; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     BpmModelRespVO.ProcessDefinition convert(ProcessDefinition bean); |     BpmModelPageItemRespVO.ProcessDefinition convert(ProcessDefinition bean); | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| package cn.iocoder.yudao.adminserver.modules.bpm.service.model; | package cn.iocoder.yudao.adminserver.modules.bpm.service.model; | ||||||
|  |  | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | ||||||
|  | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelPageItemRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.ModelPageReqVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.ModelPageReqVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; |  | ||||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
|  |  | ||||||
| @@ -20,7 +20,15 @@ public interface BpmModelService { | |||||||
|      * @param pageVO 分页查询 |      * @param pageVO 分页查询 | ||||||
|      * @return 流程模型分页 |      * @return 流程模型分页 | ||||||
|      */ |      */ | ||||||
|     PageResult<BpmModelRespVO> getModelPage(ModelPageReqVO pageVO); |     PageResult<BpmModelPageItemRespVO> getModelPage(ModelPageReqVO pageVO); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获得流程模块 | ||||||
|  |      * | ||||||
|  |      * @param id 编号 | ||||||
|  |      * @return 流程模型 | ||||||
|  |      */ | ||||||
|  |     BpmModelRespVO getModel(String id); | ||||||
|  |  | ||||||
|     // TODO @Li:不用返回 CommonResult |     // TODO @Li:不用返回 CommonResult | ||||||
|     // TODO @Li:createBpmModal。 |     // TODO @Li:createBpmModal。 | ||||||
| @@ -46,17 +54,11 @@ public interface BpmModelService { | |||||||
|      */ |      */ | ||||||
|     CommonResult<String> deploy(String modelId); |     CommonResult<String> deploy(String modelId); | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 导出模型 |  | ||||||
|      * @param modelId 模型Id |  | ||||||
|      * @return {@link FileResp} 返回文件 |  | ||||||
|      */ |  | ||||||
|     FileResp exportBpmnXml(String modelId); |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除模型 |      * 删除模型 | ||||||
|      * @param modelId 模型Id |      * @param modelId 模型Id | ||||||
|      * @return 返回成功 |      * @return 返回成功 | ||||||
|      */ |      */ | ||||||
|     CommonResult<String> deleteModel(String modelId); |     CommonResult<String> deleteModel(String modelId); | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,10 +1,11 @@ | |||||||
| package cn.iocoder.yudao.adminserver.modules.bpm.service.model.impl; | package cn.iocoder.yudao.adminserver.modules.bpm.service.model.impl; | ||||||
|  |  | ||||||
|  | import cn.hutool.core.util.ArrayUtil; | ||||||
| import cn.hutool.core.util.StrUtil; | import cn.hutool.core.util.StrUtil; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelCreateReqVO; | ||||||
|  | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelPageItemRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.BpmModelRespVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.ModelPageReqVO; | import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.ModelPageReqVO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; |  | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.convert.model.ModelConvert; | import cn.iocoder.yudao.adminserver.modules.bpm.convert.model.ModelConvert; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; | ||||||
| import cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants; | import cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants; | ||||||
| @@ -37,7 +38,10 @@ import javax.xml.stream.XMLStreamReader; | |||||||
| import java.io.ByteArrayInputStream; | import java.io.ByteArrayInputStream; | ||||||
| import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
| import java.util.*; | import java.util.HashSet; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | import java.util.Set; | ||||||
|  |  | ||||||
| import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_MODEL_KEY_EXISTS; | import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_MODEL_KEY_EXISTS; | ||||||
| import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||||||
| @@ -64,7 +68,7 @@ public class BpmModelServiceImpl implements BpmModelService { | |||||||
|     private BpmDefinitionService bpmDefinitionService; |     private BpmDefinitionService bpmDefinitionService; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public PageResult<BpmModelRespVO> getModelPage(ModelPageReqVO pageVO) { |     public PageResult<BpmModelPageItemRespVO> getModelPage(ModelPageReqVO pageVO) { | ||||||
|         ModelQuery modelQuery = repositoryService.createModelQuery(); |         ModelQuery modelQuery = repositoryService.createModelQuery(); | ||||||
|         if (StrUtil.isNotBlank(pageVO.getName())) { |         if (StrUtil.isNotBlank(pageVO.getName())) { | ||||||
|             modelQuery.modelNameLike("%" + pageVO.getName() + "%"); // 模糊匹配 |             modelQuery.modelNameLike("%" + pageVO.getName() + "%"); // 模糊匹配 | ||||||
| @@ -91,6 +95,18 @@ public class BpmModelServiceImpl implements BpmModelService { | |||||||
|         return new PageResult<>(ModelConvert.INSTANCE.convertList(models, formMap, processDefinitionMap), modelCount); |         return new PageResult<>(ModelConvert.INSTANCE.convertList(models, formMap, processDefinitionMap), modelCount); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public BpmModelRespVO getModel(String id) { | ||||||
|  |         Model model = repositoryService.getModel(id); | ||||||
|  |         BpmModelRespVO modelRespVO = ModelConvert.INSTANCE.convert(model); | ||||||
|  |         // 拼接 bpmn XML | ||||||
|  |         byte[] bpmnBytes = repositoryService.getModelEditorSource(id); | ||||||
|  |         if (ArrayUtil.isNotEmpty(bpmnBytes)) { | ||||||
|  |             modelRespVO.setBpmnXml(StrUtil.utf8Str(bpmnBytes)); | ||||||
|  |         } | ||||||
|  |         return modelRespVO; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     @Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务 |     @Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务 | ||||||
|     public String createModel(BpmModelCreateReqVO createReqVO) { |     public String createModel(BpmModelCreateReqVO createReqVO) { | ||||||
| @@ -209,24 +225,6 @@ public class BpmModelServiceImpl implements BpmModelService { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public FileResp exportBpmnXml(String modelId) { |  | ||||||
|         try { |  | ||||||
|             Model modelData = repositoryService.getModel(modelId); |  | ||||||
|             if (ObjectUtils.isEmpty(modelData)) { |  | ||||||
|                 throw exception(BpmErrorCodeConstants.BPMN_MODEL_EDITOR_SOURCE_NOT_EXISTS); |  | ||||||
|             } |  | ||||||
|             byte[] bytes = repositoryService.getModelEditorSource(modelData.getId()); |  | ||||||
|             FileResp fileResp = new FileResp(); |  | ||||||
|             fileResp.setFileName(String.format("%s.bpmn", Optional.ofNullable(modelData.getName()).orElse("流程图"))); |  | ||||||
|             fileResp.setFileByte(bytes); |  | ||||||
|             return fileResp; |  | ||||||
|         } catch (Exception e) { |  | ||||||
|             log.info("模型部署失败!modelId = {} e = {} ", modelId, ExceptionUtils.getStackTrace(e)); |  | ||||||
|             throw exception(BpmErrorCodeConstants.BPMN_MODEL_ERROR); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public CommonResult<String> deleteModel(String modelId) { |     public CommonResult<String> deleteModel(String modelId) { | ||||||
|         // TODO @Li:activitie 是逻辑删除么? |         // TODO @Li:activitie 是逻辑删除么? | ||||||
|   | |||||||
| @@ -8,11 +8,10 @@ export function page(query) { | |||||||
|   }) |   }) | ||||||
| } | } | ||||||
|  |  | ||||||
| export function exportBpmnXml(query) { | export function getModel(id) { | ||||||
|   return request({ |   return request({ | ||||||
|     url: '/bpm/model/exportBpmnXml', |     url: '/bpm/model/get?id=' + id, | ||||||
|     method: 'get', |     method: 'get' | ||||||
|     params: query |  | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -47,14 +47,17 @@ | |||||||
|  |  | ||||||
|     <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |     <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||||||
|                 @pagination="getList"/> |                 @pagination="getList"/> | ||||||
|  |  | ||||||
|  |  | ||||||
|     <el-dialog class="bpmnclass dialogClass" :visible.sync="showBpmnBool" :before-close="close" :fullscreen="true"> |     <el-dialog class="bpmnclass dialogClass" :visible.sync="showBpmnBool" :before-close="close" :fullscreen="true"> | ||||||
|       <vue-bpmn v-if="showBpmnBool" product="activiti" @processSave="processSave" :bpmnXml="bpmnXML" :bpmnData="bpmnData" @beforeClose="close"></vue-bpmn> |       <vue-bpmn v-if="showBpmnBool" product="activiti" @processSave="processSave" | ||||||
|  |                 :bpmnXml="bpmnXML" :bpmnData="bpmnData" @beforeClose="close" /> | ||||||
|     </el-dialog> |     </el-dialog> | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| import {exportBpmnXml, modelDelete, modelDeploy, modelSave, modelUpdate, page} from "@/api/bpm/model"; | import {modelDelete, modelDeploy, modelSave, modelUpdate, page, getModel} from "@/api/bpm/model"; | ||||||
| import VueBpmn from "@/components/bpmn/VueBpmn"; | import VueBpmn from "@/components/bpmn/VueBpmn"; | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
| @@ -70,13 +73,14 @@ export default { | |||||||
|       total: 0, |       total: 0, | ||||||
|       // 表格数据 |       // 表格数据 | ||||||
|       list: [], |       list: [], | ||||||
|       bpmnXML: null, |  | ||||||
|       bpmnData: {}, |  | ||||||
|       // 查询参数 |       // 查询参数 | ||||||
|       queryParams: { |       queryParams: { | ||||||
|         pageNo: 1, |         pageNo: 1, | ||||||
|         pageSize: 10 |         pageSize: 10 | ||||||
|       } |       }, | ||||||
|  |       // BPMN 数据 | ||||||
|  |       bpmnXML: null, | ||||||
|  |       bpmnData: {}, | ||||||
|     }; |     }; | ||||||
|   }, |   }, | ||||||
|   components: {VueBpmn}, |   components: {VueBpmn}, | ||||||
| @@ -144,15 +148,15 @@ export default { | |||||||
|       this.getList(); |       this.getList(); | ||||||
|     }, |     }, | ||||||
|     change(row) { |     change(row) { | ||||||
|       const that = this; |       // 重置 Model 信息 | ||||||
|       this.bpmnXML = "" |       this.bpmnXML = "" | ||||||
|       this.bpmnData = {} |       this.bpmnData = {} | ||||||
|       exportBpmnXml({ |       // 获得 Model 信息 | ||||||
|         modelId: row.id |       getModel(row.id).then(response => { | ||||||
|       }).then(response => { |         this.bpmnXML = response.data.bpmnXml | ||||||
|         that.bpmnXML = response |         this.bpmnData = response.data | ||||||
|         that.bpmnData = row |         // 打开弹窗 | ||||||
|         that.showBpmnBool = true |         this.showBpmnBool = true | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|     modelDelete(row) { |     modelDelete(row) { | ||||||
|   | |||||||
| @@ -142,13 +142,7 @@ export default { | |||||||
|       const that = this; |       const that = this; | ||||||
|       this.bpmnXML = "" |       this.bpmnXML = "" | ||||||
|       this.bpmnData = {} |       this.bpmnData = {} | ||||||
|       exportBpmnXml({ |       // TODO @芋艿:修改成 getModel | ||||||
|         modelId: row.id |  | ||||||
|       }).then(response => { |  | ||||||
|         that.bpmnXML = response |  | ||||||
|         that.bpmnData = row |  | ||||||
|         that.showBpmnBool = true |  | ||||||
|       }) |  | ||||||
|     }, |     }, | ||||||
|     modelDelete(row) { |     modelDelete(row) { | ||||||
|       const that = this; |       const that = this; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV