This commit is contained in:
lewis 2025-02-27 09:55:33 +08:00
parent 2b5e27bb87
commit 80b734a88b
82 changed files with 9737 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 系统消息模型
* Class OaMessage
* @package app\common\model\works
*/
class OaMessage extends BaseModel
{
use SoftDelete;
protected $name = 'oa_message';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\bgsp;
use app\common\model\BaseModel;
use app\common\model\dict\DictData;
use think\model\concern\SoftDelete;
/**
* 审批流程模型
* Class OaFlow
* @package app\common\model\works\bgsp
*/
class OaFlow extends BaseModel
{
use SoftDelete;
protected $name = 'oa_flow';
protected $deleteTime = 'delete_time';
public function getTypeTextAttr($value,$data){
$dict = DictData::where('type_value', 'oa_approve_cate')->column('name','value');
return !empty($data['type']) ? $dict[$data['type']] : '';
}
public function getCheckTypeTextAttr($value,$data): string
{
$arr = [1=>'固定审批流',2=>'自由审批流',3=>'可回退的审批流'];
return !empty($data['check_type']) ? $arr[$data['check_type']] : '';
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\bgsp;
use app\common\model\BaseModel;
use app\common\model\dict\DictData;
use think\model\concern\SoftDelete;
/**
* 审批类型模型
* Class OaFlowType
* @package app\common\model\works\bgsp
*/
class OaFlowType extends BaseModel
{
use SoftDelete;
protected $name = 'oa_flow_type';
protected $deleteTime = 'delete_time';
public function getTypeTextAttr($value,$data){
$dict = DictData::where('type_value', 'oa_approve_cate')->column('name','value');
return !empty($data['type']) ? $dict[$data['type']] : '';
}
}

View File

@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rcbg;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 日程安排模型
* Class OaPlan
* @package app\common\model\works\rcbg
*/
class OaPlan extends BaseModel
{
use SoftDelete;
protected $name = 'oa_plan';
protected $deleteTime = 'delete_time';
public function getStartTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i',$value) : '';
}
public function getEndTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i',$value) : '';
}
public function getRemindTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i',$value) : '';
}
public function getTypeTextAttr($value,$data): string
{
$arr = [0=>'无优先级',1=>'不重要',2=>'次要',3=>'重要',4=>'紧急'];
return $arr[$data['type']];
}
public function getRemindTypeTextAttr($value,$data): string
{
$arr = [0=>'不提醒',1=>'提前5分钟',2=>'提前15分钟',3=>'提前30分钟',4=>'提前1小时',5=>'提前2小时',6=>'提前1天'];
return $arr[$data['remind_type']];
}
}

View File

@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rcbg;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 工作记录模型
* Class OaSchedule
* @package app\common\model\works\rcbg
*/
class OaSchedule extends BaseModel
{
use SoftDelete;
protected $name = 'oa_schedule';
protected $deleteTime = 'delete_time';
public function getCidTextAttr($value,$data): string
{
$arr = [0=>'其他',1=>'方案策划',2=>'撰写文档',3=>'需求调研',4=>'需求沟通',5=>'参加会议',6=>'拜访客户',7=>'接待客户'];
return $arr[$data['cid']];
}
public function getLaborTypeTextAttr($value,$data): string
{
$arr = [1=>'案头', 2=>'外勤'];
return !empty($data['labor_type']) ? $arr[$data['labor_type']] : '';
}
public function getStartTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i',$value) : '';
}
public function getEndTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i',$value) : '';
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rcbg;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 工作汇报模型
* Class OaWork
* @package app\common\model\works\rcbg
*/
class OaWork extends BaseModel
{
use SoftDelete;
protected $name = 'oa_work';
protected $deleteTime = 'delete_time';
public function getTypeTextAttr($value,$data): string
{
$arr = [1=>'日报', 2=>'周报', 3=>'月报'];
return !empty($data['type']) ? $arr[$data['type']] : '';
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rcbg;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 工作汇报点评表模型
* Class OaWorkComment
* @package app\common\model\works\rcbg
*/
class OaWorkComment extends BaseModel
{
use SoftDelete;
protected $name = 'oa_work_comment';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rcbg;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 汇报工作发送记录表模型
* Class OaWorkRecord
* @package app\common\model\works\rcbg
*/
class OaWorkRecord extends BaseModel
{
use SoftDelete;
protected $name = 'oa_work_record';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rlzy;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 企业员工模型
* Class OaAdmin
* @package app\common\model\works\rlzy
*/
class OaAdmin extends BaseModel
{
use SoftDelete;
protected $name = 'oa_admin';
protected $deleteTime = 'delete_time';
public function getSexTextAttr($value,$data): string
{
$arr = [0=>'未设置', 1=>'男', 2=>'女'];
return $arr[$data['sex']];
}
public function getTypeTextAttr($value,$data): string
{
$arr = [0=>'正式', 1=>'试用', 2=>'实习'];
return $arr[$data['type']];
}
public function getStatusTextAttr($value,$data): string
{
$arr = [0=>'禁用', 1=>'正常', 2=>'离职'];
return $arr[$data['status']];
}
}

View File

@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rlzy;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
use app\common\model\dept\Dept;
use think\model\concern\SoftDelete;
/**
* 人事调动模型
* Class OaDepartmentChange
* @package app\common\model\works\rlzy
*/
class OaDepartmentChange extends BaseModel
{
use SoftDelete;
protected $name = 'oa_department_change';
protected $deleteTime = 'delete_time';
public function getStatusTextAttr($value,$data): string
{
$arr = [0=>'禁用', 1=>'启用'];
return $arr[$data['status']];
}
public function getMoveTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d',$value) : '';
}
public function getUserNameAttr($value,$data){
$user = Admin::field('name')->where('id',$data['uid'])->findOrEmpty();
return !$user->isEmpty() ? $user['name'] : '';
}
public function getFromDeptAttr($value,$data){
$dept = Dept::field('name')->where('id',$data['from_did'])->findOrEmpty();
return !$dept->isEmpty() ? $dept['name'] : '';
}
public function getToDeptAttr($value,$data){
$dept = Dept::field('name')->where('id',$data['to_did'])->findOrEmpty();
return !$dept->isEmpty() ? $dept['name'] : '';
}
}

View File

@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\rlzy;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 离职档案模型
* Class OaPersonalQuit
* @package app\common\model\works\rlzy
*/
class OaPersonalQuit extends BaseModel
{
use SoftDelete;
protected $name = 'oa_personal_quit';
protected $deleteTime = 'delete_time';
public function getConnectTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d',$value) : '';
}
public function getQuitTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d',$value) : '';
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\xzgl;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 车辆管理模型
* Class OaCarCate
* @package app\common\model\works\xzgl
*/
class OaCarCate extends BaseModel
{
use SoftDelete;
protected $name = 'oa_car_cate';
protected $deleteTime = 'delete_time';
public function getStatusTextAttr($value,$data): string
{
$arr = [0=>'禁用', 1=>'启用'];
return $arr[$data['status']];
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\xzgl;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 会议室管理模型
* Class OaMeetingCate
* @package app\common\model\works\xzgl
*/
class OaMeetingCate extends BaseModel
{
use SoftDelete;
protected $name = 'oa_meeting_cate';
protected $deleteTime = 'delete_time';
public function getStatusTextAttr($value,$data): string
{
$arr = [0=>'禁用', 1=>'启用'];
return $arr[$data['status']];
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\works\xzgl;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* OaSealCate模型
* Class OaSealCate
* @package app\common\model\works/xzgl
*/
class OaSealCate extends BaseModel
{
use SoftDelete;
protected $name = 'oa_seal_cate';
protected $deleteTime = 'delete_time';
public function getStatusTextAttr($value,$data): string
{
$arr = [0=>'禁用', 1=>'启用'];
return $arr[$data['status']];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\oa\controller;
use app\common\controller\BaseLikeController;
use app\common\lists\BaseDataLists;
class BaseAdminController extends BaseLikeController
{
protected $adminId = 0;
protected $adminInfo = [];
public function initialize()
{
if (isset($this->request->adminInfo) && $this->request->adminInfo) {
$this->adminInfo = $this->request->adminInfo;
$this->adminId = $this->request->adminInfo['admin_id'];
}
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace app\api\controller;
class IndexController extends BaseApiController
{
public $notNeedLogin = ['index'];
public function index()
{
return $this->data([]);
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace app\api\controller;
use app\common\service\UploadService;
use Exception;
class UploadController extends BaseApiController
{
/**
* @notes 上传图片
* @author 乔峰
* @date 2021/12/29 16:27
*/
public function image()
{
try {
$cid = $this->request->post('cid', 0);
$result = UploadService::image($cid);
return $this->success('上传成功', $result);
} catch (\Exception $e) {
return $this->fail($e->getMessage());
}
}
/**
* @notes 上传视频
* @author 乔峰
* @date 2021/12/29 16:27
*/
public function video()
{
try {
$cid = $this->request->post('cid', 0);
$result = UploadService::video($cid);
return $this->success('上传成功', $result);
} catch (Exception $e) {
return $this->fail($e->getMessage());
}
}
}

View File

@ -0,0 +1,107 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\OaMessageLists;
use app\adminapi\logic\works\OaMessageLogic;
use app\adminapi\validate\works\OaMessageValidate;
/**
* 系统消息控制器
* Class OaMessageController
* @package app\adminapi\controller\works
*/
class OaMessageController extends BaseAdminController
{
/**
* @notes 获取系统消息列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function lists()
{
return $this->dataLists(new OaMessageLists());
}
/**
* @notes 添加系统消息
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/29 14:04
*/
// public function add()
// {
// $params = (new OaMessageValidate())->post()->goCheck('add');
// $result = OaMessageLogic::add($params);
// if (true === $result) {
// return $this->success('添加成功', [], 1, 1);
// }
// return $this->fail(OaMessageLogic::getError());
// }
/**
* @notes 编辑系统消息
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/29 14:04
*/
// public function edit()
// {
// $params = (new OaMessageValidate())->post()->goCheck('edit');
// $result = OaMessageLogic::edit($params);
// if (true === $result) {
// return $this->success('编辑成功', [], 1, 1);
// }
// return $this->fail(OaMessageLogic::getError());
// }
/**
* @notes 删除系统消息
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function delete()
{
$params = (new OaMessageValidate())->post()->goCheck('delete');
OaMessageLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取系统消息详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function detail()
{
$params = (new OaMessageValidate())->goCheck('detail');
$result = OaMessageLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,638 @@
<?php
namespace app\oa\controller\works\bgsp;
use app\oa\controller\BaseAdminController;
use app\common\model\auth\Admin;
use app\common\model\dept\Dept;
use app\common\model\works\bgsp\OaFlow;
use app\common\model\works\bgsp\OaFlowType;
use think\facade\Db;
class OaApproveController extends BaseAdminController
{
public function lists(){
$params = $this->request->get(['type','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
if(empty($params['type']) || !in_array($params['type'],[1,2,3,4,5])){
return $this->fail("参数错误");
}
$where = [];
if($params['type'] == 1){
$where[] = ['check_status','in','0,1,2,3,4'];
}
if($params['type'] == 2){
$where[] = ['check_status','=',0];
}
if($params['type'] == 3){
$where[] = ['check_status','=',2];
}
if($params['type'] == 4){
$where[] = ['check_status','=',3];
}
if($params['type'] == 5){
$where[] = ['check_status','=',1];
}
$lists = Db::name('oa_approve')->field('id,type,flow_id,admin_id,check_admin_ids,check_status,create_time')->where('admin_id',$this->adminId)->where($where)
->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
$dept = Dept::where('id',$admin['dept_id'])->value('name');
$flow_type = OaFlowType::where('id',$data['type'])->value('title');
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$data['user_name'] = $admin['name'];
$data['dept_name'] = $dept ?? '';
$data['type_name'] = $flow_type ?? '';
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
return $data;
})->toArray();
$count = Db::name('oa_approve')->where($where)->where('admin_id',$this->adminId)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function detail(){
$params = $this->request->get(['id']);
if(empty($params['id'])){
return $this->fail("参数错误");
}
$data = Db::name('oa_approve')->where('id',$params['id'])->find();
$data['extends'] = !empty($data['extends']) ? json_decode($data['extends'],true) : [];
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$copy_users = Admin::where('id','in',$data['copy_uids'])->column('name');
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['copy_users'] = !empty($copy_users) ? implode(',',$copy_users) : '';
$data['flow_info'] = OaFlow::where('id',$data['flow_id'])->findOrEmpty();
$data['record'] = Db::name('oa_flow_record')->field('check_user_id,check_time,status,content')->where('action_id',$params['id'])->where('type',1)->order('id desc')->select()->each(function($data){
$data['check_time'] = date('Y-m-d H:i:s',$data['check_time']);
$user = Admin::where('id',$data['check_user_id'])->value('name');
$data['check_user_name'] = $user ?? '';
$data['status_text'] = match ($data['status']){
0=>'提交',1=>'通过',2=>'拒绝',3=>'撤销'
};
return $data;
})->toArray();
$step = Db::name('oa_flow_step')->field('id,action_id,flow_uids,flow_type,sort')->where('action_id',$params['id'])->where('type',1)->order('sort asc')->select()->toArray();
foreach ($step as $key => &$val) {
$user_id_info = Admin::field('id,name')->where('id','in',$val['flow_uids'])->select()->toArray();
foreach ($user_id_info as $k => &$v) {
$v['check_time'] = 0;
$v['content'] = '';
$v['status'] = 0;
$check_array = Db::name('oa_flow_record')->where(['check_user_id' => $v['id'],'step_id' => $val['id'],'type'=>1])->order('check_time desc')->select()->toArray();
if(!empty($check_array)){
$checked = $check_array[0];
$v['check_time'] = date('Y-m-d H:i', $checked['check_time']);
$v['content'] = $checked['content'];
$v['status'] = $checked['status'];
}
}
$check_list = Db::name('oa_flow_record')
->field('f.*,a.name')
->alias('f')
->join('admin a', 'a.id = f.check_user_id', 'left')
->where(['f.step_id' => $val['id']])->where('f.status','>',0)->select()->toArray();
foreach ($check_list as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d H:i', $vv['check_time']);
}
$val['user_id_info'] = $user_id_info;
$val['check_list'] = $check_list;
}
$data['steps'] = $step;
return $this->data($data);
}
public function add()
{
$param = $this->request->post(['flow_id','check_admin_ids','copy_uids','extends']);
if(empty($param['flow_id'])){
return $this->fail("请选择审批流程");
}
$flow = Db::name('oa_flow')->where('id',$param['flow_id'])->find();
if(empty($flow)){
return $this->fail("审批流程信息不存在");
}
if($flow['check_type'] == 2){
if(empty($param['check_admin_ids'])){
return $this->fail("请选择审核人");
}
}else{
if(empty($flow['flow_list'])){
return $this->fail("当前审批流程未设置完全");
}
}
if($flow['type'] == 1){
if(!empty($param['extends']['KSSJ']['value']) && !empty($param['extends']['JSSJ']['value'])){
$kssj = $param['extends']['KSSJ']['value'];
$jssj = $param['extends']['JSSJ']['value'];
//SELECT * FROM vx_live_room where info ->> 'name' like '%测试%'
$has = Db::name('oa_approve')->whereRaw("extends->'$.KSSJ.value' = '{$kssj}' and extends->'$.JSSJ.value' = '{$jssj}'")->find();
if(!empty($has)){
return $this->fail('当前时间已有请假申请');
}
}
}
$param['admin_id'] = $this->adminId;
$param['create_time'] = time();
$param['type'] = $flow['flow_cate'];
$param['extends'] = !empty($param['extends']) ? json_encode($param['extends']) : null;
$param['copy_uids'] = !empty($param['copy_uids']) ? $param['copy_uids'] : $flow['copy_uids'];
if (empty($param['check_admin_ids'])) {
$flow_list = unserialize($flow['flow_list']);
if($flow_list[0]['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$this->adminId)->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$param['check_admin_ids'] = $leader;
}
}else{
$param['check_admin_ids'] = $flow_list[0]['flow_uids'];
}
$aid = Db::name('oa_approve')->strict(false)->field(true)->insertGetId($param);
foreach ($flow_list as $key => &$value){
$value['action_id'] = $aid;
$value['sort'] = $key;
$value['create_time'] = time();
$value['type'] = 1;
}
Db::name('oa_flow_step')->strict(false)->field(true)->insertAll($flow_list);
}
else{
$aid = Db::name('oa_approve')->strict(false)->field(true)->insertGetId($param);
$flow_step = array(
'action_id' => $aid,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time(),
'type' => 1
);
Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
}
$step_id = Db::name('oa_flow_step')->where('action_id',$aid)->where('type',1)->order('id asc')->find();
//添加提交申请记录
$checkData=array(
'action_id' => $aid,
'check_user_id' => $this->adminId,
'content' => '提交申请',
'check_time' => time(),
'create_time' => time(),
'type' => 1,
'step_id' => $step_id['id']
);
$record_id = Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $record_id ? $this->success('ok') : $this->fail('fail');
}
public function edit(){
$param = $this->request->post(['id','flow_id','check_admin_ids','copy_uids','extends']);
if(empty($param['id'])){
return $this->fail("id参数错误");
}
$data = Db::name('oa_approve')->where('id',$param['id'])->find();
if(empty($data)){
return $this->fail("数据信息不存在");
}
if(empty($param['flow_id'])){
return $this->fail("请选择审批流程");
}
$flow = Db::name('oa_flow')->where('id',$param['flow_id'])->find();
if(empty($flow)){
return $this->fail("审批流程信息不存在");
}
if($flow['check_type'] == 2){
if(empty($param['check_admin_ids'])){
return $this->fail("请选择审核人");
}
}else{
if(empty($flow['flow_list'])){
return $this->fail("当前审批流程未设置完全");
}
}
$param['type'] = $flow['flow_cate'];
$param['extends'] = !empty($param['extends']) ? json_encode($param['extends']) : null;
$param['update_time'] = time();
$param['check_status'] = 0;
$param['check_step_sort'] = 0;
//删除原来的审核流程和审核记录
Db::name('oa_flow_step')->where(['action_id'=>$param['id']])->where('type',1)->update(['delete_time'=>time()]);
Db::name('oa_flow_record')->where(['action_id'=>$param['id']])->where('type',1)->update(['delete_time'=>time(),'is_invalid'=>1]);
if (empty($param['check_admin_ids'])) {
$flow_list = unserialize($flow['flow_list']);
if($flow_list[0]['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$this->adminId)->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$param['check_admin_ids'] = $leader;
}
}else{
$param['check_admin_ids'] = $flow_list[0]['flow_uids'];
}
Db::name('oa_approve')->where('id',$param['id'])->strict(false)->field(true)->update($param);
foreach ($flow_list as $key => &$value){
$value['action_id'] = $param['id'];
$value['sort'] = $key;
$value['create_time'] = time();
$value['type'] = 1;
}
Db::name('oa_flow_step')->strict(false)->field(true)->insertAll($flow_list);
}
else{
Db::name('oa_approve')->where('id',$param['id'])->strict(false)->field(true)->update($param);
$flow_step = array(
'action_id' => $param['id'],
'flow_uids' => $param['check_admin_ids'],
'create_time' => time(),
'type' => 1,
);
Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
}
$step_id = Db::name('oa_flow_step')->where('action_id',$param['id'])->order('id asc')->find();
//添加提交申请记录
$checkData=array(
'action_id' => $param['id'],
'check_user_id' => $this->adminId,
'content' => '重新提交申请',
'check_time' => time(),
'create_time' => time(),
'type' => 1,
'step_id' => $step_id['id']
);
$record_id = Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $record_id ? $this->success('ok') : $this->fail('fail');
}
public function check(){
$params = $this->request->post(['id','check','content','check_node','check_admin_ids']);
if(empty($params['id'])){
return $this->fail('缺少数据主键');
}
if(empty($params['check']) || !in_array($params['check'],[1,2,3])){
return $this->fail('审核参数错误');
}
$data = Db::name('oa_approve')->where('id',$params['id'])->find();
if(empty($data)){
return $this->fail('数据信息不存在');
}
//撤销
if($params['check'] == 3){
if($data['admin_id'] != $this->adminId){
return $this->fail('你不是该申请的发起者,无权撤销');
}
//撤销审核,数据操作
$params['check_status'] = 4;
$params['check_admin_ids'] ='';
$params['check_step_sort'] = 0;
$res = Db::name('oa_approve')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => 0,
'check_user_id' => $this->adminId,
'type' => 1,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}else{
return $this->fail('fail');
}
}
//拒绝
if($params['check'] == 2){
//当前审核节点详情
$step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>$data['check_step_sort'],'type'=>1])->find();
$check_admin_ids = explode(",", strval($data['check_admin_ids']));
if (!in_array($this->adminId, $check_admin_ids)){
return $this->fail('您没权限审核该审批');
}
//拒绝审核,数据操作
$params['check_status'] = 3;
$params['last_admin_id'] = $this->adminId;
$params['flow_admin_ids'] = $data['flow_admin_ids'].$this->adminId.',';
$params['check_admin_ids'] = '';
if($step['flow_type'] == 4){
//获取上一步的审核信息
$prev_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']-1),'type'=>1])->find();
if($prev_step){
//存在上一步审核
$params['check_step_sort'] = $prev_step['sort'];
$params['check_admin_ids'] = $prev_step['flow_uids'];
$params['check_status'] = 1;
}
else{
//不存在上一步审核,审核初始化步骤
$params['check_step_sort'] = 0;
$params['check_admin_ids'] = '';
$params['check_status'] = 0;
}
}
$res = Db::name('oa_approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => $step['id'],
'check_user_id' => $this->adminId,
'type' => 1,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}
else{
return $this->fail('fail');
}
}
//通过
if($params['check'] == 1){
//当前审核节点详情
$step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>$data['check_step_sort'],'type'=>1])->find();
$check_admin_ids = explode(",", strval($data['check_admin_ids']));
if (!in_array($this->adminId, $check_admin_ids)){
return $this->fail('您没权限审核该审批');
}
//多人会签审批
if($step['flow_type'] == 3){
//查询当前会签记录数
$check_count = Db::name('oa_flow_record')->where(['action_id'=>$params['id'],'step_id'=>$step['id'],'type'=>1])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1),'type'=>1])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$data['admin_id'])->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}else{
$params['check_admin_ids'] = $next_step['flow_uids'];
}
$params['check_step_sort'] = $data['check_step_sort']+1;
$params['check_status'] = 1;
}else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}else{
$params['check_status'] = 1;
$params['check_admin_ids'] = $step['flow_uids'];
}
}else if($step['flow_type'] == 0){
//自由人审批
if($params['check_node'] == 2){
$next_step = $data['check_step_sort']+1;
$flow_step = array(
'action_id' => $params['id'],
'sort' => $next_step,
'type' => 1,
'flow_uids' => $params['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$params['check_step_sort'] = $next_step;
$params['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}else{
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1),'type'=>1])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$data['admin_id'])->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}
else{
$params['check_admin_ids'] = $next_step['flow_uids'];
}
$params['check_step_sort'] = $data['check_step_sort']+1;
$params['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}
if($params['check_status'] == 1 && empty($params['check_admin_ids'])){
return $this->fail('找不到下一步的审批人该审批流程设置有问题请联系HR或者管理员');
}
//审核通过数据操作
$params['last_admin_id'] = $this->adminId;
$params['flow_admin_ids'] = $data['flow_admin_ids'].$this->adminId.',';
$res = Db::name('oa_approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => $step['id'],
'check_user_id' => $this->adminId,
'type' => 1,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}
else{
return $this->fail('fail');
}
}
return $this->fail();
}
public function copy(){
$params = $this->request->get();
$user_id = $this->adminId;
//查询条件
$map = [];
$map[] = ['f.check_status', '=', 2];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',f.copy_uids)")];
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$lists = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->where($map)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
return $item;
})->toArray();
$count = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->where($map)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function lst(){
$params = $this->request->get();
$user_id = $this->adminId;
$status = !empty($params['status']) ? $params['status'] : 0;
//查询条件
$map1 = [];
$map2 = [];
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',f.check_admin_ids)")];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',f.flow_admin_ids)")];
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$lists = [];
$count = 0;
if($status == 0){
$lists = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->whereOr([$map1,$map2])
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
return $item;
})->toArray();
$count = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->whereOr([$map1,$map2])->count();
}
if($status == 1){
$lists = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->where($map1)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
return $item;
})->toArray();
$count = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->where($map1)->count();
}
if($status == 2){
$lists = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->where($map2)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item, $key){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
return $item;
})->toArray();
$count = Db::name('oa_approve')
->field('f.*,a.name as user_name,d.name as dept_name,t.title as type_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->join('oa_flow_type t', 't.id = f.type', 'left')
->where($map2)->count();
}
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\controller\works\bgsp;
use app\oa\controller\BaseAdminController;
use app\oa\lists\works\bgsp\OaFlowLists;
use app\oa\logic\works\bgsp\OaFlowLogic;
use app\oa\validate\works\bgsp\OaFlowValidate;
/**
* 审批流程控制器
* Class OaFlowController
* @package app\adminapi\controller\works\bgsp
*/
class OaFlowController extends BaseAdminController
{
/**
* @notes 获取审批流程列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function lists()
{
return $this->dataLists(new OaFlowLists());
}
/**
* @notes 添加审批流程
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function add()
{
$params = (new OaFlowValidate())->post()->goCheck('add');
$result = OaFlowLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaFlowLogic::getError());
}
/**
* @notes 编辑审批流程
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function edit()
{
$params = (new OaFlowValidate())->post()->goCheck('edit');
$result = OaFlowLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaFlowLogic::getError());
}
/**
* @notes 删除审批流程
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function delete()
{
$params = (new OaFlowValidate())->post()->goCheck('delete');
OaFlowLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取审批流程详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function detail()
{
$params = (new OaFlowValidate())->goCheck('detail');
$result = OaFlowLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\bgsp;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\bgsp\OaFlowTypeLists;
use app\adminapi\logic\works\bgsp\OaFlowTypeLogic;
use app\adminapi\validate\works\bgsp\OaFlowTypeValidate;
/**
* 审批类型控制器
* Class OaFlowTypeController
* @package app\adminapi\controller\works\bgsp
*/
class OaFlowTypeController extends BaseAdminController
{
/**
* @notes 获取审批类型列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function lists()
{
return $this->dataLists(new OaFlowTypeLists());
}
/**
* @notes 添加审批类型
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function add()
{
$params = (new OaFlowTypeValidate())->post()->goCheck('add');
$result = OaFlowTypeLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaFlowTypeLogic::getError());
}
/**
* @notes 编辑审批类型
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function edit()
{
$params = (new OaFlowTypeValidate())->post()->goCheck('edit');
$result = OaFlowTypeLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaFlowTypeLogic::getError());
}
/**
* @notes 删除审批类型
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function delete()
{
$params = (new OaFlowTypeValidate())->post()->goCheck('delete');
$result = OaFlowTypeLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(OaFlowTypeLogic::getError());
}
/**
* @notes 获取审批类型详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function detail()
{
$params = (new OaFlowTypeValidate())->goCheck('detail');
$result = OaFlowTypeLogic::detail($params);
return $this->data($result);
}
public function all(){
$result = OaFlowTypeLogic::all();
return $this->data($result);
}
}

View File

@ -0,0 +1,738 @@
<?php
namespace app\adminapi\controller\works\finance;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\validate\works\finance\ExpenseValidate;
use app\common\model\auth\Admin;
use app\common\model\dept\Dept;
use app\common\model\works\bgsp\OaFlow;
use think\facade\Db;
class ExpenseController extends BaseAdminController
{
public function add(){
$params = (new ExpenseValidate())->post()->goCheck('add');
$params['income_month'] = strtotime($params['income_month']);
$params['expense_time'] = strtotime($params['expense_time']);
$params['admin_id'] = $this->adminId;
$params['annex'] = !empty($params['annex']) ? json_encode($params['annex']) : null;
$params['check_status'] = 0;
$params['check_step_sort'] = 0;
$params['create_time'] = time();
$params['detail'] = json_encode($params['detail']);
$flow = Db::name('oa_flow')->where('id',$params['flow_id'])->find();
if(empty($flow)){
return $this->fail("审批流程信息不存在");
}
if($flow['check_type'] == 2){
if(empty($params['check_admin_ids'])){
return $this->fail("请选择审核人");
}
}else{
if(empty($flow['flow_list'])){
return $this->fail("当前审批流程未设置完全");
}
}
$params['copy_uids'] = !empty($params['copy_uids']) ? $params['copy_uids'] : $flow['copy_uids'];
if (empty($params['check_admin_ids'])) {
$flow_list = unserialize($flow['flow_list']);
if($flow_list[0]['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$this->adminId)->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}else{
$params['check_admin_ids'] = $flow_list[0]['flow_uids'];
}
$aid = Db::name('oa_expense')->strict(false)->field(true)->insertGetId($params);
foreach ($flow_list as $key => &$value){
$value['action_id'] = $aid;
$value['sort'] = $key;
$value['create_time'] = time();
$value['type'] = 2;
}
Db::name('oa_flow_step')->strict(false)->field(true)->insertAll($flow_list);
}
else{
$aid = Db::name('oa_expense')->strict(false)->field(true)->insertGetId($params);
$flow_step = array(
'action_id' => $aid,
'flow_uids' => $params['check_admin_ids'],
'create_time' => time(),
'type' => 2
);
Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
}
$step_id = Db::name('oa_flow_step')->where('action_id',$aid)->where('type',2)->order('id asc')->find();
//添加提交申请记录
$checkData=array(
'action_id' => $aid,
'check_user_id' => $this->adminId,
'content' => '提交申请',
'check_time' => time(),
'create_time' => time(),
'type' => 2,
'step_id' => $step_id['id']
);
$record_id = Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $record_id ? $this->success('ok') : $this->fail('fail');
}
public function edit(){
$params = (new ExpenseValidate())->post()->goCheck('edit');
$params['income_month'] = strtotime($params['income_month']);
$params['expense_time'] = strtotime($params['expense_time']);
$params['annex'] = !empty($params['annex']) ? json_encode($params['annex']) : null;
$params['check_status'] = 0;
$params['check_step_sort'] = 0;
$params['detail'] = json_encode($params['detail']);
$flow = Db::name('oa_flow')->where('id',$params['flow_id'])->find();
if(empty($flow)){
return $this->fail("审批流程信息不存在");
}
if($flow['check_type'] == 2){
if(empty($param['check_admin_ids'])){
return $this->fail("请选择审核人");
}
}else{
if(empty($flow['flow_list'])){
return $this->fail("当前审批流程未设置完全");
}
}
//删除原来的审核流程和审核记录
Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'type'=>2])->update(['delete_time'=>time()]);
Db::name('oa_flow_record')->where(['action_id'=>$params['id'],'type'=>2])->update(['delete_time'=>time(),'is_invalid'=>1]);
if (empty($params['check_admin_ids'])) {
$flow_list = unserialize($flow['flow_list']);
if($flow_list[0]['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$this->adminId)->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}else{
$params['check_admin_ids'] = $flow_list[0]['flow_uids'];
}
Db::name('oa_expense')->where('id',$params['id'])->strict(false)->field(true)->update($params);
foreach ($flow_list as $key => &$value){
$value['action_id'] = $params['id'];
$value['sort'] = $key;
$value['create_time'] = time();
$value['type'] = 2;
}
Db::name('oa_flow_step')->strict(false)->field(true)->insertAll($flow_list);
}
else{
Db::name('oa_expense')->where('id',$params['id'])->strict(false)->field(true)->insertGetId($params);
$flow_step = array(
'action_id' => $params['id'],
'flow_uids' => $params['check_admin_ids'],
'create_time' => time(),
'type' => 2
);
Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
}
$step_id = Db::name('oa_flow_step')->where('action_id',$params['id'])->where('type',2)->order('id asc')->find();
//添加提交申请记录
$checkData=array(
'action_id' => $params['id'],
'check_user_id' => $this->adminId,
'content' => '提交申请',
'check_time' => time(),
'create_time' => time(),
'type' => 2,
'step_id' => $step_id['id']
);
$record_id = Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $record_id ? $this->success('ok') : $this->fail('fail');
}
public function detail(){
$params = (new ExpenseValidate())->get()->goCheck('detail');
$data = Db::name('oa_expense')->where('id',$params['id'])->find();
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待打款',3=>'审核不通过',4=>'撤销审核'
};
$data['income_month'] = date('Y-m',$data['income_month']);
$data['expense_time'] = date('Y-m-d',$data['expense_time']);
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$copy_users = Admin::where('id','in',$data['copy_uids'])->column('name');
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['copy_users'] = !empty($copy_users) ? implode(',',$copy_users) : '';
$data['detail'] = json_decode($data['detail'],true);
$data['annex'] = json_decode($data['annex'],true);
$data['total_amount'] = 0;
foreach ($data['detail'] as &$v){
$data['total_amount'] += $v['amount'];
//1-交通费 2-住宿费 3-餐补费 4-招待费 5-汽油费 6-其他费
$v['cate_name'] = match ($v['cate_id']){
'1'=>'交通费', '2'=>'住宿费', '3'=>'餐补费', '4'=>'招待费', '5'=>'汽油费', '6'=>'其他费', default=>''
};
}
$data['admin_name'] = Admin::where('id',$data['admin_id'])->value('name');
$data['flow_info'] = OaFlow::where('id',$data['flow_id'])->findOrEmpty();
$data['record'] = Db::name('oa_flow_record')->field('check_user_id,check_time,status,content')->where('action_id',$params['id'])->where('type',2)->order('id desc')->select()->each(function($data){
$data['check_time'] = date('Y-m-d H:i:s',$data['check_time']);
$user = Admin::where('id',$data['check_user_id'])->value('name');
$data['check_user_name'] = $user ?? '';
$data['status_text'] = match ($data['status']){
0=>'提交',1=>'通过',2=>'拒绝',3=>'撤销'
};
return $data;
})->toArray();
$step = Db::name('oa_flow_step')->field('id,action_id,flow_uids,flow_type,sort')->where('action_id',$params['id'])->where('type',2)->order('sort asc')->select()->toArray();
foreach ($step as $key => &$val) {
$user_id_info = Admin::field('id,name')->where('id','in',$val['flow_uids'])->select()->toArray();
foreach ($user_id_info as $k => &$v) {
$v['check_time'] = 0;
$v['content'] = '';
$v['status'] = 0;
$check_array = Db::name('oa_flow_record')->where(['check_user_id' => $v['id'],'step_id' => $val['id'],'type'=>2])->order('check_time desc')->select()->toArray();
if(!empty($check_array)){
$checked = $check_array[0];
$v['check_time'] = date('Y-m-d H:i', $checked['check_time']);
$v['content'] = $checked['content'];
$v['status'] = $checked['status'];
}
}
$check_list = Db::name('oa_flow_record')
->field('f.*,a.name')
->alias('f')
->join('admin a', 'a.id = f.check_user_id', 'left')
->where(['f.step_id' => $val['id']])->where('f.status','>',0)->select()->toArray();
foreach ($check_list as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d H:i', $vv['check_time']);
}
$val['user_id_info'] = $user_id_info;
$val['check_list'] = $check_list;
}
$data['steps'] = $step;
return $this->data($data);
}
public function lists(){
$params = $this->request->get(['start_time','end_time','status','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['start_time']) && !empty($params['end_time'])){
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
return $this->fail('结束时间不等小于开始时间');
}
$where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
if(!empty($params['status'])){
$where[] = match ($params['status']){
'1'=> ['check_status','=',0], //待审核
'2'=> ['check_status','=',1], //审核中
'3'=> [['check_status','=',2],['pay_admin_id','=',0],['pay_time','=',0]], //审批通过,待打款
'4'=> ['check_status','=',3], //审核不通过
'5'=> ['check_status','=',4], //撤销审核
'6'=> [['check_status','=',2],['pay_admin_id','>',0],['pay_time','>',0]], //审批通过,已打款
};
}else{
$where[] = ['check_status','in','0,1,2,3,4'];
}
$lists = Db::name('oa_expense')->field('id,code,income_month,expense_time,admin_id,check_admin_ids,check_status,pay_admin_id,pay_time,create_time,detail')->where('admin_id',$this->adminId)->where($where)
->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
$dept = Dept::where('id',$admin['dept_id'])->value('name');
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$data['user_name'] = $admin['name'];
$data['dept_name'] = $dept ?? '';
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
$data['income_month'] = date('Y-m',$data['income_month']);
$data['expense_time'] = date('Y-m-d',$data['expense_time']);
$data['pay_time'] = !empty($data['pay_time']) ? date('Y-m-d H:i:s',$data['pay_time']) : '';
$data['pay_admin_name'] = Admin::where('id',$data['pay_admin_id'])?->value('name');
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
if(!empty($data['pay_admin_id']) && !empty($data['pay_time']) && $data['check_status'] == 2){
$data['check_status_text'] = '已打款';
}
$data['total_amount'] = 0;
foreach (json_decode($data['detail'],true) as $v){
$data['total_amount'] += $v['amount'];
}
return $data;
})->toArray();
$count = Db::name('oa_expense')->where($where)->where('admin_id',$this->adminId)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function copy(){
$params = $this->request->get(['start_time','end_time','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$map = [];
if(!empty($params['start_time']) && !empty($params['end_time'])){
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
return $this->fail('结束时间不等小于开始时间');
}
$map[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
//查询条件
$map = [];
$map[] = ['f.check_status', '=', 2];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$this->adminId}',f.copy_uids)")];
$lists = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['income_month'] = date('Y-m',$item['income_month']);
$item['expense_time'] = date('Y-m-d',$item['expense_time']);
$item['pay_time'] = !empty($item['pay_time']) ? date('Y-m-d H:i:s',$item['pay_time']) : '';
$item['pay_admin_name'] = Admin::where('id',$item['pay_admin_id'])?->value('name');
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
if(!empty($item['pay_admin_id']) && !empty($item['pay_time']) && $item['check_status'] == 2){
$item['check_status_text'] = '已打款';
}
$item['total_amount'] = 0;
foreach (json_decode($item['detail'],true) as $v){
$item['total_amount'] += $v['amount'];
}
return $item;
})->toArray();
$count = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function deal_with(){
$params = $this->request->get();
$status = !empty($params['status']) ? $params['status'] : 0;
//查询条件
$map1 = [];
$map2 = [];
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$this->adminId}',f.check_admin_ids)")];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$this->adminId}',f.flow_admin_ids)")];
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$lists = [];
$count = 0;
if($status == 0){
$lists = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->whereOr([$map1,$map2])
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['income_month'] = date('Y-m',$item['income_month']);
$item['expense_time'] = date('Y-m-d',$item['expense_time']);
$item['pay_time'] = !empty($item['pay_time']) ? date('Y-m-d H:i:s',$item['pay_time']) : '';
$item['pay_admin_name'] = Admin::where('id',$item['pay_admin_id'])?->value('name');
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
};
if(!empty($item['pay_admin_id']) && !empty($item['pay_time']) && $item['check_status'] == 2){
$item['check_status_text'] = '已打款';
}
$item['total_amount'] = 0;
foreach (json_decode($item['detail'],true) as $v){
$item['total_amount'] += $v['amount'];
}
return $item;
})->toArray();
$count = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->whereOr([$map1,$map2])->count();
}
if($status == 1){
$lists = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map1)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['income_month'] = date('Y-m',$item['income_month']);
$item['expense_time'] = date('Y-m-d',$item['expense_time']);
$item['pay_time'] = !empty($item['pay_time']) ? date('Y-m-d H:i:s',$item['pay_time']) : '';
$item['pay_admin_name'] = Admin::where('id',$item['pay_admin_id'])?->value('name');
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待打款',3=>'审核不通过',4=>'撤销审核'
};
if(!empty($item['pay_admin_id']) && !empty($item['pay_time']) && $item['check_status'] == 2){
$item['check_status_text'] = '已打款';
}
$item['total_amount'] = 0;
foreach (json_decode($item['detail'],true) as $v){
$item['total_amount'] += $v['amount'];
}
return $item;
})->toArray();
$count = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map1)->count();
}
if($status == 2){
$lists = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map2)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item, $key){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['income_month'] = date('Y-m',$item['income_month']);
$item['expense_time'] = date('Y-m-d',$item['expense_time']);
$item['pay_time'] = !empty($item['pay_time']) ? date('Y-m-d H:i:s',$item['pay_time']) : '';
$item['pay_admin_name'] = Admin::where('id',$item['pay_admin_id'])?->value('name');
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待打款',3=>'审核不通过',4=>'撤销审核'
};
if(!empty($item['pay_admin_id']) && !empty($item['pay_time']) && $item['check_status'] == 2){
$item['check_status_text'] = '已打款';
}
$item['total_amount'] = 0;
foreach (json_decode($item['detail'],true) as $v){
$item['total_amount'] += $v['amount'];
}
return $item;
})->toArray();
$count = Db::name('oa_expense')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map2)->count();
}
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function check(){
$params = $this->request->post(['id','check','content','check_node','check_admin_ids']);
if(empty($params['id'])){
return $this->fail('缺少数据主键');
}
if(empty($params['check']) || !in_array($params['check'],[1,2,3])){
return $this->fail('审核参数错误');
}
$data = Db::name('oa_expense')->where('id',$params['id'])->find();
if(empty($data)){
return $this->fail('数据信息不存在');
}
//撤销
if($params['check'] == 3){
if($data['admin_id'] != $this->adminId){
return $this->fail('你不是该申请的发起者,无权撤销');
}
//撤销审核,数据操作
$params['check_status'] = 4;
$params['check_admin_ids'] ='';
$params['check_step_sort'] = 0;
$res = Db::name('oa_expense')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => 0,
'check_user_id' => $this->adminId,
'type' => 2,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}else{
return $this->fail('fail');
}
}
//拒绝
if($params['check'] == 2){
//当前审核节点详情
$step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>$data['check_step_sort'],'type'=>2])->find();
$check_admin_ids = explode(",", strval($data['check_admin_ids']));
if (!in_array($this->adminId, $check_admin_ids)){
return $this->fail('您没权限审核该审批');
}
//拒绝审核,数据操作
$params['check_status'] = 3;
$params['last_admin_id'] = $this->adminId;
$params['flow_admin_ids'] = $data['flow_admin_ids'].$this->adminId.',';
$params['check_admin_ids'] = '';
if($step['flow_type'] == 4){
//获取上一步的审核信息
$prev_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']-1),'type'=>2])->find();
if($prev_step){
//存在上一步审核
$params['check_step_sort'] = $prev_step['sort'];
$params['check_admin_ids'] = $prev_step['flow_uids'];
$params['check_status'] = 1;
}
else{
//不存在上一步审核,审核初始化步骤
$params['check_step_sort'] = 0;
$params['check_admin_ids'] = '';
$params['check_status'] = 0;
}
}
$res = Db::name('oa_expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => $step['id'],
'check_user_id' => $this->adminId,
'type' => 2,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}
else{
return $this->fail('fail');
}
}
//通过
if($params['check'] == 1){
//当前审核节点详情
$step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>$data['check_step_sort'],'type'=>2])->find();
$check_admin_ids = explode(",", strval($data['check_admin_ids']));
if (!in_array($this->adminId, $check_admin_ids)){
return $this->fail('您没权限审核该审批');
}
//多人会签审批
if($step['flow_type'] == 3){
//查询当前会签记录数
$check_count = Db::name('oa_flow_record')->where(['action_id'=>$params['id'],'step_id'=>$step['id'],'type'=>2])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1),'type'=>2])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$data['admin_id'])->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}else{
$params['check_admin_ids'] = $next_step['flow_uids'];
}
$params['check_step_sort'] = $data['check_step_sort']+1;
$params['check_status'] = 1;
}else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}else{
$params['check_status'] = 1;
$params['check_admin_ids'] = $step['flow_uids'];
}
}else if($step['flow_type'] == 0){
//自由人审批
if($params['check_node'] == 2){
$next_step = $data['check_step_sort']+1;
$flow_step = array(
'action_id' => $params['id'],
'sort' => $next_step,
'type' => 2,
'flow_uids' => $params['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$params['check_step_sort'] = $next_step;
$params['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}else{
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1),'type'=>2])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$data['admin_id'])->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}
else{
$params['check_admin_ids'] = $next_step['flow_uids'];
}
$params['check_step_sort'] = $data['check_step_sort']+1;
$params['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}
if($params['check_status'] == 1 && empty($params['check_admin_ids'])){
return $this->fail('找不到下一步的审批人该审批流程设置有问题请联系HR或者管理员');
}
//审核通过数据操作
$params['last_admin_id'] = $this->adminId;
$params['flow_admin_ids'] = $data['flow_admin_ids'].$this->adminId.',';
$res = Db::name('oa_expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => $step['id'],
'check_user_id' => $this->adminId,
'type' => 2,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}
else{
return $this->fail('fail');
}
}
return $this->fail();
}
public function lists2(){
$params = $this->request->get(['start_time','end_time','status','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['start_time']) && !empty($params['end_time'])){
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
return $this->fail('结束时间不等小于开始时间');
}
$where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
if(!empty($params['status'])){
$where[] = match ($params['status']){
'1'=> [['check_status','=',2],['pay_admin_id','=',0],['pay_time','=',0]], //审批通过,待打款
'2'=> [['check_status','=',2],['pay_admin_id','>',0],['pay_time','>',0]], //审批通过,已打款
};
}else{
$where[] = ['check_status','=',2];
}
$lists = Db::name('oa_expense')->field('id,code,income_month,expense_time,admin_id,check_admin_ids,check_status,pay_admin_id,pay_time,create_time,detail')->where($where)
->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
$dept = Dept::where('id',$admin['dept_id'])->value('name');
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$data['user_name'] = $admin['name'];
$data['dept_name'] = $dept ?? '';
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
$data['income_month'] = date('Y-m',$data['income_month']);
$data['expense_time'] = date('Y-m-d',$data['expense_time']);
$data['pay_time'] = !empty($data['pay_time']) ? date('Y-m-d H:i:s',$data['pay_time']) : '';
$data['pay_admin_name'] = Admin::where('id',$data['pay_admin_id'])?->value('name');
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待打款',3=>'审核不通过',4=>'撤销审核'
};
if(!empty($data['pay_admin_id']) && !empty($data['pay_time']) && $data['check_status'] == 2){
$data['check_status_text'] = '已打款';
}
$data['total_amount'] = 0;
foreach (json_decode($data['detail'],true) as $v){
$data['total_amount'] += $v['amount'];
}
return $data;
})->toArray();
$count = Db::name('oa_expense')->where($where)->where('admin_id',$this->adminId)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function payment(){
$params = (new ExpenseValidate())->post()->goCheck('pay');
$data = Db::name('oa_expense')->where('id',$params['id'])->find();
if(empty($data)){
return $this->success('申请信息不存在');
}
if($data['check_status'] !== 2){
return $this->success('当前申请未审核通过');
}
$res = Db::name('oa_expense')->where('id',$params['id'])->update(['pay_admin_id'=>$this->adminId,'pay_time'=>time()]);
return $res ? $this->success('ok') : $this->fail('fail');
}
}

View File

@ -0,0 +1,148 @@
<?php
namespace app\adminapi\controller\works\finance;
use app\adminapi\controller\BaseAdminController;
use app\common\model\auth\Admin;
use app\common\model\dept\Dept;
use think\facade\Db;
class IncomeController extends BaseAdminController
{
public function index(){
$params = $this->request->get(['start_time','end_time','status','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['start_time']) && !empty($params['end_time'])){
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
return $this->fail('结束时间不等小于开始时间');
}
$where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
if(!empty($params['status'])){
$where[] = match ($params['status']){
'1'=> ['is_cash','=',0], //未到账
'2'=> ['is_cash','=',1], //部分到账
'3'=> [['is_cash','=',2]], //全部到账
};
}else{
$where[] = ['is_cash','in','0,1,2'];
}
$lists = Db::name('oa_invoice')->field('id,is_cash,enter_amount,enter_time,type,invoice_title,amount,invoice_type,admin_id,create_time,code,open_time,check_admin_ids,open_admin_id')->where('check_status',5)->where($where)
->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
$dept = Dept::where('id',$admin['dept_id'])->value('name');
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$data['user_name'] = $admin['name'];
$data['dept_name'] = $dept ?? '';
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
$data['type_text'] = match ($data['type']){
1=>'企业',2=>'个人'
};
$data['invoice_type_text'] = match ($data['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$data['is_cash_text'] = match ($data['is_cash']){
0=>'未到账',1=>'部分到账',2=>'全部到账'
};
$data['open_time'] = !empty($data['open_time']) ? date('Y-m-d',$data['open_time']) : '';
$data['enter_time'] = !empty($data['enter_time']) ? date('Y-m-d H:i:s',$data['enter_time']) : '';
$data['open_admin_name'] = Admin::where('id',$data['open_admin_id'])?->value('name');
return $data;
})->toArray();
$count = Db::name('oa_invoice')->where($where)->where('check_status',5)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function add(){
$params = $this->request->post(['invoice_id','detail']);
if(empty($params['invoice_id']) || empty($params['detail'])){
return $this->fail('参数错误');
}
$invoice = Db::name('oa_invoice')->where('id',$params['invoice_id'])->find();
if(empty($invoice)){
return $this->fail('开票信息不存在');
}
if(!is_array($params['detail'])){
return $this->fail('到账记录数据格式错误');
}
$income_amount = 0;
$save_data = [];
foreach($params['detail'] as $k=>$v){
if(empty($v['enter_time']) || !strtotime($v['enter_time'])){
return $this->fail('到账记录第'.($k+1).'行到账日期为空');
}
if(empty($v['amount'])){
return $this->fail('到账记录第'.($k+1).'行到帐金额为空');
}
$income_amount += $v['amount'];
$save_data[] = [
'inid' => $params['invoice_id'],
'amount' => $v['amount'],
'admin_id' => $this->adminId,
'enter_time' => strtotime($v['enter_time']),
'remarks' => $v['remarks'] ?? '',
'create_time' => time(),
'status' => 1
];
}
if($income_amount > $invoice['amount']){
return $this->fail('到账金额大于发票金额,不允许保存');
}
Db::startTrans();
try {
Db::name('oa_invoice_income')->where('inid',$params['invoice_id'])->delete();
Db::name('oa_invoice_income')->insertAll($save_data);
Db::name('oa_invoice')->where('id',$params['invoice_id'])->update([
'enter_amount' => $income_amount,
'enter_time' => time(),
'is_cash' => $income_amount < $invoice['amount'] ? 1 : 2
]);
Db::commit();
return $this->success('ok');
} catch (\Exception $e) {
Db::rollback();
return $this->fail();
}
}
public function lists(){
$params = $this->request->get(['invoice_id']);
if(empty($params['invoice_id'])){
return $this->fail('参数错误');
}
$data = Db::name('oa_invoice_income')->where('inid',$params['invoice_id'])->order('create_time desc')->select()->each(function($data){
$data['enter_time'] = date('Y-m-d',$data['enter_time']);
$data['admin_name'] = Admin::where('id',$data['admin_id'])?->value('name');
return $data;
})->toArray();
return $this->data($data);
}
public function fdz(){
$params = $this->request->post(['invoice_id']);
if(empty($params['invoice_id'])){
return $this->fail('参数错误');
}
$invoice = Db::name('oa_invoice')->where('id',$params['invoice_id'])->find();
if(empty($invoice)){
return $this->fail('开票信息不存在');
}
Db::startTrans();
try {
Db::name('oa_invoice_income')->where('inid',$params['invoice_id'])->delete();
Db::name('oa_invoice')->where('id',$params['invoice_id'])->update([
'enter_amount' => 0,
'enter_time' => 0,
'is_cash' => 0
]);
Db::commit();
return $this->success('ok');
} catch (\Exception $e) {
Db::rollback();
return $this->fail();
}
}
}

View File

@ -0,0 +1,750 @@
<?php
namespace app\adminapi\controller\works\finance;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\validate\works\finance\InvoiceValidate;
use app\common\model\auth\Admin;
use app\common\model\dept\Dept;
use app\common\model\works\bgsp\OaFlow;
use think\facade\Db;
class InvoiceController extends BaseAdminController
{
public function add(){
$params = (new InvoiceValidate())->post()->goCheck('add');
$params['admin_id'] = $this->adminId;
$params['annex'] = !empty($params['annex']) ? json_encode($params['annex']) : null;
$params['create_time'] = time();
$params['check_status'] = 0;
$params['check_step_sort'] = 0;
$flow = Db::name('oa_flow')->where('id',$params['flow_id'])->find();
if(empty($flow)){
return $this->fail("审批流程信息不存在");
}
if($flow['check_type'] == 2){
if(empty($params['check_admin_ids'])){
return $this->fail("请选择审核人");
}
}else{
if(empty($flow['flow_list'])){
return $this->fail("当前审批流程未设置完全");
}
}
$params['copy_uids'] = !empty($params['copy_uids']) ? $params['copy_uids'] : $flow['copy_uids'];
if (empty($params['check_admin_ids'])) {
$flow_list = unserialize($flow['flow_list']);
if($flow_list[0]['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$this->adminId)->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}else{
$params['check_admin_ids'] = $flow_list[0]['flow_uids'];
}
$aid = Db::name('oa_invoice')->strict(false)->field(true)->insertGetId($params);
foreach ($flow_list as $key => &$value){
$value['action_id'] = $aid;
$value['sort'] = $key;
$value['create_time'] = time();
$value['type'] = 3;
}
Db::name('oa_flow_step')->strict(false)->field(true)->insertAll($flow_list);
}
else{
$aid = Db::name('oa_invoice')->strict(false)->field(true)->insertGetId($params);
$flow_step = array(
'action_id' => $aid,
'flow_uids' => $params['check_admin_ids'],
'create_time' => time(),
'type' => 3
);
Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
}
$step_id = Db::name('oa_flow_step')->where('action_id',$aid)->where('type',3)->order('id asc')->find();
//添加提交申请记录
$checkData=array(
'action_id' => $aid,
'check_user_id' => $this->adminId,
'content' => '提交申请',
'check_time' => time(),
'create_time' => time(),
'type' => 3,
'step_id' => $step_id['id']
);
$record_id = Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $record_id ? $this->success('ok') : $this->fail('fail');
}
public function edit(){
$params = (new InvoiceValidate())->post()->goCheck('edit');
$params['admin_id'] = $this->adminId;
$params['annex'] = !empty($params['annex']) ? json_encode($params['annex']) : null;
$params['create_time'] = time();
$params['check_status'] = 0;
$params['check_step_sort'] = 0;
$flow = Db::name('oa_flow')->where('id',$params['flow_id'])->find();
if(empty($flow)){
return $this->fail("审批流程信息不存在");
}
if($flow['check_type'] == 2){
if(empty($param['check_admin_ids'])){
return $this->fail("请选择审核人");
}
}else{
if(empty($flow['flow_list'])){
return $this->fail("当前审批流程未设置完全");
}
}
//删除原来的审核流程和审核记录
Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'type'=>3])->update(['delete_time'=>time()]);
Db::name('oa_flow_record')->where(['action_id'=>$params['id'],'type'=>3])->update(['delete_time'=>time(),'is_invalid'=>1]);
if (empty($params['check_admin_ids'])) {
$flow_list = unserialize($flow['flow_list']);
if($flow_list[0]['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$this->adminId)->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}else{
$params['check_admin_ids'] = $flow_list[0]['flow_uids'];
}
Db::name('oa_invoice')->where('id',$params['id'])->strict(false)->field(true)->update($params);
foreach ($flow_list as $key => &$value){
$value['action_id'] = $params['id'];
$value['sort'] = $key;
$value['create_time'] = time();
$value['type'] = 3;
}
Db::name('oa_flow_step')->strict(false)->field(true)->insertAll($flow_list);
}
else{
Db::name('oa_invoice')->where('id',$params['id'])->strict(false)->field(true)->insertGetId($params);
$flow_step = array(
'action_id' => $params['id'],
'flow_uids' => $params['check_admin_ids'],
'create_time' => time(),
'type' => 3
);
Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
}
$step_id = Db::name('oa_flow_step')->where('action_id',$params['id'])->where('type',3)->order('id asc')->find();
//添加提交申请记录
$checkData=array(
'action_id' => $params['id'],
'check_user_id' => $this->adminId,
'content' => '提交申请',
'check_time' => time(),
'create_time' => time(),
'type' => 3,
'step_id' => $step_id['id']
);
$record_id = Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $record_id ? $this->success('ok') : $this->fail('fail');
}
public function lists(){
$params = $this->request->get(['start_time','end_time','status','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['start_time']) && !empty($params['end_time'])){
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
return $this->fail('结束时间不等小于开始时间');
}
$where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
if(!empty($params['status'])){
$where[] = match ($params['status']){
'1'=> ['check_status','=',0], //待审核
'2'=> ['check_status','=',1], //审核中
'3'=> [['check_status','=',2]], //审批通过,待开具
'4'=> ['check_status','=',3], //审核不通过
'5'=> ['check_status','=',4], //撤销审核
'6'=> [['check_status','=',5]], //审批通过,已开具
'7'=> [['check_status','=',10]], //已作废
};
}else{
$where[] = ['check_status','in','0,1,2,3,4,5,10'];
}
$lists = Db::name('oa_invoice')->field('id,type,invoice_title,invoice_subject,amount,invoice_type,check_status,admin_id,create_time,check_admin_ids,open_admin_id,open_time,code')->where('admin_id',$this->adminId)->where($where)
->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
$dept = Dept::where('id',$admin['dept_id'])->value('name');
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$data['user_name'] = $admin['name'];
$data['dept_name'] = $dept ?? '';
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待开具',3=>'审核不通过',4=>'撤销审核',5=>'已开具',10=>'已作废'
};
$data['type_text'] = match ($data['type']){
1=>'企业',2=>'个人'
};
$data['invoice_type_text'] = match ($data['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$data['open_time'] = !empty($data['open_time']) ? date('Y-m-d',$data['open_time']) : '';
$data['open_admin_name'] = Admin::where('id',$data['open_admin_id'])?->value('name');
return $data;
})->toArray();
$count = Db::name('oa_invoice')->where($where)->where('admin_id',$this->adminId)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function detail(){
$params = (new InvoiceValidate())->post()->goCheck('detail');
$data = Db::name('oa_invoice')->where('id',$params['id'])->find();
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
$dept = Dept::where('id',$admin['dept_id'])->value('name');
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$copy_users = Admin::where('id','in',$data['copy_uids'])->column('name');
$data['copy_users'] = !empty($copy_users) ? implode(',',$copy_users) : '';
$data['user_name'] = $admin['name'];
$data['dept_name'] = $dept ?? '';
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
$data['annex'] = json_decode($data['annex'],true);
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待开具',3=>'审核不通过',4=>'撤销审核',5=>'已开具',10=>'已作废'
};
$data['type_text'] = match ($data['type']){
1=>'企业',2=>'个人'
};
$data['invoice_type_text'] = match ($data['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$data['is_cash_text'] = match ($data['is_cash']){
0=>'未到账',1=>'部分到账',2=>'全部到账'
};
$data['open_time'] = !empty($data['open_time']) ? date('Y-m-d',$data['open_time']) : '';
$data['open_admin_name'] = Admin::where('id',$data['open_admin_id'])?->value('name');
$data['flow_info'] = OaFlow::where('id',$data['flow_id'])->findOrEmpty();
$data['record'] = Db::name('oa_flow_record')->field('check_user_id,check_time,status,content')->where('action_id',$params['id'])->where('type',3)->order('id desc')->select()->each(function($data){
$data['check_time'] = date('Y-m-d H:i:s',$data['check_time']);
$user = Admin::where('id',$data['check_user_id'])->value('name');
$data['check_user_name'] = $user ?? '';
$data['status_text'] = match ($data['status']){
0=>'提交',1=>'通过',2=>'拒绝',3=>'撤销'
};
return $data;
})->toArray();
$step = Db::name('oa_flow_step')->field('id,action_id,flow_uids,flow_type,sort')->where('action_id',$params['id'])->where('type',3)->order('sort asc')->select()->toArray();
foreach ($step as $key => &$val) {
$user_id_info = Admin::field('id,name')->where('id','in',$val['flow_uids'])->select()->toArray();
foreach ($user_id_info as $k => &$v) {
$v['check_time'] = 0;
$v['content'] = '';
$v['status'] = 0;
$check_array = Db::name('oa_flow_record')->where(['check_user_id' => $v['id'],'step_id' => $val['id'],'type'=>3])->order('check_time desc')->select()->toArray();
if(!empty($check_array)){
$checked = $check_array[0];
$v['check_time'] = date('Y-m-d H:i', $checked['check_time']);
$v['content'] = $checked['content'];
$v['status'] = $checked['status'];
}
}
$check_list = Db::name('oa_flow_record')
->field('f.*,a.name')
->alias('f')
->join('admin a', 'a.id = f.check_user_id', 'left')
->where(['f.step_id' => $val['id']])->where('f.status','>',0)->select()->toArray();
foreach ($check_list as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d H:i', $vv['check_time']);
}
$val['user_id_info'] = $user_id_info;
$val['check_list'] = $check_list;
}
$data['steps'] = $step;
return $this->data($data);
}
public function copy(){
$params = $this->request->get(['start_time','end_time','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$map = [];
if(!empty($params['start_time']) && !empty($params['end_time'])){
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
return $this->fail('结束时间不等小于开始时间');
}
$map[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
//查询条件
$map = [];
$map[] = ['f.check_status', '=', 2];
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$this->adminId}',f.copy_uids)")];
$lists = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待开具',3=>'审核不通过',4=>'撤销审核',5=>'已开具',10=>'已作废'
};
$item['type_text'] = match ($item['type']){
1=>'企业',2=>'个人'
};
$item['invoice_type_text'] = match ($item['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$item['open_time'] = !empty($item['open_time']) ? date('Y-m-d',$item['open_time']) : '';
$item['open_admin_name'] = Admin::where('id',$item['open_admin_id'])?->value('name');
return $item;
})->toArray();
$count = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function deal_with(){
$params = $this->request->get();
$status = !empty($params['status']) ? $params['status'] : 0;
//查询条件
$map1 = [];
$map2 = [];
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$this->adminId}',f.check_admin_ids)")];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$this->adminId}',f.flow_admin_ids)")];
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$lists = [];
$count = 0;
if($status == 0){
$lists = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->whereOr([$map1,$map2])
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核',5=>'已开具',10=>'已作废'
};
$item['type_text'] = match ($item['type']){
1=>'企业',2=>'个人'
};
$item['invoice_type_text'] = match ($item['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$item['open_time'] = !empty($item['open_time']) ? date('Y-m-d',$item['open_time']) : '';
$item['open_admin_name'] = Admin::where('id',$item['open_admin_id'])?->value('name');
return $item;
})->toArray();
$count = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->whereOr([$map1,$map2])->count();
}
if($status == 1){
$lists = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map1)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item){
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中,待开具',2=>'审核通过',3=>'审核不通过',4=>'撤销审核',5=>'已开具',10=>'已作废'
};
$item['type_text'] = match ($item['type']){
1=>'企业',2=>'个人'
};
$item['invoice_type_text'] = match ($item['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$item['open_time'] = !empty($item['open_time']) ? date('Y-m-d',$item['open_time']) : '';
$item['open_admin_name'] = Admin::where('id',$item['open_admin_id'])?->value('name');
return $item;
})->toArray();
$count = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map1)->count();
}
if($status == 2){
$lists = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map2)
->order('f.id desc')
->group('f.id')
->page($page_no, $page_size)->select()
->each(function($item, $key){
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_admin_users'] = implode(',',$check_user);
}
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
$item['check_status_text'] = match ($item['check_status']){
0=>'待审核',1=>'审核中,待开具',2=>'审核通过',3=>'审核不通过',4=>'撤销审核',5=>'已开具',10=>'已作废'
};
$item['type_text'] = match ($item['type']){
1=>'企业',2=>'个人'
};
$item['invoice_type_text'] = match ($item['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$item['open_time'] = !empty($item['open_time']) ? date('Y-m-d',$item['open_time']) : '';
$item['open_admin_name'] = Admin::where('id',$item['open_admin_id'])?->value('name');
return $item;
})->toArray();
$count = Db::name('oa_invoice')
->field('f.*,a.name as user_name,d.name as dept_name')
->alias('f')
->join('admin a', 'a.id = f.admin_id', 'left')
->join('dept d', 'd.id = a.dept_id', 'left')
->where($map2)->count();
}
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function check(){
$params = $this->request->post(['id','check','content','check_node','check_admin_ids']);
if(empty($params['id'])){
return $this->fail('缺少数据主键');
}
if(empty($params['check']) || !in_array($params['check'],[1,2,3])){
return $this->fail('审核参数错误');
}
$data = Db::name('oa_invoice')->where('id',$params['id'])->find();
if(empty($data)){
return $this->fail('数据信息不存在');
}
//撤销
if($params['check'] == 3){
if($data['admin_id'] != $this->adminId){
return $this->fail('你不是该申请的发起者,无权撤销');
}
//撤销审核,数据操作
$params['check_status'] = 4;
$params['check_admin_ids'] ='';
$params['check_step_sort'] = 0;
$res = Db::name('oa_invoice')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => 0,
'check_user_id' => $this->adminId,
'type' => 3,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}else{
return $this->fail('fail');
}
}
//拒绝
if($params['check'] == 2){
//当前审核节点详情
$step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>$data['check_step_sort'],'type'=>3])->find();
$check_admin_ids = explode(",", strval($data['check_admin_ids']));
if (!in_array($this->adminId, $check_admin_ids)){
return $this->fail('您没权限审核该审批');
}
//拒绝审核,数据操作
$params['check_status'] = 3;
$params['last_admin_id'] = $this->adminId;
$params['flow_admin_ids'] = $data['flow_admin_ids'].$this->adminId.',';
$params['check_admin_ids'] = '';
if($step['flow_type'] == 4){
//获取上一步的审核信息
$prev_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']-1),'type'=>3])->find();
if($prev_step){
//存在上一步审核
$params['check_step_sort'] = $prev_step['sort'];
$params['check_admin_ids'] = $prev_step['flow_uids'];
$params['check_status'] = 1;
}
else{
//不存在上一步审核,审核初始化步骤
$params['check_step_sort'] = 0;
$params['check_admin_ids'] = '';
$params['check_status'] = 0;
}
}
$res = Db::name('oa_invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => $step['id'],
'check_user_id' => $this->adminId,
'type' => 3,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}
else{
return $this->fail('fail');
}
}
//通过
if($params['check'] == 1){
//当前审核节点详情
$step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>$data['check_step_sort'],'type'=>3])->find();
$check_admin_ids = explode(",", strval($data['check_admin_ids']));
if (!in_array($this->adminId, $check_admin_ids)){
return $this->fail('您没权限审核该审批');
}
//多人会签审批
if($step['flow_type'] == 3){
//查询当前会签记录数
$check_count = Db::name('oa_flow_record')->where(['action_id'=>$params['id'],'step_id'=>$step['id'],'type'=>3])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1),'type'=>3])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$data['admin_id'])->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}else{
$params['check_admin_ids'] = $next_step['flow_uids'];
}
$params['check_step_sort'] = $data['check_step_sort']+1;
$params['check_status'] = 1;
}else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}else{
$params['check_status'] = 1;
$params['check_admin_ids'] = $step['flow_uids'];
}
}else if($step['flow_type'] == 0){
//自由人审批
if($params['check_node'] == 2){
$next_step = $data['check_step_sort']+1;
$flow_step = array(
'action_id' => $params['id'],
'sort' => $next_step,
'type' => 3,
'flow_uids' => $params['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('oa_flow_step')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$params['check_step_sort'] = $next_step;
$params['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}else{
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1),'type'=>3])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
//获取部门负责人
$dept = Admin::where('id',$data['admin_id'])->value('dept_id');
if(empty($dept)){
return $this->fail('当前用户未设置部门,请联系管理员');
}
$leader = Dept::where('id',$dept)->value('leader_id');
if(empty($leader)){
return $this->fail('当前部门负责人还未设置,请联系管理员');
}else{
$params['check_admin_ids'] = $leader;
}
}
else{
$params['check_admin_ids'] = $next_step['flow_uids'];
}
$params['check_step_sort'] = $data['check_step_sort']+1;
$params['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$params['check_status'] = 2;
$params['check_admin_ids'] ='';
}
}
if($params['check_status'] == 1 && empty($params['check_admin_ids'])){
return $this->fail('找不到下一步的审批人该审批流程设置有问题请联系HR或者管理员');
}
//审核通过数据操作
$params['last_admin_id'] = $this->adminId;
$params['flow_admin_ids'] = $data['flow_admin_ids'].$this->adminId.',';
$res = Db::name('oa_invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($params);
if($res){
$checkData=array(
'action_id' => $params['id'],
'step_id' => $step['id'],
'check_user_id' => $this->adminId,
'type' => 3,
'check_time' => time(),
'status' => $params['check'],
'content' => $params['content'] ?? '',
'create_time' => time()
);
Db::name('oa_flow_record')->strict(false)->field(true)->insertGetId($checkData);
return $this->success('ok');
}
else{
return $this->fail('fail');
}
}
return $this->fail();
}
public function lists2(){
$params = $this->request->get(['start_time','end_time','status','page_no','page_size']);
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['start_time']) && !empty($params['end_time'])){
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
return $this->fail('结束时间不等小于开始时间');
}
$where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
if(!empty($params['status'])){
$where[] = match ($params['status']){
'1'=> ['check_status','=',2], //审批通过,待开具
'2'=> ['check_status','=',5], //审批通过,已开具
'3'=> [['check_status','=',10]], //已作废
};
}else{
$where[] = ['check_status','in','2,5,10'];
}
$lists = Db::name('oa_invoice')->field('id,type,invoice_title,invoice_subject,amount,invoice_type,check_status,admin_id,create_time,check_admin_ids,open_admin_id,open_time,code,delivery')->where($where)
->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
$dept = Dept::where('id',$admin['dept_id'])->value('name');
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
$data['user_name'] = $admin['name'];
$data['dept_name'] = $dept ?? '';
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
$data['check_status_text'] = match ($data['check_status']){
0=>'待审核',1=>'审核中',2=>'审核通过,待开具',3=>'审核不通过',4=>'撤销审核',5=>'已开具',10=>'已作废'
};
$data['type_text'] = match ($data['type']){
1=>'企业',2=>'个人'
};
$data['invoice_type_text'] = match ($data['invoice_type']){
1=>'增值税专用发票',2=>'普通发票',3=>'专用发票'
};
$data['open_time'] = !empty($data['open_time']) ? date('Y-m-d',$data['open_time']) : '';
$data['open_admin_name'] = Admin::where('id',$data['open_admin_id'])?->value('name');
return $data;
})->toArray();
$count = Db::name('oa_invoice')->where($where)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
public function invoice(){
$params = (new InvoiceValidate())->post()->goCheck('invoice');
$data = Db::name('oa_invoice')->where('id',$params['id'])->find();
if(empty($data)){
return $this->success('申请信息不存在');
}
if($data['check_status'] != 2 && $data['check_status'] != 5 ){
return $this->success('当前申请未审核通过');
}
$update_data = [
'code' => $params['code'],
'open_time' => strtotime($params['open_time']),
'open_admin_id' => $this->adminId,
'delivery' => $params['delivery'] ?? '',
'check_status' => 5,
];
$res = Db::name('oa_invoice')->where('id',$params['id'])->update($update_data);
return $res ? $this->success('ok') : $this->fail('fail');
}
public function voids(){
$params = (new InvoiceValidate())->post()->goCheck('detail');
$data = Db::name('oa_invoice')->where('id',$params['id'])->find();
if(empty($data)){
return $this->fail('申请信息不存在');
}
if($data['check_status'] < 5){
return $this->fail('当前申请未开票');
}
if($data['is_cash'] > 0){
return $this->fail('发票已经新增有到账记录,请先反到账后再作废发票');
}
if($data['check_status']==5){
$res = Db::name('oa_invoice')->where('id',$params['id'])->update(['check_status'=>10]);
}else{
$res = Db::name('oa_invoice')->where('id',$params['id'])->update(['check_status'=>5]);
}
return $res ? $this->success('ok') : $this->fail('fail');
}
}

View File

@ -0,0 +1,115 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rcbg;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rcbg\OaPlanLists;
use app\adminapi\logic\works\rcbg\OaPlanLogic;
use app\adminapi\validate\works\rcbg\OaPlanValidate;
/**
* 日程安排控制器
* Class OaPlanController
* @package app\adminapi\controller\works\rcbg
*/
class OaPlanController extends BaseAdminController
{
/**
* @notes 获取日程安排列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function lists()
{
return $this->dataLists(new OaPlanLists());
}
/**
* @notes 添加日程安排
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function add()
{
$params = (new OaPlanValidate())->post()->goCheck('add');
$result = OaPlanLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaPlanLogic::getError());
}
/**
* @notes 编辑日程安排
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function edit()
{
$params = (new OaPlanValidate())->post()->goCheck('edit');
$result = OaPlanLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaPlanLogic::getError());
}
/**
* @notes 删除日程安排
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function delete()
{
$params = (new OaPlanValidate())->post()->goCheck('delete');
OaPlanLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取日程安排详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function detail()
{
$params = (new OaPlanValidate())->goCheck('detail');
$result = OaPlanLogic::detail($params);
return $this->data($result);
}
public function calendar(){
$params = (new OaPlanValidate())->get()->goCheck('calendar');
$params['admin_id'] = $this->adminId;
$result = OaPlanLogic::calendar($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,115 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rcbg;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rcbg\OaScheduleLists;
use app\adminapi\logic\works\rcbg\OaScheduleLogic;
use app\adminapi\validate\works\rcbg\OaScheduleValidate;
/**
* 工作记录控制器
* Class OaScheduleController
* @package app\adminapi\controller\works\rcbg
*/
class OaScheduleController extends BaseAdminController
{
/**
* @notes 获取工作记录列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function lists()
{
return $this->dataLists(new OaScheduleLists());
}
/**
* @notes 添加工作记录
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function add()
{
$params = (new OaScheduleValidate())->post()->goCheck('add');
$result = OaScheduleLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaScheduleLogic::getError());
}
/**
* @notes 编辑工作记录
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function edit()
{
$params = (new OaScheduleValidate())->post()->goCheck('edit');
$result = OaScheduleLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaScheduleLogic::getError());
}
/**
* @notes 删除工作记录
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function delete()
{
$params = (new OaScheduleValidate())->post()->goCheck('delete');
OaScheduleLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工作记录详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function detail()
{
$params = (new OaScheduleValidate())->goCheck('detail');
$result = OaScheduleLogic::detail($params);
return $this->data($result);
}
public function calendar(){
$params = (new OaScheduleValidate())->get()->goCheck('calendar');
$params['admin_id'] = $this->adminId;
$result = OaScheduleLogic::calendar($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rcbg;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rcbg\OaWorkCommentLists;
use app\adminapi\logic\works\rcbg\OaWorkCommentLogic;
use app\adminapi\validate\works\rcbg\OaWorkCommentValidate;
/**
* 工作汇报点评表控制器
* Class OaWorkCommentController
* @package app\adminapi\controller\works\rcbg
*/
class OaWorkCommentController extends BaseAdminController
{
/**
* @notes 获取工作汇报点评表列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function lists()
{
return $this->dataLists(new OaWorkCommentLists());
}
/**
* @notes 添加工作汇报点评表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function add()
{
$params = (new OaWorkCommentValidate())->post()->goCheck('add');
$result = OaWorkCommentLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaWorkCommentLogic::getError());
}
/**
* @notes 编辑工作汇报点评表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function edit()
{
$params = (new OaWorkCommentValidate())->post()->goCheck('edit');
$result = OaWorkCommentLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaWorkCommentLogic::getError());
}
/**
* @notes 删除工作汇报点评表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function delete()
{
$params = (new OaWorkCommentValidate())->post()->goCheck('delete');
OaWorkCommentLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工作汇报点评表详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function detail()
{
$params = (new OaWorkCommentValidate())->goCheck('detail');
$result = OaWorkCommentLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rcbg;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rcbg\OaWorkLists;
use app\adminapi\logic\works\rcbg\OaWorkLogic;
use app\adminapi\validate\works\rcbg\OaWorkValidate;
/**
* 工作汇报控制器
* Class OaWorkController
* @package app\adminapi\controller\works\rcbg
*/
class OaWorkController extends BaseAdminController
{
/**
* @notes 获取工作汇报列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function lists()
{
return $this->dataLists(new OaWorkLists());
}
/**
* @notes 添加工作汇报
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function add()
{
$params = (new OaWorkValidate())->post()->goCheck('add');
$result = OaWorkLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaWorkLogic::getError());
}
/**
* @notes 编辑工作汇报
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function edit()
{
$params = (new OaWorkValidate())->post()->goCheck('edit');
$result = OaWorkLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaWorkLogic::getError());
}
/**
* @notes 删除工作汇报
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function delete()
{
$params = (new OaWorkValidate())->post()->goCheck('delete');
$result = OaWorkLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(OaWorkLogic::getError());
}
/**
* @notes 获取工作汇报详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function detail()
{
$params = (new OaWorkValidate())->goCheck('detail');
$result = OaWorkLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rcbg;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rcbg\OaWorkRecordLists;
use app\adminapi\logic\works\rcbg\OaWorkRecordLogic;
use app\adminapi\validate\works\rcbg\OaWorkRecordValidate;
/**
* 汇报工作发送记录表控制器
* Class OaWorkRecordController
* @package app\adminapi\controller\works\rcbg
*/
class OaWorkRecordController extends BaseAdminController
{
/**
* @notes 获取汇报工作发送记录表列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function lists()
{
return $this->dataLists(new OaWorkRecordLists());
}
/**
* @notes 添加汇报工作发送记录表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function add()
{
$params = (new OaWorkRecordValidate())->post()->goCheck('add');
$result = OaWorkRecordLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaWorkRecordLogic::getError());
}
/**
* @notes 编辑汇报工作发送记录表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function edit()
{
$params = (new OaWorkRecordValidate())->post()->goCheck('edit');
$result = OaWorkRecordLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaWorkRecordLogic::getError());
}
/**
* @notes 删除汇报工作发送记录表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function delete()
{
$params = (new OaWorkRecordValidate())->post()->goCheck('delete');
OaWorkRecordLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取汇报工作发送记录表详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function detail()
{
$params = (new OaWorkRecordValidate())->goCheck('detail');
$result = OaWorkRecordLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rlzy;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rlzy\OaAdminLists;
use app\adminapi\logic\works\rlzy\OaAdminLogic;
use app\adminapi\validate\works\rlzy\OaAdminValidate;
/**
* 企业员工控制器
* Class OaAdminController
* @package app\adminapi\controller\works\rlzy
*/
class OaAdminController extends BaseAdminController
{
/**
* @notes 获取企业员工列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function lists()
{
return $this->dataLists(new OaAdminLists());
}
/**
* @notes 添加企业员工
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function add()
{
$params = (new OaAdminValidate())->post()->goCheck('add');
$result = OaAdminLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaAdminLogic::getError());
}
/**
* @notes 编辑企业员工
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function edit()
{
$params = (new OaAdminValidate())->post()->goCheck('edit');
$result = OaAdminLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaAdminLogic::getError());
}
/**
* @notes 删除企业员工
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function delete()
{
$params = (new OaAdminValidate())->post()->goCheck('delete');
$result = OaAdminLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(OaAdminLogic::getError());
}
/**
* @notes 获取企业员工详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function detail()
{
$params = (new OaAdminValidate())->goCheck('detail');
$result = OaAdminLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rlzy;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rlzy\OaDepartmentChangeLists;
use app\adminapi\logic\works\rlzy\OaDepartmentChangeLogic;
use app\adminapi\validate\works\rlzy\OaDepartmentChangeValidate;
/**
* 人事调动控制器
* Class OaDepartmentChangeController
* @package app\adminapi\controller\works\rlzy
*/
class OaDepartmentChangeController extends BaseAdminController
{
/**
* @notes 获取人事调动列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function lists()
{
return $this->dataLists(new OaDepartmentChangeLists());
}
/**
* @notes 添加人事调动
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function add()
{
$params = (new OaDepartmentChangeValidate())->post()->goCheck('add');
$result = OaDepartmentChangeLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaDepartmentChangeLogic::getError());
}
/**
* @notes 编辑人事调动
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function edit()
{
$params = (new OaDepartmentChangeValidate())->post()->goCheck('edit');
$result = OaDepartmentChangeLogic::edit($params,$this->adminId);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaDepartmentChangeLogic::getError());
}
/**
* @notes 删除人事调动
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function delete()
{
$params = (new OaDepartmentChangeValidate())->post()->goCheck('delete');
OaDepartmentChangeLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取人事调动详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function detail()
{
$params = (new OaDepartmentChangeValidate())->goCheck('detail');
$result = OaDepartmentChangeLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\rlzy;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\rlzy\OaPersonalQuitLists;
use app\adminapi\logic\works\rlzy\OaPersonalQuitLogic;
use app\adminapi\validate\works\rlzy\OaPersonalQuitValidate;
/**
* 离职档案控制器
* Class OaPersonalQuitController
* @package app\adminapi\controller\works\rlzy
*/
class OaPersonalQuitController extends BaseAdminController
{
/**
* @notes 获取离职档案列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function lists()
{
return $this->dataLists(new OaPersonalQuitLists());
}
/**
* @notes 添加离职档案
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function add()
{
$params = (new OaPersonalQuitValidate())->post()->goCheck('add');
$result = OaPersonalQuitLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaPersonalQuitLogic::getError());
}
/**
* @notes 编辑离职档案
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function edit()
{
$params = (new OaPersonalQuitValidate())->post()->goCheck('edit');
$result = OaPersonalQuitLogic::edit($params,$this->adminId);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaPersonalQuitLogic::getError());
}
/**
* @notes 删除离职档案
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function delete()
{
$params = (new OaPersonalQuitValidate())->post()->goCheck('delete');
OaPersonalQuitLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取离职档案详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function detail()
{
$params = (new OaPersonalQuitValidate())->goCheck('detail');
$result = OaPersonalQuitLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\xzgl;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\xzgl\OaCarCateLists;
use app\adminapi\logic\works\xzgl\OaCarCateLogic;
use app\adminapi\validate\works\xzgl\OaCarCateValidate;
/**
* 车辆管理控制器
* Class OaCarCateController
* @package app\adminapi\controller\works\xzgl
*/
class OaCarCateController extends BaseAdminController
{
/**
* @notes 获取车辆管理列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function lists()
{
return $this->dataLists(new OaCarCateLists());
}
/**
* @notes 添加车辆管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function add()
{
$params = (new OaCarCateValidate())->post()->goCheck('add');
$result = OaCarCateLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaCarCateLogic::getError());
}
/**
* @notes 编辑车辆管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function edit()
{
$params = (new OaCarCateValidate())->post()->goCheck('edit');
$result = OaCarCateLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaCarCateLogic::getError());
}
/**
* @notes 删除车辆管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function delete()
{
$params = (new OaCarCateValidate())->post()->goCheck('delete');
OaCarCateLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取车辆管理详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function detail()
{
$params = (new OaCarCateValidate())->goCheck('detail');
$result = OaCarCateLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\xzgl;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\xzgl\OaMeetingCateLists;
use app\adminapi\logic\works\xzgl\OaMeetingCateLogic;
use app\adminapi\validate\works\xzgl\OaMeetingCateValidate;
/**
* 会议室管理控制器
* Class OaMeetingCateController
* @package app\adminapi\controller\works\xzgl
*/
class OaMeetingCateController extends BaseAdminController
{
/**
* @notes 获取会议室管理列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function lists()
{
return $this->dataLists(new OaMeetingCateLists());
}
/**
* @notes 添加会议室管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function add()
{
$params = (new OaMeetingCateValidate())->post()->goCheck('add');
$result = OaMeetingCateLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaMeetingCateLogic::getError());
}
/**
* @notes 编辑会议室管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function edit()
{
$params = (new OaMeetingCateValidate())->post()->goCheck('edit');
$result = OaMeetingCateLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaMeetingCateLogic::getError());
}
/**
* @notes 删除会议室管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function delete()
{
$params = (new OaMeetingCateValidate())->post()->goCheck('delete');
OaMeetingCateLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取会议室管理详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function detail()
{
$params = (new OaMeetingCateValidate())->goCheck('detail');
$result = OaMeetingCateLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\works\xzgl;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\works\xzgl\OaSealCateLists;
use app\adminapi\logic\works\xzgl\OaSealCateLogic;
use app\adminapi\validate\works\xzgl\OaSealCateValidate;
/**
* OaSealCate控制器
* Class OaSealCateController
* @package app\adminapi\controller\works/xzgl
*/
class OaSealCateController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function lists()
{
return $this->dataLists(new OaSealCateLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function add()
{
$params = (new OaSealCateValidate())->post()->goCheck('add');
$result = OaSealCateLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OaSealCateLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function edit()
{
$params = (new OaSealCateValidate())->post()->goCheck('edit');
$result = OaSealCateLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OaSealCateLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function delete()
{
$params = (new OaSealCateValidate())->post()->goCheck('delete');
OaSealCateLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function detail()
{
$params = (new OaSealCateValidate())->goCheck('detail');
$result = OaSealCateLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\api\http\middleware;
use app\common\exception\ControllerExtendException;
use app\api\controller\BaseApiController;
use think\exception\ClassNotFoundException;
use app\common\exception\HttpException;
use Webman\Http\Request;
use Webman\Http\Response;
use Webman\MiddlewareInterface;
class InitMiddleware implements MiddlewareInterface
{
public function process(Request $request, callable $handler): Response
{
//获取控制器
try {
$controller = str_replace('.', '\\', $request->controller);
$controllerClass = new $controller;
if (($controllerClass instanceof BaseApiController) === false) {
throw new ControllerExtendException($controller, '404');
}
} catch (ClassNotFoundException $e) {
throw new HttpException(404, 'controller not exists:' . $e->getClass());
}
//创建控制器对象
$request->controllerObject = new $controller;
return $handler($request);
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace app\api\http\middleware;
use app\common\cache\UserTokenCache;
use app\common\service\JsonService;
use app\api\service\UserTokenService;
use Webman\Config;
use Webman\Http\Request;
use Webman\Http\Response;
use Webman\MiddlewareInterface;
class LoginMiddleware implements MiddlewareInterface
{
/**
* @notes 登录验证
* @param $request
* @param \Closure $next
* @return mixed|\think\response\Json
* @author 令狐冲
* @date 2021/7/1 17:33
*/
public function process(Request $request, callable $handler): Response
{
$token = $request->header('token');
//判断接口是否免登录
$isNotNeedLogin = $request->controllerObject->isNotNeedLogin();
//不直接判断$isNotNeedLogin结果使不需要登录的接口通过为了兼容某些接口可以登录或不登录访问
if (empty($token) && !$isNotNeedLogin) {
//没有token并且该地址需要登录才能访问, 指定show为0前端不弹出此报错
return JsonService::fail('请求参数缺token', [], 0, 1);
}
$userInfo = (new UserTokenCache())->getUserInfo($token);
if (empty($userInfo) && !$isNotNeedLogin) {
//token过期无效并且该地址需要登录才能访问
return JsonService::fail('登录超时,请重新登录', [], -1, 0);
}
//token临近过期自动续期
if ($userInfo) {
//获取临近过期自动续期时长
$beExpireDuration = Config::get('project.user_token.be_expire_duration');
//token续期
if (time() > ($userInfo['expire_time'] - $beExpireDuration)) {
$result = UserTokenService::overtimeToken($token);
//续期失败(数据表被删除导致)
if (empty($result)) {
return JsonService::fail('登录过期', [], -1);
}
}
}
//给request赋值用于控制器
$request->userInfo = $userInfo;
$request->userId = $userInfo['user_id'] ?? 0;
return $handler($request);
}
}

View File

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\lists;
use app\common\lists\BaseDataLists;
/**
* 管理员模块数据列表基类
* Class BaseAdminDataLists
* @package app\admin\lists
*/
abstract class BaseAdminDataLists extends BaseDataLists
{
protected $adminInfo;
protected $adminId;
public function __construct()
{
parent::__construct();
$this->adminInfo = $this->request->adminInfo;
$this->adminId = $this->request->adminId;
}
}

View File

@ -0,0 +1,83 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\works\OaMessage;
use app\common\lists\ListsSearchInterface;
/**
* 系统消息列表
* Class OaMessageLists
* @package app\adminapi\listsworks
*/
class OaMessageLists extends BaseAdminDataLists implements ListsSearchInterface
{
private $where = [];
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function setSearch(): array
{
return [
'%like%' => ['title'],
];
}
/**
* @notes 获取系统消息列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function lists(): array
{
$params = $this->request->get(['start_time','end_time']);
if(!empty($params['start_time']) && !empty($params['end_time'])){
$this->where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
}
return OaMessage::where($this->searchWhere)->where($this->where)->where('to_uid',$this->adminId)
->field(['id', 'title', 'content', 'read_time', 'create_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['is_read'] = empty($data['read_time']) ? '未读' : '已读';
})
->toArray();
}
/**
* @notes 获取系统消息数量
* @return int
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function count(): int
{
return OaMessage::where($this->searchWhere)->where($this->where)->where('to_uid',$this->adminId)->count();
}
}

View File

@ -0,0 +1,97 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\lists\works\bgsp;
use app\oa\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
use app\common\model\dept\Dept;
use app\common\model\works\bgsp\OaFlow;
use app\common\lists\ListsSearchInterface;
use app\common\model\works\bgsp\OaFlowType;
/**
* 审批流程列表
* Class OaFlowLists
* @package app\adminapi\listsworks\bgsp
*/
class OaFlowLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function setSearch(): array
{
return [
'=' => ['check_type', 'type','flow_cate'],
'%like%' => ['name'],
];
}
/**
* @notes 获取审批流程列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function lists(): array
{
return OaFlow::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['type_text'] = $data->type_text;
$data['check_type_text'] = $data->check_type_text;
$flow_cate = OaFlowType::where('id',$data['flow_cate'])->findOrEmpty();
$data['flow_cate_name'] = $flow_cate['title'];
if(!empty($data['department_ids'])){
$dept = Dept::where('id','in',$data['department_ids'])->column('name');
$data['department_names'] = implode(',',$dept);
}else{
$data['department_names'] = '全公司';
}
if(!empty($data['copy_uids'])){
$copy_user = Admin::where('id','in',$data['copy_uids'])->column('name');
$data['copy_user_names'] = implode(',',$copy_user);
}else{
$data['copy_user_names'] = '';
}
})
->toArray();
}
/**
* @notes 获取审批流程数量
* @return int
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function count(): int
{
return OaFlow::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,86 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\bgsp;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\dept\Dept;
use app\common\model\works\bgsp\OaFlowType;
use app\common\lists\ListsSearchInterface;
/**
* 审批类型列表
* Class OaFlowTypeLists
* @package app\adminapi\listsworks\bgsp
*/
class OaFlowTypeLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function setSearch(): array
{
return [
'=' => ['type'],
'%like%' => ['title', 'name'],
];
}
/**
* @notes 获取审批类型列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function lists(): array
{
return OaFlowType::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
if(!empty($data['department_ids'])){
$dept = Dept::where('id','in',$data['department_ids'])->column('name');
$data['department_names'] = implode(',',$dept);
}else{
$data['department_names'] = '全公司';
}
$data['type_text'] = $data->type_text;
})
->toArray();
}
/**
* @notes 获取审批类型数量
* @return int
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function count(): int
{
return OaFlowType::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rcbg;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\works\rcbg\OaPlan;
use app\common\lists\ListsSearchInterface;
/**
* 日程安排列表
* Class OaPlanLists
* @package app\adminapi\listsworks\rcbg
*/
class OaPlanLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function setSearch(): array
{
return [
'=' => ['title', 'type'],
];
}
/**
* @notes 获取日程安排列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function lists(): array
{
return OaPlan::where($this->searchWhere)->where('admin_id',$this->adminId)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['type_text'] = $data->type_text;
$data['remind_type_text'] = $data->remind_type_text;
})
->toArray();
}
/**
* @notes 获取日程安排数量
* @return int
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function count(): int
{
return OaPlan::where($this->searchWhere)->where('admin_id',$this->adminId)->count();
}
}

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rcbg;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\works\rcbg\OaSchedule;
use app\common\lists\ListsSearchInterface;
/**
* 工作记录列表
* Class OaScheduleLists
* @package app\adminapi\listsworks\rcbg
*/
class OaScheduleLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function setSearch(): array
{
return [
'=' => ['labor_type','cid'],
'%like%' => ['title'],
];
}
/**
* @notes 获取工作记录列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function lists(): array
{
return OaSchedule::where($this->searchWhere)->where('admin_id',$this->adminId)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['cid_text'] = $data->cid_text;
$data['labor_type_text'] = $data->labor_type_text;
})
->toArray();
}
/**
* @notes 获取工作记录数量
* @return int
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function count(): int
{
return OaSchedule::where($this->searchWhere)->where('admin_id',$this->adminId)->count();
}
}

View File

@ -0,0 +1,82 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rcbg;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
use app\common\model\works\rcbg\OaWorkComment;
use app\common\lists\ListsSearchInterface;
/**
* 工作汇报点评表列表
* Class OaWorkCommentLists
* @package app\adminapi\listsworks\rcbg
*/
class OaWorkCommentLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function setSearch(): array
{
return [
'=' => ['work_id']
];
}
/**
* @notes 获取工作汇报点评表列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function lists(): array
{
return OaWorkComment::where($this->searchWhere)
->field(['id', 'work_id', 'admin_id', 'content','create_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$user = Admin::field('name,avatar')->where('id',$data['admin_id'])->findOrEmpty();
$data['admin_name'] = $user['name'];
$data['admin_avatar'] = $user['avatar'];
})
->toArray();
}
/**
* @notes 获取工作汇报点评表数量
* @return int
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function count(): int
{
return OaWorkComment::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,81 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rcbg;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
use app\common\model\works\rcbg\OaWork;
use app\common\lists\ListsSearchInterface;
/**
* 工作汇报列表
* Class OaWorkLists
* @package app\adminapi\listsworks\rcbg
*/
class OaWorkLists extends BaseAdminDataLists implements ListsSearchInterface
{
private $where = [];
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function setSearch(): array
{
return [
'=' => ['type'],
];
}
/**
* @notes 获取工作汇报列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function lists(): array
{
return OaWork::where($this->searchWhere)->where('admin_id',$this->adminId)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$type_user = Admin::where('id','in',$data['type_user'])->column('name');
$data['type_user_names'] = implode(',',$type_user);
$data['type_text'] = $data->type_text;
})
->toArray();
}
/**
* @notes 获取工作汇报数量
* @return int
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function count(): int
{
return OaWork::where($this->searchWhere)->where('admin_id',$this->adminId)->count();
}
}

View File

@ -0,0 +1,85 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rcbg;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
use app\common\model\works\rcbg\OaWork;
use app\common\model\works\rcbg\OaWorkRecord;
use app\common\lists\ListsSearchInterface;
/**
* 汇报工作发送记录表列表
* Class OaWorkRecordLists
* @package app\adminapi\listsworks\rcbg
*/
class OaWorkRecordLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function setSearch(): array
{
return [
];
}
/**
* @notes 获取汇报工作发送记录表列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function lists(): array
{
return OaWorkRecord::where($this->searchWhere)->where('to_uid',$this->adminId)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$work = OaWork::field('type,works')->where('id',$data['wid'])->findOrEmpty();
$data['type_text'] = $work->type_text;
$data['works'] = $work['works'];
$from_user = Admin::field('name')->where('id',$data['from_uid'])->findOrEmpty();
$data['from_user_name'] = $from_user['name'] ?? '';
$data['is_read'] = !empty($data['read_time']) ? '已读' : '未读';
})
->toArray();
}
/**
* @notes 获取汇报工作发送记录表数量
* @return int
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function count(): int
{
return OaWorkRecord::where($this->searchWhere)->where('to_uid',$this->adminId)->count();
}
}

View File

@ -0,0 +1,90 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rlzy;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\dept\Dept;
use app\common\model\dept\Jobs;
use app\common\model\dept\Orgs;
use app\common\model\works\rlzy\OaAdmin;
use app\common\lists\ListsSearchInterface;
/**
* 企业员工列表
* Class OaAdminLists
* @package app\adminapi\listsworks\rlzy
*/
class OaAdminLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function setSearch(): array
{
return [
'=' => ['sex', 'org_id', 'dept_id', 'job_id', 'type', 'status'],
'%like%' => ['name', 'mobile'],
];
}
/**
* @notes 获取企业员工列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function lists(): array
{
return OaAdmin::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['sex_text'] = $data->sex_text;
$data['type_text'] = $data->type_text;
$data['status_text'] = $data->status_text;
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
$job = Jobs::field('name')->where('id',$data['job_id'])->findOrEmpty();
$data['org_name'] = !$org->isEmpty() ? $org['name'] : '';
$data['dept_name'] = !$dept->isEmpty() ? $dept['name'] : '';
$data['job_name'] = !$job->isEmpty() ? $job['name'] : '';
})
->toArray();
}
/**
* @notes 获取企业员工数量
* @return int
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function count(): int
{
return OaAdmin::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,82 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rlzy;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\works\rlzy\OaDepartmentChange;
use app\common\lists\ListsSearchInterface;
/**
* 人事调动列表
* Class OaDepartmentChangeLists
* @package app\adminapi\listsworks\rlzy
*/
class OaDepartmentChangeLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function setSearch(): array
{
return [
'=' => ['uid', 'from_did', 'to_did', 'status', 'move_time'],
];
}
/**
* @notes 获取人事调动列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function lists(): array
{
return OaDepartmentChange::where($this->searchWhere)
->field(['id', 'uid', 'from_did', 'to_did', 'remark', 'admin_id', 'status', 'move_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['user_name'] = $data->user_name;
$data['from_dept'] = $data->from_dept;
$data['to_dept'] = $data->to_dept;
$data['status_text'] = $data->status_text;
})
->toArray();
}
/**
* @notes 获取人事调动数量
* @return int
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function count(): int
{
return OaDepartmentChange::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,85 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\rlzy;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
use app\common\model\works\rlzy\OaPersonalQuit;
use app\common\lists\ListsSearchInterface;
/**
* 离职档案列表
* Class OaPersonalQuitLists
* @package app\adminapi\listsworks\rlzy
*/
class OaPersonalQuitLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function setSearch(): array
{
return [
'=' => ['uid', 'lead_admin_id', 'connect_id', 'quit_time'],
];
}
/**
* @notes 获取离职档案列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function lists(): array
{
return OaPersonalQuit::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$user = Admin::where('id',$data['uid'])->findOrEmpty();
$other_user = Admin::where('id','in',[$data['lead_admin_id'],$data['connect_id']])->column('name','id');
$connect_users = Admin::where('id','in',$data['connect_uids'])->column('name');
$data['user_name'] = $user['name'];
$data['lead_admin_name'] = $other_user[$data['lead_admin_id']] ?? '';
$data['connect_user_name'] = $other_user[$data['connect_id']] ?? '';
$data['connect_users'] = implode(',',$connect_users);
})
->toArray();
}
/**
* @notes 获取离职档案数量
* @return int
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function count(): int
{
return OaPersonalQuit::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\xzgl;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\works\xzgl\OaCarCate;
use app\common\lists\ListsSearchInterface;
/**
* 车辆管理列表
* Class OaCarCateLists
* @package app\adminapi\listsworks\xzgl
*/
class OaCarCateLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function setSearch(): array
{
return [
'=' => ['status'],
'%like%' => ['title', 'name'],
];
}
/**
* @notes 获取车辆管理列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function lists(): array
{
return OaCarCate::where($this->searchWhere)
->field(['id', 'title', 'name', 'status'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['status_text'] = $data->status_text;
})
->toArray();
}
/**
* @notes 获取车辆管理数量
* @return int
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function count(): int
{
return OaCarCate::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\xzgl;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\works\xzgl\OaMeetingCate;
use app\common\lists\ListsSearchInterface;
/**
* 会议室管理列表
* Class OaMeetingCateLists
* @package app\adminapi\listsworks\xzgl
*/
class OaMeetingCateLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function setSearch(): array
{
return [
'=' => ['status'],
'%like%' => ['title'],
];
}
/**
* @notes 获取会议室管理列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function lists(): array
{
return OaMeetingCate::where($this->searchWhere)
->field(['id', 'title', 'status'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['status_text'] = $data->status_text;
})
->toArray();
}
/**
* @notes 获取会议室管理数量
* @return int
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function count(): int
{
return OaMeetingCate::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\works\xzgl;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\works\xzgl\OaSealCate;
use app\common\lists\ListsSearchInterface;
/**
* OaSealCate列表
* Class OaSealCateLists
* @package app\adminapi\listsworks/xzgl
*/
class OaSealCateLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function setSearch(): array
{
return [
'=' => ['status'],
'%like%' => ['title'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function lists(): array
{
return OaSealCate::where($this->searchWhere)
->field(['id', 'title', 'status'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['status_text'] = $data->status_text;
})
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function count(): int
{
return OaSealCate::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,121 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works;
use app\common\model\auth\Admin;
use app\common\model\works\OaMessage;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 系统消息逻辑
* Class OaMessageLogic
* @package app\adminapi\logic\works
*/
class OaMessageLogic extends BaseLogic
{
/**
* @notes 添加系统消息
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/29 14:04
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
OaMessage::create([
'title' => $params['title'],
'content' => $params['content'],
'from_uid' => $params['from_uid'],
'to_uid' => $params['to_uid'],
'read_time' => $params['read_time'],
'create_time' => $params['create_time']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑系统消息
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/29 14:04
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaMessage::where('id', $params['id'])->update([
'title' => $params['title'],
'content' => $params['content'],
'from_uid' => $params['from_uid'],
'to_uid' => $params['to_uid'],
'read_time' => $params['read_time'],
'create_time' => $params['create_time']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除系统消息
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/29 14:04
*/
public static function delete(array $params): bool
{
return OaMessage::destroy($params['id']);
}
/**
* @notes 获取系统消息详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/29 14:04
*/
public static function detail($params): array
{
$data = OaMessage::findOrEmpty($params['id']);
$data['to_user_name'] = Admin::where('id',$data['to_uid'])->value('name');
OaMessage::where('id',$params['id'])->update(['read_time'=>time()]);
return $data->toArray();
}
}

View File

@ -0,0 +1,186 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\bgsp;
use app\common\model\auth\Admin;
use app\common\model\dept\Dept;
use app\common\model\works\bgsp\OaFlow;
use app\common\logic\BaseLogic;
use app\common\model\works\bgsp\OaFlowType;
use think\facade\Db;
/**
* 审批流程逻辑
* Class OaFlowLogic
* @package app\adminapi\logic\works\bgsp
*/
class OaFlowLogic extends BaseLogic
{
/**
* @notes 添加审批流程
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/24 14:16
*/
public static function add(array $params): bool
{
if($params['check_type'] == 3){
$flow_list = $params['flow_list'];
foreach($flow_list as &$v){
$v['flow_type'] = 4;
}
$params['flow_list'] = $flow_list;
}
if($params['check_type'] == 2){
$params['flow_list'] = '';
}
if($params['check_type'] == 1){
$flow_list = $params['flow_list'];
foreach($flow_list as &$v){
unset($v['flow_name']);
}
$params['flow_list'] = $flow_list;
}
Db::startTrans();
try {
OaFlow::create([
'name' => $params['name'],
'check_type' => $params['check_type'],
'type' => $params['type'],
'flow_cate' => $params['flow_cate'],
'department_ids' => $params['department_ids'] ?? '',
'copy_uids' => $params['copy_uids'] ?? '',
'remark' => $params['remark'] ?? '',
'flow_list' => !empty($params['flow_list']) ? serialize($params['flow_list']) : ''
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑审批流程
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/24 14:16
*/
public static function edit(array $params): bool
{
if($params['check_type'] == 3){
$flow_list = $params['flow_list'];
foreach($flow_list as &$v){
$v['flow_type'] = 4;
}
$params['flow_list'] = $flow_list;
}
if($params['check_type'] == 2){
$params['flow_list'] = '';
}
if($params['check_type'] == 1){
$flow_list = $params['flow_list'];
foreach($flow_list as &$v){
unset($v['flow_name']);
}
$params['flow_list'] = $flow_list;
}
Db::startTrans();
try {
OaFlow::where('id', $params['id'])->update([
'name' => $params['name'],
'check_type' => $params['check_type'],
'type' => $params['type'],
'flow_cate' => $params['flow_cate'],
'department_ids' => $params['department_ids'] ?? '',
'copy_uids' => $params['copy_uids'] ?? '',
'remark' => $params['remark'] ?? '',
'flow_list' => !empty($params['flow_list']) ? serialize($params['flow_list']) : ''
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除审批流程
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/24 14:16
*/
public static function delete(array $params): bool
{
return OaFlow::destroy($params['id']);
}
/**
* @notes 获取审批流程详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/24 14:16
*/
public static function detail($params): array
{
$data = OaFlow::findOrEmpty($params['id']);
$data['type_text'] = $data->type_text;
$data['check_type_text'] = $data->check_type_text;
$flow_cate = OaFlowType::where('id',$data['flow_cate'])->findOrEmpty();
$data['flow_cate_name'] = $flow_cate['title'];
if(!empty($data['department_ids'])){
$dept = Dept::where('id','in',$data['department_ids'])->column('name');
$data['department_names'] = implode(',',$dept);
}else{
$data['department_names'] = '全公司';
}
if(!empty($data['copy_uids'])){
$copy_user = Admin::where('id','in',$data['copy_uids'])->column('name');
$data['copy_user_names'] = implode(',',$copy_user);
}else{
$data['copy_user_names'] = '';
}
$flow_list = unserialize($data['flow_list']);
if(!empty($flow_list)){
foreach ($flow_list as &$v){
if(!empty($v['flow_uids'])){
$flow_users = Admin::where('id','in',$v['flow_uids'])->column('name');
$v['flow_user_names'] = implode(',',$flow_users);
}else{
$v['flow_user_names'] = '';
}
}
}
$data['flow_list'] = $flow_list ?? '';
return $data->toArray();
}
}

View File

@ -0,0 +1,149 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\bgsp;
use app\common\model\dept\Dept;
use app\common\model\dict\DictData;
use app\common\model\works\bgsp\OaFlow;
use app\common\model\works\bgsp\OaFlowType;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 审批类型逻辑
* Class OaFlowTypeLogic
* @package app\adminapi\logic\works\bgsp
*/
class OaFlowTypeLogic extends BaseLogic
{
/**
* @notes 添加审批类型
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/24 13:34
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
OaFlowType::create([
'type' => $params['type'],
'title' => $params['title'],
'name' => $params['name'],
'icon' => $params['icon'] ?? '',
'department_ids' => $params['department_ids'] ?? '',
'data' => !empty($params['data']) ? json_encode($params['data']) : null,
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑审批类型
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/24 13:34
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaFlowType::where('id', $params['id'])->update([
'type' => $params['type'],
'title' => $params['title'],
'name' => $params['name'],
'icon' => $params['icon'] ?? '',
'department_ids' => $params['department_ids'] ?? '',
'data' => !empty($params['data']) ? json_encode($params['data']) : null,
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除审批类型
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/24 13:34
*/
public static function delete(array $params): bool
{
Db::startTrans();
try {
OaFlowType::destroy($params['id']);
OaFlow::destroy(function($query)use($params){
$query->where('flow_cate','=',$params['id']);
});
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 获取审批类型详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/24 13:34
*/
public static function detail($params): array
{
$data = OaFlowType::findOrEmpty($params['id']);
if(!empty($data['department_ids'])){
$dept = Dept::where('id','in',$data['department_ids'])->column('name');
$data['department_names'] = implode(',',$dept);
}else{
$data['department_names'] = '全公司';
}
$data['type_text'] = $data->type_text;
$data['data'] = !empty($data['data']) ? json_decode($data['data'],true) : [];
return $data->toArray();
}
public static function all(): array
{
$data = DictData::field('name,value')->where('type_value', 'oa_approve_cate')->select()->each(function($data){
$data['children'] = OaFlowType::field('id,title,icon')->where('type',$data['value'])->select()->toArray();
})->toArray();
return $data;
}
}

View File

@ -0,0 +1,185 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rcbg;
use app\common\model\works\rcbg\OaPlan;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 日程安排逻辑
* Class OaPlanLogic
* @package app\adminapi\logic\works\rcbg
*/
class OaPlanLogic extends BaseLogic
{
/**
* @notes 添加日程安排
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 11:53
*/
public static function add(array $params,$admin_id): bool
{
$start_time = strtotime($params['start_time']);
$end_time = strtotime($params['end_time']);
$remind_time = 0;
if (isset($params['remind_type'])) {
if($params['remind_type']==1){
$remind_time = $start_time-5*60;
}
if($params['remind_type']==2){
$remind_time = $start_time-15*60;
}
if($params['remind_type']==3){
$remind_time = $start_time-30*60;
}
if($params['remind_type']==4){
$remind_time = $start_time-60*60;
}
if($params['remind_type']==5){
$remind_time = $start_time-120*60;
}
if($params['remind_type']==6){
$remind_time = $start_time-1440*60;
}
}
Db::startTrans();
try {
OaPlan::create([
'title' => $params['title'],
'type' => $params['type'],
'start_time' => $start_time,
'end_time' => $end_time,
'remind_type' => $params['remind_type'],
'remind_time' => $remind_time,
'remark' => $params['remark'] ?? '',
'admin_id' => $admin_id
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑日程安排
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 11:53
*/
public static function edit(array $params): bool
{
$start_time = strtotime($params['start_time']);
$end_time = strtotime($params['end_time']);
$remind_time = 0;
if (isset($params['remind_type'])) {
if($params['remind_type']==1){
$remind_time = $start_time-5*60;
}
if($params['remind_type']==2){
$remind_time = $start_time-15*60;
}
if($params['remind_type']==3){
$remind_time = $start_time-30*60;
}
if($params['remind_type']==4){
$remind_time = $start_time-60*60;
}
if($params['remind_type']==5){
$remind_time = $start_time-120*60;
}
if($params['remind_type']==6){
$remind_time = $start_time-1440*60;
}
}
Db::startTrans();
try {
OaPlan::where('id', $params['id'])->update([
'title' => $params['title'],
'type' => $params['type'],
'start_time' => $start_time,
'end_time' => $end_time,
'remind_type' => $params['remind_type'],
'remind_time' => $remind_time,
'remark' => $params['remark'] ?? ''
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除日程安排
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 11:53
*/
public static function delete(array $params): bool
{
return OaPlan::destroy($params['id']);
}
/**
* @notes 获取日程安排详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 11:53
*/
public static function detail($params): array
{
$data = OaPlan::findOrEmpty($params['id']);
$data['type_text'] = $data->type_text;
$data['remind_type_text'] = $data->remind_type_text;
return $data->toArray();
}
/**
* @notes 获取日程安排日历
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 11:53
*/
public static function calendar($params){
$where[] = [
['admin_id','=',$params['admin_id']],
['start_time','>=',strtotime($params['start_time'])],
['end_time','<=',strtotime($params['end_time'])]
];
$data = OaPlan::where($where)->select()->toArray();
return $data;
}
}

View File

@ -0,0 +1,139 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rcbg;
use app\common\model\works\rcbg\OaSchedule;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 工作记录逻辑
* Class OaScheduleLogic
* @package app\adminapi\logic\works\rcbg
*/
class OaScheduleLogic extends BaseLogic
{
/**
* @notes 添加工作记录
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 14:27
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
OaSchedule::create([
'title' => $params['title'],
'start_time' => strtotime($params['start_time']),
'end_time' => strtotime($params['end_time']),
'labor_time' => (strtotime($params['end_time']) - strtotime($params['start_time'])) / 3600,
'labor_type' => $params['labor_type'],
'cid' => $params['cid'],
'remark' => $params['remark'] ?? '',
'admin_id' => $admin_id
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑工作记录
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 14:27
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaSchedule::where('id', $params['id'])->update([
'title' => $params['title'],
'start_time' => strtotime($params['start_time']),
'end_time' => strtotime($params['end_time']),
'labor_time' => (strtotime($params['end_time']) - strtotime($params['start_time'])) / 3600,
'labor_type' => $params['labor_type'],
'cid' => $params['cid'],
'remark' => $params['remark'] ?? ''
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除工作记录
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 14:27
*/
public static function delete(array $params): bool
{
return OaSchedule::destroy($params['id']);
}
/**
* @notes 获取工作记录详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 14:27
*/
public static function detail($params): array
{
$data = OaSchedule::findOrEmpty($params['id']);
$data['cid_text'] = $data->cid_text;
$data['labor_type_text'] = $data->labor_type_text;
return $data->toArray();
}
/**
* @notes 获取工作记录日历
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 11:53
*/
public static function calendar($params){
$where[] = [
['admin_id','=',$params['admin_id']],
['start_time','>=',strtotime($params['start_time'])],
['end_time','<=',strtotime($params['end_time'])]
];
$data = OaSchedule::where($where)->select()->toArray();
return $data;
}
}

View File

@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rcbg;
use app\common\model\works\rcbg\OaWorkComment;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 工作汇报点评表逻辑
* Class OaWorkCommentLogic
* @package app\adminapi\logic\works\rcbg
*/
class OaWorkCommentLogic extends BaseLogic
{
/**
* @notes 添加工作汇报点评表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 17:39
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
OaWorkComment::create([
'work_id' => $params['work_id'],
'admin_id' => $admin_id,
'content' => $params['content']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑工作汇报点评表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 17:39
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaWorkComment::where('id', $params['id'])->update([
'work_id' => $params['work_id'],
'content' => $params['content']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除工作汇报点评表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 17:39
*/
public static function delete(array $params): bool
{
return OaWorkComment::destroy($params['id']);
}
/**
* @notes 获取工作汇报点评表详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 17:39
*/
public static function detail($params): array
{
return OaWorkComment::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,150 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rcbg;
use app\common\model\auth\Admin;
use app\common\model\works\rcbg\OaWork;
use app\common\logic\BaseLogic;
use app\common\model\works\rcbg\OaWorkComment;
use app\common\model\works\rcbg\OaWorkRecord;
use think\facade\Db;
/**
* 工作汇报逻辑
* Class OaWorkLogic
* @package app\adminapi\logic\works\rcbg
*/
class OaWorkLogic extends BaseLogic
{
/**
* @notes 添加工作汇报
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 15:56
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
$res = OaWork::create([
'type' => $params['type'],
'type_user' => $params['type_user'],
'works' => $params['works'],
'plans' => $params['plans'] ?? '',
'remark' => $params['remark'] ?? '',
'admin_id' => $admin_id,
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]);
$data = [];
$to_users = explode(',',$params['type_user']);
foreach ($to_users as $v){
$data[] = [
'wid' => $res['id'],
'from_uid' => $admin_id,
'to_uid' => $v,
'send_time' => time(),
'read_time' => 0
];
}
(new OaWorkRecord()) -> saveAll($data);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑工作汇报
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 15:56
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaWork::where('id', $params['id'])->update([
'type' => $params['type'],
'works' => $params['works'],
'plans' => $params['plans'] ?? '',
'remark' => $params['remark'] ?? '',
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除工作汇报
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 15:56
*/
public static function delete(array $params): bool
{
Db::startTrans();
try {
OaWork::destroy($params['id']);
OaWorkRecord::destroy(function($query)use($params){
$query->where('wid','=',$params['id']);
});
OaWorkComment::destroy(function($query)use($params){
$query->where('work_id','=',$params['id']);
});
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 获取工作汇报详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 15:56
*/
public static function detail($params): array
{
$data = OaWork::findOrEmpty($params['id']);
$type_user = Admin::where('id','in',$data['type_user'])->column('name');
$data['type_user_names'] = implode(',',$type_user);
$data['type_text'] = $data->type_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,125 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rcbg;
use app\common\model\auth\Admin;
use app\common\model\works\rcbg\OaWork;
use app\common\model\works\rcbg\OaWorkRecord;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 汇报工作发送记录表逻辑
* Class OaWorkRecordLogic
* @package app\adminapi\logic\works\rcbg
*/
class OaWorkRecordLogic extends BaseLogic
{
/**
* @notes 添加汇报工作发送记录表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 16:48
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
OaWorkRecord::create([
'wid' => $params['wid'],
'from_uid' => $params['from_uid'],
'to_uid' => $params['to_uid'],
'send_time' => $params['send_time'],
'read_time' => $params['read_time']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑汇报工作发送记录表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 16:48
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaWorkRecord::where('id', $params['id'])->update([
'wid' => $params['wid'],
'from_uid' => $params['from_uid'],
'to_uid' => $params['to_uid'],
'send_time' => $params['send_time'],
'read_time' => $params['read_time']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除汇报工作发送记录表
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 16:48
*/
public static function delete(array $params): bool
{
return OaWorkRecord::destroy($params['id']);
}
/**
* @notes 获取汇报工作发送记录表详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 16:48
*/
public static function detail($params): array
{
$data = OaWorkRecord::findOrEmpty($params['id']);
$work = OaWork::field('type,type_user,works,plans,remark,annex')->where('id',$data['wid'])->findOrEmpty();
$type_user = Admin::where('id','in',$work['type_user'])->column('name');
$work['type_user_names'] = implode(',',$type_user);
$work['type_text'] = $work->type_text;
$data['work_info'] = $work->toArray();
$from_user = Admin::field('name')->where('id',$data['from_uid'])->findOrEmpty();
$data['from_user_name'] = $from_user['name'] ?? '';
if(!empty($data['read_time'])){
OaWorkRecord::where('id',$params)->update(['read_time'=>time()]);
}
return $data->toArray();
}
}

View File

@ -0,0 +1,247 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rlzy;
use app\common\cache\AdminAuthCache;
use app\common\cache\AdminTokenCache;
use app\common\model\auth\Admin;
use app\common\model\auth\AdminRole;
use app\common\model\auth\AdminSession;
use app\common\model\dept\Dept;
use app\common\model\dept\Jobs;
use app\common\model\dept\Orgs;
use app\common\model\works\rlzy\OaAdmin;
use app\common\logic\BaseLogic;
use think\facade\Config;
use think\facade\Db;
/**
* 企业员工逻辑
* Class OaAdminLogic
* @package app\adminapi\logic\works\rlzy
*/
class OaAdminLogic extends BaseLogic
{
/**
* @notes 添加企业员工
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 15:49
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
$admin = Admin::create([
'name' => $params['name'],
'account' => $params['mobile'],
'avatar' => $params['thumb'] ?? config('project.default_image.admin_avatar'),
'password' => create_password($params['password'], Config::get('project.unique_identification')),
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'job_id' => $params['job_id'],
'disable' => $params['status'] == 2 ? 1 : 0,
]);
self::insertRole($admin['id'], $params['role_id'] ?? []);
OaAdmin::create([
'name' => $params['name'],
'email' => $params['email'] ?? '',
'mobile' => $params['mobile'] ?? '',
'sex' => $params['sex'] ?? 0,
'thumb' => $params['thumb'] ?? config('project.default_image.admin_avatar'),
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'job_id' => $params['job_id'],
'type' => $params['type'],
'age' => $params['age'] ?? 0,
'native_place' => $params['native_place'] ?? '',
'idcard' => $params['idcard'] ?? '',
'education' => $params['education'] ?? '',
'bank_account' => $params['bank_account'] ?? '',
'bank_info' => $params['bank_info'] ?? '',
'desc' => $params['desc'] ?? null,
'entry_time' => !empty($params['entry_time']) ? strtotime($params['entry_time']) : 0,
'status' => $params['status'],
'admin_id' => $admin['id']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑企业员工
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 15:49
*/
public static function edit(array $params): bool
{
$data = OaAdmin::where('id', $params['id'])->findOrEmpty();
Db::startTrans();
try {
OaAdmin::where('id', $params['id'])->update([
'name' => $params['name'],
'email' => $params['email'] ?? '',
'mobile' => $params['mobile'] ?? '',
'sex' => $params['sex'] ?? 0,
'thumb' => $params['thumb'] ?? config('project.default_image.admin_avatar'),
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'job_id' => $params['job_id'],
'type' => $params['type'],
'age' => $params['age'] ?? 0,
'native_place' => $params['native_place'] ?? '',
'idcard' => $params['idcard'] ?? '',
'education' => $params['education'] ?? '',
'bank_account' => $params['bank_account'] ?? '',
'bank_info' => $params['bank_info'] ?? '',
'desc' => $params['desc'] ?? null,
'entry_time' => !empty($params['entry_time']) ? strtotime($params['entry_time']) : 0,
'status' => $params['status'],
]);
Admin::where('id',$data['admin_id'])->update([
'name' => $params['name'],
'account' => $params['name'],
'avatar' => $params['thumb'] ?? config('project.default_image.admin_avatar'),
'password' => create_password($params['password'], Config::get('project.unique_identification')),
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'job_id' => $params['job_id'],
'disable' => $params['status'] == 2 ? 1 : 0,
]);
// 更换角色后.设置token过期
$roleId = AdminRole::where('admin_id', $data['admin_id'])->column('role_id');
if (!empty(array_diff_assoc($roleId, $params['role_id'])) || $params['status'] == 2) {
$tokenArr = AdminSession::where('admin_id', $data['admin_id'])->select()->toArray();
foreach ($tokenArr as $token) {
self::expireToken($token['token']);
}
}
(new AdminAuthCache($data['admin_id']))->clearAuthCache();
// 删除旧的关联信息
AdminRole::delByUserId($data['admin_id']);
// 角色
self::insertRole($data['admin_id'], $params['role_id']);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除企业员工
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 15:49
*/
public static function delete(array $params): bool
{
$data = OaAdmin::where('id', $params['id'])->findOrEmpty();
Db::startTrans();
try {
OaAdmin::destroy($params['id']);
Admin::destroy($data['admin_id']);
//设置token过期
$tokenArr = AdminSession::where('admin_id', $data['admin_id'])->select()->toArray();
foreach ($tokenArr as $token) {
self::expireToken($token['token']);
}
(new AdminAuthCache($data['admin_id']))->clearAuthCache();
// 删除旧的关联信息
AdminRole::delByUserId($data['admin_id']);
Db::commit();
return true;
}catch (\Exception $e){
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 获取企业员工详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/22 15:49
*/
public static function detail($params): array
{
$data = OaAdmin::findOrEmpty($params['id']);
$data['sex_text'] = $data->sex_text;
$data['type_text'] = $data->type_text;
$data['status_text'] = $data->status_text;
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
$job = Jobs::field('name')->where('id',$data['job_id'])->findOrEmpty();
$data['org_name'] = !$org->isEmpty() ? $org['name'] : '';
$data['dept_name'] = !$dept->isEmpty() ? $dept['name'] : '';
$data['job_name'] = !$job->isEmpty() ? $job['name'] : '';
$data['role_id'] = AdminRole::where('admin_id', $data['admin_id'])->column('role_id');
return $data->toArray();
}
public static function insertRole($adminId, $roleIds)
{
if (!empty($roleIds)) {
// 角色
$roleData = [];
foreach ($roleIds as $roleId) {
$roleData[] = [
'admin_id' => $adminId,
'role_id' => $roleId,
];
}
(new AdminRole())->saveAll($roleData);
}
}
public static function expireToken($token): bool
{
$adminSession = AdminSession::where('token', '=', $token)
->with('admin')
->find();
if (empty($adminSession)) {
return false;
}
$time = time();
$adminSession->expire_time = $time;
$adminSession->update_time = $time;
$adminSession->save();
return (new AdminTokenCache())->deleteAdminInfo($token);
}
}

View File

@ -0,0 +1,124 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rlzy;
use app\common\model\auth\Admin;
use app\common\model\works\rlzy\OaDepartmentChange;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 人事调动逻辑
* Class OaDepartmentChangeLogic
* @package app\adminapi\logic\works\rlzy
*/
class OaDepartmentChangeLogic extends BaseLogic
{
/**
* @notes 添加人事调动
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 17:55
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
OaDepartmentChange::create([
'uid' => $params['uid'],
'from_did' => $params['from_did'],
'to_did' => $params['to_did'],
'remark' => $params['remark'] ?? '',
'admin_id' => $admin_id,
'status' => $params['status'] ?? 1,
'move_time' => !empty($params['move_time']) ? strtotime($params['move_time']) : 0
]);
Admin::where('id',$params['uid'])->update(['dept_id'=>$params['to_did']]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑人事调动
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 17:55
*/
public static function edit(array $params,$admin_id): bool
{
Db::startTrans();
try {
OaDepartmentChange::where('id', $params['id'])->update([
'uid' => $params['uid'],
'from_did' => $params['from_did'],
'to_did' => $params['to_did'],
'remark' => $params['remark'] ?? '',
'admin_id' => $admin_id,
'status' => $params['status'] ?? 1,
'move_time' => !empty($params['move_time']) ? strtotime($params['move_time']) : 0
]);
Admin::where('id',$params['uid'])->update(['dept_id'=>$params['to_did']]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除人事调动
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 17:55
*/
public static function delete(array $params): bool
{
return OaDepartmentChange::destroy($params['id']);
}
/**
* @notes 获取人事调动详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/22 17:55
*/
public static function detail($params): array
{
$data = OaDepartmentChange::findOrEmpty($params['id']);
$data['user_name'] = $data->user_name;
$data['from_dept'] = $data->from_dept;
$data['to_dept'] = $data->to_dept;
$data['status_text'] = $data->status_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,129 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\rlzy;
use app\common\model\auth\Admin;
use app\common\model\works\rlzy\OaPersonalQuit;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 离职档案逻辑
* Class OaPersonalQuitLogic
* @package app\adminapi\logic\works\rlzy
*/
class OaPersonalQuitLogic extends BaseLogic
{
/**
* @notes 添加离职档案
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 09:43
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
OaPersonalQuit::create([
'uid' => $params['uid'],
'remark' => $params['remark'] ?? '',
'admin_id' => $admin_id,
'lead_admin_id' => $params['lead_admin_id'],
'connect_uids' => $params['connect_uids'],
'connect_id' => $params['connect_id'],
'connect_time' => !empty($params['connect_time']) ? strtotime($params['connect_time']) : 0,
'quit_time' => !empty($params['quit_time']) ? strtotime($params['quit_time']) : 0,
]);
Admin::where('id',$params['uid'])->update(['status'=>2]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑离职档案
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 09:43
*/
public static function edit(array $params,$admin_id): bool
{
Db::startTrans();
try {
OaPersonalQuit::where('id', $params['id'])->update([
'uid' => $params['uid'],
'remark' => $params['remark'] ?? '',
'admin_id' => $admin_id,
'lead_admin_id' => $params['lead_admin_id'],
'connect_uids' => $params['connect_uids'],
'connect_id' => $params['connect_id'],
'connect_time' => !empty($params['connect_time']) ? strtotime($params['connect_time']) : 0,
'quit_time' => !empty($params['quit_time']) ? strtotime($params['quit_time']) : 0,
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除离职档案
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/23 09:43
*/
public static function delete(array $params): bool
{
return OaPersonalQuit::destroy($params['id']);
}
/**
* @notes 获取离职档案详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/23 09:43
*/
public static function detail($params): array
{
$data = OaPersonalQuit::findOrEmpty($params['id']);
$user = Admin::where('id',$data['uid'])->findOrEmpty();
$other_user = Admin::where('id','in',[$data['lead_admin_id'],$data['connect_id']])->column('name','id');
$connect_users = Admin::where('id','in',$data['connect_uids'])->column('name');
$data['user_name'] = $user['name'];
$data['lead_admin_name'] = $other_user[$data['lead_admin_id']] ?? '';
$data['connect_user_name'] = $other_user[$data['connect_id']] ?? '';
$data['connect_users'] = implode(',',$connect_users);
return $data->toArray();
}
}

View File

@ -0,0 +1,112 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\xzgl;
use app\common\model\works\xzgl\OaCarCate;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 车辆管理逻辑
* Class OaCarCateLogic
* @package app\adminapi\logic\works\xzgl
*/
class OaCarCateLogic extends BaseLogic
{
/**
* @notes 添加车辆管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 14:02
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
OaCarCate::create([
'title' => $params['title'],
'name' => $params['name'],
'status' => $params['status'] ?? 1
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑车辆管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 14:02
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaCarCate::where('id', $params['id'])->update([
'title' => $params['title'],
'name' => $params['name'],
'status' => $params['status'] ?? 1
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除车辆管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 14:02
*/
public static function delete(array $params): bool
{
return OaCarCate::destroy($params['id']);
}
/**
* @notes 获取车辆管理详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/22 14:02
*/
public static function detail($params): array
{
$data = OaCarCate::findOrEmpty($params['id']);
$data['status_text'] = $data->status_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,110 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\xzgl;
use app\common\model\works\xzgl\OaMeetingCate;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 会议室管理逻辑
* Class OaMeetingCateLogic
* @package app\adminapi\logic\works\xzgl
*/
class OaMeetingCateLogic extends BaseLogic
{
/**
* @notes 添加会议室管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 14:24
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
OaMeetingCate::create([
'title' => $params['title'],
'status' => $params['status'] ?? 1
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑会议室管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 14:24
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaMeetingCate::where('id', $params['id'])->update([
'title' => $params['title'],
'status' => $params['status'] ?? 1
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除会议室管理
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 14:24
*/
public static function delete(array $params): bool
{
return OaMeetingCate::destroy($params['id']);
}
/**
* @notes 获取会议室管理详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/22 14:24
*/
public static function detail($params): array
{
$data = OaMeetingCate::findOrEmpty($params['id']);
$data['status_text'] = $data->status_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,110 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\logic\works\xzgl;
use app\common\model\works\xzgl\OaSealCate;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* OaSealCate逻辑
* Class OaSealCateLogic
* @package app\adminapi\logic\works/xzgl
*/
class OaSealCateLogic extends BaseLogic
{
/**
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 11:53
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
OaSealCate::create([
'title' => $params['title'],
'status' => $params['status'] ?? 1
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 11:53
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
OaSealCate::where('id', $params['id'])->update([
'title' => $params['title'],
'status' => $params['status'] ?? 1
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/05/22 11:53
*/
public static function delete(array $params): bool
{
return OaSealCate::destroy($params['id']);
}
/**
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/05/22 11:53
*/
public static function detail($params): array
{
$data = OaSealCate::findOrEmpty($params['id']);
$data['status_text'] = $data->status_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,104 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works;
use app\common\validate\BaseValidate;
/**
* 系统消息验证器
* Class OaMessageValidate
* @package app\adminapi\validate\works
*/
class OaMessageValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'title' => 'require',
'from_uid' => 'require',
'to_uid' => 'require',
'read_time' => 'require',
'create_time' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'title' => '消息主题',
'from_uid' => '发送人id',
'to_uid' => '接收人id',
'read_time' => '阅读时间',
'create_time' => '创建时间',
];
/**
* @notes 添加场景
* @return OaMessageValidate
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function sceneAdd()
{
return $this->only(['title','from_uid','to_uid','read_time','create_time']);
}
/**
* @notes 编辑场景
* @return OaMessageValidate
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function sceneEdit()
{
return $this->only(['id','title','from_uid','to_uid','read_time','create_time']);
}
/**
* @notes 删除场景
* @return OaMessageValidate
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaMessageValidate
* @author likeadmin
* @date 2024/05/29 14:04
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,130 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\bgsp;
use app\common\model\dept\Dept;
use app\common\model\dict\DictData;
use app\common\validate\BaseValidate;
/**
* 审批类型验证器
* Class OaFlowTypeValidate
* @package app\adminapi\validate\works\bgsp
*/
class OaFlowTypeValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'type' => 'require|checkType',
'title' => 'require',
'name' => 'require',
'department_ids' => 'checkDept',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'type' => '所属分类',
'title' => '审批名称',
'name' => '审批标识',
'department_ids' => '应用部门',
];
/**
* @notes 添加场景
* @return OaFlowTypeValidate
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function sceneAdd()
{
return $this->only(['type','title','name','icon','department_ids','data']);
}
/**
* @notes 编辑场景
* @return OaFlowTypeValidate
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function sceneEdit()
{
return $this->only(['id','type','title','name','icon','department_ids','data']);
}
/**
* @notes 删除场景
* @return OaFlowTypeValidate
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaFlowTypeValidate
* @author likeadmin
* @date 2024/05/24 13:34
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkType($value): bool|string
{
$dict = DictData::where('type_value', 'oa_approve_cate')->column('value');
if (!in_array($value, $dict)) {
return '所属分类数据值无效';
}
return true;
}
public function checkDept($value): bool|string
{
if(!empty($value)){
$data = explode(',',$value);
if(empty($data)){
return '应用部门数据错误';
}
foreach($data as $v){
$dept = Dept::where('id',$v)->findOrEmpty();
if($dept->isEmpty()){
return '应用部门信息不存在';
}
}
}
return true;
}
}

View File

@ -0,0 +1,203 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\bgsp;
use app\common\model\auth\Admin;
use app\common\model\dept\Dept;
use app\common\model\dict\DictData;
use app\common\model\works\bgsp\OaFlowType;
use app\common\validate\BaseValidate;
/**
* 审批流程验证器
* Class OaFlowValidate
* @package app\adminapi\validate\works\bgsp
*/
class OaFlowValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'name' => 'require',
'check_type' => 'require|integer|in:1,2,3',
'type' => 'require|checkType',
'flow_cate' => 'require|checkFlowCate',
'department_ids' => 'checkDept',
'copy_uids' => 'checkCopyUser',
'flow_list' => 'requireCallback:check_require|checkFlowList'
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '审批流名称',
'check_type' => '流程类型',
'type' => '应用模块',
'flow_cate' => '应用审批类型',
'department_ids' => '应用部门',
'copy_uids' => '抄送人',
'flow_list' => '审批流程'
];
/**
* @notes 添加场景
* @return OaFlowValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneAdd()
{
return $this->only(['name','check_type','type','flow_cate','department_ids','copy_uids','remark','flow_list']);
}
/**
* @notes 编辑场景
* @return OaFlowValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneEdit()
{
return $this->only(['id','name','check_type','type','flow_cate','department_ids','copy_uids','remark','flow_list']);
}
/**
* @notes 删除场景
* @return OaFlowValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaFlowValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkType($value): bool|string
{
$dict = DictData::where('type_value', 'oa_approve_cate')->column('value');
if (!in_array($value, $dict)) {
return '所属分类数据值无效';
}
return true;
}
public function checkDept($value): bool|string
{
if(!empty($value)){
$data = explode(',',$value);
if(empty($data)){
return '应用部门数据错误';
}
foreach($data as $v){
$dept = Dept::where('id',$v)->findOrEmpty();
if($dept->isEmpty()){
return '应用部门信息不存在';
}
}
}
return true;
}
public function checkCopyUser($value): bool|string
{
if(!empty($value)){
$data = explode(',',$value);
if(empty($data)){
return '抄送人数据错误';
}
foreach($data as $v){
$user = Admin::where('id',$v)->findOrEmpty();
if($user->isEmpty()){
return '抄送人信息不存在';
}
}
}
return true;
}
public function checkFlowCate($value): bool|string
{
$data = OaFlowType::where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '审批类型不存在' : true;
}
public function check_require($value, $data): bool
{
if($data['check_type'] != 2){
return true;
}
return false;
}
public function checkFlowList($value,$rule,$data): bool|string
{
if($data['check_type'] != 2) {
if(empty($value) || !is_array($value)) return '审批流程数据格式错误';
if($data['check_type'] == 1){
foreach ($value as $k=>$v) {
if(!isset($v['flow_type']) || !isset($v['flow_uids'])){
return '固定审批流数据参数缺失';
}
if(empty($v['flow_type']) || !in_array($v['flow_type'],[1,2,3])){
return '固定审批流第'.($k+1).'行的类型未选择';
}
if($v['flow_type'] > 1 && empty($v['flow_uids'])){
return '固定审批流第'.($k+1).'行的指定人未选择';
}
}
}
if($data['check_type'] == 3){
foreach ($value as $k=>$v) {
if(!isset($v['flow_type']) || !isset($v['flow_uids']) || !isset($v['flow_name'])){
return '可回退的审批流数据参数缺失';
}
if(empty($v['flow_name'])){
return '可回退的审批流第'.($k+1).'行的流程名称未填写';
}
if(empty($v['flow_uids'])){
return '可回退的审批流第'.($k+1).'行的指定人未选择';
}
}
}
}
return true;
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace app\oa\validate\works\finance;
use app\common\model\works\bgsp\OaFlow;
use app\common\validate\BaseValidate;
class ExpenseValidate extends BaseValidate
{
protected $rule = [
'id' => 'require',
'code' => 'require',
'income_month' => 'require|dateFormat:Y-m',
'expense_time' => 'require|dateFormat:Y-m-d',
'flow_id' => 'require|checkFlow',
'annex' => 'checkAnnex',
'detail' => 'require|checkDetail',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'code' => '报销编码',
'income_month' => '入账月份',
'expense_time' => '原始单据日期',
'flow_id' => '审批流程',
'annex' => '附件',
'detail' => '报销选项',
];
/**
* @notes 添加场景
* @return ExpenseValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneAdd()
{
return $this->only(['code','income_month','expense_time','flow_id','annex','detail','check_admin_ids','copy_uids']);
}
/**
* @notes 编辑场景
* @return ExpenseValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneEdit()
{
return $this->only(['id','code','income_month','expense_time','flow_id','annex','detail','check_admin_ids','copy_uids']);
}
/**
* @notes 删除场景
* @return ExpenseValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return ExpenseValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneDetail()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return ExpenseValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function scenePay()
{
return $this->only(['id']);
}
public function checkFlow($value): bool|string {
$data = OaFlow::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '审批流程信息不存在';
}
if($data['type'] != 5){
return '当前审批流信息不属于报销审批类型';
}
return true;
}
public function checkDetail($value): bool|string
{
if(!is_array($value)){
return '报销选项数据格式错误';
}
foreach($value as $k=>$v){
if(empty($v['amount'])){
return '报销选项第'.($k+1).'行报销金额为空';
}
if(empty($v['cate_id'])){
return '报销选项第'.($k+1).'行报销项目为空';
}
if(!in_array($v['cate_id'],[1,2,3,4,5,6])){
return '报销选项第'.($k+1).'行报销项目数据值错误';
}
}
return true;
}
}

View File

@ -0,0 +1,118 @@
<?php
namespace app\oa\validate\works\finance;
use app\common\model\works\bgsp\OaFlow;
use app\common\validate\BaseValidate;
class InvoiceValidate extends BaseValidate
{
protected $rule = [
'id' => 'require',
'code' => 'require',
'open_time' => 'require|dateFormat:Y-m-d',
'cash_type' => 'require|in:1,2,3,4,5,6,7',
'is_cash' => 'require|in:0,1,2',
'amount' => 'require|float',
'type' => 'require|in:1,2',
'invoice_subject' => 'require',
'invoice_type' => 'require|in:1,2,3',
'invoice_title' => 'require',
'invoice_phone' => 'mobile',
'invoice_account' => 'number',
'flow_id' => 'require|checkFlow',
'check_remark' => 'require',
'annex' => 'checkAnnex',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'require',
'code' => '发票号码',
'cash_type' => '付款方式',
'is_cash' => '是否到账',
'amount' => '发票金额',
'type' => '抬头类型',
'invoice_subject' => '发票主体',
'invoice_type' => '发票类型',
'invoice_title' => '开票抬头',
'invoice_phone' => '电话号码',
'invoice_account' => '银行账号',
'flow_id' => '审批流程id',
'check_remark' => '撤销的理由',
'annex' => '附件',
];
/**
* @notes 添加场景
* @return InvoiceValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneAdd()
{
return $this->only(['amount','type','invoice_subject','invoice_type','invoice_title','invoice_phone','invoice_tax','invoice_bank','invoice_account','invoice_banking','invoice_address','remark','annex','flow_id','check_admin_ids','copy_uids']);
}
/**
* @notes 编辑场景
* @return InvoiceValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneEdit()
{
return $this->only(['id','amount','type','invoice_subject','invoice_type','invoice_title','invoice_phone','invoice_tax','invoice_bank','invoice_account','invoice_banking','invoice_address','remark','annex','flow_id','check_admin_ids','copy_uids']);
}
/**
* @notes 删除场景
* @return InvoiceValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return InvoiceValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneDetail()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return InvoiceValidate
* @author likeadmin
* @date 2024/05/24 14:16
*/
public function sceneInvoice()
{
return $this->only(['id','code','open_time','delivery']);
}
public function checkFlow($value): bool|string {
$data = OaFlow::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '审批流程信息不存在';
}
if($data['type'] != 6){
return '当前审批流信息不属于报销审批类型';
}
return true;
}
}

View File

@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rcbg;
use app\common\model\works\rcbg\OaPlan;
use app\common\validate\BaseValidate;
/**
* 日程安排验证器
* Class OaPlanValidate
* @package app\adminapi\validate\works\rcbg
*/
class OaPlanValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'title' => 'require',
'type' => 'require|integer|in:0,1,2,3,4',
'start_time' => 'require|dateFormat:Y-m-d H:i',
'end_time' => 'require|dateFormat:Y-m-d H:i',
'remind_type' => 'require|integer|in:0,1,2,3,4,5,6',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'title' => '工作安排主题',
'type' => '日程优先级',
'start_time' => '开始时间',
'end_time' => '结束时间',
'remind_type' => '提醒类型',
];
/**
* @notes 添加场景
* @return OaPlanValidate
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function sceneAdd()
{
return $this->only(['title','type','start_time','end_time','remind_type']);
}
/**
* @notes 编辑场景
* @return OaPlanValidate
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function sceneEdit()
{
return $this->only(['id','title','type','start_time','end_time','remind_type']);
}
/**
* @notes 删除场景
* @return OaPlanValidate
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaPlanValidate
* @author likeadmin
* @date 2024/05/23 11:53
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function sceneCalendar()
{
return $this->only(['start_time','end_time']);
}
public function checkData($value): bool|string
{
$data = OaPlan::field('id')->where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
}

View File

@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rcbg;
use app\common\validate\BaseValidate;
/**
* 工作记录验证器
* Class OaScheduleValidate
* @package app\adminapi\validate\works\rcbg
*/
class OaScheduleValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'title' => 'require',
'start_time' => 'require|dateFormat:Y-m-d H:i',
'end_time' => 'require|dateFormat:Y-m-d H:i',
'labor_type' => 'require|integer|in:1,2',
'cid' => 'require|integer|in:0,1,2,3,4,5,6,7',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'title' => '工作内容',
'start_time' => '开始时间',
'end_time' => '结束时间',
'labor_type' => '工作类型',
'cid' => '工作类别',
];
/**
* @notes 添加场景
* @return OaScheduleValidate
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function sceneAdd()
{
return $this->only(['title','start_time','end_time','labor_type','cid','remark']);
}
/**
* @notes 编辑场景
* @return OaScheduleValidate
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function sceneEdit()
{
return $this->only(['id','title','start_time','end_time','labor_type','cid','remark']);
}
/**
* @notes 删除场景
* @return OaScheduleValidate
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaScheduleValidate
* @author likeadmin
* @date 2024/05/23 14:27
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function sceneCalendar()
{
return $this->only(['start_time','end_time']);
}
}

View File

@ -0,0 +1,98 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rcbg;
use app\common\validate\BaseValidate;
/**
* 工作汇报点评表验证器
* Class OaWorkCommentValidate
* @package app\adminapi\validate\works\rcbg
*/
class OaWorkCommentValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'work_id' => 'require',
'content' => 'require'
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'work_id' => '工作汇报id',
'content' => '点评内容',
];
/**
* @notes 添加场景
* @return OaWorkCommentValidate
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function sceneAdd()
{
return $this->only(['work_id','content']);
}
/**
* @notes 编辑场景
* @return OaWorkCommentValidate
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function sceneEdit()
{
return $this->only(['id','work_id','content']);
}
/**
* @notes 删除场景
* @return OaWorkCommentValidate
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaWorkCommentValidate
* @author likeadmin
* @date 2024/05/23 17:39
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,104 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rcbg;
use app\common\validate\BaseValidate;
/**
* 汇报工作发送记录表验证器
* Class OaWorkRecordValidate
* @package app\adminapi\validate\works\rcbg
*/
class OaWorkRecordValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'wid' => 'require',
'from_uid' => 'require',
'to_uid' => 'require',
'send_time' => 'require',
'read_time' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'wid' => '汇报工作id',
'from_uid' => '发送人id',
'to_uid' => '接收人id',
'send_time' => '发送日期',
'read_time' => '阅读时间',
];
/**
* @notes 添加场景
* @return OaWorkRecordValidate
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function sceneAdd()
{
return $this->only(['wid','from_uid','to_uid','send_time','read_time']);
}
/**
* @notes 编辑场景
* @return OaWorkRecordValidate
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function sceneEdit()
{
return $this->only(['id','wid','from_uid','to_uid','send_time','read_time']);
}
/**
* @notes 删除场景
* @return OaWorkRecordValidate
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaWorkRecordValidate
* @author likeadmin
* @date 2024/05/23 16:48
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,110 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rcbg;
use app\common\validate\BaseValidate;
/**
* 工作汇报验证器
* Class OaWorkValidate
* @package app\adminapi\validate\works\rcbg
*/
class OaWorkValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'type' => 'require|integer|in:1,2,3',
'type_user' => 'require|checkTypeUser',
'works' => 'require',
'annex' => 'checkAnnex',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'type' => '类型',
'type_user' => '接受人员ID',
'works' => '汇报工作内容',
'annex' => '附件'
];
/**
* @notes 添加场景
* @return OaWorkValidate
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function sceneAdd()
{
return $this->only(['type','type_user','works','plans','remark','annex']);
}
/**
* @notes 编辑场景
* @return OaWorkValidate
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function sceneEdit()
{
return $this->only(['id','type','works','plans','remark','annex'])->remove('type_user',true);
}
/**
* @notes 删除场景
* @return OaWorkValidate
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaWorkValidate
* @author likeadmin
* @date 2024/05/23 15:56
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkTypeUser($value): bool|string
{
if(empty($value) || empty(explode(',',$value))){
return '接受人员数据格式错误';
}
return true;
}
}

View File

@ -0,0 +1,178 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rlzy;
use app\common\model\auth\SystemRole;
use app\common\model\dept\Dept;
use app\common\model\dept\Jobs;
use app\common\model\dept\Orgs;
use app\common\model\works\rlzy\OaAdmin;
use app\common\validate\BaseValidate;
/**
* 企业员工验证器
* Class OaAdminValidate
* @package app\adminapi\validate\works\rlzy
*/
class OaAdminValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'name' => 'require',
'email' => 'email',
'mobile' => 'require|mobile|unique:oa_admin',
'sex' => 'integer|in:0,1,2',
'org_id' => 'require|checkOrg',
'dept_id' => 'require|checkDept',
'job_id' => 'require|checkJob',
'type' => 'require|integer|in:0,1,2',
'age' => 'integer|gt:0',
'idcard' => 'idCard',
'entry_time' => 'require|dateFormat:Y-m-d',
'status' => 'require|integer|in:0,1,2',
'password' => 'require|length:6,32',
'role_id' => 'require|checkRole',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'name' => '员工姓名',
'email' => '电子邮箱',
'mobile' => '手机号码',
'sex' => '性别',
'org_id' => '组织',
'dept_id' => '部门',
'job_id' => '职位',
'type' => '员工类型',
'age' => '年龄',
'idcard' => '身份证',
'entry_time' => '员工入职日期',
'status' => '状态',
'password' => '登录密码',
'role_id' => '角色权限',
];
/**
* @notes 添加场景
* @return OaAdminValidate
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function sceneAdd()
{
return $this->remove('id',true);
}
/**
* @notes 编辑场景
* @return OaAdminValidate
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function sceneEdit()
{}
/**
* @notes 删除场景
* @return OaAdminValidate
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaAdminValidate
* @author likeadmin
* @date 2024/05/22 15:49
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = OaAdmin::field('id')->where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
public function checkOrg($value): bool|string
{
$org = Orgs::where('id', $value)->findOrEmpty();
if ($org->isEmpty()) {
return '组织不存在';
}
return true;
}
public function checkDept($value, $rule, $data): bool|string
{
$dept = Dept::where('id', $value)->findOrEmpty();
if ($dept->isEmpty()) {
return '部门不存在';
}
if ($dept['org_id'] != $data['org_id']) {
return '该部门不属于当前选择的组织';
}
return true;
}
public function checkJob($value, $rule, $data): bool|string
{
$job = Jobs::where('id', $value)->findOrEmpty();
if ($job->isEmpty()) {
return '岗位不存在';
}
if ($job['dept_id'] != $data['dept_id']) {
return '该岗位不属于当前选择的部门';
}
return true;
}
public function checkRole($value): bool|string
{
if(empty($value) || !is_array($value)){
return '角色数据格式错误';
}
foreach ($value as $item) {
$res = SystemRole::where('id',$item)->findOrEmpty();
if($res->isEmpty()){
return '角色数据不存在';
}
}
return true;
}
}

View File

@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rlzy;
use app\common\model\works\rlzy\OaDepartmentChange;
use app\common\validate\BaseValidate;
/**
* 人事调动验证器
* Class OaDepartmentChangeValidate
* @package app\adminapi\validate\works\rlzy
*/
class OaDepartmentChangeValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'uid' => 'require',
'from_did' => 'require',
'to_did' => 'require|different:from_did',
'move_time' => 'require|dateFormat:Y-m-d',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'uid' => '用户',
'from_did' => '原部门',
'to_did' => '调到部门',
'move_time' => '调动时间',
];
/**
* @notes 添加场景
* @return OaDepartmentChangeValidate
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function sceneAdd()
{
return $this->only(['uid','from_did','to_did','admin_id','status','move_time']);
}
/**
* @notes 编辑场景
* @return OaDepartmentChangeValidate
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function sceneEdit()
{
return $this->only(['id','uid','from_did','to_did','admin_id','status','move_time']);
}
/**
* @notes 删除场景
* @return OaDepartmentChangeValidate
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaDepartmentChangeValidate
* @author likeadmin
* @date 2024/05/22 17:55
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = OaDepartmentChange::field('id')->where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
}

View File

@ -0,0 +1,113 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\rlzy;
use app\common\model\works\rlzy\OaPersonalQuit;
use app\common\validate\BaseValidate;
/**
* 离职档案验证器
* Class OaPersonalQuitValidate
* @package app\adminapi\validate\works\rlzy
*/
class OaPersonalQuitValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'uid' => 'require',
'lead_admin_id' => 'require',
'connect_uids' => 'require',
'connect_id' => 'require',
'connect_time' => 'require|dateFormat:Y-m-d',
'quit_time' => 'require|dateFormat:Y-m-d',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'uid' => '用户ID',
'lead_admin_id' => '部门负责人',
'connect_uids' => '参与交接人,多',
'connect_id' => '资料交接人',
'connect_time' => '资料交接时间',
'quit_time' => '离职时间',
];
/**
* @notes 添加场景
* @return OaPersonalQuitValidate
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function sceneAdd()
{
return $this->only(['uid','admin_id','lead_admin_id','connect_uids','connect_id','connect_time','quit_time']);
}
/**
* @notes 编辑场景
* @return OaPersonalQuitValidate
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function sceneEdit()
{
return $this->only(['id','uid','admin_id','lead_admin_id','connect_uids','connect_id','connect_time','quit_time']);
}
/**
* @notes 删除场景
* @return OaPersonalQuitValidate
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaPersonalQuitValidate
* @author likeadmin
* @date 2024/05/23 09:43
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = OaPersonalQuit::field('id')->where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
}

View File

@ -0,0 +1,107 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\xzgl;
use app\common\model\works\xzgl\OaCarCate;
use app\common\validate\BaseValidate;
/**
* 车辆管理验证器
* Class OaCarCateValidate
* @package app\adminapi\validate\works\xzgl
*/
class OaCarCateValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'title' => 'require',
'name' => 'require',
'status' => 'integer|in:0,1',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'title' => '车辆名称',
'name' => '车辆号码',
'status' => '状态',
];
/**
* @notes 添加场景
* @return OaCarCateValidate
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function sceneAdd()
{
return $this->only(['title','name','status']);
}
/**
* @notes 编辑场景
* @return OaCarCateValidate
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function sceneEdit()
{
return $this->only(['id','title','name','status']);
}
/**
* @notes 删除场景
* @return OaCarCateValidate
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaCarCateValidate
* @author likeadmin
* @date 2024/05/22 14:02
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = OaCarCate::field('id')->where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
}

View File

@ -0,0 +1,105 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\xzgl;
use app\common\model\works\xzgl\OaMeetingCate;
use app\common\validate\BaseValidate;
/**
* 会议室管理验证器
* Class OaMeetingCateValidate
* @package app\adminapi\validate\works\xzgl
*/
class OaMeetingCateValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'title' => 'require',
'status' => 'integer|in:0,1',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'title' => '会议室名称',
'status' => '状态',
];
/**
* @notes 添加场景
* @return OaMeetingCateValidate
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function sceneAdd()
{
return $this->only(['title','status']);
}
/**
* @notes 编辑场景
* @return OaMeetingCateValidate
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function sceneEdit()
{
return $this->only(['id','title','status']);
}
/**
* @notes 删除场景
* @return OaMeetingCateValidate
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaMeetingCateValidate
* @author likeadmin
* @date 2024/05/22 14:24
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = OaMeetingCate::field('id')->where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
}

View File

@ -0,0 +1,105 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\oa\validate\works\xzgl;
use app\common\model\works\xzgl\OaSealCate;
use app\common\validate\BaseValidate;
/**
* OaSealCate验证器
* Class OaSealCateValidate
* @package app\adminapi\validate\works/xzgl
*/
class OaSealCateValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'title' => 'require',
'status' => 'integer|in:0,1',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'title' => '印章类型名称',
'status' => '状态',
];
/**
* @notes 添加场景
* @return OaSealCateValidate
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function sceneAdd()
{
return $this->only(['title','status']);
}
/**
* @notes 编辑场景
* @return OaSealCateValidate
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function sceneEdit()
{
return $this->only(['id','title','status']);
}
/**
* @notes 删除场景
* @return OaSealCateValidate
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OaSealCateValidate
* @author likeadmin
* @date 2024/05/22 11:53
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = OaSealCate::field('id')->where('id',$value)->findOrEmpty();
return $data->isEmpty() ? '数据不存在' : true;
}
}