优化页面样式

This commit is contained in:
2026-03-10 09:59:24 +08:00
parent 99a0b63f0e
commit e94ebd3fe6
8 changed files with 36 additions and 16 deletions

View File

@@ -117,7 +117,10 @@ class SystemDeptLogic extends BaseLogic
public function accessDept(array $where = []): array
{
$query = $this->search($where);
$query->auth($this->adminInfo['deptList']);
// 超级管理员(id=1)可查看全部部门,普通管理员按部门权限过滤
if (isset($this->adminInfo['id']) && $this->adminInfo['id'] > 1) {
$query->auth($this->adminInfo['deptList'] ?? []);
}
$query->field('id, id as value, name as label, parent_id');
$query->order('sort', 'desc');
$data = $this->getAll($query);

View File

@@ -40,7 +40,10 @@ class SystemUserLogic extends BaseLogic
{
$query = $this->search($where);
$query->with(['depts']);
$query->auth($this->adminInfo['deptList']);
// 超级管理员(id=1)可查看全部用户,普通管理员按部门权限过滤
if (isset($this->adminInfo['id']) && $this->adminInfo['id'] > 1) {
$query->auth($this->adminInfo['deptList'] ?? []);
}
return $this->getList($query);
}
@@ -132,9 +135,11 @@ class SystemUserLogic extends BaseLogic
return $this->transaction(function () use ($data, $id) {
$role_ids = $data['role_ids'] ?? [];
$post_ids = $data['post_ids'] ?? [];
// 仅可修改当前部门和子部门的用户
// 超级管理员可修改任意用户,普通管理员仅可修改当前部门和子部门的用户
$query = $this->model->where('id', $id);
$query->auth($this->adminInfo['deptList']);
if (isset($this->adminInfo['id']) && $this->adminInfo['id'] > 1) {
$query->auth($this->adminInfo['deptList'] ?? []);
}
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');
@@ -182,7 +187,10 @@ class SystemUserLogic extends BaseLogic
throw new ApiException('超级管理员禁止删除');
}
$query = $this->model->where('id', $ids);
$query->auth($this->adminInfo['deptList']);
// 超级管理员可删除任意用户,普通管理员仅可删除当前部门和子部门的用户
if (isset($this->adminInfo['id']) && $this->adminInfo['id'] > 1) {
$query->auth($this->adminInfo['deptList'] ?? []);
}
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');