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

因为这个项目license问题无法开源,更多技术支持与服务请加入我的知识星球。

1、后端角色的转换

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的组件

<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、选择好角色的处理

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信息

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. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 01:40:04       49 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 01:40:04       53 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 01:40:04       42 阅读
  4. Python语言-面向对象

    2024-07-11 01:40:04       53 阅读

热门阅读

  1. GraalVM简介及使用

    2024-07-11 01:40:04       18 阅读
  2. 徐州服务器租用:论带宽的作用有哪些

    2024-07-11 01:40:04       17 阅读
  3. 1. Go 九九乘法表

    2024-07-11 01:40:04       23 阅读
  4. Perl词法作用域:自定义编程环境的构建术

    2024-07-11 01:40:04       20 阅读
  5. SQL Server 设置端口详解

    2024-07-11 01:40:04       19 阅读
  6. MyBatis 框架核心及面试知识要点

    2024-07-11 01:40:04       23 阅读
  7. NLP - 基于bert预训练模型的文本多分类示例

    2024-07-11 01:40:04       16 阅读