first commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class AdminCheck extends Validate
|
||||
{
|
||||
protected $regex = ['checkUser' => '/^[A-Za-z]{1}[A-Za-z0-9_-]{4,19}$/'];
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require|chs',
|
||||
'username' => 'require|regex:checkUser|unique:admin',
|
||||
'mobile' => 'require|mobile|unique:admin',
|
||||
'reg_pwd' => 'require|min:6',
|
||||
'did' => 'require',
|
||||
'position_id' => 'require',
|
||||
'type' => 'require',
|
||||
'entry_time' => 'require',
|
||||
'id' => 'require',
|
||||
'pwd' => 'require|min:6|confirm',
|
||||
'status' => 'require|checkStatus:-1,1',
|
||||
'old_pwd' => 'require|different:pwd',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '员工姓名不能为空',
|
||||
'name.chs' => '员工姓名只能是汉字',
|
||||
'username.require' => '登录账号不能为空',
|
||||
'username.regex' => '登录账号必须是以字母开头,只能包含字母数字下划线和减号,5到20位',
|
||||
'username.unique' => '同样的登录账号已经存在,建议增加数字,如:xxx123',
|
||||
'mobile.require' => '手机不能为空',
|
||||
'mobile.mobile' => '手机格式错误',
|
||||
'mobile.unique' => '同样的手机号码已经存在,请检查一下是否被离职或者禁用员工占用',
|
||||
'reg_pwd.require' => '密码不能为空',
|
||||
'reg_pwd.min' => '密码至少要6个字符',
|
||||
'did.require' => '请选择所在部门',
|
||||
'position_id.require' => '请选择职位',
|
||||
'type.require' => '请选择员工类型',
|
||||
'entry_time.require' => '请选择入职时间',
|
||||
'id.require' => '缺少更新条件',
|
||||
'pwd.require' => '密码不能为空',
|
||||
'pwd.min' => '密码至少要6个字符',
|
||||
'pwd.confirm' => '两次密码不一致',
|
||||
'old_pwd.require' => '请提供旧密码',
|
||||
'old_pwd.different' => '新密码不能和旧密码一样',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['name', 'username', 'mobile', 'reg_pwd', 'did', 'position_id', 'type', 'entry_time'],
|
||||
'edit' => ['name', 'username', 'mobile', 'did', 'position_id', 'entry_time', 'id'],
|
||||
'editPwd' => ['old_pwd', 'pwd'],
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ConfCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:config',
|
||||
'name' => 'require|lower|min:3|unique:config',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '配置名称不能为空',
|
||||
'title.unique' => '同样的配置名称已经存在',
|
||||
'name.require' => '配置标识不能为空',
|
||||
'name.lower' => '配置标识只能是小写字母',
|
||||
'name.min' => '配置标识至少需要2个小写字母',
|
||||
'name.unique' => '同样的配置标识已经存在',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class DepartmentCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:department',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '部门名称不能为空',
|
||||
'title.unique' => '同样的部门名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class GroupCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:admin_group',
|
||||
'id' => 'require',
|
||||
'status' => 'require|checkStatus:-1,1',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的记录已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
'status.require' => '状态为必选',
|
||||
'status.checkStatus' => '系统所有者组不能被禁用',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'status'],
|
||||
'edit' => ['id', 'title', 'status'],
|
||||
];
|
||||
|
||||
// 自定义验证规则
|
||||
protected function checkStatus($value, $rule, $data)
|
||||
{
|
||||
if ($value == -1 and $data['id'] == 1) {
|
||||
return $rule == false;
|
||||
}
|
||||
return $rule == true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class KnowledgeCateCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:knowledge_cate',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class NoteCateCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:note_cate',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace app\admin\validate;
|
||||
use think\Validate;
|
||||
|
||||
class NoteCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:note',
|
||||
'id' => 'require',
|
||||
'status' => 'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '标题不能为空',
|
||||
'title.unique' => '同样的记录已经存在!',
|
||||
'id.require' => '缺少更新条件',
|
||||
'status.require' => '状态为必选',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title']
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class PositionCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:position',
|
||||
'work_price' => 'require|number',
|
||||
'group_id' => 'require',
|
||||
'id' => 'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '岗位名称不能为空',
|
||||
'title.unique' => '同样的岗位名称已经存在',
|
||||
'work_price.require' => '岗位工时单价不能为空',
|
||||
'work_price.number' => '岗位工时单价只能是整数',
|
||||
'group_id.require' => '至少要选择一个角色权限',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'work_price', 'group_id'],
|
||||
'edit' => ['title', 'work_price', 'group_id', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class RuleCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'name' => 'require',
|
||||
'menu' => 'require',
|
||||
'src' => 'unique:admin_rule',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '菜单节点名称不能为空',
|
||||
'src.unique' => '同样的菜单节点URL已经存在',
|
||||
'menu.require' => '是否是左侧菜单需要选择',
|
||||
'name.require' => '节点日志操作名称不能为空',
|
||||
'id.require' => '缺少更新条件'
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'src', 'name', 'menu'],
|
||||
'edit' => ['id', 'title', 'src', 'name', 'menu']
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class TaskCateCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:task_cate',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class WorkCateCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:work_cate',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user