You've already forked jianlizaojia
员工证书列表
This commit is contained in:
89
app/xzgl/controller/StaffCert.php
Normal file
89
app/xzgl/controller/StaffCert.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace app\xzgl\controller;
|
||||
|
||||
use app\xzgl\model\XzglStaff;
|
||||
use app\xzgl\model\XzglStaffCert;
|
||||
use jerryyan\staff\model\StaffUser;
|
||||
use think\admin\Controller;
|
||||
use think\admin\helper\QueryHelper;
|
||||
use think\admin\model\SystemBase;
|
||||
|
||||
/**
|
||||
* 员工证书管理
|
||||
*/
|
||||
class StaffCert extends Controller
|
||||
{
|
||||
/**
|
||||
* 员工证书管理
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @return void
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->title = '员工证书管理';
|
||||
XzglStaffCert::mQuery()->layTable(function () {
|
||||
$this->zclb = SystemBase::items('员工注册类别');
|
||||
$this->zczy = SystemBase::items('员工注册专业');
|
||||
$this->zsjb = SystemBase::items('员工证书级别');
|
||||
}, static function (QueryHelper $query) {
|
||||
$query->with('staff');
|
||||
$query->equal('status,zclb,zczy,zsjb')->dateBetween('create_at,valid_before');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加员工证书
|
||||
* @auth true
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
XzglStaffCert::mForm('form');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑员工证书
|
||||
* @auth true
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
XzglStaffCert::mForm('form');
|
||||
}
|
||||
|
||||
protected function _form_filter(&$vo)
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->_vali([
|
||||
'staff_id.require' => '员工ID不能为空!',
|
||||
// 'zclb.require' => '员工注册类别不能为空!',
|
||||
// 'zczy.require' => '员工注册专业不能为空!',
|
||||
// 'zsjb.require' => '员工证书级别不能为空!',
|
||||
// 'zsxq.require' => '员工证书详情不能为空!',
|
||||
]);
|
||||
if (empty($vo['valid_before'])) {
|
||||
unset($vo['valid_before']);
|
||||
}
|
||||
// if (empty($vo['valid_after'])) {
|
||||
// unset($vo['valid_after']);
|
||||
// }
|
||||
if (empty($vo['id'])) {
|
||||
$vo['create_by'] = session('user.id');
|
||||
}
|
||||
} else {
|
||||
$this->zclb = SystemBase::items('员工注册类别');
|
||||
$this->zczy = SystemBase::items('员工注册专业');
|
||||
$this->zsjb = SystemBase::items('员工证书级别');
|
||||
$this->staffs = StaffUser::mk()->field("id, name")->select();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工证书
|
||||
* @auth true
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
XzglStaffCert::mDelete();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user