Department.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://demo.thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  12. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  13. // +----------------------------------------------------------------------
  14. namespace app\user\controller;
  15. use app\common\constant\CommonConstant;
  16. use library\Controller;
  17. use library\tools\Data;
  18. /**
  19. * 部门
  20. */
  21. class Department extends Controller
  22. {
  23. /**
  24. * 绑定数据表
  25. * @var string
  26. */
  27. protected $table = 'Department';
  28. /**
  29. * 列表
  30. * @auth true
  31. * @menu true
  32. * @throws \think\Exception
  33. * @throws \think\db\exception\DataNotFoundException
  34. * @throws \think\db\exception\ModelNotFoundException
  35. * @throws \think\exception\DbException
  36. */
  37. public function index()
  38. {
  39. $this->title = '部门列表';
  40. $query = $this->_query($this->table)
  41. ->field('dept_id as id,name,parent_id as pid')
  42. ->where('is_deleted',CommonConstant::IS_DELETED_0);
  43. $query->page(false);
  44. }
  45. /**
  46. * 列表数据处理
  47. * @param array $data
  48. * @throws \Exception
  49. */
  50. protected function _index_page_filter(&$data)
  51. {
  52. if($data) {
  53. foreach ($data as &$vo) {
  54. $vo['ids'] = join(',', Data::getArrSubIds($data, $vo['id']));
  55. }
  56. $data = Data::arr2table($data);
  57. }
  58. }
  59. }