BPM 模型重构 7:增加任务分配规则的列表 UI 界面

This commit is contained in:
YunaiV 2022-01-13 10:16:28 +08:00
parent 64a1d1f0f6
commit 3f6a5f06fa
3 changed files with 79 additions and 9 deletions

View File

@ -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<String> createTaskAssignRule(@Valid @RequestBody BpmTaskAssignRuleCreateReqVO reqVO) {
return success("1024");
}
@PutMapping("/update")
public CommonResult<Boolean> updateTaskAssignRule(@Valid @RequestBody BpmTaskAssignRuleCreateReqVO reqVO) {
return success(true);
}
}

View File

@ -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
})
}

View File

@ -222,7 +222,7 @@
</el-dialog>
<!-- 添加/修改弹窗 -->
<el-dialog title="修改任务规则" :visible.sync="taskAssignRule.open" width="500px" append-to-body>
<el-form ref="form" :model="taskAssignRule.form" :rules="taskAssignRule.rules" label-width="110px">
<el-form ref="taskAssignRuleForm" :model="taskAssignRule.form" :rules="taskAssignRule.rules" label-width="110px">
<el-form-item label="任务名称" prop="taskDefinitionName">
<el-input v-model="taskAssignRule.form.taskDefinitionName" disabled />
</el-form-item>
@ -235,14 +235,14 @@
</el-select>
</el-form-item>
<el-form-item v-if="taskAssignRule.form.type === 10" label="指定角色" prop="roleIds">
<el-select v-model="form.formId" clearable style="width: 100%">
<el-select v-model="taskAssignRule.form.roleIds" multiple clearable style="width: 100%">
<el-option v-for="item in taskAssignRule.roleOptions" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitAssignRuleForm"> </el-button>
<el-button @click="cancelAssignRuleForm"> </el-button>
</div>
</el-dialog>
</div>
@ -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");
}
}
};