作者 王智

daima

... ... @@ -43,20 +43,22 @@ class Renwu extends Backend
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
if ($this->request->isAjax())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
if ($this->request->request('keyField'))
{
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->with(['user', 'vip', 'xiid', 'zhaoid'])
->with(['user','vip'])
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with(['user', 'vip', 'xiid', 'zhaoid'])
->with(['user','vip'])
->where($where)
->order($sort, $order)
->limit($offset, $limit)
... ... @@ -64,9 +66,7 @@ class Renwu extends Backend
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname', 'mobile', 'address', 'address_con', 'car_num', 'color', 'car_type', 'vip']);
$row->getRelation('xi_id')->visible(['nickname']);
$row->getRelation('zhao_id')->visible(['nickname']);
$row->getRelation('user')->visible(['nickname','mobile','address','address_con','car_num','color','car_type','vip']);
$row->getRelation('vip')->visible(['title']);
}
$list = collection($list)->toArray();
... ...
... ... @@ -102,14 +102,6 @@ class Renwu extends Model
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function xi_id()
{
return $this->belongsTo('User', 'xi_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function zhao_id()
{
return $this->belongsTo('User', 'zhao_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function vip()
... ...
... ... @@ -39,11 +39,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'vip.title', title: __('Vip.title'),operate:false},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"0":__('Type 0'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
// {field: 'xi_id', title: __('Xi_id')},
{field: 'xi_id.nickname', title: __('xi_id.nickname'),operate:'LIKE'},
{field: 'xi_type', title: __('Xi_type'), searchList: {"1":__('Xi_type 1'),"0":__('Xi_type 0'),"2":__('Xi_type 2')}, formatter: Table.api.formatter.normal},
// {field: 'xi_images', title: __('Xi_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
// {field: 'zhao_id', title: __('Zhao_id')},
{field: 'zhao_id.nickname', title: __('zhao_id.nickname'),operate:'LIKE'},
{field: 'zhao_type', title: __('Zhao_type'), searchList: {"1":__('Zhao_type 1'),"0":__('Zhao_type 0'),"2":__('Zhao_type 2')}, formatter: Table.api.formatter.normal},
// {field: 'zhao_images', title: __('Zhao_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'car_address', title: __('Car_address'),operate:'LIKE'},
... ...