123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?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);
- }
-
-
- }
|