作者 董瑞恩
1 个管道 的构建 通过 耗费 1 秒

interface

@@ -29,13 +29,21 @@ use think\Db; @@ -29,13 +29,21 @@ use think\Db;
29 class AdminFaultController extends AdminBaseController{ 29 class AdminFaultController extends AdminBaseController{
30 30
31 public function index(){ 31 public function index(){
  32 + $param=$this->request->param();
  33 + $where=array();
  34 + if (!empty($param['fault_type'])){
  35 + $where['fault_type']=$param['fault_type'];
  36 + }
32 $data=Db::name('fault') 37 $data=Db::name('fault')
33 ->alias('a') 38 ->alias('a')
34 ->field('a.*,b.serial_number,b.hospital') 39 ->field('a.*,b.serial_number,b.hospital')
35 ->join('equipment b','a.eq_name=b.name') 40 ->join('equipment b','a.eq_name=b.name')
  41 + ->where($where)
36 ->order('a.create_time','desc') 42 ->order('a.create_time','desc')
37 ->paginate(10); 43 ->paginate(10);
  44 +
38 $this->assign('data',$data); 45 $this->assign('data',$data);
  46 + $this->assign('fault_type', isset($param['fault_type']) ? $param['fault_type'] : '');
39 return $this->fetch(); 47 return $this->fetch();
40 } 48 }
41 49
@@ -7,11 +7,11 @@ @@ -7,11 +7,11 @@
7 </ul> 7 </ul>
8 <form class="well form-inline margin-top-20" method="post" action="{:url('AdminFault/index')}"> 8 <form class="well form-inline margin-top-20" method="post" action="{:url('AdminFault/index')}">
9 分类: 9 分类:
10 - <select class="form-control" name="category" style="width: 140px;"> 10 + <select class="form-control" name="fault_type" style="width: 140px;">
11 <option value='0'>全部</option> 11 <option value='0'>全部</option>
12 <option value='1'>计费</option> 12 <option value='1'>计费</option>
13 <option value='2'>床体</option> 13 <option value='2'>床体</option>
14 - <option value='3'>床锁</option> 14 + <option value='3' readonly>床锁</option>
15 <option value='4'>其他</option> 15 <option value='4'>其他</option>
16 </select> &nbsp;&nbsp; 16 </select> &nbsp;&nbsp;
17 <input type="submit" class="btn btn-primary" value="搜索"/> 17 <input type="submit" class="btn btn-primary" value="搜索"/>