|
@@ -3,8 +3,10 @@
|
|
namespace catchAdmin\alarm\model;
|
|
namespace catchAdmin\alarm\model;
|
|
|
|
|
|
use catcher\base\CatchModel as Model;
|
|
use catcher\base\CatchModel as Model;
|
|
|
|
+use catchAdmin\permissions\model\Users;
|
|
use catchAdmin\permissions\model\DataRangScopeTrait;
|
|
use catchAdmin\permissions\model\DataRangScopeTrait;
|
|
use catchAdmin\system\model\SysDictData;
|
|
use catchAdmin\system\model\SysDictData;
|
|
|
|
+use think\facade\Db;
|
|
class ControlManage extends Model
|
|
class ControlManage extends Model
|
|
{
|
|
{
|
|
use DataRangScopeTrait;
|
|
use DataRangScopeTrait;
|
|
@@ -47,8 +49,9 @@ class ControlManage extends Model
|
|
public function getList()
|
|
public function getList()
|
|
{
|
|
{
|
|
$res=$this->dataRange()
|
|
$res=$this->dataRange()
|
|
|
|
+
|
|
->catchSearch()
|
|
->catchSearch()
|
|
- ->append(['type_text','rfid_type_text','state_text','timeRange','stations'])
|
|
|
|
|
|
+ ->append(['type_text','rfid_type_text','state_text','timeRange','stations','bw_names','creator'])
|
|
->order($this->aliasField('id'), 'desc')
|
|
->order($this->aliasField('id'), 'desc')
|
|
->paginate();
|
|
->paginate();
|
|
return $res;
|
|
return $res;
|
|
@@ -58,7 +61,10 @@ class ControlManage extends Model
|
|
{
|
|
{
|
|
return $query->where('name', 'like', '%' . $value . '%');
|
|
return $query->where('name', 'like', '%' . $value . '%');
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ public function getCreatorAttr($value){
|
|
|
|
+ $val= $this->getData('creator_id');
|
|
|
|
+ return Db::table('users')->where('id',$val)->value('realname');
|
|
|
|
+ }
|
|
public function getTimeRangeAttr($value){
|
|
public function getTimeRangeAttr($value){
|
|
$start_time = $this->getData('start_time');
|
|
$start_time = $this->getData('start_time');
|
|
$end_time = $this->getData('end_time');
|
|
$end_time = $this->getData('end_time');
|
|
@@ -72,7 +78,15 @@ class ControlManage extends Model
|
|
$obj = $this->getData('control_obj');
|
|
$obj = $this->getData('control_obj');
|
|
return $obj;
|
|
return $obj;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ public function getBwNamesAttr($value){
|
|
|
|
+ $ids = $this->getData('bw_ids');
|
|
|
|
+ $idArr=explode(',',$ids);
|
|
|
|
+ $name='';
|
|
|
|
+ foreach($idArr as $val){
|
|
|
|
+ $name.=','.Db::table('bw_list')->where('id',$val)->value('name');
|
|
|
|
+ }
|
|
|
|
+ return trim($name,',');
|
|
|
|
+ }
|
|
public function getTypeTextAttr($value){
|
|
public function getTypeTextAttr($value){
|
|
$type = $this->getData('type');
|
|
$type = $this->getData('type');
|
|
if($type=='1'){
|
|
if($type=='1'){
|