기술나눔

jeecgboot-vue3 기반의 Flowable 프로세스 - 통합 모방 DingTalk 프로세스 (3) 역할 선택 추가

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

이 프로젝트의 라이센스 문제로 인해 오픈 소스화할 수 없습니다. 더 많은 기술 지원 및 서비스를 받으려면 내 Knowledge Planet에 가입하세요.

1. 백엔드 역할 변경

  1. else if(this.getAssigneeType() == AssigneeTypeEnum.ROLE) {
  2. ExtensionAttribute extDataTypeAttribute = new ExtensionAttribute();
  3. extDataTypeAttribute.setNamespace(ProcessConstants.NAMASPASE);
  4. extDataTypeAttribute.setName("dataType");
  5. extDataTypeAttribute.setValue("ROLES");
  6. userTask.addAttribute(extDataTypeAttribute);
  7. ExtensionAttribute extTextAttribute = new ExtensionAttribute();
  8. extTextAttribute.setNamespace(ProcessConstants.NAMASPASE);
  9. extTextAttribute.setName("text");
  10. extTextAttribute.setValue(String.join(",", this.getApprovalText()));
  11. userTask.addAttribute(extTextAttribute);
  12. List<String> roleslist = this.getRoles();
  13. userTask.setCandidateGroups(roleslist);
  14. userTask.setAssignee("${assignee}");
  15. }

2. 캐릭터를 선택하고 대신 jeecg 구성요소를 사용하세요.

  1. <div v-if="dataType === 'ROLES'" style="width: 100%;">
  2. <j-select-role v-model:value="roleIds" :multi="false" @getSelectResult="selRole" placeholder="请选择角色"></j-select-role>
  3. </div>

3. 좋은 역할대우를 선택하라

  1. function selRole(option,deptList) {
  2. console.log("selRole option",option)
  3. console.log("selRole deptList",deptList)
  4. let groups = null;
  5. let text = null;
  6. if (option && option.length > 0) {
  7. userTaskForm.value.dataType = 'ROLES';
  8. groups = deptList.join(",") || null;
  9. text = option?.map(k => k.label).join(",") || null;
  10. } else {
  11. userTaskForm.value.dataType = '';
  12. multiLoopType.value = 'Null';
  13. }
  14. userTaskForm.value.candidateGroups = groups;
  15. userTaskForm.value.text = text;
  16. updateElementTask();
  17. changeMultiLoopType();
  18. }

4. 승인노드 정보도 동시에 업데이트

  1. else if (assigneeType === 'role') {
  2. console.log("assigneeType === 'role'")
  3. if (roles.length > 0) {
  4. const all = roles.map((id) => getRoleById({id: id}).then(res => {
  5. console.log("getRoleById res",res)
  6. if(res.code === 200) {
  7. return res.result.roleName;
  8. }
  9. })
  10. )
  11. Promise.all(all).then((roles) => {
  12. console.log("all roles",roles)
  13. content.value = roles.map((role) => role).join('、')
  14. })
  15. }

5. 효과 그리기