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