mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
BPM 模型重构 7:增加任务分配规则的列表 UI 界面
This commit is contained in:
parent
4e7f5489a5
commit
64a1d1f0f6
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.definition;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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;
|
||||
@ -12,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@ -30,7 +28,7 @@ public class BpmTaskAssignRuleController {
|
||||
public CommonResult<List<BpmTaskAssignRuleRespVO>> getTaskAssignRuleList(
|
||||
@RequestParam(value = "modelId", required = false) String modelId,
|
||||
@RequestParam(value = "processDefinitionId", required = false) String processDefinitionId) {
|
||||
return success(taskAssignRuleService.getTaskAssignRules(modelId, processDefinitionId));
|
||||
return success(taskAssignRuleService.getTaskAssignRuleList(modelId, processDefinitionId));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,16 +12,16 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum BpmTaskAssignRuleTypeEnum {
|
||||
|
||||
ROLE(10, "指定角色"),
|
||||
ROLE(10, "角色"),
|
||||
|
||||
DEPT(20, "指定部门"),
|
||||
DEPT_LEADER(21, "指定部门的负责人"),
|
||||
DEPT(20, "部门的成员"),
|
||||
DEPT_LEADER(21, "部门的负责人"),
|
||||
|
||||
USER(30, "指定用户"),
|
||||
USER(30, "用户"),
|
||||
|
||||
USER_GROUP(40, "指定用户组"), // TODO 芋艿:预留,暂未实现
|
||||
USER_GROUP(40, "用户组"), // TODO 芋艿:预留,暂未实现
|
||||
|
||||
SCRIPT(50, "指定脚本"), // 例如说,发起人所在部门的领导、发起人所在部门的领导的领导
|
||||
SCRIPT(50, "自定义脚本"), // 例如说,发起人所在部门的领导、发起人所在部门的领导的领导
|
||||
;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ public class BpmUserTaskActivitiBehavior extends UserTaskActivityBehavior {
|
||||
}
|
||||
|
||||
private BpmTaskAssignRuleDO getTaskRule(TaskEntity task) {
|
||||
List<BpmTaskAssignRuleDO> taskRules = bpmTaskRuleService.getTaskAssignRulesByProcessDefinitionId(task.getProcessDefinitionId(),
|
||||
List<BpmTaskAssignRuleDO> taskRules = bpmTaskRuleService.getTaskAssignRuleListByProcessDefinitionId(task.getProcessDefinitionId(),
|
||||
task.getTaskDefinitionKey());
|
||||
if (CollUtil.isEmpty(taskRules)) {
|
||||
throw new ActivitiException(StrUtil.format("流程任务({}/{}/{}) 找不到符合的任务规则",
|
||||
|
@ -20,8 +20,8 @@ public interface BpmTaskAssignRuleService {
|
||||
* @param taskDefinitionKey 流程任务定义的 Key。允许空
|
||||
* @return 任务规则数组
|
||||
*/
|
||||
List<BpmTaskAssignRuleDO> getTaskAssignRulesByProcessDefinitionId(String processDefinitionId,
|
||||
@Nullable String taskDefinitionKey);
|
||||
List<BpmTaskAssignRuleDO> getTaskAssignRuleListByProcessDefinitionId(String processDefinitionId,
|
||||
@Nullable String taskDefinitionKey);
|
||||
|
||||
/**
|
||||
* 获得流程模型的任务规则数组
|
||||
@ -29,7 +29,7 @@ public interface BpmTaskAssignRuleService {
|
||||
* @param modelId 流程模型的编号
|
||||
* @return 任务规则数组
|
||||
*/
|
||||
List<BpmTaskAssignRuleDO> getTaskAssignRulesByModelId(String modelId);
|
||||
List<BpmTaskAssignRuleDO> getTaskAssignRuleListByModelId(String modelId);
|
||||
|
||||
|
||||
/**
|
||||
@ -39,7 +39,7 @@ public interface BpmTaskAssignRuleService {
|
||||
* @param processDefinitionId 流程定义的编号
|
||||
* @return 任务规则数组
|
||||
*/
|
||||
List<BpmTaskAssignRuleRespVO> getTaskAssignRules(String modelId, String processDefinitionId);
|
||||
List<BpmTaskAssignRuleRespVO> getTaskAssignRuleList(String modelId, String processDefinitionId);
|
||||
|
||||
// TODO 芋艿:创建任务规则
|
||||
// TODO 芋艿:复制任务规则
|
||||
|
@ -40,29 +40,29 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
|
||||
private BpmProcessDefinitionService processDefinitionService;
|
||||
|
||||
@Override
|
||||
public List<BpmTaskAssignRuleDO> getTaskAssignRulesByProcessDefinitionId(String processDefinitionId,
|
||||
String taskDefinitionKey) {
|
||||
public List<BpmTaskAssignRuleDO> getTaskAssignRuleListByProcessDefinitionId(String processDefinitionId,
|
||||
String taskDefinitionKey) {
|
||||
return taskRuleMapper.selectListByProcessDefinitionId(processDefinitionId, taskDefinitionKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmTaskAssignRuleDO> getTaskAssignRulesByModelId(String modelId) {
|
||||
public List<BpmTaskAssignRuleDO> getTaskAssignRuleListByModelId(String modelId) {
|
||||
return taskRuleMapper.selectListByModelId(modelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmTaskAssignRuleRespVO> getTaskAssignRules(String modelId, String processDefinitionId) {
|
||||
public List<BpmTaskAssignRuleRespVO> getTaskAssignRuleList(String modelId, String processDefinitionId) {
|
||||
// 获得规则
|
||||
List<BpmTaskAssignRuleDO> rules = Collections.emptyList();
|
||||
BpmnModel model = null;
|
||||
if (StrUtil.isNotEmpty(modelId)) {
|
||||
rules = getTaskAssignRulesByModelId(modelId);
|
||||
rules = getTaskAssignRuleListByModelId(modelId);
|
||||
model = modelService.getBpmnModel(modelId);
|
||||
} else if (StrUtil.isNotEmpty(processDefinitionId)) {
|
||||
rules = getTaskAssignRulesByProcessDefinitionId(processDefinitionId, null);
|
||||
rules = getTaskAssignRuleListByProcessDefinitionId(processDefinitionId, null);
|
||||
model = processDefinitionService.getBpmnModel(processDefinitionId);
|
||||
}
|
||||
if (CollUtil.isEmpty(rules) || model == null) {
|
||||
if (model == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
9
yudao-admin-ui/src/api/bpm/taskAssignRule.js
Normal file
9
yudao-admin-ui/src/api/bpm/taskAssignRule.js
Normal file
@ -0,0 +1,9 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getTaskAssignRuleList(query) {
|
||||
return request({
|
||||
url: '/bpm/task-assign-rule/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -37,9 +37,10 @@ export const DICT_TYPE = {
|
||||
// bpm
|
||||
BPM_MODEL_CATEGORY: 'bpm_model_category',
|
||||
BPM_MODEL_FORM_TYPE: 'bpm_model_form_type',
|
||||
BPM_TASK_ASSIGN_RULE_TYPE: 'bpm_task_assign_rule_type',
|
||||
BPM_PROCESS_INSTANCE_STATUS: 'bpm_process_instance_status',
|
||||
BPM_PROCESS_INSTANCE_RESULT: 'bpm_process_instance_result',
|
||||
OA_LEAVE_STATUS: 'flow_status',
|
||||
OA_LEAVE_STATUS: 'flow_status', // todo 芋艿:可以删除
|
||||
OA_LEAVE_TYPE: 'oa_leave_type'
|
||||
}
|
||||
|
||||
|
@ -82,12 +82,15 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="380" fixed="right">
|
||||
<el-table-column label="操作" align="center" width="450" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['bpm:model:update']">修改流程</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-setting" @click="handleDesign(scope.row)"
|
||||
v-hasPermi="['bpm:model:update']">设计流程</el-button>
|
||||
<!-- TODO 权限 -->
|
||||
<el-button size="mini" type="text" icon="el-icon-s-custom" @click="handleAssignRule(scope.row)"
|
||||
v-hasPermi="['bpm:model:update']">分配规则</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-thumb" @click="handleDeploy(scope.row)"
|
||||
v-hasPermi="['bpm:model:deploy']">发布流程</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-ice-cream-round" @click="handleDefinitionList(scope.row)"
|
||||
@ -195,6 +198,53 @@
|
||||
<el-button @click="uploadClose">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- ========== 流程任务分配规则 ========== -->
|
||||
<!-- 列表弹窗 -->
|
||||
<el-dialog title="任务分配规则" :visible.sync="taskAssignRule.listOpen" width="800px" append-to-body>
|
||||
<el-table v-loading="taskAssignRule.loading" :data="taskAssignRule.list">
|
||||
<el-table-column label="任务名" align="center" prop="taskDefinitionName" width="120" fixed />
|
||||
<el-table-column label="任务标识" align="center" prop="taskDefinitionKey" width="300" />
|
||||
<el-table-column label="规则类型" align="center" prop="type">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getDictDataLabel(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE, scope.row.type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规则范围" align="center" prop="options" />
|
||||
<el-table-column label="操作" align="center" width="80" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<!-- TODO 权限 -->
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdateTaskAssignRule(scope.row)"
|
||||
v-hasPermi="['bpm:model:update']">修改</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</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-item label="任务名称" prop="taskDefinitionName">
|
||||
<el-input v-model="taskAssignRule.form.taskDefinitionName" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务标识" prop="taskDefinitionKey">
|
||||
<el-input v-model="taskAssignRule.form.taskDefinitionKey" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="规则类型" prop="type">
|
||||
<el-select v-model="taskAssignRule.form.type" clearable style="width: 100%">
|
||||
<el-option v-for="dict in taskAssignRuleDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
|
||||
</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-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>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -213,6 +263,8 @@ 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 {listSimpleRoles} from "@/api/system/role";
|
||||
|
||||
export default {
|
||||
name: "model",
|
||||
@ -262,6 +314,22 @@ export default {
|
||||
formCustomViewPath: [{ required: true, message: "表单查看路由不能为空", trigger: "blur" }],
|
||||
},
|
||||
|
||||
// 任务分配规则表单
|
||||
taskAssignRule: {
|
||||
row: undefined, // 选中的流程模型
|
||||
list: [], // 选中流程模型的任务分配规则们
|
||||
listOpen: false, // 列表是否打开
|
||||
loading: false, // 加载中
|
||||
open: false, // 是否打开
|
||||
form: {}, // 表单
|
||||
rules: { // 表单校验规则
|
||||
type: [{ required: true, message: "规则类型不能为空", trigger: "change" }],
|
||||
roleIds: [{required: true, message: "指定角色不能为空", trigger: "change" }],
|
||||
},
|
||||
// 各种下拉框
|
||||
roleOptions: [],
|
||||
},
|
||||
|
||||
// 流程导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
@ -285,7 +353,8 @@ export default {
|
||||
|
||||
// 数据字典
|
||||
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY),
|
||||
modelFormTypeDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_FORM_TYPE)
|
||||
modelFormTypeDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_FORM_TYPE),
|
||||
taskAssignRuleDictDatas: getDictDatas(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE),
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -504,6 +573,40 @@ export default {
|
||||
this.$refs.upload.submit();
|
||||
})
|
||||
},
|
||||
// ========== ==========
|
||||
doGetTaskAssignRuleList() {
|
||||
this.taskAssignRule.loading = true;
|
||||
getTaskAssignRuleList({
|
||||
modelId: this.taskAssignRule.row.id
|
||||
}).then(response => {
|
||||
this.taskAssignRule.loading = false;
|
||||
this.taskAssignRule.list = response.data;
|
||||
})
|
||||
},
|
||||
/** 处理任务分配规则列表的按钮操作 */
|
||||
handleAssignRule(row) {
|
||||
this.taskAssignRule.row = row;
|
||||
this.taskAssignRule.listOpen = true;
|
||||
this.doGetTaskAssignRuleList();
|
||||
// 获得角色列表
|
||||
this.taskAssignRule.roleOptions = [];
|
||||
listSimpleRoles().then(response => {
|
||||
// 处理 roleOptions 参数
|
||||
this.taskAssignRule.roleOptions.push(...response.data);
|
||||
});
|
||||
},
|
||||
/** 处理修改任务分配规则的按钮操作 */
|
||||
handleUpdateTaskAssignRule(row) {
|
||||
this.taskAssignRule.form = {
|
||||
...row,
|
||||
options: []
|
||||
};
|
||||
// TODO 芋艿:需要搞一搞
|
||||
if (row.type === 10) {
|
||||
this.taskAssignRule.form.role = row.options;
|
||||
}
|
||||
this.taskAssignRule.open = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user