作者 王智

daima

... ... @@ -50,13 +50,13 @@ class Renwu extends Backend
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->with(['user', 'vip','user_xi','user_zhao'])
->with(['user', 'vip', 'xi_id', 'zhao_id'])
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with(['user', 'vip','user_xi','user_zhao'])
->with(['user', 'vip', 'xi_id', 'zhao_id'])
->where($where)
->order($sort, $order)
->limit($offset, $limit)
... ... @@ -65,8 +65,8 @@ 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('user_xi')->visible(['nickname']);
$row->getRelation('user_zhao')->visible(['nickname']);
$row->getRelation('xi_id')->visible(['nickname']);
$row->getRelation('zhao_id')->visible(['nickname']);
$row->getRelation('vip')->visible(['title']);
}
$list = collection($list)->toArray();
... ...
... ... @@ -102,11 +102,11 @@ class Renwu extends Model
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function user_xi()
public function xi_id()
{
return $this->belongsTo('User', 'xi_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function user_zhao()
public function zhao_id()
{
return $this->belongsTo('User', 'zhao_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
... ...
... ... @@ -39,11 +39,11 @@ 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: 'user_xi.nickname', title: __('user_xi.nickname'),operate:'LIKE'},
{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: 'user_zhao.nickname', title: __('user_zhao.nickname'),operate:'LIKE'},
{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'},
... ...