1.优化工作台页面/dashboard/console

2.移除岗位管理相关代码和数据库
This commit is contained in:
2026-05-18 11:41:34 +08:00
parent 52b5ccb8e4
commit 085454fb78
30 changed files with 201 additions and 1123 deletions

View File

@@ -69,7 +69,6 @@ class SystemUserLogic extends BaseLogic
$admin = $this->model->findOrEmpty($id);
$data = $admin->hidden(['password'])->toArray();
$data['roleList'] = $admin->roles->toArray() ?: [];
$data['postList'] = $admin->posts->toArray() ?: [];
$data['deptList'] = $admin->depts ? $admin->depts->toArray() : [];
return $data;
}
@@ -101,7 +100,6 @@ class SystemUserLogic extends BaseLogic
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
return $this->transaction(function () use ($data) {
$role_ids = $data['role_ids'] ?? [];
$post_ids = $data['post_ids'] ?? [];
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
@@ -114,11 +112,7 @@ class SystemUserLogic extends BaseLogic
}
$user = SystemUser::create($data);
$user->roles()->detach();
$user->posts()->detach();
$user->roles()->saveAll($role_ids);
if (!empty($post_ids)) {
$user->posts()->save($post_ids);
}
return $user;
});
}
@@ -134,7 +128,6 @@ class SystemUserLogic extends BaseLogic
unset($data['password']);
return $this->transaction(function () use ($data, $id) {
$role_ids = $data['role_ids'] ?? [];
$post_ids = $data['post_ids'] ?? [];
// 超级管理员可修改任意用户,普通管理员仅可修改当前部门和子部门的用户
$query = $this->model->where('id', $id);
if (isset($this->adminInfo['id']) && $this->adminInfo['id'] > 1) {
@@ -157,11 +150,7 @@ class SystemUserLogic extends BaseLogic
$result = parent::edit($id, $data);
if ($result) {
$user->roles()->detach();
$user->posts()->detach();
$user->roles()->saveAll($role_ids);
if (!empty($post_ids)) {
$user->posts()->save($post_ids);
}
UserInfoCache::clearUserInfo($id);
UserAuthCache::clearUserAuth($id);
UserMenuCache::clearUserMenu($id);