mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 09:11:52 +08:00
优化流程 Model 的更新逻辑
This commit is contained in:
parent
df91c3ceff
commit
1294506a95
@ -1,9 +1,6 @@
|
|||||||
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.*;
|
||||||
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.ModelPageReqVO;
|
|
||||||
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;
|
||||||
@ -49,16 +46,19 @@ public class BpmModelController {
|
|||||||
return success(bpmModelService.createModel(createRetVO));
|
return success(bpmModelService.createModel(createRetVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PutMapping("/update")
|
||||||
@ApiOperation(value = "修改模型属性")
|
@ApiOperation(value = "修改模型")
|
||||||
public CommonResult<String> updateModel(@RequestBody BpmModelCreateReqVO modelVO) {
|
public CommonResult<Boolean> updateModel(@RequestBody BpmModelUpdateReqVO modelVO) {
|
||||||
return bpmModelService.updateModel(modelVO);
|
bpmModelService.updateModel(modelVO);
|
||||||
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@ApiOperation(value = "删除模型")
|
@ApiOperation("删除模型")
|
||||||
public CommonResult<String> deleteModel(@RequestParam String modelId) {
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = String.class)
|
||||||
return bpmModelService.deleteModel(modelId);
|
public CommonResult<Boolean> deleteModel(@RequestParam("id") String id) {
|
||||||
|
bpmModelService.deleteModel(id);
|
||||||
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/deploy")
|
@PostMapping("/deploy")
|
||||||
|
@ -6,14 +6,15 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
|
|
||||||
@ApiModel("流程模型的创建 Request 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")
|
||||||
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "BPMN XML", required = true)
|
@ApiModelProperty(value = "BPMN XML", required = true)
|
||||||
private String bpmnXml;
|
private String bpmnXml;
|
||||||
|
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
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 javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
@ApiModel("流程模型的更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class BpmModelUpdateReqVO extends BpmModelBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
@NotEmpty(message = "编号不能为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "BPMN XML", required = true)
|
||||||
|
@NotEmpty(message = "BPMN XML 不能为空")
|
||||||
|
private String bpmnXml;
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,7 @@ 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.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.BpmModelUpdateReqVO;
|
||||||
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;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
@ -64,6 +65,12 @@ public interface ModelConvert {
|
|||||||
model.setMetaInfo(JsonUtils.toJsonString(this.buildMetaInfo(bean.getDescription(), bean.getFormId())));
|
model.setMetaInfo(JsonUtils.toJsonString(this.buildMetaInfo(bean.getDescription(), bean.getFormId())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default void copy(Model model, BpmModelUpdateReqVO bean) {
|
||||||
|
model.setName(bean.getName());
|
||||||
|
model.setCategory(bean.getCategory());
|
||||||
|
model.setMetaInfo(JsonUtils.toJsonString(this.buildMetaInfo(bean.getDescription(), bean.getFormId())));
|
||||||
|
}
|
||||||
|
|
||||||
default BpmModelMetaInfoRespDTO buildMetaInfo(String description, Long formId) {
|
default BpmModelMetaInfoRespDTO buildMetaInfo(String description, Long formId) {
|
||||||
BpmModelMetaInfoRespDTO metaInfo = new BpmModelMetaInfoRespDTO();
|
BpmModelMetaInfoRespDTO metaInfo = new BpmModelMetaInfoRespDTO();
|
||||||
metaInfo.setDescription(description);
|
metaInfo.setDescription(description);
|
||||||
|
@ -25,8 +25,8 @@ public interface BpmErrorCodeConstants {
|
|||||||
|
|
||||||
// ========== OA 工作流模块 1-009-002-000 ==========
|
// ========== OA 工作流模块 1-009-002-000 ==========
|
||||||
ErrorCode BPM_MODEL_KEY_EXISTS = new ErrorCode(1009002000, "已经存在流程标识为【{}】的流程");
|
ErrorCode BPM_MODEL_KEY_EXISTS = new ErrorCode(1009002000, "已经存在流程标识为【{}】的流程");
|
||||||
|
ErrorCode BPMN_MODEL_NOT_EXISTS = new ErrorCode(1009002001, "流程模型不存在");
|
||||||
|
|
||||||
ErrorCode BPMN_MODEL_EDITOR_SOURCE_NOT_EXISTS = new ErrorCode(1004001001, "模型数据为空,请先成功设计流程并保存");
|
|
||||||
ErrorCode BPMN_MODEL_ERROR = new ErrorCode(1004001002, "工作流模型异常");
|
ErrorCode BPMN_MODEL_ERROR = new ErrorCode(1004001002, "工作流模型异常");
|
||||||
ErrorCode BPMN_MODEL_PROCESS_NOT_EXISTS = new ErrorCode(1004001009, "流程数据为空");
|
ErrorCode BPMN_MODEL_PROCESS_NOT_EXISTS = new ErrorCode(1004001009, "流程数据为空");
|
||||||
ErrorCode BPMN_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1004001004, "流程定义不存在");
|
ErrorCode BPMN_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1004001004, "流程定义不存在");
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
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.*;
|
||||||
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.ModelPageReqVO;
|
|
||||||
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 javax.validation.Valid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程模型接口
|
* 流程模型接口
|
||||||
*
|
*
|
||||||
@ -30,22 +29,20 @@ public interface BpmModelService {
|
|||||||
*/
|
*/
|
||||||
BpmModelRespVO getModel(String id);
|
BpmModelRespVO getModel(String id);
|
||||||
|
|
||||||
// TODO @Li:不用返回 CommonResult
|
|
||||||
// TODO @Li:createBpmModal。
|
|
||||||
/**
|
/**
|
||||||
* 创建流程模型
|
* 创建流程模型
|
||||||
*
|
*
|
||||||
* @param modelVO 创建信息
|
* @param modelVO 创建信息
|
||||||
* @return 创建的流程模型的编号
|
* @return 创建的流程模型的编号
|
||||||
*/
|
*/
|
||||||
String createModel(BpmModelCreateReqVO modelVO);
|
String createModel(@Valid BpmModelCreateReqVO modelVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改模型属性,填充bpmn数据
|
* 修改流程模型
|
||||||
* @param modelVO 模型对象
|
*
|
||||||
* @return 返回成功
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
CommonResult<String> updateModel(BpmModelCreateReqVO modelVO);
|
void updateModel(@Valid BpmModelUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署模型 使模型成为一个 process
|
* 部署模型 使模型成为一个 process
|
||||||
@ -56,9 +53,9 @@ public interface BpmModelService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除模型
|
* 删除模型
|
||||||
* @param modelId 模型Id
|
*
|
||||||
* @return 返回成功
|
* @param id 编号
|
||||||
*/
|
*/
|
||||||
CommonResult<String> deleteModel(String modelId);
|
void deleteModel(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.service.model.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
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.*;
|
||||||
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.ModelPageReqVO;
|
|
||||||
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;
|
||||||
@ -115,6 +112,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||||||
if (keyModel != null) {
|
if (keyModel != null) {
|
||||||
throw exception(BPM_MODEL_KEY_EXISTS);
|
throw exception(BPM_MODEL_KEY_EXISTS);
|
||||||
}
|
}
|
||||||
|
// TODO @芋艿:需要校验下 key 的格式
|
||||||
|
|
||||||
// 创建流程定义
|
// 创建流程定义
|
||||||
Model model = repositoryService.newModel();
|
Model model = repositoryService.newModel();
|
||||||
@ -137,55 +135,24 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||||||
// ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
|
// ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
|
||||||
// repositoryService.setProcessDefinitionCategory(definition.getId(), createReqVO.getCategory());
|
// repositoryService.setProcessDefinitionCategory(definition.getId(), createReqVO.getCategory());
|
||||||
// return definition.getId();
|
// return definition.getId();
|
||||||
// }
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// @Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务
|
|
||||||
// public String createModel(BpmModelCreateReqVO createReqVO) {
|
|
||||||
// // 校验流程标识已经存在
|
|
||||||
// Model keyModel = this.getModelByKey(createReqVO.getKey());
|
|
||||||
// if (keyModel != null) {
|
|
||||||
// throw exception(BPM_MODEL_KEY_EXISTS);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 创建流程定义
|
|
||||||
// Model model = repositoryService.newModel();
|
|
||||||
// ModelConvert.INSTANCE.copy(model, createReqVO);
|
|
||||||
// // 保存流程定义
|
|
||||||
// repositoryService.saveModel(model);
|
|
||||||
// // 添加 BPMN XML
|
|
||||||
// repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(createReqVO.getBpmnXml()));
|
|
||||||
// return model.getId();
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<String> updateModel(BpmModelCreateReqVO modelVO) {
|
@Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务
|
||||||
// try {
|
public void updateModel(BpmModelUpdateReqVO updateReqVO) {
|
||||||
// Model model = repositoryService.getModel(modelVO.getId());
|
// 校验流程模型存在
|
||||||
// if (ObjectUtils.isEmpty(model)) {
|
Model model = repositoryService.getModel(updateReqVO.getId());
|
||||||
// throw ServiceExceptionUtil.exception(BpmErrorCodeConstants.BPMN_MODEL_EDITOR_SOURCE_NOT_EXISTS);
|
if (model == null) {
|
||||||
// }
|
throw exception(BpmErrorCodeConstants.BPMN_MODEL_NOT_EXISTS);
|
||||||
// // 只能修改名字跟描述
|
}
|
||||||
// BpmModelCreateReqVO modelCreateVO = JsonUtils.parseObject(model.getMetaInfo(), BpmModelCreateReqVO.class);
|
// TODO @芋艿:需要校验下 key 的格式
|
||||||
// if (ObjectUtils.isEmpty(modelCreateVO)) {
|
|
||||||
// modelCreateVO = new BpmModelCreateReqVO();
|
// 修改流程定义
|
||||||
// }
|
ModelConvert.INSTANCE.copy(model, updateReqVO);
|
||||||
// modelCreateVO.setName(modelVO.getName());
|
// 更新模型
|
||||||
// modelCreateVO.setDescription(modelVO.getDescription());
|
repositoryService.saveModel(model);
|
||||||
// model.setMetaInfo(JsonUtils.toJsonString(modelCreateVO));
|
// 更新 BPMN XML
|
||||||
// model.setName(modelVO.getName());
|
repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(updateReqVO.getBpmnXml()));
|
||||||
// model.setKey(modelVO.getKey());
|
|
||||||
// // 更新模型
|
|
||||||
// repositoryService.saveModel(model);
|
|
||||||
//
|
|
||||||
// repositoryService.addModelEditorSource(model.getId(), modelVO.getBpmnXml().getBytes(StandardCharsets.UTF_8));
|
|
||||||
//
|
|
||||||
// return CommonResult.success("保存成功");
|
|
||||||
// }catch (Exception e){
|
|
||||||
// log.info("模型更新失败!modelVO = {}", modelVO, e);
|
|
||||||
// throw ServiceExceptionUtil.exception(BpmErrorCodeConstants.BPMN_MODEL_ERROR);
|
|
||||||
// }
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -193,11 +160,11 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||||||
try {
|
try {
|
||||||
Model modelData = repositoryService.getModel(modelId);
|
Model modelData = repositoryService.getModel(modelId);
|
||||||
if (ObjectUtils.isEmpty(modelData)) {
|
if (ObjectUtils.isEmpty(modelData)) {
|
||||||
throw exception(BpmErrorCodeConstants.BPMN_MODEL_EDITOR_SOURCE_NOT_EXISTS);
|
throw exception(BpmErrorCodeConstants.BPMN_MODEL_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
byte[] bytes = repositoryService.getModelEditorSource(modelData.getId());
|
byte[] bytes = repositoryService.getModelEditorSource(modelData.getId());
|
||||||
if (bytes == null) {
|
if (bytes == null) {
|
||||||
throw exception(BpmErrorCodeConstants.BPMN_MODEL_EDITOR_SOURCE_NOT_EXISTS);
|
throw exception(BpmErrorCodeConstants.BPMN_MODEL_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 将xml转换为流
|
// 将xml转换为流
|
||||||
// TODO @Li:这里是标准逻辑,看看 hutool 有没工具类提供。如果没有,咱自己封装一个
|
// TODO @Li:这里是标准逻辑,看看 hutool 有没工具类提供。如果没有,咱自己封装一个
|
||||||
@ -226,10 +193,14 @@ public class BpmModelServiceImpl implements BpmModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<String> deleteModel(String modelId) {
|
public void deleteModel(String id) {
|
||||||
// TODO @Li:activitie 是逻辑删除么?
|
// 校验流程模型存在
|
||||||
repositoryService.deleteModel(modelId);
|
Model model = repositoryService.getModel(id);
|
||||||
return CommonResult.success("删除成功");
|
if (model == null) {
|
||||||
|
throw exception(BpmErrorCodeConstants.BPMN_MODEL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
// 执行删除
|
||||||
|
repositoryService.deleteModel(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model getModelByKey(String key) {
|
private Model getModelByKey(String key) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function page(query) {
|
export function getModelPage(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/bpm/model/page',
|
url: '/bpm/model/page',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -15,15 +15,15 @@ export function getModel(id) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modelUpdate(data) {
|
export function updateModel(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/bpm/model/update',
|
url: '/bpm/model/update',
|
||||||
method: 'POST',
|
method: 'PUT',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modelSave(data) {
|
export function createModel(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/bpm/model/create',
|
url: '/bpm/model/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -31,15 +31,14 @@ export function modelSave(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modelDelete(data) {
|
export function deleteModel(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/bpm/model/delete?modelId='+ data.modelId,
|
url: '/bpm/model/delete?id=' + id,
|
||||||
method: 'POST',
|
method: 'DELETE'
|
||||||
data: data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modelDeploy(data) {
|
export function deployModel(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/bpm/model/deploy?modelId='+ data.modelId,
|
url: '/bpm/model/deploy?modelId='+ data.modelId,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<!-- 操作工具栏 -->
|
<!-- 操作工具栏 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="openBpmn"
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
v-hasPermi="['infra:config:create']">新建流程</el-button>
|
v-hasPermi="['infra:config:create']">新建流程</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
@ -38,26 +38,26 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="240">
|
<el-table-column label="操作" align="center" width="240">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-setting" @click="change(scope.row)">设计流程</el-button>
|
<el-button size="mini" type="text" icon="el-icon-setting" @click="handleUpdate(scope.row)">设计流程</el-button>
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="modelDelete(scope.row)">删除</el-button>
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="modelDelete(scope.row)">删除</el-button>
|
||||||
<el-button size="mini" type="text" icon="el-icon-thumb" @click="modelDeploy(scope.row)">发布</el-button>
|
<el-button size="mini" type="text" icon="el-icon-thumb" @click="modelDeploy(scope.row)">发布</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
<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="showBpmnOpen" :before-cancel="cancel" :fullscreen="true">
|
||||||
<vue-bpmn v-if="showBpmnBool" product="activiti" @processSave="processSave"
|
<vue-bpmn v-if="showBpmnOpen" product="activiti" @processSave="processSave"
|
||||||
:bpmnXml="bpmnXML" :bpmnData="bpmnData" @beforeClose="close" />
|
:bpmnXml="bpmnXML" :bpmnData="bpmnData" @beforeClose="cancel" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {modelDelete, modelDeploy, modelSave, modelUpdate, page, getModel} from "@/api/bpm/model";
|
import {deleteModel, deployModel, createModel, updateModel, getModelPage, getModel} from "@/api/bpm/model";
|
||||||
import VueBpmn from "@/components/bpmn/VueBpmn";
|
import VueBpmn from "@/components/bpmn/VueBpmn";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -68,7 +68,6 @@ export default {
|
|||||||
loading: true,
|
loading: true,
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
showBpmnBool: false,
|
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
// 表格数据
|
// 表格数据
|
||||||
@ -79,6 +78,7 @@ export default {
|
|||||||
pageSize: 10
|
pageSize: 10
|
||||||
},
|
},
|
||||||
// BPMN 数据
|
// BPMN 数据
|
||||||
|
showBpmnOpen: false,
|
||||||
bpmnXML: null,
|
bpmnXML: null,
|
||||||
bpmnData: {},
|
bpmnData: {},
|
||||||
};
|
};
|
||||||
@ -88,19 +88,20 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询登录日志列表 */
|
/** 查询流程模型列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
page(this.queryParams).then(response => {
|
getModelPage(this.queryParams).then(response => {
|
||||||
this.list = response.data.list;
|
this.list = response.data.list;
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// 登录状态字典翻译
|
// 表单重置
|
||||||
statusFormat(row, column) {
|
reset() {
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
this.bpmnData = {}
|
||||||
|
this.bpmnXML = ""
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
@ -114,49 +115,48 @@ export default {
|
|||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
processSave(data) {
|
processSave(data) {
|
||||||
const that = this;
|
// 修改的提交
|
||||||
// 如果存在id 说明是修改
|
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
let postData = JSON.parse(data.metaInfo)
|
updateModel(data).then(response => {
|
||||||
postData.bpmnXml = data.bpmnXml
|
this.msgSuccess("修改成功");
|
||||||
postData.id = data.id
|
// 关闭弹窗,刷新列表
|
||||||
postData.name = data.name
|
this.showBpmnOpen = false
|
||||||
postData.key = data.key
|
|
||||||
postData.description = data.description
|
|
||||||
modelUpdate(postData).then(response => {
|
|
||||||
this.msgSuccess("保存成功");
|
|
||||||
})
|
|
||||||
this.showBpmnBool = false
|
|
||||||
this.getList();
|
this.getList();
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
modelSave(data).then(response => {
|
// 添加的提交
|
||||||
that.bpmnData.id = response.data
|
createModel(data).then(response => {
|
||||||
|
this.bpmnData.id = response.data
|
||||||
this.msgSuccess("保存成功");
|
this.msgSuccess("保存成功");
|
||||||
|
// 关闭弹窗,刷新列表
|
||||||
|
this.showBpmnOpen = false
|
||||||
|
this.getList();
|
||||||
})
|
})
|
||||||
|
|
||||||
this.showBpmnBool = false
|
|
||||||
this.getList();
|
|
||||||
},
|
},
|
||||||
openBpmn() {
|
handleAdd() {
|
||||||
this.bpmnData = {}
|
|
||||||
this.bpmnXML = ""
|
|
||||||
this.showBpmnBool = true
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.showBpmnBool = false
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
change(row) {
|
|
||||||
// 重置 Model 信息
|
// 重置 Model 信息
|
||||||
this.bpmnXML = ""
|
this.reset()
|
||||||
this.bpmnData = {}
|
// 打开弹窗
|
||||||
|
this.showBpmnOpen = true
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
// 打开弹窗
|
||||||
|
this.showBpmnOpen = false
|
||||||
|
// 重置 Model 信息
|
||||||
|
this.reset()
|
||||||
|
// 刷新列表
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
handleUpdate(row) {
|
||||||
|
// 重置 Model 信息
|
||||||
|
this.reset()
|
||||||
// 获得 Model 信息
|
// 获得 Model 信息
|
||||||
getModel(row.id).then(response => {
|
getModel(row.id).then(response => {
|
||||||
this.bpmnXML = response.data.bpmnXml
|
this.bpmnXML = response.data.bpmnXml
|
||||||
this.bpmnData = response.data
|
this.bpmnData = response.data
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
this.showBpmnBool = true
|
this.showBpmnOpen = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
modelDelete(row) {
|
modelDelete(row) {
|
||||||
@ -166,9 +166,7 @@ export default {
|
|||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
modelDelete({
|
deleteModel(row.id).then(response => {
|
||||||
modelId: row.id
|
|
||||||
}).then(response => {
|
|
||||||
that.getList();
|
that.getList();
|
||||||
that.msgSuccess("删除成功");
|
that.msgSuccess("删除成功");
|
||||||
})
|
})
|
||||||
@ -181,7 +179,7 @@ export default {
|
|||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "success"
|
type: "success"
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
modelDeploy({
|
deployModel({
|
||||||
modelId: row.id
|
modelId: row.id
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
that.getList();
|
that.getList();
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
<el-table-column label="操作" align="center" >
|
<el-table-column label="操作" align="center" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<!-- <el-button size="mini" type="text" icon="el-icon-setting" @click="change(scope.row)">设计流程</el-button>-->
|
<!-- <el-button size="mini" type="text" icon="el-icon-setting" @click="change(scope.row)">设计流程</el-button>-->
|
||||||
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="modelDelete(scope.row)">删除</el-button>-->
|
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="deleteModel(scope.row)">删除</el-button>-->
|
||||||
<!-- <el-button size="mini" type="text" icon="el-icon-thumb" @click="modelDeploy(scope.row)">发布</el-button>-->
|
<!-- <el-button size="mini" type="text" icon="el-icon-thumb" @click="deployModel(scope.row)">发布</el-button>-->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -114,14 +114,14 @@ export default {
|
|||||||
postData.name = data.name
|
postData.name = data.name
|
||||||
postData.key = data.key
|
postData.key = data.key
|
||||||
postData.description = data.description
|
postData.description = data.description
|
||||||
modelUpdate(postData).then(response => {
|
updateModel(postData).then(response => {
|
||||||
this.msgSuccess("保存成功");
|
this.msgSuccess("保存成功");
|
||||||
})
|
})
|
||||||
this.showBpmnBool = false
|
this.showBpmnBool = false
|
||||||
this.getList();
|
this.getList();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
modelSave(data).then(response => {
|
createModel(data).then(response => {
|
||||||
that.bpmnData.id = response.data
|
that.bpmnData.id = response.data
|
||||||
this.msgSuccess("保存成功");
|
this.msgSuccess("保存成功");
|
||||||
})
|
})
|
||||||
@ -151,7 +151,7 @@ export default {
|
|||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
modelDelete({
|
deleteModel({
|
||||||
modelId: row.id
|
modelId: row.id
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
that.getList();
|
that.getList();
|
||||||
@ -166,7 +166,7 @@ export default {
|
|||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "success"
|
type: "success"
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
modelDeploy({
|
deployModel({
|
||||||
modelId: row.id
|
modelId: row.id
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
that.getList();
|
that.getList();
|
||||||
|
Loading…
Reference in New Issue
Block a user