基于jeecgboot-vue3的Flowable流程-集成仿钉钉流程(三)增加角色的选择

因为这个项目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、效果图

相关推荐
海的诗篇_1 分钟前
前端开发面试题总结-HTML篇
前端·面试·html
Sun_light8 分钟前
用原生 HTML/CSS/JS 手把手带你实现一个美观的 To-Do List 待办清单小Demo
前端·css·html
用户214118326360210 分钟前
dify案例分享--告别手工录入!Dify 工作流批量识别电子发票,5分钟生成Excel表格
前端·人工智能
SweetRetry11 分钟前
前端依赖管理实战:从臃肿到精简的优化之路
前端·人工智能
LaoZhangAI12 分钟前
Claude Code完全指南:2025年最强AI编程助手深度评测
前端·后端
卸任14 分钟前
Electron自制翻译工具:增加中英互译
前端·react.js·electron
LaoZhangAI16 分钟前
FLUX.1 Kontext vs GPT-4o图像编辑全面对比:2025年最全评测指南
前端·后端
LaoZhangAI17 分钟前
2025最全Supabase MCP使用指南:一键连接AI助手与数据库【实战教程】
前端·javascript·后端
冷凌爱28 分钟前
每天总结一个html标签——Audio音频标签
前端·html·音视频
Smile_frank28 分钟前
vue-07(高级组件通信模式:provide+inject)
前端·vue.js