作者 王智

xiugai

@@ -30,9 +30,12 @@ class Car extends Backend @@ -30,9 +30,12 @@ class Car extends Backend
30 // $this->view->assign("statusList", $this->model->getStatusList()); 30 // $this->view->assign("statusList", $this->model->getStatusList());
31 $this->view->assign("ismenuList", $this->model->getIsmenuList()); 31 $this->view->assign("ismenuList", $this->model->getIsmenuList());
32 $this->view->assign("typeList", $this->model->getTypeList()); 32 $this->view->assign("typeList", $this->model->getTypeList());
33 - 33 + $filter = $this->request->get("filter", '');
  34 + $filter = json_decode($filter, true);
  35 + $where = [];
  36 + if (!empty($filter['title'])) $where['title'] = ['LIKE', '%' . $filter['title'] . '%'];
34 // 必须将结果集转换为数组 37 // 必须将结果集转换为数组
35 - $ruleList = collection($this->model->field('*,pid')->order('weigh', 'desc')->select())->toArray(); 38 + $ruleList = collection($this->model->field('*,pid')->where($where)->order('weigh', 'desc')->select())->toArray();
36 foreach ($ruleList as $k => &$v) { 39 foreach ($ruleList as $k => &$v) {
37 $v['title'] = __($v['title']); 40 $v['title'] = __($v['title']);
38 $v['remark'] = __($v['remark']); 41 $v['remark'] = __($v['remark']);
@@ -75,8 +78,6 @@ class Car extends Backend @@ -75,8 +78,6 @@ class Car extends Backend
75 if ($this->request->isAjax()) { 78 if ($this->request->isAjax()) {
76 $list = $this->rulelist; 79 $list = $this->rulelist;
77 $total = count($this->rulelist); 80 $total = count($this->rulelist);
78 - dump($list);  
79 - die;  
80 $result = array("total" => $total, "rows" => $list); 81 $result = array("total" => $total, "rows" => $list);
81 return json($result); 82 return json($result);
82 } 83 }