LeaveInfo.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace app\leave\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 请假列表
  7. * Class LeaveInfo
  8. * @package app\leave\controller
  9. */
  10. class LeaveInfo extends Controller
  11. {
  12. /**
  13. * 绑定数据表
  14. * @var string
  15. */
  16. protected $table = 'LeaveInfo';
  17. /**
  18. * 类型列表
  19. * @auth true
  20. * @menu true
  21. * @throws \think\Exception
  22. * @throws \think\db\exception\DataNotFoundException
  23. * @throws \think\db\exception\ModelNotFoundException
  24. * @throws \think\exception\DbException
  25. * @throws \think\exception\PDOException
  26. */
  27. public function index()
  28. {
  29. $this->title = '列表管理';
  30. $all_type = \app\common\model\LeaveType::getAllType();
  31. $this->all_type = array_column($all_type,null,'id');
  32. $sel_where = [];
  33. if($type = input('type')) $sel_where[] = ['a.type','=',$type];
  34. if($name = input('name')) $sel_where[] = ['u.name','like','%'.$name.'%'];
  35. $query = $this->_query($this->table)
  36. ->field('a.*,u.name,u.headimg')
  37. ->where($sel_where)
  38. ->alias('a')
  39. ->leftJoin('store_member u','u.id = a.user_id')
  40. ->where('a.is_deleted',0)->page();
  41. }
  42. /**
  43. * 数据列表处理
  44. * @auth true
  45. * @menu true
  46. * @param array $data
  47. * @throws \think\db\exception\DataNotFoundException
  48. * @throws \think\db\exception\ModelNotFoundException
  49. * @throws \think\exception\DbException
  50. */
  51. protected function _index_page_filter(&$data)
  52. {
  53. foreach ($data as $k=>&$v){
  54. }
  55. }
  56. /**
  57. * 删除
  58. * @auth true
  59. * @menu true
  60. * @param array $data
  61. * @throws \think\db\exception\DataNotFoundException
  62. * @throws \think\db\exception\ModelNotFoundException
  63. * @throws \think\exception\DbException
  64. */
  65. public function remove()
  66. {
  67. $this->_save($this->table, ['is_deleted' => '1']);
  68. }
  69. /**
  70. *
  71. * 编辑
  72. * @auth true
  73. * @menu true
  74. * @param array $data
  75. * @throws \think\db\exception\DataNotFoundException
  76. * @throws \think\db\exception\ModelNotFoundException
  77. * @throws \think\exception\DbException
  78. */
  79. public function edit()
  80. {
  81. $this->title = '编辑';
  82. $this->_form($this->table, 'form');
  83. }
  84. /**
  85. *
  86. * 数据处理
  87. * @auth true
  88. * @menu true
  89. * @param array $data
  90. * @throws \think\db\exception\DataNotFoundException
  91. * @throws \think\db\exception\ModelNotFoundException
  92. * @throws \think\exception\DbException
  93. */
  94. protected function _form_filter(&$data)
  95. {
  96. }
  97. }