ReqOrder.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. /**
  5. * 需求订单
  6. *
  7. */
  8. class ReqOrder extends Backend
  9. {
  10. /**
  11. * ReqOrder模型对象
  12. * @var \app\admin\model\ReqOrder
  13. */
  14. protected $model = null;
  15. protected $preExcludeFields = ['id', 'create_time', 'update_time'];
  16. protected $withJoinTable = ['department', 'admin', 'supplier'];
  17. protected $quickSearchField = ['id'];
  18. public function initialize()
  19. {
  20. parent::initialize();
  21. $this->model = new \app\admin\model\ReqOrder;
  22. }
  23. /**
  24. * 查看
  25. */
  26. public function index()
  27. {
  28. $this->request->filter(['strip_tags', 'trim']);
  29. // 如果是select则转发到select方法,若select未重写,其实还是继续执行index
  30. if ($this->request->param('select')) {
  31. $this->select();
  32. }
  33. list($where, $alias, $limit, $order) = $this->queryBuilder();
  34. $res = $this->model
  35. ->withJoin($this->withJoinTable, $this->withJoinType)
  36. ->alias($alias)
  37. ->where($where)
  38. ->order($order)
  39. ->paginate($limit);
  40. $res->visible(['department' => ['pid','name'],'admin' => ['username','mobile'],'supplier' => ['name']]);
  41. $this->success('', [
  42. 'list' => $res->items(),
  43. 'total' => $res->total(),
  44. 'remark' => get_route_remark(),
  45. ]);
  46. }
  47. /**
  48. * 若需重写查看、编辑、删除等方法,请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写
  49. */
  50. }