LeaveType.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. namespace app\leave\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 请假类型
  7. * Class LeaveType
  8. * @package app\leave\controller
  9. */
  10. class LeaveType extends Controller
  11. {
  12. /**
  13. * 绑定数据表
  14. * @var string
  15. */
  16. protected $table = 'LeaveType';
  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. $query = $this->_query($this->table)->where('is_deleted',0)->page(false);
  31. }
  32. /**
  33. * 数据列表处理
  34. * @auth true
  35. * @menu true
  36. * @param array $data
  37. * @throws \think\db\exception\DataNotFoundException
  38. * @throws \think\db\exception\ModelNotFoundException
  39. * @throws \think\exception\DbException
  40. */
  41. protected function _index_page_filter(&$data)
  42. {
  43. foreach ($data as $k=>&$v){
  44. }
  45. }
  46. /**
  47. * 删除
  48. * @auth true
  49. * @menu true
  50. * @param array $data
  51. * @throws \think\db\exception\DataNotFoundException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. * @throws \think\exception\DbException
  54. */
  55. public function remove()
  56. {
  57. $this->_save($this->table, ['is_deleted' => '1']);
  58. }
  59. /**
  60. * 禁用
  61. * @auth true
  62. * @menu true
  63. * @param array $data
  64. * @throws \think\db\exception\DataNotFoundException
  65. * @throws \think\db\exception\ModelNotFoundException
  66. * @throws \think\exception\DbException
  67. */
  68. public function forbidden()
  69. {
  70. $this->_save($this->table, ['status' => '0']);
  71. }
  72. /**
  73. * 启用
  74. * @auth true
  75. * @menu true
  76. * @param array $data
  77. * @throws \think\db\exception\DataNotFoundException
  78. * @throws \think\db\exception\ModelNotFoundException
  79. * @throws \think\exception\DbException
  80. */
  81. public function enable()
  82. {
  83. $this->_save($this->table, ['status' => '1']);
  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. public function add(){
  95. $this->title = '添加';
  96. $this->_form($this->table, 'form');
  97. }
  98. /**
  99. *
  100. * 编辑
  101. * @auth true
  102. * @menu true
  103. * @param array $data
  104. * @throws \think\db\exception\DataNotFoundException
  105. * @throws \think\db\exception\ModelNotFoundException
  106. * @throws \think\exception\DbException
  107. */
  108. public function edit()
  109. {
  110. $this->title = '编辑';
  111. $this->_form($this->table, 'form');
  112. }
  113. /**
  114. *
  115. * 数据处理
  116. * @auth true
  117. * @menu true
  118. * @param array $data
  119. * @throws \think\db\exception\DataNotFoundException
  120. * @throws \think\db\exception\ModelNotFoundException
  121. * @throws \think\exception\DbException
  122. */
  123. protected function _form_filter(&$data)
  124. {
  125. }
  126. }