Product.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\admin\controller\ps;
  3. use app\common\controller\Backend;
  4. /**
  5. * 流程单-产品
  6. *
  7. * @icon fa fa-cubes
  8. */
  9. class Product extends Backend
  10. {
  11. /**
  12. * Product模型对象
  13. * @var \app\admin\model\ps\Product
  14. */
  15. protected $model = null;
  16. protected $relationSearch = true;
  17. protected $searchFields = 'id,code,name';
  18. public function _initialize()
  19. {
  20. parent::_initialize();
  21. $this->model = new \app\admin\model\ps\Product;
  22. $this->view->assign("statusList", $this->model->getStatusList());
  23. }
  24. public function import()
  25. {
  26. parent::import();
  27. }
  28. /**
  29. * 查看
  30. */
  31. public function index()
  32. {
  33. $this->request->filter(['strip_tags', 'trim']);
  34. if ($this->request->isAjax()) {
  35. if ($this->request->request('keyField')) {
  36. return $this->selectpage();
  37. }
  38. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  39. $list = $this->model
  40. ->with(['factory'])
  41. ->where($where)
  42. ->order($sort, $order)
  43. ->paginate($limit);
  44. $result = array("total" => $list->total(), "rows" => $list->items());
  45. return json($result);
  46. }
  47. return $this->view->fetch();
  48. }
  49. }