You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.3 KiB
117 lines
3.3 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\personnel;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\personnel\PersonnelService;
|
|
|
|
|
|
/**
|
|
* 人力资源-人员控制器
|
|
* Class Personnel
|
|
* @package app\adminapi\controller\personnel
|
|
*/
|
|
class Personnel extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取人力资源-人员列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["name",""],
|
|
["gender",""],
|
|
["phone",""],
|
|
["address",""],
|
|
["education",""],
|
|
["employee_number",""],
|
|
["status",""],
|
|
["create_time",""]
|
|
]);
|
|
return success((new PersonnelService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 人力资源-人员详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new PersonnelService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加人力资源-人员
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["name",""],
|
|
["gender",0],
|
|
["phone",""],
|
|
["head_img",""],
|
|
["address",""],
|
|
["native_place",""],
|
|
["education",""],
|
|
["profile",""],
|
|
["emergency_contact_phone",""],
|
|
["id_card_front",""],
|
|
["id_card_back",""],
|
|
["status",0],
|
|
["is_sys_user",0],
|
|
["info",[]],
|
|
]);
|
|
$this->validate($data, 'app\validate\personnel\Personnel.add');
|
|
$id = (new PersonnelService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 人力资源-人员编辑
|
|
* @param $id 人力资源-人员id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["name",""],
|
|
["gender",0],
|
|
["phone",""],
|
|
["head_img",""],
|
|
["address",""],
|
|
["native_place",""],
|
|
["education",""],
|
|
["profile",""],
|
|
["emergency_contact_phone",""],
|
|
["id_card_front",""],
|
|
["id_card_back",""],
|
|
["status",0],
|
|
["is_sys_user",0],
|
|
["info",[]],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\personnel\Personnel.edit');
|
|
(new PersonnelService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 人力资源-人员删除
|
|
* @param $id 人力资源-人员id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new PersonnelService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
}
|
|
|