Commit db5414769724de63e5be1cffd81ba6d6f9244e14
1 parent
f8b34d5b
流程的挂起与激活
Showing
13 changed files
with
135 additions
and
48 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/BpmModelController.java
| @@ -69,4 +69,11 @@ public class BpmModelController { | @@ -69,4 +69,11 @@ public class BpmModelController { | ||
| 69 | return success(true); | 69 | return success(true); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | + @PutMapping("/update-state") | ||
| 73 | + @ApiOperation(value = "修改模型的状态", notes = "实际更新的部署的流程定义的状态") | ||
| 74 | + public CommonResult<Boolean> updateModelState(@RequestBody BpmModelUpdateStateReqVO reqVO) { | ||
| 75 | + bpmModelService.updateModelState(reqVO.getId(), reqVO.getState()); | ||
| 76 | + return success(true); | ||
| 77 | + } | ||
| 78 | + | ||
| 72 | } | 79 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelUpdateStateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import javax.validation.constraints.NotNull; | ||
| 8 | + | ||
| 9 | +@ApiModel("流程模型更新状态 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class BpmModelUpdateStateReqVO { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty(value = "编号", required = true, example = "1024") | ||
| 14 | + @NotNull(message = "编号不能为空") | ||
| 15 | + private String id; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 SuspensionState 枚举") | ||
| 18 | + @NotNull(message = "状态不能为空") | ||
| 19 | + private Integer state; | ||
| 20 | + | ||
| 21 | +} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java
| @@ -28,13 +28,10 @@ public interface BpmErrorCodeConstants { | @@ -28,13 +28,10 @@ public interface BpmErrorCodeConstants { | ||
| 28 | ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1009002001, "流程模型不存在"); | 28 | ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1009002001, "流程模型不存在"); |
| 29 | ErrorCode MODEL_KEY_VALID = new ErrorCode(1009002002, "流程标识格式不正确,需要以字母或下划线开头,后接任意字母、数字、中划线、下划线、句点!"); | 29 | ErrorCode MODEL_KEY_VALID = new ErrorCode(1009002002, "流程标识格式不正确,需要以字母或下划线开头,后接任意字母、数字、中划线、下划线、句点!"); |
| 30 | 30 | ||
| 31 | - // ========== 流程模型 1-009-003-000 ========== | 31 | + // ========== 流程定义 1-009-003-000 ========== |
| 32 | ErrorCode DEFINITION_KEY_NOT_MATCH = new ErrorCode(1009003000, "流程定义的标识期望是({}),当前是({}),请修改 BPMN 流程图"); | 32 | ErrorCode DEFINITION_KEY_NOT_MATCH = new ErrorCode(1009003000, "流程定义的标识期望是({}),当前是({}),请修改 BPMN 流程图"); |
| 33 | - ErrorCode DEFINITION_NAME_NOT_MATCH = new ErrorCode(1009003000, "流程定义的名字期望是({}),当前是({}),请修改 BPMN 流程图"); | ||
| 34 | - | ||
| 35 | - ErrorCode BPMN = new ErrorCode(1004001002, "工作流模型异常"); | ||
| 36 | - ErrorCode BPMN_MODEL_PROCESS_NOT_EXISTS = new ErrorCode(1004001009, "流程数据为空"); | ||
| 37 | - ErrorCode BPMN_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1004001004, "流程定义不存在"); | 33 | + ErrorCode DEFINITION_NAME_NOT_MATCH = new ErrorCode(1009003001, "流程定义的名字期望是({}),当前是({}),请修改 BPMN 流程图"); |
| 34 | + ErrorCode DEFINITION_NOT_EXISTS = new ErrorCode(1009003002, "流程定义不存在"); | ||
| 38 | 35 | ||
| 39 | // ========== 动态表单模块 1-009-004-000 ========== | 36 | // ========== 动态表单模块 1-009-004-000 ========== |
| 40 | ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009004000, "动态表单不存在"); | 37 | ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009004000, "动态表单不存在"); |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmDefinitionService.java
| @@ -81,6 +81,14 @@ public interface BpmDefinitionService { | @@ -81,6 +81,14 @@ public interface BpmDefinitionService { | ||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | /** | 83 | /** |
| 84 | + * 获得 deploymentId 对应的 ProcessDefinition | ||
| 85 | + * | ||
| 86 | + * @param deploymentId 部署编号 | ||
| 87 | + * @return 流程定义 | ||
| 88 | + */ | ||
| 89 | + ProcessDefinition getDefinitionByDeploymentId(String deploymentId); | ||
| 90 | + | ||
| 91 | + /** | ||
| 84 | * 获得 deploymentIds 对应的 ProcessDefinition 数组 | 92 | * 获得 deploymentIds 对应的 ProcessDefinition 数组 |
| 85 | * | 93 | * |
| 86 | * @param deploymentIds 部署编号的数组 | 94 | * @param deploymentIds 部署编号的数组 |
| @@ -96,4 +104,12 @@ public interface BpmDefinitionService { | @@ -96,4 +104,12 @@ public interface BpmDefinitionService { | ||
| 96 | */ | 104 | */ |
| 97 | String createDefinition(@Valid BpmDefinitionCreateReqDTO createReqDTO); | 105 | String createDefinition(@Valid BpmDefinitionCreateReqDTO createReqDTO); |
| 98 | 106 | ||
| 107 | + /** | ||
| 108 | + * 更新流程定义的挂起状态 | ||
| 109 | + * | ||
| 110 | + * @param id 流程定义的编号 | ||
| 111 | + * @param state 挂起状态 {@link org.activiti.engine.impl.persistence.entity.SuspensionState} | ||
| 112 | + */ | ||
| 113 | + void updateDefinitionSuspensionState(String id, Integer state); | ||
| 114 | + | ||
| 99 | } | 115 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/ProcessService.java
| @@ -17,14 +17,4 @@ public interface ProcessService { | @@ -17,14 +17,4 @@ public interface ProcessService { | ||
| 17 | */ | 17 | */ |
| 18 | void deployProcess(MultipartFile multipartFile); | 18 | void deployProcess(MultipartFile multipartFile); |
| 19 | 19 | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * 激活或者挂起流程模型实体 | ||
| 23 | - * @param processDefinitionId 流程模型实体id | ||
| 24 | - * @param type 类型 | ||
| 25 | - * @return 状态 | ||
| 26 | - */ | ||
| 27 | - String setActivOrHang(String processDefinitionId,String type); | ||
| 28 | - | ||
| 29 | - | ||
| 30 | } | 20 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/ProcessServiceImpl.java
| @@ -56,31 +56,6 @@ public class ProcessServiceImpl implements ProcessService { | @@ -56,31 +56,6 @@ public class ProcessServiceImpl implements ProcessService { | ||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | /** | 58 | /** |
| 59 | - * 激活或者挂起流程模型实体 | ||
| 60 | - * @param processDefinitionId 流程模型实体id | ||
| 61 | - * @param type 类型 | ||
| 62 | - * @return 提示 | ||
| 63 | - */ | ||
| 64 | - @Override | ||
| 65 | - public String setActivOrHang(String processDefinitionId, String type) { | ||
| 66 | - String result = "无操作"; | ||
| 67 | - switch (type){ | ||
| 68 | - case "active": | ||
| 69 | - repositoryService.activateProcessDefinitionById(processDefinitionId,true,null); | ||
| 70 | - result = "已激活ID为【"+processDefinitionId+"】的流程模型实例"; | ||
| 71 | - break; | ||
| 72 | - case "suspend": | ||
| 73 | - repositoryService.suspendProcessDefinitionById(processDefinitionId,true,null); | ||
| 74 | - result = "已挂起ID为【"+processDefinitionId+"】的流程模型实例"; | ||
| 75 | - break; | ||
| 76 | - default: | ||
| 77 | - break; | ||
| 78 | - } | ||
| 79 | - return result; | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | * 根据上传文件类型对应实现不同方式的流程部署 | 59 | * 根据上传文件类型对应实现不同方式的流程部署 |
| 85 | * @param inputStream 文件输入流 | 60 | * @param inputStream 文件输入流 |
| 86 | * @param fileName 文件名 | 61 | * @param fileName 文件名 |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmDefinitionServiceImpl.java
| @@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.util.StrUtil; | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageItemRespVO; | 5 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageItemRespVO; |
| 6 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageReqVO; | 6 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.BpmProcessDefinitionPageReqVO; |
| 7 | -import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.FileResp; | ||
| 8 | import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmDefinitionConvert; | 7 | import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmDefinitionConvert; |
| 9 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmProcessDefinitionDO; | 8 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmProcessDefinitionDO; |
| 10 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; | 9 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; |
| @@ -19,6 +18,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -19,6 +18,7 @@ import lombok.extern.slf4j.Slf4j; | ||
| 19 | import org.activiti.bpmn.converter.BpmnXMLConverter; | 18 | import org.activiti.bpmn.converter.BpmnXMLConverter; |
| 20 | import org.activiti.bpmn.model.BpmnModel; | 19 | import org.activiti.bpmn.model.BpmnModel; |
| 21 | import org.activiti.engine.RepositoryService; | 20 | import org.activiti.engine.RepositoryService; |
| 21 | +import org.activiti.engine.impl.persistence.entity.SuspensionState; | ||
| 22 | import org.activiti.engine.repository.Deployment; | 22 | import org.activiti.engine.repository.Deployment; |
| 23 | import org.activiti.engine.repository.ProcessDefinition; | 23 | import org.activiti.engine.repository.ProcessDefinition; |
| 24 | import org.activiti.engine.repository.ProcessDefinitionQuery; | 24 | import org.activiti.engine.repository.ProcessDefinitionQuery; |
| @@ -134,6 +134,11 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService { | @@ -134,6 +134,11 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService { | ||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | @Override | 136 | @Override |
| 137 | + public ProcessDefinition getDefinitionByDeploymentId(String deploymentId) { | ||
| 138 | + return repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult(); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + @Override | ||
| 137 | public List<ProcessDefinition> getDefinitionListByDeploymentIds(Set<String> deploymentIds) { | 142 | public List<ProcessDefinition> getDefinitionListByDeploymentIds(Set<String> deploymentIds) { |
| 138 | if (CollUtil.isEmpty(deploymentIds)) { | 143 | if (CollUtil.isEmpty(deploymentIds)) { |
| 139 | return Collections.emptyList(); | 144 | return Collections.emptyList(); |
| @@ -170,4 +175,19 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService { | @@ -170,4 +175,19 @@ public class BpmDefinitionServiceImpl implements BpmDefinitionService { | ||
| 170 | return definition.getId(); | 175 | return definition.getId(); |
| 171 | } | 176 | } |
| 172 | 177 | ||
| 178 | + @Override | ||
| 179 | + public void updateDefinitionSuspensionState(String id, Integer state) { | ||
| 180 | + // 激活 | ||
| 181 | + if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), state)) { | ||
| 182 | + repositoryService.activateProcessDefinitionById(id, true, null); | ||
| 183 | + return; | ||
| 184 | + } | ||
| 185 | + // 挂起 | ||
| 186 | + if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) { | ||
| 187 | + repositoryService.suspendProcessDefinitionById(id, true, null); | ||
| 188 | + return; | ||
| 189 | + } | ||
| 190 | + log.error("[updateDefinitionSuspensionState][流程定义({}) 修改未知状态({})]", id, state); | ||
| 191 | + } | ||
| 192 | + | ||
| 173 | } | 193 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/BpmModelService.java
| @@ -57,4 +57,12 @@ public interface BpmModelService { | @@ -57,4 +57,12 @@ public interface BpmModelService { | ||
| 57 | */ | 57 | */ |
| 58 | void deleteModel(String id); | 58 | void deleteModel(String id); |
| 59 | 59 | ||
| 60 | + /** | ||
| 61 | + * 修改模型的状态,实际更新的部署的流程定义的状态 | ||
| 62 | + * | ||
| 63 | + * @param id 编号 | ||
| 64 | + * @param state 状态 {@link org.activiti.engine.impl.persistence.entity.SuspensionState} | ||
| 65 | + */ | ||
| 66 | + void updateModelState(String id, Integer state); | ||
| 67 | + | ||
| 60 | } | 68 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java
| @@ -16,6 +16,7 @@ import cn.iocoder.yudao.framework.common.util.object.PageUtils; | @@ -16,6 +16,7 @@ import cn.iocoder.yudao.framework.common.util.object.PageUtils; | ||
| 16 | import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; | 16 | import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 17 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 18 | import org.activiti.engine.RepositoryService; | 18 | import org.activiti.engine.RepositoryService; |
| 19 | +import org.activiti.engine.impl.persistence.entity.SuspensionState; | ||
| 19 | import org.activiti.engine.repository.Deployment; | 20 | import org.activiti.engine.repository.Deployment; |
| 20 | import org.activiti.engine.repository.Model; | 21 | import org.activiti.engine.repository.Model; |
| 21 | import org.activiti.engine.repository.ModelQuery; | 22 | import org.activiti.engine.repository.ModelQuery; |
| @@ -158,6 +159,14 @@ public class BpmModelServiceImpl implements BpmModelService { | @@ -158,6 +159,14 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 158 | .setBpmnXml(StrUtil.utf8Str(bpmnBytes)); | 159 | .setBpmnXml(StrUtil.utf8Str(bpmnBytes)); |
| 159 | String definitionId = bpmDefinitionService.createDefinition(definitionCreateReqDTO); | 160 | String definitionId = bpmDefinitionService.createDefinition(definitionCreateReqDTO); |
| 160 | 161 | ||
| 162 | + // 将老的流程定义进行挂起。也就是说,只有最新部署的流程定义,才可以发起任务。 | ||
| 163 | + if (StrUtil.isNotEmpty(model.getDeploymentId())) { | ||
| 164 | + ProcessDefinition oldDefinition = bpmDefinitionService.getDefinitionByDeploymentId(model.getDeploymentId()); | ||
| 165 | + if (oldDefinition != null) { | ||
| 166 | + bpmDefinitionService.updateDefinitionSuspensionState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode()); | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + | ||
| 161 | // 更新 model 的 deploymentId,进行关联 | 170 | // 更新 model 的 deploymentId,进行关联 |
| 162 | ProcessDefinition definition = bpmDefinitionService.getDefinition(definitionId); | 171 | ProcessDefinition definition = bpmDefinitionService.getDefinition(definitionId); |
| 163 | model.setDeploymentId(definition.getDeploymentId()); | 172 | model.setDeploymentId(definition.getDeploymentId()); |
| @@ -175,6 +184,23 @@ public class BpmModelServiceImpl implements BpmModelService { | @@ -175,6 +184,23 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 175 | repositoryService.deleteModel(id); | 184 | repositoryService.deleteModel(id); |
| 176 | } | 185 | } |
| 177 | 186 | ||
| 187 | + @Override | ||
| 188 | + public void updateModelState(String id, Integer state) { | ||
| 189 | + // 校验流程模型存在 | ||
| 190 | + Model model = repositoryService.getModel(id); | ||
| 191 | + if (model == null) { | ||
| 192 | + throw exception(MODEL_NOT_EXISTS); | ||
| 193 | + } | ||
| 194 | + // 校验流程定义存在 | ||
| 195 | + ProcessDefinition definition = bpmDefinitionService.getDefinitionByDeploymentId(model.getDeploymentId()); | ||
| 196 | + if (definition == null) { | ||
| 197 | + throw exception(DEFINITION_NOT_EXISTS); | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + // 更新状态 | ||
| 201 | + bpmDefinitionService.updateDefinitionSuspensionState(definition.getId(), state); | ||
| 202 | + } | ||
| 203 | + | ||
| 178 | private Model getModelByKey(String key) { | 204 | private Model getModelByKey(String key) { |
| 179 | return repositoryService.createModelQuery().modelKey(key).singleResult(); | 205 | return repositoryService.createModelQuery().modelKey(key).singleResult(); |
| 180 | } | 206 | } |
yudao-admin-ui/src/api/bpm/model.js
| @@ -23,6 +23,18 @@ export function updateModel(data) { | @@ -23,6 +23,18 @@ export function updateModel(data) { | ||
| 23 | }) | 23 | }) |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | +// 任务状态修改 | ||
| 27 | +export function updateModelState(id, state) { | ||
| 28 | + return request({ | ||
| 29 | + url: '/bpm/model/update-state', | ||
| 30 | + method: 'put', | ||
| 31 | + data: { | ||
| 32 | + id, | ||
| 33 | + state | ||
| 34 | + } | ||
| 35 | + }) | ||
| 36 | +} | ||
| 37 | + | ||
| 26 | export function createModel(data) { | 38 | export function createModel(data) { |
| 27 | return request({ | 39 | return request({ |
| 28 | url: '/bpm/model/create', | 40 | url: '/bpm/model/create', |
yudao-admin-ui/src/api/infra/job.js
| @@ -65,7 +65,6 @@ export function updateJobStatus(jobId, status) { | @@ -65,7 +65,6 @@ export function updateJobStatus(jobId, status) { | ||
| 65 | }) | 65 | }) |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | - | ||
| 69 | // 定时任务立即执行一次 | 68 | // 定时任务立即执行一次 |
| 70 | export function runJob(jobId) { | 69 | export function runJob(jobId) { |
| 71 | return request({ | 70 | return request({ |
yudao-admin-ui/src/views/bpm/definition/index.vue
| @@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
| 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="定义编号" align="center" prop="id" /> | ||
| 6 | - <el-table-column label="定义名称" align="center" prop="name" width="200"> | 5 | + <el-table-column label="定义编号" align="center" prop="id" width="400" /> |
| 6 | + <el-table-column label="定义名称" align="center" prop="name" width="100"> | ||
| 7 | <template slot-scope="scope"> | 7 | <template slot-scope="scope"> |
| 8 | <el-button type="text" @click="handleBpmnDetail(scope.row)"> | 8 | <el-button type="text" @click="handleBpmnDetail(scope.row)"> |
| 9 | <span>{{ scope.row.name }}</span> | 9 | <span>{{ scope.row.name }}</span> |
yudao-admin-ui/src/views/bpm/model/index.vue
| @@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
| 69 | <el-table-column label="激活状态" align="center" prop="processDefinition.version" width="80"> | 69 | <el-table-column label="激活状态" align="center" prop="processDefinition.version" width="80"> |
| 70 | <template slot-scope="scope"> | 70 | <template slot-scope="scope"> |
| 71 | <el-switch v-if="scope.row.processDefinition" v-model="scope.row.processDefinition.suspensionState" | 71 | <el-switch v-if="scope.row.processDefinition" v-model="scope.row.processDefinition.suspensionState" |
| 72 | - :active-value="1" :inactive-value="2" @change="handleStatusChange(scope.row)" /> | 72 | + :active-value="1" :inactive-value="2" @change="handleChangeState(scope.row)" /> |
| 73 | </template> | 73 | </template> |
| 74 | </el-table-column> | 74 | </el-table-column> |
| 75 | <el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"> | 75 | <el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"> |
| @@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
| 104 | </template> | 104 | </template> |
| 105 | 105 | ||
| 106 | <script> | 106 | <script> |
| 107 | -import {deleteModel, deployModel, getModelPage, getModel} from "@/api/bpm/model"; | 107 | +import {deleteModel, deployModel, getModelPage, getModel, updateModelState} from "@/api/bpm/model"; |
| 108 | import {DICT_TYPE, getDictDatas} from "@/utils/dict"; | 108 | import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
| 109 | import {getForm} from "@/api/bpm/form"; | 109 | import {getForm} from "@/api/bpm/form"; |
| 110 | import {decodeFields} from "@/utils/formGenerator"; | 110 | import {decodeFields} from "@/utils/formGenerator"; |
| @@ -250,7 +250,23 @@ export default { | @@ -250,7 +250,23 @@ export default { | ||
| 250 | key: row.key | 250 | key: row.key |
| 251 | } | 251 | } |
| 252 | }); | 252 | }); |
| 253 | - } | 253 | + }, |
| 254 | + /** 更新状态操作 */ | ||
| 255 | + handleChangeState(row) { | ||
| 256 | + const id = row.id; | ||
| 257 | + let state = row.processDefinition.suspensionState; | ||
| 258 | + let statusState = state === 1 ? '激活' : '挂起'; | ||
| 259 | + this.$confirm('是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?', "警告", { | ||
| 260 | + confirmButtonText: "确定", | ||
| 261 | + cancelButtonText: "取消", | ||
| 262 | + type: "warning" | ||
| 263 | + }).then(function() { | ||
| 264 | + return updateModelState(id, state); | ||
| 265 | + }).then(() => { | ||
| 266 | + this.getList(); | ||
| 267 | + this.msgSuccess(statusState + "成功"); | ||
| 268 | + }) | ||
| 269 | + }, | ||
| 254 | } | 270 | } |
| 255 | }; | 271 | }; |
| 256 | </script> | 272 | </script> |