作者 SHW\戥岁。。

类别通用搜索

@@ -29,6 +29,7 @@ class Litestoregoods extends Backend @@ -29,6 +29,7 @@ class Litestoregoods extends Backend
29 */ 29 */
30 protected $model = null; 30 protected $model = null;
31 protected $spec_model = null; 31 protected $spec_model = null;
  32 +// protected $searchFields = 'category.name';
32 33
33 public function _initialize() 34 public function _initialize()
34 { 35 {
@@ -70,7 +71,7 @@ class Litestoregoods extends Backend @@ -70,7 +71,7 @@ class Litestoregoods extends Backend
70 if ($this->request->request('keyField')) { 71 if ($this->request->request('keyField')) {
71 return $this->selectpage(); 72 return $this->selectpage();
72 } 73 }
73 - list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 74 + list($where, $sort, $order, $offset, $limit) = $this->buildparams("category.name",true);
74 $total = $this->model 75 $total = $this->model
75 ->with(['category', 'activity']) 76 ->with(['category', 'activity'])
76 ->where($where) 77 ->where($where)
@@ -31,7 +31,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestor @@ -31,7 +31,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestor
31 {field: 'goods_id', title: __('Goods_id')}, 31 {field: 'goods_id', title: __('Goods_id')},
32 {field: 'goods_name', title: __('Goods_name'), operate: 'LIKE'}, 32 {field: 'goods_name', title: __('Goods_name'), operate: 'LIKE'},
33 {field: 'keywords', title: __('Keywords'), operate: 'LIKE'}, 33 {field: 'keywords', title: __('Keywords'), operate: 'LIKE'},
34 - {field: 'category.name', title: __('Category.name'), operate: false}, 34 + {field: 'category.name', title: __('Category.name'), operate: 'LIKE'},
35 {field: 'activity.name', title: __('Activity.name'), operate: false}, 35 {field: 'activity.name', title: __('Activity.name'), operate: false},
36 {field: 'category_id', visible: false, title: __('Category_id')}, 36 {field: 'category_id', visible: false, title: __('Category_id')},
37 {field: 'image', title: __('Image'), formatter: Table.api.formatter.image}, 37 {field: 'image', title: __('Image'), formatter: Table.api.formatter.image},