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

相关推荐
anOnion2 小时前
构建无障碍组件之Carousel Pattern
前端·html·交互设计
ssshooter3 小时前
Tauri 2 iOS 开发避坑指南:文件保存、Dialog 和 Documents 目录的那些坑
前端·后端·ios
Можно3 小时前
深入理解 ES6 Proxy:与 Object.defineProperty 的全面对比
前端·javascript·vue.js
Birdy_x4 小时前
接口自动化项目实战(1):requests请求封装
开发语言·前端·python
天天向上10245 小时前
vue el-table实现拖拽排序
前端·javascript·vue.js
柳杉6 小时前
Three.js × Blender:从建模到 Web 3D 的完整工作流深度解析
前端·javascript·数据可视化
reembarkation7 小时前
vue3中使用howler播放音频列表
前端·vue.js·音视频
手握风云-7 小时前
基于 Java 的网页聊天室(三)
服务器·前端·数据库
weixin199701080167 小时前
《识货商品详情页前端性能优化实战》
前端·性能优化
Forever7_7 小时前
重磅!Vue3 手势工具正式发布!免费使用!
前端·前端框架·前端工程化