HrController.php
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
namespace App\Http\Controllers\Aside\Manage;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Requests\Aside\Manage\ManagerHrRequest;
use App\Models\Manage\ManageHr;
use App\Models\Manage\Menu;
use Illuminate\Http\Request;
use App\Http\Logic\Aside\Manage\HrLogic;
class HrController extends BaseController
{
/**
* @remark :获取列表
* @name :list
* @author :lyh
* @method :post
* @time :2023/7/24 11:56
*/
public function list(ManageHr $manageHr)
{
$lists = $manageHr->lists($this->map,$this->page,$this->row,['id','sort']);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['photo_gallery_link'] = json_decode($v['photo_gallery']);
$v['id_card_gallery_link'] = json_decode($v['id_card_gallery']);
$v['certificate_gallery_link'] = json_decode($v['certificate_gallery']);
$lists['list'][$k] = $v;
}
}
$this->response('success', Code::SUCCESS, $lists);
}
/**
* @remark :获取详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/9/6 10:04
*/
public function info(HrLogic $logic){
$info = $logic->getHrInfo();
$info['photo_gallery_link'] = $info['photo_gallery'];
$info['id_card_gallery_link'] = $info['id_card_gallery'];
$info['certificate_gallery_link'] = $info['certificate_gallery'];
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2023/9/6 10:05
*/
public function save(ManagerHrRequest $request,HrLogic $logic){
$request->validated();
$logic->hrSave();
$this->response('success');
}
/**
* @remark :获取所有搜索参数
* @name :deptList
* @author :lyh
* @method :post
* @time :2023/7/22 17:17
*/
public function getSearchParamsList(HrLogic $hrLogic){
$list = $hrLogic->getSearchParams();
$this->response('success',Code::SUCCESS,$list);
}
/**
* @param HrLogic $hrLogic
* @return \Illuminate\Http\JsonResponse
*/
public function getHrList(HrLogic $hrLogic)
{
$page_size = intval(request()->input('page_size', 15));
$list = $hrLogic->getHrListForV5($page_size);
$result = [];
foreach ($list as $v) {
$result[] = [
'name' => $v->name,
'id_card' => $v->id_card,
'mobile' => $v->mobile,
'dept_title' => $v->dept_title = $v->dept ? $v->dept->title : '',
'position_title' => $v->position = $v->position ? $v->position->name : '',
'status' => $v->status,
];
}
$this->response('success',Code::SUCCESS, $result);
}
/**
* @remark :修改排序
* @name :sort
* @author :lyh
* @method :post
* @time :2023/12/7 9:12
*/
public function sort(HrLogic $hrLogic){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$hrLogic->setSort();
$this->response('success');
}
}