diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmTaskAssignRuleController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmTaskAssignRuleController.java index 4333f889f..643a5cae5 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmTaskAssignRuleController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmTaskAssignRuleController.java @@ -1,16 +1,15 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.definition; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.rule.BpmTaskAssignRuleCreateReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.rule.BpmTaskAssignRuleRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import io.swagger.annotations.Api; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.validation.Valid; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -31,4 +30,14 @@ public class BpmTaskAssignRuleController { return success(taskAssignRuleService.getTaskAssignRuleList(modelId, processDefinitionId)); } + @PostMapping("/create") + public CommonResult createTaskAssignRule(@Valid @RequestBody BpmTaskAssignRuleCreateReqVO reqVO) { + return success("1024"); + } + + @PutMapping("/update") + public CommonResult updateTaskAssignRule(@Valid @RequestBody BpmTaskAssignRuleCreateReqVO reqVO) { + return success(true); + } + } diff --git a/yudao-admin-ui/src/api/bpm/taskAssignRule.js b/yudao-admin-ui/src/api/bpm/taskAssignRule.js index 4c24e3285..a3e60663a 100644 --- a/yudao-admin-ui/src/api/bpm/taskAssignRule.js +++ b/yudao-admin-ui/src/api/bpm/taskAssignRule.js @@ -7,3 +7,19 @@ export function getTaskAssignRuleList(query) { params: query }) } + +export function createTaskAssignRule(data) { + return request({ + url: '/bpm/task-assign-rule/create', + method: 'post', + data: data + }) +} + +export function updateTaskAssignRule(data) { + return request({ + url: '/bpm/task-assign-rule/update', + method: 'put', + data: data + }) +} diff --git a/yudao-admin-ui/src/views/bpm/model/index.vue b/yudao-admin-ui/src/views/bpm/model/index.vue index 2fb73052b..b402a6837 100644 --- a/yudao-admin-ui/src/views/bpm/model/index.vue +++ b/yudao-admin-ui/src/views/bpm/model/index.vue @@ -222,7 +222,7 @@ - + @@ -235,14 +235,14 @@ - + @@ -263,7 +263,7 @@ import {getForm, getSimpleForms} from "@/api/bpm/form"; import {decodeFields} from "@/utils/formGenerator"; import Parser from '@/components/parser/Parser' import {getBaseHeader} from "@/utils/request"; -import {getTaskAssignRuleList} from "@/api/bpm/taskAssignRule"; +import {createTaskAssignRule, getTaskAssignRuleList, updateTaskAssignRule} from "@/api/bpm/taskAssignRule"; import {listSimpleRoles} from "@/api/system/role"; export default { @@ -597,6 +597,9 @@ export default { }, /** 处理修改任务分配规则的按钮操作 */ handleUpdateTaskAssignRule(row) { + // 先重置标识 + this.resetAssignRuleForm(); + // 设置表单 this.taskAssignRule.form = { ...row, options: [] @@ -606,6 +609,48 @@ export default { this.taskAssignRule.form.role = row.options; } this.taskAssignRule.open = true; + }, + /** 提交任务分配规则的表单 */ + submitAssignRuleForm() { + this.$refs["taskAssignRuleForm"].validate(valid => { + if (valid) { + // 构建表单 + let form = { + ...this.taskAssignRule.form, + taskDefinitionName: undefined, + }; + if (form.type === 10) { + form.options = form.roleIds; + } + form.roleIds = undefined; + // 新增 + if (!form.id) { + createTaskAssignRule(form).then(response => { + this.msgSuccess("修改成功"); + this.taskAssignRule.open = false; + this.doGetTaskAssignRuleList(); + }); + // 修改 + } else { + form.taskDefinitionKey = undefined; // 无法修改 + updateTaskAssignRule(form).then(response => { + this.msgSuccess("修改成功"); + this.taskAssignRule.open = false; + this.doGetTaskAssignRuleList(); + }); + } + } + }); + }, + /** 取消任务分配规则的表单 */ + cancelAssignRuleForm() { + this.taskAssignRule.open = false; + this.resetAssignRuleForm(); + }, + // 表单重置 + resetAssignRuleForm() { + this.taskAssignRule.form = {}; + this.resetForm("taskAssignRuleForm"); } } };