Evection.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. namespace app\synth\controller;
  3. use app\common\model\LeaveApprove;
  4. use library\Controller;
  5. use think\Db;
  6. /**
  7. * 请假列表
  8. * Class Evection
  9. * @package app\synth\controller
  10. */
  11. class Evection extends Controller
  12. {
  13. /**
  14. * 绑定数据表
  15. * @var string
  16. */
  17. protected $table = 'EvectionInfo';
  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. $this->all_type =[1=>'市内出差',2=>'市外出差'];
  32. $this->status_arr = [0=>'全部','1'=>'审批中',2=>'审批通过',3=>'审批拒绝',9=>'已取消'];
  33. $sel_where = [];
  34. $time = explode(' - ',input('create_at'));
  35. if(input('create_at')){
  36. $sel_where[] = ['a.create_at','between time',$time];
  37. }
  38. if($type = input('type')) $sel_where[] = ['a.type','=',$type];
  39. if($status = input('status')) $sel_where[] = ['a.status','=',$status];
  40. if($name = input('name')) $sel_where[] = ['u.name','like','%'.$name.'%'];
  41. $query = $this->_query($this->table)
  42. ->field('a.*,u.name,u.headimg')
  43. ->where($sel_where)
  44. ->alias('a')
  45. ->leftJoin('store_member u','u.id = a.user_id')
  46. ->where('a.is_deleted',0)
  47. ->page();
  48. }
  49. /**
  50. * 数据列表处理
  51. * @auth true
  52. * @menu true
  53. * @param array $data
  54. * @throws \think\db\exception\DataNotFoundException
  55. * @throws \think\db\exception\ModelNotFoundException
  56. * @throws \think\exception\DbException
  57. */
  58. protected function _index_page_filter(&$data)
  59. {
  60. foreach ($data as $k=>&$v){
  61. }
  62. }
  63. /**
  64. * 删除
  65. * @auth true
  66. * @menu true
  67. * @param array $data
  68. * @throws \think\db\exception\DataNotFoundException
  69. * @throws \think\db\exception\ModelNotFoundException
  70. * @throws \think\exception\DbException
  71. */
  72. public function remove()
  73. {
  74. $this->_save($this->table, ['is_deleted' => '1']);
  75. }
  76. /**
  77. *
  78. * 编辑
  79. * @auth true
  80. * @menu true
  81. * @param array $data
  82. * @throws \think\db\exception\DataNotFoundException
  83. * @throws \think\db\exception\ModelNotFoundException
  84. * @throws \think\exception\DbException
  85. */
  86. public function edit()
  87. {
  88. $this->title = '编辑';
  89. $this->_form($this->table, 'form');
  90. }
  91. /**
  92. *
  93. * 数据处理
  94. * @auth true
  95. * @menu true
  96. * @param array $data
  97. * @throws \think\db\exception\DataNotFoundException
  98. * @throws \think\db\exception\ModelNotFoundException
  99. * @throws \think\exception\DbException
  100. */
  101. protected function _form_filter(&$data)
  102. {
  103. }
  104. /**
  105. *
  106. * 审批记录
  107. * @auth true
  108. * @menu true
  109. * @param array $data
  110. * @throws \think\db\exception\DataNotFoundException
  111. * @throws \think\db\exception\ModelNotFoundException
  112. * @throws \think\exception\DbException
  113. */
  114. public function approve()
  115. {
  116. $id = input('id');
  117. $list = $this->_query('LeaveApprove')
  118. ->alias('r')
  119. ->field('r.*,u.name,u.phone,u.headimg')
  120. ->leftJoin('store_member u','u.id = r.approve_user')
  121. ->where('r.leave_id',$id)
  122. ->order('r.id desc')->page(false);
  123. $this->assign('list',$list);
  124. $this->fetch();
  125. }
  126. }