result; if($type){ return $this->getDictValue('AlarmHandleResult',$type); }else{ return '未处理'; } } /** * 获取开始时间(文本) */ public function getStartTimeTextAttr($value) { if($this->start_time){ return date('Y-m-d H:i:s',$this->start_time); }else{ return ''; } } /** * 获取结束时间(文本) */ public function getEndTimeTextAttr($value) { if($this->end_time){ return date('Y-m-d H:i:s',$this->end_time); }else{ return ''; } } /** * 设备名称 */ public function getDeviceNameAttr($value) { return '测试设备'; } /** * 获取原因 */ public function getReasonTextAttr($value) { return $this->getDictValue('AlarmReason',$this->alarm_reason); } /** * 获取告警状态 */ public function getStateAttr($value) { return $this->getDictValue('AlarmState',$value); } /* * 获取字典值(文本) */ public function getDictValue($typeCode,$value) { return (new SysDictData())->getValueByCode($typeCode,$value); } /** * 获取告警类型名称 */ public function getAlarmTypeAttr($value) { return $this->getDictValue('AlarmType', $value); } }