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

相关推荐
遇到困难睡大觉哈哈5 小时前
Harmony os 静态卡片(ArkTS + FormLink)详细介绍
前端·microsoft·harmonyos·鸿蒙
用户47949283569156 小时前
Bun 卖身 Anthropic!尤雨溪神吐槽:OpenAI 你需要工具链吗?
前端·openai·bun
p***43486 小时前
前端在移动端中的网络请求优化
前端
g***B7386 小时前
前端在移动端中的Ionic
前端
拿破轮7 小时前
使用通义灵码解决复杂正则表达式替换字符串的问题.
java·服务器·前端
whltaoin7 小时前
【 Web认证 】Cookie、Session 与 JWT Token:Web 认证机制的原理、实现与对比
前端·web·jwt·cookie·session·认证机制
Aerelin7 小时前
爬虫playwright入门讲解
前端·javascript·html·playwright
5***o5007 小时前
前端在移动端中的NativeBase
前端
灵魂学者8 小时前
Vue3.x —— 父子通信
前端·javascript·vue.js·github
1***Q7848 小时前
前端跨域解决方案
前端