基于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、效果图

相关推荐
子兮曰8 小时前
async/await高级模式:async迭代器、错误边界与并发控制
前端·javascript·github
恋猫de小郭8 小时前
2026 Flutter VS React Native ,同时在 AI 时代 VS Native 开发,你没见过的版本
android·前端·flutter
GIS之路10 小时前
ArcGIS Pro 中的 Notebooks 入门
前端
IT_陈寒12 小时前
React状态管理终极对决:Redux vs Context API谁更胜一筹?
前端·人工智能·后端
Kagol13 小时前
TinyVue 支持 Skills 啦!现在你可以让 AI 使用 TinyVue 组件搭建项目
前端·agent·ai编程
柳杉13 小时前
从零打造 AI 全球趋势监测大屏
前端·javascript·aigc
simple_lau13 小时前
Cursor配置MasterGo MCP:一键读取设计稿生成高还原度前端代码
前端·javascript·vue.js
睡不着先生13 小时前
如何设计一个真正可扩展的表单生成器?
前端·javascript·vue.js
天蓝色的鱼鱼13 小时前
模块化与组件化:90%的前端开发者都没搞懂的本质区别
前端·架构·代码规范
明君8799713 小时前
Flutter 如何给图片添加多行文字水印
前端·flutter