fix -- 流程定义,添加用户任务的候选人功能
This commit is contained in:
@@ -571,7 +571,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
.active()
|
||||
.includeProcessVariables()
|
||||
.taskAssignee(userId.toString())
|
||||
.taskCandidateOrAssigned(userId.toString())
|
||||
.orderByTaskCreateTime().desc();
|
||||
page.setTotal(taskQuery.count());
|
||||
List<Task> taskList = taskQuery.listPage(pageNum - 1, pageSize);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<template>
|
||||
<div style="margin-top: 16px">
|
||||
<el-form-item label="候选类型">
|
||||
<!-- <el-select v-model="formData.groupType" placeholder="请选择分组类型" @change="onGroupTypeChange">-->
|
||||
<el-select v-model="formData.groupType" placeholder="请选择分组类型">
|
||||
<el-select v-model="formData.groupType" placeholder="请选择分组类型" @change="onGroupTypeChange">
|
||||
<el-option label="固定用户" value="ASSIGNEE" />
|
||||
<!-- <el-option label="候选用户" value="USERS" />-->
|
||||
<el-option label="候选用户" value="USERS" />
|
||||
<!-- <el-option label="候选组" value="ROLE" />-->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -177,16 +176,16 @@ export default {
|
||||
this.$nextTick(() => this.resetTaskForm());
|
||||
}
|
||||
},
|
||||
'userTaskForm.assignee': {
|
||||
handler () {
|
||||
this.updateElementTask('assignee');
|
||||
}
|
||||
},
|
||||
'userTaskForm.candidateUsers': {
|
||||
handler () {
|
||||
this.updateElementTask('candidateUsers');
|
||||
}
|
||||
},
|
||||
// 'userTaskForm.assignee': {
|
||||
// handler () {
|
||||
// this.updateElementTask('assignee');
|
||||
// }
|
||||
// },
|
||||
// 'userTaskForm.candidateUsers': {
|
||||
// handler () {
|
||||
// this.updateElementTask('candidateUsers');
|
||||
// }
|
||||
// },
|
||||
},
|
||||
created() {
|
||||
listUser().then(response => {
|
||||
@@ -196,13 +195,27 @@ export default {
|
||||
methods: {
|
||||
resetTaskForm() {
|
||||
for (let key in this.defaultTaskForm) {
|
||||
if (key === "candidateUsers" || key === "candidateGroups") {
|
||||
let val = this.bpmnElement?.businessObject[key] ? this.bpmnElement.businessObject[key].split(",") : [];
|
||||
// TODO 2022/01/10 添加候选组的设值 this.$set(this.userTaskForm, key, value);
|
||||
if (key === "candidateUsers") {
|
||||
const val = this.bpmnElement?.businessObject[key] ? this.bpmnElement.businessObject[key].split(",") : [];
|
||||
if (val && val.length > 0) {
|
||||
this.formData.groupType = 'USERS';
|
||||
let users = [];
|
||||
// TODO 2022/01/28 优化用户信息获取方式
|
||||
val.forEach(k => {
|
||||
getUser(k).then(response => {
|
||||
let user = response.data.user
|
||||
users.push(user)
|
||||
})
|
||||
})
|
||||
this.$set(this.userTaskForm, key, users);
|
||||
}
|
||||
} else if (key === "candidateGroups") {
|
||||
// TODO 2022/01/28 添加候选组的设值 this.$set(this.userTaskForm, key, value);
|
||||
} else if (key === "assignee") {
|
||||
let val = this.bpmnElement?.businessObject[key] || this.defaultTaskForm[key];
|
||||
// 判断是否为动态用户
|
||||
if (val && val.startsWith('${') && val.endsWith('}')) {
|
||||
this.formData.groupType = 'ASSIGNEE';
|
||||
this.formData.assignType = '2';
|
||||
this.$set(this.userTaskForm, key, val);
|
||||
} else {
|
||||
@@ -219,12 +232,14 @@ export default {
|
||||
const taskAttr = Object.create(null);
|
||||
if (key === "candidateUsers" || key === "candidateGroups") {
|
||||
if (this.userTaskForm[key] && this.userTaskForm[key].length > 0) {
|
||||
// TODO 2022/01/10 添加候选组的设值
|
||||
// taskAttr[key] = this.userTaskForm[key]
|
||||
taskAttr['assignee'] = null;
|
||||
taskAttr[key] = this.userTaskForm[key].map(k => k.userId) || null
|
||||
}
|
||||
// TODO 2022/01/10 添加候选组的设值
|
||||
// taskAttr[key] = this.userTaskForm[key] && this.userTaskForm[key].length ? this.userTaskForm[key].join() : null;
|
||||
} else {
|
||||
if (this.userTaskForm[key]) {
|
||||
taskAttr['candidateUsers'] = null;
|
||||
if (this.formData.assignType === '1') {
|
||||
taskAttr[key] = this.userTaskForm[key].userId || null;
|
||||
} else if (this.formData.assignType === '2') {
|
||||
@@ -277,18 +292,24 @@ export default {
|
||||
if (this.formData.groupType === 'ASSIGNEE') {
|
||||
val = this.selectedUserDate[0];
|
||||
this.userTaskForm.assignee = val;
|
||||
// this.updateElementTask('assignee')
|
||||
this.updateElementTask('assignee')
|
||||
} else {
|
||||
val = this.selectedUserDate;
|
||||
this.userTaskForm.candidateUsers = val;
|
||||
// this.updateElementTask('candidateUsers')
|
||||
this.updateElementTask('candidateUsers')
|
||||
}
|
||||
|
||||
}
|
||||
this.candidateVisible = false;
|
||||
},
|
||||
onGroupTypeChange(val) {
|
||||
this.userTaskForm = {}
|
||||
if (val === 'ASSIGNEE') {
|
||||
this.formData.assignType = '1'
|
||||
}
|
||||
},
|
||||
onSelectAssignee() {
|
||||
this.getDeptTreeSelect()
|
||||
this.getDeptTreeSelect();
|
||||
this.candidateVisible = true;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user