PoolTalent.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免费声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  13. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  14. // +----------------------------------------------------------------------
  15. namespace app\admin\controller;
  16. use app\data\model\DataPoolTalent;
  17. use app\data\model\DataZhicheng;
  18. use Carbon\Carbon;
  19. use think\admin\Controller;
  20. use think\admin\model\SystemUser;
  21. use think\db\Query;
  22. /**
  23. * 人才库管理
  24. * Class PoolTalent
  25. * @package app\admin\controller
  26. */
  27. class PoolTalent extends Controller
  28. {
  29. /**
  30. * 职称管理
  31. * @auth true
  32. * @menu true
  33. */
  34. public function zc(){
  35. $this->title='职称管理';
  36. DataZhicheng::mQuery()
  37. ->show()
  38. ->like('name')
  39. ->order('id','desc')
  40. ->layTable();
  41. }
  42. /**
  43. * 职称编辑
  44. * @auth true
  45. * @menu true
  46. */
  47. public function zc_edit(){
  48. DataZhicheng::mForm('zc_form');
  49. }
  50. /**
  51. * 职称添加
  52. * @auth true
  53. * @menu true
  54. */
  55. public function zc_add(){
  56. DataZhicheng::mForm('zc_form');
  57. }
  58. /**
  59. * 职称删除
  60. * @auth true
  61. * @menu true
  62. */
  63. public function zc_del($id){
  64. DataZhicheng::whereIn('id',$id)->save([
  65. 'is_del'=>0,
  66. ]);
  67. $this->success('删除成功');
  68. }
  69. /**
  70. * 人才申请管理
  71. * @auth true
  72. * @menu true
  73. */
  74. public function index(){
  75. $this->title='人才申请管理';
  76. $name=input('name');
  77. DataPoolTalent::mQuery()
  78. ->when($name,function (Query $query) use ($name) {
  79. $query->hasWhere('user',function (Query $query) use ($name) {
  80. $query->whereLike('nickname',"%{$name}%");
  81. });
  82. })
  83. ->with(['user'])
  84. ->order('id','desc')
  85. ->layTable();
  86. }
  87. /**
  88. * 人才申请审核
  89. * @auth true
  90. * @menu true
  91. */
  92. public function audit($id){
  93. $this->title='人才申请审核';
  94. $row=DataPoolTalent::mk()->findOrFail($id);
  95. if($this->request->isGet()){
  96. $this->assign('row',$row);
  97. $this->fetch();
  98. }else{
  99. if($row['audit']>1){
  100. $this->error('该记录已审核');
  101. }
  102. $data=$this->_vali([
  103. 'audit.require'=>'结果必须',
  104. 'audit.in:2,3'=>'结果有误',
  105. 'why.requireIf:audit,3'=>'原因必须',
  106. 'why.max:200'=>'原因有误',
  107. ]);
  108. $row['audit']=$data['audit'];
  109. $row['why']=$data['why']??'';
  110. $row['audit_at']=Carbon::now();
  111. $row->save();
  112. $this->success('审核成功');
  113. }
  114. }
  115. /**
  116. * 人才库配置
  117. * @auth true
  118. * @menu true
  119. */
  120. public function config(){
  121. if($this->request->isGet()){
  122. $this->fetch();
  123. }else{
  124. $data=$this->_vali([
  125. 'tel.require'=>'联系方式必须',
  126. ]);
  127. sysconf('config_pool_talent',$data);
  128. $this->success('保存成功');
  129. }
  130. }
  131. }