From 86110c794d5156328fe27d6601579befd6ede02b Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Thu, 26 Dec 2024 10:16:13 +0800 Subject: [PATCH 1/8] update --- .../Controllers/Admin/OrdersController.php | 20 +++++++++++++------ resources/views/admin/orders/index.blade.php | 18 +++++++++++++++-- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Admin/OrdersController.php b/app/Http/Controllers/Admin/OrdersController.php index e1cb3b3..aad8f7b 100755 --- a/app/Http/Controllers/Admin/OrdersController.php +++ b/app/Http/Controllers/Admin/OrdersController.php @@ -37,6 +37,14 @@ class OrdersController extends CommonController $project_id = request()->project_id ?? $projects->first()->id; $project = Project::find($project_id); $status = $request->get('status', 20); + $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(); + $month = request()->month ?? '全部'; $months = (new OrdersController())->_getMonths(); @@ -92,7 +100,7 @@ class OrdersController extends CommonController "bed" => function ($query) { $query->with(["room", "building", "area"]); } - ])->where('status',$status) + ])->where('status', $status) ->orderBy("id", "desc"); if (request()->is_export) { @@ -118,7 +126,7 @@ class OrdersController extends CommonController '20' => '进行中', '100' => '已完成' ]; - return view($this->bladePath . ".index", compact("status", "data", "project_id", "month", "project", "hushizhang", "yuanfang", "order_status_list")); + return view($this->bladePath . ".index", compact('buildings', 'areas', "status", "data", "project_id", "month", "project", "hushizhang", "yuanfang", "order_status_list")); } public function _getMonths() @@ -262,11 +270,11 @@ class OrdersController extends CommonController } })->where('admin_id', $user->id)->pluck('area_id'); } - $data = Area::where(function ($query) use ($areaId,$building_id) { + $data = Area::where(function ($query) use ($areaId, $building_id) { if ($areaId) { $query->whereIn('area.id', $areaId); } - if($building_id){ + if ($building_id) { $query->where('building_id', $building_id); } })->with(['project', @@ -295,8 +303,8 @@ class OrdersController extends CommonController $data = $data->toArray(); } // 获取楼栋 - $buildings = Building::where('project_id',$project_id)->where('project_id', $project_id)->get(); - return view($this->bladePath . ".artboard", compact("data", "projects", "project_id","buildings","building_id")); + $buildings = Building::where('project_id', $project_id)->where('project_id', $project_id)->get(); + return view($this->bladePath . ".artboard", compact("data", "projects", "project_id", "buildings", "building_id")); } diff --git a/resources/views/admin/orders/index.blade.php b/resources/views/admin/orders/index.blade.php index 409e907..1142631 100755 --- a/resources/views/admin/orders/index.blade.php +++ b/resources/views/admin/orders/index.blade.php @@ -15,6 +15,20 @@ value="{{$pp->id}}" @if($pp->id == $project_id) {{ "selected" }}@endif>{{$pp->name}} @endforeach + + - +
-
@foreach($buildings as $pp) + @endforeach @@ -25,8 +26,8 @@ From 1c22f9a08704d5d44845dbd622e6906f49769645 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Thu, 26 Dec 2024 10:37:20 +0800 Subject: [PATCH 7/8] update --- resources/views/admin/orders/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/admin/orders/index.blade.php b/resources/views/admin/orders/index.blade.php index 8f3c4de..a698f37 100755 --- a/resources/views/admin/orders/index.blade.php +++ b/resources/views/admin/orders/index.blade.php @@ -23,7 +23,7 @@ value="{{$pp->id}}" @if($pp->id == $building_id) {{ "selected" }}@endif>{{$pp->name}} @endforeach -