| xqd
@@ -3,6 +3,8 @@
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
|
|
use App\Models\InnerDevice;
|
|
|
+use App\Models\InnerDeviceNamesModel;
|
|
|
+use App\Models\Option;
|
|
|
use App\Models\Part;
|
|
|
use App\Models\RepairDevice;
|
|
|
use Illuminate\Http\Request;
|
| xqd
@@ -44,8 +46,8 @@ class RepairDeviceController extends BaseController
|
|
|
|
|
|
public function get(Request $request)
|
|
|
{
|
|
|
- $items = $this->model->orderBy('created_at', 'desc');
|
|
|
-
|
|
|
+ $items = $this->model->orderBy('created_at', 'desc')->with(['inner_device']);
|
|
|
+ //搜索名字
|
|
|
$tmp_items = collect(['name']);
|
|
|
foreach($tmp_items as $tmp_item) {
|
|
|
if($request->has($tmp_item) && !empty($request->input($tmp_item))) {
|
| xqd
@@ -53,6 +55,7 @@ class RepairDeviceController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //搜索内部设备id
|
|
|
$select_items = collect(['inner_device_id']);
|
|
|
foreach($select_items as $select_item) {
|
|
|
if($request->has($select_item) && !empty($request->input($select_item))) {
|
| xqd
@@ -67,10 +70,10 @@ class RepairDeviceController extends BaseController
|
|
|
$item->user_phone = $item->user ? $item->user->phone : '';
|
|
|
$item->project_name = $item->project ? $item->project->name : '';
|
|
|
$item->number = $item->inner_device ? $item->inner_device->number : '';
|
|
|
- $item->spec_name = $item->inner_device ? ($item->inner_device->spec ? $item->inner_device->spec->name : '') : '';
|
|
|
- $item->status_label = $item->inner_device ? $item->inner_device->getStatusLabel() : '';
|
|
|
- $item->device_name = $item->inner_device ? ($item->inner_device->device_name ? $item->inner_device->device_name->name : '') : '';
|
|
|
+ $item->spec_name = $item->inner_device ? ($item->inner_device->spec_name ? $item->inner_device->spec_name : '') : '';
|
|
|
+ $item->device_name = $item->inner_device ? ($item->inner_device->device_name ? $item->inner_device->devices_name->name : '') : '';
|
|
|
$item->work_point_name = $item->work_point ? $item->work_point->name : '';
|
|
|
+ $item->status_label = $item->inner_device ? ($item->inner_device->option ? $item->inner_device->option->name :'' ) : '';
|
|
|
}
|
|
|
|
|
|
return response()->json(['code' => 0, 'message' => '', 'count' => $items->total(), 'data' => $items->items()]);
|