weizong song 5 months ago
parent 10bd19f8fc
commit ebf1b39245

BIN
.DS_Store vendored

Binary file not shown.

@ -10,6 +10,7 @@ namespace App\Http\Controllers\Admin;
use App\Exports\OrdersExport;
use App\Models\AdminAreaLink;
use App\Models\AdminBuildingLink;
use App\Models\Area;
use App\Models\Bed;
use App\Models\Building;
@ -40,10 +41,43 @@ class OrdersController extends CommonController
$building_id = $request->get('building_id');
$area_id = $request->get('area_id');
// 楼栋
$buildings = Building::where('project_id', $project_id)->get();
// 病区
$areas = Area::where('project_id', $project_id)->get();
// 判断是否护士长
$userId = auth()->id();
$roleId = Role::where('name', 'like', '%护士长%')->where('guard_name', 'admin')->value('id');
$hushizhang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')->where('model_id', $userId)->count();
// 是否院方管理
$roleId = Role::where('name', 'like', '%院方管理%')->where('guard_name', 'admin')->value('id');
$yuanfang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')->where('model_id', $userId)->count();
// 楼栋 - 如果是院方管理,只显示有权限的楼栋
$buildingsQuery = Building::where('project_id', $project_id);
if ($yuanfang) {
$user = auth()->user();
$buildingId = AdminBuildingLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('building_id');
if ($buildingId->isNotEmpty()) {
$buildingsQuery = $buildingsQuery->whereIn('id', $buildingId);
}
}
$buildings = $buildingsQuery->get();
// 病区 - 如果是护士长,只显示有权限的病区;如果是院方管理,只显示有权限楼栋下的病区
$areasQuery = Area::where('project_id', $project_id);
if ($hushizhang) {
$user = auth()->user();
$areaId = AdminAreaLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('area_id');
if ($areaId->isNotEmpty()) {
$areasQuery = $areasQuery->whereIn('id', $areaId);
}
} elseif ($yuanfang) {
$user = auth()->user();
$buildingId = AdminBuildingLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('building_id');
if ($buildingId->isNotEmpty()) {
$areasQuery = $areasQuery->whereIn('building_id', $buildingId);
}
}
$areas = $areasQuery->get();
$month = request()->month ?? '全部';
@ -64,22 +98,45 @@ class OrdersController extends CommonController
});
}
// 判断是否护士长
$userId = auth()->id();
$roleId = Role::where('name', 'like', '%护士长%')->where('guard_name', 'admin')->value('id');
$hushizhang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')->where('model_id', $userId)->count();
// 是否院方管理
$roleId = Role::where('name', 'like', '%院方管理%')->where('guard_name', 'admin')->value('id');
$yuanfang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')->where('model_id', $userId)->count();
if ($hushizhang) {
$user = auth()->user();
$areaId = AdminAreaLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('area_id');
$bedList = Bed::whereIn('area_id', $areaId)->pluck('id');
$this->model = $this->model->whereIn('bed_id', $bedList);
if ($areaId->isNotEmpty()) {
$bedList = Bed::whereIn('area_id', $areaId)->pluck('id');
if ($bedList->isNotEmpty()) {
$this->model = $this->model->whereIn('bed_id', $bedList);
} else {
// 如果没有关联的床位,返回空结果
$this->model = $this->model->whereIn('bed_id', []);
}
} else {
// 如果没有关联的病区,返回空结果
$this->model = $this->model->whereIn('bed_id', []);
}
}
// 院方管理角色:根据 building 权限过滤
if ($yuanfang) {
$user = auth()->user();
$buildingId = AdminBuildingLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('building_id');
if ($buildingId->isNotEmpty()) {
$areaId = Area::whereIn('building_id', $buildingId)->pluck('id');
if ($areaId->isNotEmpty()) {
$bedList = Bed::whereIn('area_id', $areaId)->pluck('id');
if ($bedList->isNotEmpty()) {
$this->model = $this->model->whereIn('bed_id', $bedList);
} else {
// 如果没有关联的床位,返回空结果
$this->model = $this->model->whereIn('bed_id', []);
}
} else {
// 如果楼栋下没有病区,返回空结果
$this->model = $this->model->whereIn('bed_id', []);
}
} else {
// 如果没有关联的楼栋,返回空结果
$this->model = $this->model->whereIn('bed_id', []);
}
}
if ($request->date) {
@ -274,7 +331,15 @@ class OrdersController extends CommonController
$hushizhang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')
->where('model_id', $userId)->count();
// 是否院方管理
$roleId = Role::where('name', 'like', '%院方管理%')->where('guard_name', 'admin')->value('id');
$yuanfang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')
->where('model_id', $userId)->count();
$areaId = [];
$buildingId = [];
if ($hushizhang) {
$user = auth()->user();
$areaId = AdminAreaLink::where(function ($qeury) use ($project_id) {
@ -282,11 +347,21 @@ class OrdersController extends CommonController
$qeury->where('project_id', $project_id);
}
})->where('admin_id', $user->id)->pluck('area_id');
} elseif ($yuanfang) {
$user = auth()->user();
$buildingId = AdminBuildingLink::where(function ($qeury) use ($project_id) {
if ($project_id) {
$qeury->where('project_id', $project_id);
}
})->where('admin_id', $user->id)->pluck('building_id');
}
$data = Area::where(function ($query) use ($areaId, $building_id) {
$data = Area::where(function ($query) use ($areaId, $buildingId, $building_id) {
if ($areaId) {
$query->whereIn('area.id', $areaId);
}
if ($buildingId) {
$query->whereIn('area.building_id', $buildingId);
}
if ($building_id) {
$query->where('building_id', $building_id);
}
@ -315,8 +390,16 @@ class OrdersController extends CommonController
if ($data->first()) {
$data = $data->toArray();
}
// 获取楼栋
$buildings = Building::where('project_id', $project_id)->where('project_id', $project_id)->get();
// 获取楼栋 - 如果是院方管理,只显示有权限的楼栋
$buildingsQuery = Building::where('project_id', $project_id);
if ($yuanfang) {
$user = auth()->user();
$buildingId = AdminBuildingLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('building_id');
if ($buildingId->isNotEmpty()) {
$buildingsQuery = $buildingsQuery->whereIn('id', $buildingId);
}
}
$buildings = $buildingsQuery->get();
return view($this->bladePath . ".artboard", compact("data", "projects", "project_id", "buildings", "building_id"));
}

@ -15,6 +15,7 @@ use App\Forms\AskSubmitForm;
use App\Forms\AskSubmitScForm;
use App\Forms\ProjectForm;
use App\Models\AdminAreaLink;
use App\Models\AdminBuildingLink;
use App\Models\Area;
use App\Models\AskSubmit;
use App\Models\Bed;
@ -125,6 +126,26 @@ class ProjectController extends CommonController
return $this->ajaxResponse($headList);
}
public function getYuanfangList()
{
$buildingId = \request('building_id', 0);
$project_id = \request('project_id');
// 获取院方管理
$roleId = Role::where('name', 'like', '%院方管理%')->where('guard_name', 'admin')->value('id');
$adminIds = DB::table('model_has_roles')->where('role_id', $roleId)->where('model_type', 'App\Admin')->pluck('model_id');
// 全量院方管理数据
$yuanfangList = Admin::whereIn('id', $adminIds)->whereRaw("find_in_set('$project_id',project_ids)")->get();
// 获取楼栋选中的院方管理
foreach ($yuanfangList as $item) {
$item->selected = '';
if ($buildingId) {
$has = AdminBuildingLink::where('building_id', $buildingId)->where('admin_id', $item->id)->count();
if ($has) $item->selected = 'selected';
}
}
return $this->ajaxResponse($yuanfangList);
}
public function createSub(Request $request)
{
switch ($request->type) {
@ -135,6 +156,21 @@ class ProjectController extends CommonController
"myindex" => $request->myindex
];
$res = (new Building())->create($data);
// 添加选中的院方管理
if (isset($request->yuanfang) && is_array($request->yuanfang)) {
$links = [];
foreach ($request->yuanfang as $item) {
$links[] = [
'admin_id' => $item,
'building_id' => $res->id,
'project_id' => $res->project_id,
'created_at' => date('Y-m-d H:i:s')
];
}
if (!empty($links)) {
AdminBuildingLink::insert($links);
}
}
break;
case "building":
$parent = Building::find($request->id);
@ -210,7 +246,24 @@ class ProjectController extends CommonController
];
switch ($request->type) {
case "building":
$res = (new Building())->find($request->id)->update($data);
$res = (new Building())->find($request->id);
$res->update($data);
// 删除原来关联,添加新关联
AdminBuildingLink::where('building_id', $request->id)->delete();
if (isset($request->yuanfang) && is_array($request->yuanfang)) {
$links = [];
foreach ($request->yuanfang as $item) {
$links[] = [
'admin_id' => $item,
'building_id' => $request->id,
'project_id' => $res->project_id,
'created_at' => date('Y-m-d H:i:s')
];
}
if (!empty($links)) {
AdminBuildingLink::insert($links);
}
}
break;
case "area":
$res = (new Area())->find($request->id);

@ -11,6 +11,7 @@ namespace App\Http\Controllers\Admin;
use App\Customer;
use App\Libs\AlipayF2F;
use App\Models\AdminAreaLink;
use App\Models\AdminBuildingLink;
use App\Models\Area;
use App\Models\Balance;
use App\Models\Bed;
@ -245,17 +246,49 @@ class StatisticsController extends CommonController
->where('model_type', 'App\Admin')
->where('model_id', $userId)
->count();
// 获取这个护士长病区的订单
// 是否院方管理
$roleId = Role::where('name', 'like', '%院方管理%')->where('guard_name', 'admin')->value('id');
$yuanfang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')
->where('model_id', $userId)
->count();
// 获取这个护士长病区的订单或院方管理楼栋的订单
$user = auth()->user();
$areaId = AdminAreaLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('area_id');
$bedList = Bed::whereIn('area_id', $areaId)->pluck('id');
$orderIds = Orders::whereIn('bed_id', $bedList)->pluck('id');
$orderIds = [];
if ($hushizhang) {
$areaId = AdminAreaLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('area_id');
if ($areaId->isNotEmpty()) {
$bedList = Bed::whereIn('area_id', $areaId)->pluck('id');
if ($bedList->isNotEmpty()) {
$orderIds = Orders::whereIn('bed_id', $bedList)->pluck('id');
}
}
} elseif ($yuanfang) {
$buildingId = AdminBuildingLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('building_id');
if ($buildingId->isNotEmpty()) {
$areaId = Area::whereIn('building_id', $buildingId)->pluck('id');
if ($areaId->isNotEmpty()) {
$bedList = Bed::whereIn('area_id', $areaId)->pluck('id');
if ($bedList->isNotEmpty()) {
$orderIds = Orders::whereIn('bed_id', $bedList)->pluck('id');
}
}
}
// 如果没有关联数据,$orderIds 保持为空数组,后续查询会返回空结果
}
$recharges = Recharge::with(["manager", "order", "patient"])
->where(function ($query) use ($hushizhang, $orderIds) {
if ($hushizhang) {
$query->whereIn('order_id', $orderIds);
->where(function ($query) use ($hushizhang, $yuanfang, $orderIds) {
if ($hushizhang || $yuanfang) {
if (!empty($orderIds)) {
$query->whereIn('order_id', $orderIds);
} else {
// 如果没有关联数据,返回空结果
$query->whereIn('order_id', []);
}
}
})
->withCount("refunds")
@ -268,9 +301,14 @@ class StatisticsController extends CommonController
$recharges_sum = $recharges->sum('money');
$refunds = Refund::whereNotNull("paid_at")
->where(function ($query) use ($hushizhang, $orderIds) {
if ($hushizhang) {
$query->whereIn('order_id', $orderIds);
->where(function ($query) use ($hushizhang, $yuanfang, $orderIds) {
if ($hushizhang || $yuanfang) {
if (!empty($orderIds)) {
$query->whereIn('order_id', $orderIds);
} else {
// 如果没有关联数据,返回空结果
$query->whereIn('order_id', []);
}
}
})
->whereRaw("DATE_FORMAT(`paid_at`,'%Y-%m') = '{$month}'")
@ -386,7 +424,15 @@ class StatisticsController extends CommonController
$hushizhang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')
->where('model_id', $userId)->count();
// 是否院方管理
$roleId = Role::where('name', 'like', '%院方管理%')->where('guard_name', 'admin')->value('id');
$yuanfang = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')
->where('model_id', $userId)->count();
$areaId = [];
$buildingId = [];
if ($hushizhang) {
$user = auth()->user();
$areaId = AdminAreaLink::where(function ($qeury) use ($project_id) {
@ -394,11 +440,21 @@ class StatisticsController extends CommonController
$qeury->where('project_id', $project_id);
}
})->where('admin_id', $user->id)->pluck('area_id');
} elseif ($yuanfang) {
$user = auth()->user();
$buildingId = AdminBuildingLink::where(function ($qeury) use ($project_id) {
if ($project_id) {
$qeury->where('project_id', $project_id);
}
})->where('admin_id', $user->id)->pluck('building_id');
}
$data = Area::where('project_id', $project_id)->with('project', 'building')->where(function ($query) use ($areaId) {
$data = Area::where('project_id', $project_id)->with('project', 'building')->where(function ($query) use ($areaId, $buildingId) {
if ($areaId) {
$query->whereIn('id', $areaId);
}
if ($buildingId) {
$query->whereIn('building_id', $buildingId);
}
})->paginate(40);
$data->appends($request->all())->render();

@ -0,0 +1,9 @@
<?php
namespace App\Models;
class AdminBuildingLink extends CommonModel
{
}

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminBuildingLinks extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('admin_building_links', function (Blueprint $table) {
$table->increments('id');
$table->integer("building_id")->nullable();
$table->integer("project_id")->nullable();
$table->string("admin_id")->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('admin_building_links');
}
}

BIN
public/.DS_Store vendored

Binary file not shown.

File diff suppressed because one or more lines are too long

BIN
public/h5/.DS_Store vendored

Binary file not shown.

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>护工管理</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.2916c8b2.js></script><script src=/h5/static/js/index.31cd4916.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.ed4a2d2b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.2037823a.js></script><script src=/h5/static/js/index.6649961e.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -157,6 +157,13 @@
</select>
</div>
<div class="form-group" id="yuanfang" style="display: none">
<label for="yuanfang" class="control-label">院方管理</label>
<select name="yuanfang[]" id="yuanfang_option" class="custom-select" multiple>
</select>
</div>
</form>
</div>
<div class="modal-footer">
@ -262,6 +269,9 @@
case "project":
$("#model-form .modal-title").html("新增楼栋");
$("#head").hide();
// ajax调用获取所有院方管理信息并渲染出来
getYuanfang(0);
$("#yuanfang").show();
break;
case "building":
var building_name = $("#building_id option:selected").html();
@ -269,16 +279,19 @@
// ajax调用获取所有护士长信息并渲染出来
getHead(0)
$("#head").show();
$("#yuanfang").hide();
break;
case "area":
var area_name = $("#area_id option:selected").html();
$("#model-form .modal-title").html("新增病房-" + area_name);
$("#head").hide();
$("#yuanfang").hide();
break;
case "room":
var room_name = $("#room_id option:selected").html();
$("#model-form .modal-title").html("新增病床-" + room_name);
$("#head").hide();
$("#yuanfang").hide();
break;
}
@ -297,6 +310,18 @@
});
}
// 根据楼栋id获取院方管理数据并渲染
function getYuanfang(building_id) {
var url = "{{ url($urlPrefix."/get-yuanfang") }}";
var project_id = '{{$project->id}}'
$.get(url, {project_id:project_id,building_id: building_id}, function (res) {
$("#yuanfang_option").html('')
for (var i = 0; i < res.length; i++) {
$("#yuanfang_option").append('<option ' + res[i].selected + ' value=' + res[i].id + '>' + res[i].name + '</option>');
}
});
}
function editBed(element) {
var type = $(element).closest("tr").attr("data-type");
var id = $(element).closest("tr").attr("data-id");
@ -337,20 +362,26 @@
case "building":
$("#model-form .modal-title").html("修改楼栋");
$("#head").hide();
// 获取院方管理列表
getYuanfang(id);
$("#yuanfang").show();
break;
case "area":
$("#model-form .modal-title").html("修改病区/楼层");
// 获取护士长列表
getHead(id)
$("#head").show();
$("#yuanfang").hide();
break;
case "room":
$("#model-form .modal-title").html("修改病房");
$("#head").hide();
$("#yuanfang").hide();
break;
case "bed":
$("#model-form .modal-title").html("修改床位");
$("#head").hide();
$("#yuanfang").hide();
break;
}

@ -48,6 +48,7 @@ Route::group(["namespace" => "Admin", "prefix" => "admin"], function () {
Route::get("project/get-subs", 'ProjectController@getSubs');
Route::post("project/create-sub", 'ProjectController@createSub');
Route::get("project/get-head", 'ProjectController@getHeadList');
Route::get("project/get-yuanfang", 'ProjectController@getYuanfangList');
// 满意度调查
Route::get("project/asksubmit", 'ProjectController@askSubmit');

@ -0,0 +1,122 @@
# 院方管理角色 Building 权限设置说明
## 一、数据库迁移
首先需要运行数据库迁移,创建 `admin_building_links` 表:
```bash
php artisan migrate
```
这将创建 `admin_building_links` 表,用于存储管理员与楼栋的关联关系。
## 二、角色设置
### 1. 确保存在"院方管理"角色
在系统中需要有一个角色名称包含"院方管理"的角色(例如:"院方管理"、"院方管理员"等)。
### 2. 为管理员分配角色
1. 进入 **系统管理 > 管理员管理**
2. 编辑需要设置为"院方管理"的管理员
3. 在角色设置中,为该管理员分配"院方管理"角色
4. 确保该管理员的 `project_ids` 字段包含其需要管理的项目ID逗号分隔
## 三、楼栋权限关联设置
### 方法一:创建新楼栋时设置
1. 进入 **医院/项目管理 > 床位管理**
2. 选择对应的项目
3. 点击楼栋下拉框旁边的 **"+"** 按钮,创建新楼栋
4. 在弹出的对话框中:
- 填写楼栋名称
- 设置排序号
- **在"院方管理"下拉框中选择需要关联的院方管理员**(可多选)
5. 点击"保存"
### 方法二:编辑现有楼栋时设置
1. 进入 **医院/项目管理 > 床位管理**
2. 选择对应的项目
3. 选择需要编辑的楼栋
4. 点击楼栋下拉框旁边的 **"编辑"** 按钮(铅笔图标)
5. 在弹出的对话框中:
- 可以修改楼栋名称和排序号
- **在"院方管理"下拉框中选择需要关联的院方管理员**(可多选)
6. 点击"保存"
## 四、权限控制效果
设置完成后,具有"院方管理"角色的管理员将:
### 1. 订单列表页面 (`/admin/orders`)
- 只能查看其管理的楼栋下的所有订单
- 楼栋下拉框只显示其有权限的楼栋
- 病区下拉框只显示其有权限楼栋下的病区
### 2. 统计页面
- **财务统计** (`/admin/statistics/finance`):只能查看其管理楼栋下的充值、退款记录
- **护理统计** (`/admin/statistics/huli`):只能查看其管理楼栋下的病区数据
### 3. 陪护一览页面 (`/admin/orders/artboard`)
- 只显示其管理楼栋下的病区和床位信息
## 五、权限层级说明
系统的权限控制采用三级结构:
1. **项目级权限**:通过 `admins.project_ids` 字段控制,管理员只能访问其关联的项目
2. **角色级权限**
- **护士长**:通过 `admin_area_links` 表关联病区,只能查看其管理病区下的数据
- **院方管理**:通过 `admin_building_links` 表关联楼栋,只能查看其管理楼栋下的数据(包括该楼栋下所有病区)
3. **数据级权限**:根据角色和关联关系,自动过滤查询结果
## 六、注意事项
1. **一个管理员可以同时拥有多个角色**,但权限控制逻辑为:
- 如果同时是"护士长"和"院方管理",优先使用"护士长"的权限(更细粒度)
- 如果只是"院方管理",则使用楼栋级别的权限
2. **一个楼栋可以关联多个院方管理员**,这些管理员都可以查看该楼栋下的所有数据
3. **删除楼栋时**,相关的 `admin_building_links` 记录会通过软删除保留,但权限会失效
4. **修改楼栋关联**时,系统会先删除旧的关联关系,再创建新的关联关系
## 七、数据表结构
### admin_building_links 表
| 字段 | 类型 | 说明 |
|------|------|------|
| id | int | 主键 |
| building_id | int | 楼栋ID |
| project_id | int | 项目ID |
| admin_id | string | 管理员ID |
| created_at | timestamp | 创建时间 |
| updated_at | timestamp | 更新时间 |
| deleted_at | timestamp | 软删除时间 |
## 八、API 接口
新增的接口:
- `GET /admin/project/get-yuanfang`:获取院方管理列表
- 参数:`project_id`(必填)、`building_id`(可选,用于编辑时标记已选中的管理员)
## 九、常见问题
### Q1: 为什么设置了权限但看不到数据?
A: 请检查:
1. 管理员是否已分配"院方管理"角色
2. 管理员的 `project_ids` 是否包含当前项目ID
3. 楼栋是否已正确关联到该管理员
### Q2: 如何查看某个楼栋关联了哪些管理员?
A: 可以通过编辑该楼栋,在"院方管理"下拉框中查看已选中的管理员。
### Q3: 如何批量设置多个楼栋的权限?
A: 目前需要逐个楼栋进行设置,或者可以通过数据库直接操作 `admin_building_links` 表。
Loading…
Cancel
Save