Quellcode durchsuchen

Merge branch 'master' of http://gogs.renlianiot.com:4000/zmcoding/smart-tool-api

tongshanglei vor 2 Jahren
Ursprung
Commit
08c228a926

+ 23 - 0
catch/equipment/EquipmentService.php

@@ -0,0 +1,23 @@
+<?php
+// +----------------------------------------------------------------------
+// | CatchAdmin [Just Like ~ ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
+// +----------------------------------------------------------------------
+// | Author: JaguarJack [ njphper@gmail.com ]
+// +----------------------------------------------------------------------
+
+namespace catchAdmin\equipment;
+
+use catcher\ModuleService;
+
+class EquipmentService extends ModuleService
+{
+    public function loadRouteFrom()
+    {
+        // TODO: Implement loadRouteFrom() method.
+        return __DIR__ . DIRECTORY_SEPARATOR . 'route.php';
+    }
+}

+ 107 - 0
catch/equipment/controller/EquipmentType.php

@@ -0,0 +1,107 @@
+<?php
+/*
+ * @Descripttion: 
+ * @version: 1.0.0
+ * @Author: likang
+ * @Date: 2022-06-17 15:45:05
+ * @LastEditors: likang
+ * @LastEditTime: 2022-06-21 14:19:07
+ */
+
+namespace catchAdmin\equipment\controller;
+
+use catcher\base\CatchRequest as Request;
+use catcher\CatchResponse;
+use catcher\base\CatchController;
+use catchAdmin\equipment\model\EquipmentType as equipmentTypeModel;
+
+class EquipmentType extends CatchController
+{
+    protected $equipmentTypeModel;
+    
+    public function __construct(EquipmentTypeModel $equipmentTypeModel)
+    {
+        $this->equipmentTypeModel = $equipmentTypeModel;
+    }
+    
+    /**
+     * 列表
+     * @time 2022年06月17日 15:45
+     * @param Request $request 
+     */
+    public function index(Request $request) : \think\Response
+    {
+        $pch =null;
+       $pch = $this->equipmentTypeModel->where('pid',0)->order('order asc')->select()->toArray();
+       foreach($pch as $key=>$value)
+       {    
+            $list= $this->equipmentTypeModel->where('pid',$value['id'])->order('order asc')->select()->toArray();
+            foreach($list as $k=>$v)
+            {
+                $list[$k]['pid'] = strval($v['pid']);
+                $list[$k]['status']=strval($v['status']);
+            }
+            $pch[$key]['children']= $list;
+            $pch[$key]['pid'] = strval($value['pid']);
+            $pch[$key]['status']=strval($value['status']);
+       }
+
+        return CatchResponse::success($pch);
+    }
+    
+    /**
+     * 保存信息
+     * @time 2022年06月17日 15:45
+     * @param Request $request 
+     */
+    public function save(Request $request) : \think\Response
+    {
+        return CatchResponse::success($this->equipmentTypeModel->storeBy($request->post()));
+    }
+    
+    /**
+     * 读取
+     * @time 2022年06月17日 15:45
+     * @param $id 
+     */
+    public function read($id) : \think\Response
+    {
+        return CatchResponse::success($this->equipmentTypeModel->findBy($id));
+    }
+    
+    /**
+     * 更新
+     * @time 2022年06月17日 15:45
+     * @param Request $request 
+     * @param $id
+     */
+    public function update(Request $request, $id) : \think\Response
+    {
+        
+        return CatchResponse::success($this->equipmentTypeModel->updateBy($id, $request->post()));
+    }
+    
+    /**
+     * 删除
+     * @time 2022年06月17日 15:45
+     * @param $id
+     */
+    public function delete($id) : \think\Response
+    {
+        if($id<=7)
+        {
+            return CatchResponse::fail('该类型不能删除');
+        }
+        return CatchResponse::success($this->equipmentTypeModel->deleteBy($id,true));
+    }
+    /**
+     * @Descripttion: 获取父类设备种类
+     * @name: likang
+     * @return {*}
+     */    
+    public function findParentEquipmentType()
+    {
+        $pch = $this->equipmentTypeModel->where('pid',0)->order('order asc')->select();
+        return CatchResponse::success($pch);
+    }
+}

+ 42 - 0
catch/equipment/database/migrations/20220617154512_equipment_type.php

@@ -0,0 +1,42 @@
+<?php
+use think\migration\Migrator;
+use think\migration\db\Column;
+use Phinx\Db\Adapter\MysqlAdapter;
+
+class EquipmentType extends Migrator
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
+     *
+     * The following commands can be used in this method and Phinx will
+     * automatically reverse them when rolling back:
+     *
+     *    createTable
+     *    renameTable
+     *    addColumn
+     *    renameColumn
+     *    addIndex
+     *    addForeignKey
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change()
+    {
+        $table = $this->table('equipment_type', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '设备类型表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
+        $table->addColumn('pid', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '父类的id',])
+			->addColumn('status', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '1 有效  -1 无效',])
+			->addColumn('name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '名称',])
+            ->addColumn('order', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '顺序',])
+			->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
+			->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
+			->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
+			->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
+            ->create();
+    }
+}

+ 47 - 0
catch/equipment/model/EquipmentType.php

@@ -0,0 +1,47 @@
+<?php
+/*
+ * @Descripttion: 
+ * @version: 1.0.0
+ * @Author: likang
+ * @Date: 2022-06-17 15:45:06
+ * @LastEditors: likang
+ * @LastEditTime: 2022-06-21 13:57:42
+ */
+
+namespace catchAdmin\equipment\model;
+
+use catcher\base\CatchModel as Model;
+use think\Model as ThinkModel;
+
+class EquipmentType extends Model
+{
+    // 表名
+    public $name = 'equipment_type';
+    // 数据库字段映射
+    public $field = array(
+        'id',
+        // 父类的id
+        'pid',
+        // 1 有效  -1 无效
+        'status',
+        // 名称
+        'name',
+        // 创建人ID
+        'creator_id',
+        // 创建时间
+        'created_at',
+        // 更新时间
+        'updated_at',
+        // 软删除
+        'deleted_at',
+        //顺序
+        'order'
+    );
+    public function getParentNamebyChildId($id)
+    {
+        $pid =$this->where('id',$id)->value('pid');
+        $name =  $this->where('id',$pid)->value('name');
+        return $name;
+    }
+
+}

+ 15 - 0
catch/equipment/module.json

@@ -0,0 +1,15 @@
+{
+    "name": "equipment",
+    "alias": "equipment",
+    "description": "设备管理",
+    "version": "1.0.0",
+    "keywords": [""],
+    "order": 0,
+    "services": [
+        "\\catchAdmin\\equipment\\EquipmentService"
+    ],
+    "aliases": {},
+    "files": [],
+    "requires": [],
+    "enable": true
+}

+ 17 - 0
catch/equipment/route.php

@@ -0,0 +1,17 @@
+<?php
+// +----------------------------------------------------------------------
+// | CatchAdmin [Just Like ~ ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
+// +----------------------------------------------------------------------
+// | Author: JaguarJack [ njphper@gmail.com ]
+// +----------------------------------------------------------------------
+
+// you should use `$router`
+$router->group(function () use ($router){
+	// equipmentType路由
+	$router->resource('equipmentType', '\catchAdmin\equipment\controller\EquipmentType');
+	$router->get('findParentEquipmentTyp','\catchAdmin\equipment\controller\EquipmentType@findParentEquipmentType');
+})->middleware('auth');

+ 69 - 0
catch/hydraulic/controller/HydEquipment.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace catchAdmin\hydraulic\controller;
+
+use catcher\base\CatchRequest as Request;
+use catcher\CatchResponse;
+use catcher\base\CatchController;
+use catchAdmin\hydraulic\model\HydEquipment as hydEquipmentModel;
+
+class HydEquipment extends CatchController
+{
+    protected $hydEquipmentModel;
+    
+    public function __construct(HydEquipmentModel $hydEquipmentModel)
+    {
+        $this->hydEquipmentModel = $hydEquipmentModel;
+    }
+    
+    /**
+     * 列表
+     * @time 2022年06月21日 11:02
+     * @param Request $request 
+     */
+    public function index(Request $request) : \think\Response
+    {
+        return CatchResponse::paginate($this->hydEquipmentModel->getList());
+    }
+    
+    /**
+     * 保存信息
+     * @time 2022年06月21日 11:02
+     * @param Request $request 
+     */
+    public function save(Request $request) : \think\Response
+    {
+        return CatchResponse::success($this->hydEquipmentModel->storeBy($request->post()));
+    }
+    
+    /**
+     * 读取
+     * @time 2022年06月21日 11:02
+     * @param $id 
+     */
+    public function read($id) : \think\Response
+    {
+        return CatchResponse::success($this->hydEquipmentModel->findBy($id));
+    }
+    
+    /**
+     * 更新
+     * @time 2022年06月21日 11:02
+     * @param Request $request 
+     * @param $id
+     */
+    public function update(Request $request, $id) : \think\Response
+    {
+        return CatchResponse::success($this->hydEquipmentModel->updateBy($id, $request->post()));
+    }
+    
+    /**
+     * 删除
+     * @time 2022年06月21日 11:02
+     * @param $id
+     */
+    public function delete($id) : \think\Response
+    {
+        return CatchResponse::success($this->hydEquipmentModel->deleteBy($id));
+    }
+}

+ 2 - 2
catch/hydraulic/controller/WrenchCheckRecord.php

@@ -5,7 +5,7 @@
  * @Author: likang
  * @Date: 2022-06-10 16:59:25
  * @LastEditors: likang
- * @LastEditTime: 2022-06-13 15:19:23
+ * @LastEditTime: 2022-06-13 15:35:12
  */
 namespace catchAdmin\hydraulic\controller;
 
@@ -84,7 +84,7 @@ class WrenchCheckRecord extends CatchController
     {  
        $data = $request->get();
         $check_id = $data['id'];
-        $list =   WrenchCheckRecordData::where('wrench_check_id',$check_id)->order('stress','desc')->select();
+        $list =   WrenchCheckRecordData::where('wrench_check_id',$check_id)->order('stress','asc')->select();
         return CatchResponse::success($list);
     }
 }

+ 8 - 6
catch/hydraulic/database/migrations/20220303142809_hydraulic.php

@@ -1,4 +1,12 @@
 <?php
+/*
+ * @Descripttion: 
+ * @version: 1.0.0
+ * @Author: likang
+ * @Date: 2022-05-27 13:34:31
+ * @LastEditors: likang
+ * @LastEditTime: 2022-06-21 16:40:42
+ */
 
 use think\migration\Migrator;
 use think\migration\db\Column;
@@ -32,13 +40,7 @@ class Hydraulic extends Migrator
         $table = $this->table('hydraulic', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
         //基础信息
         $table->addColumn('number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '编号',])
-			->addColumn('model', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '型号',])
 			->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '所属部门',])
-			->addColumn('name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '名称',])
-			->addColumn('is_used', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '使用状态',])
-			->addColumn('brand', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '品牌',])
-			->addColumn('supplier', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '供应商',])
-			->addColumn('out_date', 'date', ['null' => true,'signed' => true,'comment' => '出厂日期',])
             ->addColumn('remark', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '备注',])
 			->addColumn('alarm_state', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '告警状态',])
 			->addColumn('net_state', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '网络状态',])

+ 1 - 1
catch/hydraulic/database/migrations/20220505112140_hydraulic_add_fields.php

@@ -42,7 +42,7 @@ class HydraulicAddFields extends Migrator
 
             $table  ->addColumn('imei', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => 'imei号',])
                     ->addColumn('sim_card', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => 'sim卡号',])
-                    ->addColumn('check_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'default' => null,'signed' => true,'comment' => '校验时间',])
+                    ->addColumn('eq_id', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '设备id',])
                     ->addColumn('effective_period', 'string', ['limit' => 8,'null' => true,'signed' => true,'comment' => '有效周期',])
                     ->addColumn('effective_time', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '有效截止时间',])
                     ->update();

+ 11 - 13
catch/hydraulic/database/migrations/20220506141132_wrench.php

@@ -1,4 +1,12 @@
 <?php
+/*
+ * @Descripttion: 
+ * @version: 1.0.0
+ * @Author: likang
+ * @Date: 2022-05-27 13:34:31
+ * @LastEditors: likang
+ * @LastEditTime: 2022-06-21 16:46:12
+ */
 
 use think\migration\Migrator;
 use think\migration\db\Column;
@@ -31,29 +39,19 @@ class Wrench extends Migrator
     {
         $table = $this->table('wrench', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '液压扳手' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
         $table->addColumn('number', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '编号',])
-			->addColumn('model', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '型号',])
 			->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '所属部门',])
-			->addColumn('name', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '名称',])
-			->addColumn('is_used', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '使用状态',])
-			->addColumn('brand', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '品牌',])
-			->addColumn('supplier', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '供应商',])
-			->addColumn('out_date', 'date', ['null' => true,'signed' => true,'comment' => '出厂日期',])
+			->addColumn('eq_id', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '设备id',])
 			->addColumn('remark', 'string', ['limit' => 256,'null' => true,'signed' => true,'comment' => '备注',])
 			->addColumn('alarm_state', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '告警状态',])
 			->addColumn('net_state', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '网络状态',])
 			->addColumn('online_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '在线时间',])
-			->addColumn('max_pressure', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '最大压力',])
-            ->addColumn('min_pressure', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '最小压力',])
+			->addColumn('pressure', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '压力',])
             ->addColumn('angle_sensor', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '角度传感器',])
-            
-
-
 			->addColumn('checked_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '校验时间',])
 			->addColumn('checked_no', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '校验台编号',])
 			->addColumn('checked_res', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '校验结果',])
 			->addColumn('checked_user_id', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '操作员',])
-			->addColumn('max_torque', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '最大扭矩',])
-			->addColumn('min_torque', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '最小扭矩',])
+			->addColumn('torque', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '扭矩',])
 			->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
 			->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
 			->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])

+ 52 - 0
catch/hydraulic/database/migrations/20220621110250_hydraulic_equipment.php

@@ -0,0 +1,52 @@
+<?php
+
+use think\migration\Migrator;
+use think\migration\db\Column;
+use Phinx\Db\Adapter\MysqlAdapter;
+
+class HydraulicEquipment extends Migrator
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
+     *
+     * The following commands can be used in this method and Phinx will
+     * automatically reverse them when rolling back:
+     *
+     *    createTable
+     *    renameTable
+     *    addColumn
+     *    renameColumn
+     *    addIndex
+     *    addForeignKey
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change()
+    {
+        $table = $this->table('hydraulic_equipment', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
+        $table->addColumn('material_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '物料号',])
+			->addColumn('equipment_type', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '设备类别',])
+			->addColumn('name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '工具名称',])
+			->addColumn('equipment_model', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '设备型号',])
+			->addColumn('issue_unit', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '发放单位',])
+			->addColumn('fixed_asset_number', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '固定资产编号',])
+			->addColumn('fixed_asset_number2', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '类固定资产编号',])
+			->addColumn('serial_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '序列号',])
+			->addColumn('factory_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '出厂编号',])
+			->addColumn('check_last_time', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '上次校验时间',])
+			->addColumn('check_next_time', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '下次校验时间',])
+			->addColumn('check_status', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '校验状态',])
+			->addColumn('status', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '状态',])
+			->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
+			->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
+			->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
+			->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
+            ->create();
+    }
+}

+ 101 - 0
catch/hydraulic/model/HydEquipment.php

@@ -0,0 +1,101 @@
+<?php
+
+namespace catchAdmin\hydraulic\model;
+
+use catchAdmin\equipment\model\EquipmentType;
+use catcher\base\CatchModel as Model;
+use catchAdmin\permissions\model\DataRangScopeTrait;
+use catchAdmin\system\model\SysDictData;
+
+class HydEquipment extends Model
+{
+    use DataRangScopeTrait;
+    // 表名
+    public $name = 'hydraulic_equipment';
+    // 数据库字段映射
+    public $field = array(
+        'id',
+        // 物料号
+        'material_number',
+        // 设备类别
+        'equipment_type',
+        // 工具名称
+        'name',
+        // 设备型号
+        'equipment_model',
+        // 发放单位
+        'issue_unit',
+        // 固定资产编号
+        'fixed_asset_number',
+        // 类固定资产编号
+        'fixed_asset_number2',
+        // 序列号
+        'serial_number',
+        // 出厂编号
+        'factory_number',
+        // 上次校验时间
+        'check_last_time',
+        // 下次校验时间
+        'check_next_time',
+        // 校验状态
+        'check_status',
+        // 状态
+        'status',
+        // 创建人ID
+        'creator_id',
+        // 创建时间
+        'created_at',
+        // 更新时间
+        'updated_at',
+        // 软删除
+        'deleted_at',
+    );
+    public function getList()
+    {
+        $res =  $this->dataRange()
+            ->catchSearch()
+            ->append(['classification','equ_type_name', 'list'])
+            ->order($this->aliasField('id'), 'desc')
+            ->paginate();
+        return $res;
+    }
+    public function getClassificationAttr()
+    {
+        $id = $this->getData('equipment_type');
+        $eq = new EquipmentType();
+        $name = $eq->getParentNamebyChildId($id);
+        return $name;
+    }
+    public function getEquTypeNameAttr()
+    {
+        $id = $this->getData('equipment_type');
+        $name =  EquipmentType::where('id',$id)->value('name');
+        return $name;
+    }
+    public function getCheckStatusAttr()
+    {
+        $id = $this->getData('check_status');
+        $Dict =  new SysDictData();
+        $value = $Dict->getValueByCode('Check',$id);
+        return $value;
+    }
+    public function getStatusAttr()
+    {
+        $id = $this->getData('status');
+        $Dict =  new SysDictData();
+        $value = $Dict->getValueByCode('ToolStatus',$id);
+        return $value;
+    }
+    public function getCheckLastTimeAttr()
+    {
+        $time = $this->getData('check_last_time');
+        return date('Y-m-d',$time);
+    }
+    public function getCheckNextTimeAttr()
+    {
+        $time = $this->getData('check_next_time');
+        return date('Y-m-d',$time);
+    }
+    
+    
+}

+ 8 - 6
catch/hydraulic/model/Hydraulic.php

@@ -21,13 +21,13 @@ class Hydraulic extends Model
         // 所属部门
         'department_id',
         // 名称
-        'name',
+        //'name',
         // 使用状态
-        'is_used',
+        //'is_used',
         // 品牌
-        'brand',
+       // 'brand',
         // 供应商
-        'supplier',
+        //'supplier',
         // 出厂日期
         'out_date',
         // 告警状态
@@ -35,7 +35,7 @@ class Hydraulic extends Model
         // 网络状态
         'net_state',
         // 在线时间
-        'online_time',
+        //'online_time',
         //扭矩
         'torque',
         //压力
@@ -62,7 +62,9 @@ class Hydraulic extends Model
         'sim_card',
         'effective_time',
         'effective_period',
-        'check_time',
+        //设备的id
+        'eq_id'
+        
     );
      /**
      * 获取列表

+ 14 - 16
catch/hydraulic/model/Wrench.php

@@ -16,20 +16,22 @@ class Wrench extends Model
         'id',
         // 编号
         'number',
+        //设备id
+        'eq_id',
         // 型号
-        'model',
+        //'model',
         // 所属部门
         'department_id',
         // 名称
-        'name',
+        //'name',
         // 使用状态
-        'is_used',
+        //'is_used',
         // 品牌
-        'brand',
+        //'brand',
         // 供应商
-        'supplier',
+        //'supplier',
         // 出厂日期
-        'out_date',
+       // 'out_date',
         // 备注
         'remark',
         // 告警状态
@@ -37,24 +39,20 @@ class Wrench extends Model
         // 网络状态
         'net_state',
         // 在线时间
-        'online_time',
-        // 最大压力
-        'max_pressure',
+        //'online_time',
+        //最大压力
+        'pressure',
         // 最小压力
-        'min_pressure',
+       // 'min_pressure',
         'angle_sensor',
-        // 校验时间
-        'checked_at',
         // 校验台编号
         'checked_no',
         // 校验结果
         'checked_res',
         // 操作员
         'checked_user_id',
-        // 最大扭矩
-        'max_torque',
-        // 最小扭矩
-        'min_torque',
+        // 扭矩
+        'torque',
         // 创建人ID
         'creator_id',
         // 创建时间

+ 2 - 1
catch/hydraulic/route.php

@@ -1,5 +1,4 @@
 <?php
-
 // +----------------------------------------------------------------------
 // | CatchAdmin [Just Like ~ ]
 // +----------------------------------------------------------------------
@@ -25,4 +24,6 @@ $router->group(function () use ($router){
 	// 扳手校验路由
 	$router->resource('wrenchCheckRecord', '\catchAdmin\hydraulic\controller\WrenchCheckRecord');
 	$router->get('wrenchCheckRecordData', '\catchAdmin\hydraulic\controller\WrenchCheckRecord@decordDataList');
+	// 液压设备路由
+	$router->resource('hydEquipment', '\catchAdmin\hydraulic\controller\HydEquipment');
 })->middleware('auth');