作者 张关杰

hr manage

... ... @@ -21,12 +21,18 @@ class HrController extends BaseController
'id.required' => 'ID不能为空'
]);
$data = $logic->getInfo($this->param['id']);
//print_r($data);exit;
return $this->success($data);
}
public function save(Request $request, HrLogic $logic){
//print_r($this->param);exit;
$data = $logic->save($this->param);
return $this->success($data);
}
public function parm_desciption(HrLogic $logic){
$data = $logic->parms();
return $this->success($data);
}
}
... ...
... ... @@ -4,10 +4,7 @@ namespace App\Http\Logic\Aside\Manage;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Aside\ManageHrModel;
use App\Models\Aside\ManageHrLogModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use App\Models\Manage\ManageHr;
/**
... ... @@ -21,21 +18,42 @@ class HrLogic extends BaseLogic
public function __construct()
{
parent::__construct();
$this->model = new ManageHrModel();
$this->model = new ManageHr();
}
public function save($param){
if(isset($param['id'])){
$id = $param['id'];
$data = $this->model->read($id);
if(empty($data)){
$this->fail('没有该数据');
foreach ($this->model::specielField() as $v){
$param = $this->setJson($v,$param);
}
$param['update_at'] = date("Y-m-d H:i:s");
return parent::save($param);
}else{
}
public function getInfo($id){
$data = parent::getInfo($id);
foreach ($this->model::specielField() as $v){
$data[$v] = json_decode($data[$v],true);
}
return $data;
}
//数组转json存储
public function setJson($str,$param){
if(isset($param[$str]) && is_array($param[$str])){
$param[$str] = json_encode($param[$str]);
}else{
$param[$str] = '';
}
return $param;
}
public function parms(){
$data['belong_group'] = $this->model::belongGroup();
$data['education'] = $this->model::education();
$data['entry_position'] = $this->model::entryPosition();
$data['p_level'] = $this->model::pLevel();
$data['dangyuan'] = $this->model::dangyuan();
$data['dangzhibu'] = $this->model::dangzhibu();
return $data;
}
}
... ...
... ... @@ -148,9 +148,7 @@ class Logic
$this->model[$name] = $value;
}
}
$res = $this->model->save();
if($res){
//清缓存
if($this->is_cache && !empty($param['id'])){
... ...
... ... @@ -4,12 +4,13 @@ namespace App\Models\Aside;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Base;
class ManageHrModel extends Model
class ManageHrModel extends Base
{
protected $table = 'gl_manage_hr';
protected $table = 'gl_manage_hrs';
//use HasFactory;
protected $guarded = ['updated_at'];
/**
* 归属小组
* @return string[]
... ...
<?php
namespace App\Models\Manage;
use App\Models\Base;
class ManageHr extends Base
{
protected $table = 'gl_manage_hr';
/**
* 特殊字段
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function specielField(){
return ['photo_gallery','id_card_gallery','certificate_gallery','career_history','learning_history'];
}
/**
* 归属小组
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function belongGroup()
{
return [
1 => 'KA组',
2 => 'A组',
3 => 'B组',
4 => 'C组',
5 => 'D组',
6 => 'E组',
7 => 'F组',
8 => 'G组',
9 => 'H组',
10 => 'GA组',
11=> 'GB组',
12 => 'GC组',
13 => '前端组',
14 => '后端组',
15 => '黑格组',
16 => '售后组',
0 => '其他',
];
}
/**
* 学历
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function education()
{
return [
1 => '专科',
2 => '本科',
3 => '研究生及以上',
0 => '其他',
];
}
/**
* 入职岗位
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function entryPosition()
{
return [
1 => '优化师',
2 => '优化师助理',
3 => '优化顾问',
4 => '项目经理',
5 => '平面设计',
6 => '技术经理',
7 => '技术主管',
8 => '技术总监',
9 => '渠道经理',
10 => '前端研发',
11=> '后端研发',
12 => '行政财务',
13 => '品牌营销',
14 => '销售经理',
15 => '销售主管',
16 => '售后技术',
17 => '售后服务',
18 => '外贸销售',
19 => '渠道助理',
20 => '黑格运营',
21 => '运营',
22 => '短视频剪辑师',
23 => '人事',
24 => '采购',
0 => '其他',
];
}
/**
* 级别序列
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function pLevel()
{
return [
0 => '实习期/试用期(P0)',
1 => '初级(P1)',
2 => '初级(P2)',
3 => '初级(P3)',
4 => '中级(P4)',
5 => '中级(P5)',
6 => '中级(P6)',
7 => '高级(P7)',
8 => '高级(P8)',
9 => '高级(P9)',
10 => '高级(P10)',
11=> '职务初级(M1)',
12 => '职务初级(M2)',
13 => '职务初级(M3)',
14 => '职务中级(M4)',
15 => '职务中级(M5)',
16 => '职务中级(M6)',
17 => '职务高级(M7)',
18 => '职务高级(M8)',
19 => '职务高级(M9)',
20 => '职务高级(M10)',
];
}
/**
* 是否党员
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function dangyuan()
{
return [
0 => '群众',
1 => '预备党员',
2 => '正式党员',
];
}
/**
* 是否有党支部
* @return string[]
* @author zgj
* @date 2023/5/31
*/
public static function dangzhibu()
{
return [
0 => '无',
1 => '是',
2 => '否',
];
}
}
... ...
此 diff 太大无法显示。
... ... @@ -7,7 +7,7 @@ use \App\Http\Controllers\Aside;
//必须登录验证的路由组
Route::middleware(['web','accesstoken'])->group(function (){ //admin用渲染默认要加上web的中间件
Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上web的中间件
Route::middleware(['aloginauth'])->group(function () {
Route::get('/', [Aside\IndexController::class, 'index'])->name('admin.home.white');
Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white');
... ... @@ -105,6 +105,7 @@ Route::middleware(['web','accesstoken'])->group(function (){ //admin皜脫
Route::get('/', [Aside\Manage\HrController::class, 'list'])->name('admin.hr');
Route::get('/info', [Aside\Manage\HrController::class, 'info'])->name('admin.hr_info');
Route::post('/save', [Aside\Manage\HrController::class, 'save'])->name('admin.hr_save');
Route::get('/parm_desciption', [Aside\Manage\HrController::class, 'parm_desciption'])->name('admin.hr_parm_desciption');//选择字段数组
});
});
... ...