likang 2 years ago
parent
commit
d31fbd17b1

+ 18 - 0
catch/hydraulic/controller/Maintenance.php

@@ -25,6 +25,7 @@ class Maintenance extends CatchController
      */
     public function index(Request $request) : \think\Response
     {
+        $data =$request->post();
         return CatchResponse::paginate($this->maintenanceModel->getList());
     }
     
@@ -87,4 +88,21 @@ class Maintenance extends CatchController
     {
         return CatchResponse::success($this->maintenanceModel->deleteBy($id,true));
     }
+    /**
+     * function
+     * 获取参数类型
+     * @return void
+     */
+    public function getMaintenOption(Request $request)
+    {
+        $data= $request->get();
+        $where = [];
+        if($data['type'])
+        {
+             $where[]  = ['device_type','=',$data['type']];
+        }
+        $list = $this->maintenanceModel->where($where)->field('value,name')->select();
+        return CatchResponse::success($list);
+
+    }
 }

+ 5 - 1
catch/hydraulic/model/MaintenanceMapper.php

@@ -58,7 +58,8 @@ class maintenancemapper extends Model
 
         return $query->where('device_type', '=', $value);
         
-    } 
+    }
+    
 
     /**
      * 设备类型名称
@@ -68,5 +69,8 @@ class maintenancemapper extends Model
        
         return (new SysDictData())->getValueByCode('Maintenance', $value) ?: '';
     }
+    /**
+     * 搜索属性
+     */
 
 }

+ 2 - 1
catch/hydraulic/route.php

@@ -18,6 +18,7 @@ $router->group(function () use ($router){
 	$router->get('get_device_mold', '\catchAdmin\hydraulic\controller\DeviceMold@getDeviceMold');
 	// wrench路由
 	$router->resource('wrench', '\catchAdmin\hydraulic\controller\Wrench');
-	// 
+	//获取维保记录映射
+	 $router->get('get_mainten_option', '\catchAdmin\hydraulic\controller\Maintenance@getMaintenOption');
 	$router->resource('maintenance_mapper', '\catchAdmin\hydraulic\controller\Maintenance');
 })->middleware('auth');