因为这个项目license问题无法开源,更多技术支持与服务请加入我的知识星球。
1、后端角色的转换
java
else if(this.getAssigneeType() == AssigneeTypeEnum.ROLE) {
ExtensionAttribute extDataTypeAttribute = new ExtensionAttribute();
extDataTypeAttribute.setNamespace(ProcessConstants.NAMASPASE);
extDataTypeAttribute.setName("dataType");
extDataTypeAttribute.setValue("ROLES");
userTask.addAttribute(extDataTypeAttribute);
ExtensionAttribute extTextAttribute = new ExtensionAttribute();
extTextAttribute.setNamespace(ProcessConstants.NAMASPASE);
extTextAttribute.setName("text");
extTextAttribute.setValue(String.join(",", this.getApprovalText()));
userTask.addAttribute(extTextAttribute);
List<String> roleslist = this.getRoles();
userTask.setCandidateGroups(roleslist);
userTask.setAssignee("${assignee}");
}
2、选择角色改用jeecg的组件
javascript
<div v-if="dataType === 'ROLES'" style="width: 100%;">
<j-select-role v-model:value="roleIds" :multi="false" @getSelectResult="selRole" placeholder="请选择角色"></j-select-role>
</div>
3、选择好角色的处理
javascript
function selRole(option,deptList) {
console.log("selRole option",option)
console.log("selRole deptList",deptList)
let groups = null;
let text = null;
if (option && option.length > 0) {
userTaskForm.value.dataType = 'ROLES';
groups = deptList.join(",") || null;
text = option?.map(k => k.label).join(",") || null;
} else {
userTaskForm.value.dataType = '';
multiLoopType.value = 'Null';
}
userTaskForm.value.candidateGroups = groups;
userTaskForm.value.text = text;
updateElementTask();
changeMultiLoopType();
}
4、同时更新approvalNode信息
javascript
else if (assigneeType === 'role') {
console.log("assigneeType === 'role'")
if (roles.length > 0) {
const all = roles.map((id) => getRoleById({id: id}).then(res => {
console.log("getRoleById res",res)
if(res.code === 200) {
return res.result.roleName;
}
})
)
Promise.all(all).then((roles) => {
console.log("all roles",roles)
content.value = roles.map((role) => role).join('、')
})
}
5、效果图