Flow.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. namespace app\leave\controller;
  3. use app\common\model\User;
  4. use library\Controller;
  5. use think\Db;
  6. /**
  7. * 请假流程
  8. * Class Flow
  9. * @package app\leave\controller
  10. */
  11. class Flow extends Controller
  12. {
  13. /**
  14. * 绑定数据表
  15. * @var string
  16. */
  17. protected $table = 'LeaveFlow';
  18. /**
  19. * 流程列表
  20. * @auth true
  21. * @menu true
  22. * @throws \think\Exception
  23. * @throws \think\db\exception\DataNotFoundException
  24. * @throws \think\db\exception\ModelNotFoundException
  25. * @throws \think\exception\DbException
  26. * @throws \think\exception\PDOException
  27. */
  28. public function index()
  29. {
  30. $this->title = '管理';
  31. $sel_type = input('sel_type');
  32. $query = $this->_query($this->table)
  33. ->alias('f')
  34. ->field('f.*,u.name,u.headimg')
  35. ->leftJoin('store_member u','u.id = f.user_id')
  36. ->order('sort asc,id desc')
  37. ->where('is_deleted',0)
  38. ->when($sel_type,function ($query)use ($sel_type){
  39. if($sel_type) $query->where('type',$sel_type);
  40. })->page(false);
  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->_delete($this->table);
  68. }
  69. /**
  70. * 添加
  71. * @auth true
  72. * @menu true
  73. * @param array $data
  74. * @throws \think\db\exception\DataNotFoundException
  75. * @throws \think\db\exception\ModelNotFoundException
  76. * @throws \think\exception\DbException
  77. */
  78. public function add(){
  79. $this->title = '添加';
  80. $this->_form($this->table, 'form');
  81. }
  82. /**
  83. *
  84. * 编辑
  85. * @auth true
  86. * @menu true
  87. * @param array $data
  88. * @throws \think\db\exception\DataNotFoundException
  89. * @throws \think\db\exception\ModelNotFoundException
  90. * @throws \think\exception\DbException
  91. */
  92. public function edit()
  93. {
  94. $this->title = '编辑';
  95. $this->_form($this->table, 'form');
  96. }
  97. /**
  98. *
  99. * 数据处理
  100. * @auth true
  101. * @menu true
  102. * @param array $data
  103. * @throws \think\db\exception\DataNotFoundException
  104. * @throws \think\db\exception\ModelNotFoundException
  105. * @throws \think\exception\DbException
  106. */
  107. protected function _form_filter(&$data)
  108. {
  109. if($this->request->isGet()) {
  110. $this->all_user = User::where('is_deleted',0)->column('name','id');
  111. }
  112. }
  113. }