We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
system/dept.js
export function getDeptSuperior(ids, exclude) { exclude = exclude !== undefined ? exclude : false // 修改后 const data = Array.isArray(ids) || ids.length === 0 ? ids : Array.of(ids) // 原来的,再某些情况下参数无法以数组的形式传递给后端 // const data = ids.length || ids.length === 0 ? ids : Array.of(ids) debugger return request({ url: 'api/dept/superior?exclude=' + exclude, method: 'post', data }) }
对应的后端APIsystem/rest/DeptController
system/rest/DeptController
@ApiOperation("查询部门:根据ID获取同级与上级数据") @PostMapping("/superior") @PreAuthorize("@el.check('user:list','dept:list','coreuser:list')") public ResponseEntity<Object> getDeptSuperior(@RequestBody List<Long> ids, @RequestParam(defaultValue = "false") Boolean exclude) { Set<Dept> deptSet = new LinkedHashSet<>(); for (Long id : ids) { Dept dept = deptService.findById(id); List<Dept> depts = deptService.getSuperior(dept, new ArrayList<>()); if (exclude) { for (Dept data : depts) { if (data.getId().equals(dept.getPid())) { data.setSubCount(data.getSubCount() - 1); } } // 编辑部门时不显示自己以及自己下级的数据,避免出现PID数据环形问题 depts = depts.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toList()); } deptSet.addAll(depts); } return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)), HttpStatus.OK); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
system/dept.js
对应的后端API
system/rest/DeptController
The text was updated successfully, but these errors were encountered: