master
cody 1 year ago
parent 45eddc9390
commit 86110c794d

@ -37,6 +37,14 @@ class OrdersController extends CommonController
$project_id = request()->project_id ?? $projects->first()->id; $project_id = request()->project_id ?? $projects->first()->id;
$project = Project::find($project_id); $project = Project::find($project_id);
$status = $request->get('status', 20); $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 ?? '全部'; $month = request()->month ?? '全部';
$months = (new OrdersController())->_getMonths(); $months = (new OrdersController())->_getMonths();
@ -92,7 +100,7 @@ class OrdersController extends CommonController
"bed" => function ($query) { "bed" => function ($query) {
$query->with(["room", "building", "area"]); $query->with(["room", "building", "area"]);
} }
])->where('status',$status) ])->where('status', $status)
->orderBy("id", "desc"); ->orderBy("id", "desc");
if (request()->is_export) { if (request()->is_export) {
@ -118,7 +126,7 @@ class OrdersController extends CommonController
'20' => '进行中', '20' => '进行中',
'100' => '已完成' '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() public function _getMonths()
@ -262,11 +270,11 @@ class OrdersController extends CommonController
} }
})->where('admin_id', $user->id)->pluck('area_id'); })->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) { if ($areaId) {
$query->whereIn('area.id', $areaId); $query->whereIn('area.id', $areaId);
} }
if($building_id){ if ($building_id) {
$query->where('building_id', $building_id); $query->where('building_id', $building_id);
} }
})->with(['project', })->with(['project',
@ -295,8 +303,8 @@ class OrdersController extends CommonController
$data = $data->toArray(); $data = $data->toArray();
} }
// 获取楼栋 // 获取楼栋
$buildings = Building::where('project_id',$project_id)->where('project_id', $project_id)->get(); $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")); return view($this->bladePath . ".artboard", compact("data", "projects", "project_id", "buildings", "building_id"));
} }

@ -15,6 +15,20 @@
value="{{$pp->id}}" @if($pp->id == $project_id) {{ "selected" }}@endif>{{$pp->name}}</option> value="{{$pp->id}}" @if($pp->id == $project_id) {{ "selected" }}@endif>{{$pp->name}}</option>
@endforeach @endforeach
</select> </select>
<select class="form-control mr-1" name="building_id"
onchange="$(this).closest('form').submit()">
@foreach($buildings as $pp)
<option
value="{{$pp->id}}" @if($pp->id == $building_id) {{ "selected" }}@endif>{{$pp->name}}</option>
@endforeach
</select>
<select class="form-control mr-1" name="building_id"
onchange="$(this).closest('form').submit()">
@foreach($areas as $pp)
<option
value="{{$pp->id}}" @if($pp->id == $area_id) {{ "selected" }}@endif>{{$pp->name}}</option>
@endforeach
</select>
<select class="form-control mr-1" name="month" onchange="$(this).closest('form').submit()"> <select class="form-control mr-1" name="month" onchange="$(this).closest('form').submit()">
@foreach($months as $mm) @foreach($months as $mm)
<option value="{{$mm}}" @if($mm == $month) {{ "selected" }}@endif>{{$mm}}</option> <option value="{{$mm}}" @if($mm == $month) {{ "selected" }}@endif>{{$mm}}</option>
@ -49,7 +63,7 @@
<th>所属项目/医院</th> <th>所属项目/医院</th>
<th>所在楼栋</th> <th>所在楼栋</th>
<th>所在病区</th> <th>所在病区</th>
<th>客户科室</th> {{-- <th>客户科室</th>--}}
<th>客户姓名</th> <th>客户姓名</th>
<th>客户余额</th> <th>客户余额</th>
<th>联系电话</th> <th>联系电话</th>
@ -73,7 +87,7 @@
<td>{{ $row->project->name }}</td> <td>{{ $row->project->name }}</td>
<td>{{ $row->bed->building->name }}</td> <td>{{ $row->bed->building->name }}</td>
<td>{{ $row->bed->area->name }}</td> <td>{{ $row->bed->area->name }}</td>
<td>{{ $row->department }}</td> {{-- <td>{{ $row->department }}</td>--}}
<td>{{ $row->customer->name ?: $row->patient->name }}</td> <td>{{ $row->customer->name ?: $row->patient->name }}</td>
<td>{{ $row->customer->balance }}</td> <td>{{ $row->customer->balance }}</td>
<td>{{ $row->customer->mobile }}</td> <td>{{ $row->customer->mobile }}</td>

Loading…
Cancel
Save