作者 王智

daima

@@ -43,20 +43,22 @@ class Renwu extends Backend @@ -43,20 +43,22 @@ class Renwu extends Backend
43 $this->relationSearch = true; 43 $this->relationSearch = true;
44 //设置过滤方法 44 //设置过滤方法
45 $this->request->filter(['strip_tags', 'trim']); 45 $this->request->filter(['strip_tags', 'trim']);
46 - if ($this->request->isAjax()) { 46 + if ($this->request->isAjax())
  47 + {
47 //如果发送的来源是Selectpage,则转发到Selectpage 48 //如果发送的来源是Selectpage,则转发到Selectpage
48 - if ($this->request->request('keyField')) { 49 + if ($this->request->request('keyField'))
  50 + {
49 return $this->selectpage(); 51 return $this->selectpage();
50 } 52 }
51 list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 53 list($where, $sort, $order, $offset, $limit) = $this->buildparams();
52 $total = $this->model 54 $total = $this->model
53 - ->with(['user', 'vip', 'xiid', 'zhaoid']) 55 + ->with(['user','vip'])
54 ->where($where) 56 ->where($where)
55 ->order($sort, $order) 57 ->order($sort, $order)
56 ->count(); 58 ->count();
57 59
58 $list = $this->model 60 $list = $this->model
59 - ->with(['user', 'vip', 'xiid', 'zhaoid']) 61 + ->with(['user','vip'])
60 ->where($where) 62 ->where($where)
61 ->order($sort, $order) 63 ->order($sort, $order)
62 ->limit($offset, $limit) 64 ->limit($offset, $limit)
@@ -64,9 +66,7 @@ class Renwu extends Backend @@ -64,9 +66,7 @@ class Renwu extends Backend
64 66
65 foreach ($list as $row) { 67 foreach ($list as $row) {
66 68
67 - $row->getRelation('user')->visible(['nickname', 'mobile', 'address', 'address_con', 'car_num', 'color', 'car_type', 'vip']);  
68 - $row->getRelation('xi_id')->visible(['nickname']);  
69 - $row->getRelation('zhao_id')->visible(['nickname']); 69 + $row->getRelation('user')->visible(['nickname','mobile','address','address_con','car_num','color','car_type','vip']);
70 $row->getRelation('vip')->visible(['title']); 70 $row->getRelation('vip')->visible(['title']);
71 } 71 }
72 $list = collection($list)->toArray(); 72 $list = collection($list)->toArray();
@@ -102,14 +102,6 @@ class Renwu extends Model @@ -102,14 +102,6 @@ class Renwu extends Model
102 { 102 {
103 return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); 103 return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
104 } 104 }
105 - public function xi_id()  
106 - {  
107 - return $this->belongsTo('User', 'xi_id', 'id', [], 'LEFT')->setEagerlyType(0);  
108 - }  
109 - public function zhao_id()  
110 - {  
111 - return $this->belongsTo('User', 'zhao_id', 'id', [], 'LEFT')->setEagerlyType(0);  
112 - }  
113 105
114 106
115 public function vip() 107 public function vip()
@@ -39,11 +39,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -39,11 +39,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
39 {field: 'vip.title', title: __('Vip.title'),operate:false}, 39 {field: 'vip.title', title: __('Vip.title'),operate:false},
40 {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"0":__('Type 0'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, 40 {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"0":__('Type 0'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
41 // {field: 'xi_id', title: __('Xi_id')}, 41 // {field: 'xi_id', title: __('Xi_id')},
42 - {field: 'xi_id.nickname', title: __('xi_id.nickname'),operate:'LIKE'},  
43 {field: 'xi_type', title: __('Xi_type'), searchList: {"1":__('Xi_type 1'),"0":__('Xi_type 0'),"2":__('Xi_type 2')}, formatter: Table.api.formatter.normal}, 42 {field: 'xi_type', title: __('Xi_type'), searchList: {"1":__('Xi_type 1'),"0":__('Xi_type 0'),"2":__('Xi_type 2')}, formatter: Table.api.formatter.normal},
44 // {field: 'xi_images', title: __('Xi_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, 43 // {field: 'xi_images', title: __('Xi_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
45 // {field: 'zhao_id', title: __('Zhao_id')}, 44 // {field: 'zhao_id', title: __('Zhao_id')},
46 - {field: 'zhao_id.nickname', title: __('zhao_id.nickname'),operate:'LIKE'},  
47 {field: 'zhao_type', title: __('Zhao_type'), searchList: {"1":__('Zhao_type 1'),"0":__('Zhao_type 0'),"2":__('Zhao_type 2')}, formatter: Table.api.formatter.normal}, 45 {field: 'zhao_type', title: __('Zhao_type'), searchList: {"1":__('Zhao_type 1'),"0":__('Zhao_type 0'),"2":__('Zhao_type 2')}, formatter: Table.api.formatter.normal},
48 // {field: 'zhao_images', title: __('Zhao_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, 46 // {field: 'zhao_images', title: __('Zhao_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
49 {field: 'car_address', title: __('Car_address'),operate:'LIKE'}, 47 {field: 'car_address', title: __('Car_address'),operate:'LIKE'},