2072 lines
54 KiB
PHP
2072 lines
54 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (c) 2021 勾股工作室
|
|
* @license https://opensource.org/licenses/GPL-3.0
|
|
* @link https://www.gougucms.com
|
|
*/
|
|
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\api\ApiController;
|
|
use app\api\middleware\Auth;
|
|
use app\note\model\Note as NoteList;
|
|
use app\home\model\AdminLog;
|
|
use app\user\validate\AdminCheck;
|
|
use think\exception\ValidateException;
|
|
use think\facade\Db;
|
|
|
|
class OaApprove extends ApiController
|
|
{
|
|
protected $middleware = [
|
|
Auth::class => ['except' => []]
|
|
];
|
|
|
|
//获取审批应用
|
|
public function app()
|
|
{
|
|
$uid = JWT_UID;
|
|
$userInfo = Db::name('Admin')->where(['id' => $uid])->field(['id', 'username', 'name', 'email', 'mobile', 'sex', 'nickname', 'thumb', 'did', 'position_id', 'desc', 'entry_time'])->find();
|
|
$department = $userInfo['did'];
|
|
$map1 = [];
|
|
$map2 = [];
|
|
$map1[] = ['status', '=', 1];
|
|
$map1[] = ['department_ids', '=', ''];
|
|
$map2[] = ['status', '=', 1];
|
|
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$department}',department_ids)")];
|
|
$list = Db::name('FlowType')->whereOr([$map1,$map2])->fetchSql(false)->select()->toArray();
|
|
foreach($list as $k=>$v) {
|
|
$list[$k]['create_time'] = date('Y-m-d H:i:s', $v['create_time']);
|
|
$list[$k]['update_time'] = date('Y-m-d H:i:s', $v['update_time']);
|
|
}
|
|
/*
|
|
$list[] = [
|
|
"id" => 9996,
|
|
"type" => 3,
|
|
"title" => "报销",
|
|
"name" => "baoxiao",
|
|
"icon" => "icon-baoxiao",
|
|
"img" => "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/oa/baoxiao.png",
|
|
"department_ids" => "",
|
|
"status" => 1,
|
|
"create_time" => "2022-01-10 16:21:32",
|
|
"update_time" => "2022-01-10 16:21:32"
|
|
];
|
|
|
|
$list[] = [
|
|
"id" => 9997,
|
|
"type" => 3,
|
|
"title" => "发票",
|
|
"name" => "fapiao",
|
|
"icon" => "icon-fapiao",
|
|
"img" => "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/oa/fapiao.png",
|
|
"department_ids" => "",
|
|
"status" => 1,
|
|
"create_time" => "2022-01-10 16:21:32",
|
|
"update_time" => "2022-01-10 16:21:32"
|
|
];
|
|
*/
|
|
$loginAdmin = Db::name('Admin')->where(['id' => $uid])->find();
|
|
$did = $loginAdmin['did'];
|
|
// 如果是人事部
|
|
$departmentId = Db::name('Department')->where(['title' => '综合部'])->value('id');
|
|
if ($did == $departmentId) {
|
|
$list[] = [
|
|
"id" => 9998,
|
|
"type" => 4,
|
|
"title" => "人力资源",
|
|
"name" => "renliziyuan",
|
|
"icon" => "icon-renliziyuan",
|
|
"img" => "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/oa/renliziyuan.png",
|
|
"department_ids" => "",
|
|
"status" => 1,
|
|
"create_time" => "2022-01-10 16:21:32",
|
|
"update_time" => "2022-01-10 16:21:32"
|
|
];
|
|
}
|
|
|
|
$this->apiSuccess('获取成功', $list);
|
|
}
|
|
|
|
//获取审批应用字段
|
|
public function app_field()
|
|
{
|
|
$this->uid = JWT_UID;
|
|
$loginAdmin = Db::name('Admin')->where(['id' => $this->uid])->find();
|
|
$this->did = $loginAdmin['did'];
|
|
$param = get_params();
|
|
$type = isset($param['type']) ? $param['type'] : 0;
|
|
$flowType = Db::name('FlowType')->where('id', $type)->find();
|
|
if (empty($flowType)) {
|
|
$this->apiError("审批流程不存在");
|
|
}
|
|
$field = $this->getFlowField($type, $this->did);
|
|
$this->apiSuccess('获取成功', [
|
|
'type' => $type,
|
|
'title' => $flowType['title'],
|
|
'name' => $flowType['name'],
|
|
'field' => $field
|
|
]);
|
|
}
|
|
|
|
//添加新增/编辑审批
|
|
public function add()
|
|
{
|
|
$this->checkAuth();
|
|
$this->uid = JWT_UID;
|
|
$loginAdmin = Db::name('Admin')->where(['id' => $this->uid])->find();
|
|
$this->did = $loginAdmin['did'];
|
|
$param = get_params();
|
|
if (empty($param['flow_id'])) {
|
|
$this->apiError("审批流程id不能为空");
|
|
}
|
|
if (empty($param['type'])) {
|
|
$this->apiError("审批流程类型不能为空");
|
|
}
|
|
if (isset($param['detail_time'])) {
|
|
$param['detail_time'] = strtotime($param['detail_time']);
|
|
}
|
|
if (isset($param['start_time'])) {
|
|
$param['start_time'] = strtotime($param['start_time']);
|
|
}
|
|
if (isset($param['end_time'])) {
|
|
$param['end_time'] = strtotime($param['end_time']);
|
|
if ($param['end_time'] < $param['start_time']) {
|
|
$this->apiError('时间选择有误');
|
|
}
|
|
}
|
|
if (isset($param['start_time_a'])) {
|
|
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
|
|
}
|
|
if (isset($param['end_time_a'])) {
|
|
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
|
|
if ($param['end_time'] <= $param['start_time']) {
|
|
$this->apiError('结束时间需要大于开始时间');
|
|
}
|
|
}
|
|
$flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list');
|
|
$flow = unserialize($flow_list);
|
|
if (empty($param['check_admin_ids'])) {
|
|
foreach($flow as $item) {
|
|
// 当前部门负责人
|
|
if ($item['flow_type'] == 1) {
|
|
$manager = get_department_manager($this->uid);
|
|
if (empty($manager)) {
|
|
$this->apiError('当前部门负责人不存在');
|
|
}
|
|
}
|
|
// 上级部门负责人
|
|
if ($item['flow_type'] == 2) {
|
|
$manager = get_department_manager($this->uid, 1);
|
|
if (empty($manager)) {
|
|
$this->apiError('上级部门负责人不存在');
|
|
}
|
|
}
|
|
// 当前部门分管领导
|
|
if ($item['flow_type'] == 7) {
|
|
$leader = get_department_leader($this->uid);
|
|
if (empty($leader)) {
|
|
$this->apiError('当前部门分管领导不存在');
|
|
}
|
|
}
|
|
// 上级部门分管领导
|
|
if ($item['flow_type'] == 6) {
|
|
$leader = get_department_leader($this->uid, 1);
|
|
if (empty($leader)) {
|
|
$this->apiError('上级部门分管领导不存在');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!empty($param['id']) && $param['id'] > 0) {
|
|
$param['update_time'] = time();
|
|
$param['check_status'] = 0;
|
|
$param['check_step_sort'] = 0;
|
|
try {
|
|
//删除原来的审核流程和审核记录
|
|
Db::name('FlowStep')->where(['action_id'=>$param['id'],'type'=>1,'delete_time'=>0])->update(['delete_time'=>time()]);
|
|
Db::name('FlowRecord')->where(['action_id'=>$param['id'],'type'=>1,'delete_time'=>0])->update(['delete_time'=>time()]);
|
|
|
|
if (empty($param['check_admin_ids'])) {
|
|
if($flow[0]['flow_type'] == 1){
|
|
// 部门负责人
|
|
$manager = get_department_manager($this->uid);
|
|
$param['check_admin_ids'] = $manager;
|
|
}
|
|
else if($flow[0]['flow_type'] == 2){
|
|
// 上级部门负责人
|
|
$manager = get_department_manager($this->uid, 1);
|
|
$param['check_admin_ids'] = $manager;
|
|
}
|
|
else if($flow[0]['flow_type'] == 7){
|
|
// 部门分管领导
|
|
$leader = get_department_leader($this->uid);
|
|
$param['check_admin_ids'] = $leader;
|
|
}
|
|
else if($flow[0]['flow_type'] == 6){
|
|
// 上级部门分管领导
|
|
$leader = get_department_leader($this->uid, 1);
|
|
$param['check_admin_ids'] = $leader;
|
|
}
|
|
else{
|
|
$param['check_admin_ids'] = $flow[0]['flow_uids'];
|
|
}
|
|
Db::name('Approve')->strict(false)->field(true)->update($param);
|
|
foreach ($flow as $key => &$value){
|
|
$value['action_id'] = $param['id'];
|
|
$value['sort'] = $key;
|
|
$value['create_time'] = time();
|
|
}
|
|
$res = Db::name('FlowStep')->strict(false)->field(true)->insertAll($flow);
|
|
}
|
|
else{
|
|
Db::name('Approve')->strict(false)->field(true)->update($param);
|
|
$flow_step = array(
|
|
'action_id' => $param['id'],
|
|
'flow_uids' => $param['check_admin_ids'],
|
|
'create_time' => time()
|
|
);
|
|
$res = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
|
|
}
|
|
//添加提交申请记录
|
|
$checkData=array(
|
|
'action_id' => $param['id'],
|
|
'check_user_id' => $this->uid,
|
|
'content' => '重新提交申请',
|
|
'check_time' => time(),
|
|
'create_time' => time()
|
|
);
|
|
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
|
|
add_log('edit', $param['id'], $param);
|
|
//发送消息通知
|
|
$msg=[
|
|
'from_uid'=>$this->uid,
|
|
'title' => Db::name('FlowType')->where('id',$param['type'])->value('title'),
|
|
'action_id'=>$param['id']
|
|
];
|
|
$users = $param['check_admin_ids'];
|
|
sendMessage($users,21,$msg);
|
|
} catch (\Exception $e) {
|
|
$this->apiError($e->getMessage());
|
|
}
|
|
} else {
|
|
$param['admin_id'] = $this->uid;
|
|
$param['department_id'] = $this->did;
|
|
$param['create_time'] = time();
|
|
try {
|
|
|
|
if (empty($param['check_admin_ids'])) {
|
|
if($flow[0]['flow_type'] == 1){
|
|
// 部门负责人
|
|
$manager = get_department_manager($this->uid);
|
|
$param['check_admin_ids'] = $manager;
|
|
}
|
|
else if($flow[0]['flow_type'] == 2){
|
|
// 上级部门负责人
|
|
$manager = get_department_manager($this->uid, 1);
|
|
$param['check_admin_ids'] = $manager;
|
|
}
|
|
else if($flow[0]['flow_type'] == 7){
|
|
// 部门分管领导
|
|
$leader = get_department_leader($this->uid);
|
|
$param['check_admin_ids'] = $leader;
|
|
}
|
|
else if($flow[0]['flow_type'] == 6){
|
|
// 上级部门分管领导
|
|
$leader = get_department_leader($this->uid, 1);
|
|
$param['check_admin_ids'] = $leader;
|
|
}
|
|
else{
|
|
$param['check_admin_ids'] = $flow[0]['flow_uids'];
|
|
}
|
|
$aid = Db::name('Approve')->strict(false)->field(true)->insertGetId($param);
|
|
foreach ($flow as $key => &$value){
|
|
$value['action_id'] = $aid;
|
|
$value['sort'] = $key;
|
|
$value['create_time'] = time();
|
|
}
|
|
|
|
$res = Db::name('FlowStep')->strict(false)->field(true)->insertAll($flow);
|
|
}
|
|
else{
|
|
$aid = Db::name('Approve')->strict(false)->field(true)->insertGetId($param);
|
|
$flow_step = array(
|
|
'action_id' => $aid,
|
|
'flow_uids' => $param['check_admin_ids'],
|
|
'create_time' => time()
|
|
);
|
|
$step_id = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
|
|
}
|
|
//添加提交申请记录
|
|
$checkData=array(
|
|
'action_id' => $aid,
|
|
'check_user_id' => $this->uid,
|
|
'content' => '提交申请',
|
|
'check_time' => time(),
|
|
'create_time' => time()
|
|
);
|
|
$record_id = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
|
|
add_log('add', $aid, $param);
|
|
//给审核人发送消息通知
|
|
$msg=[
|
|
'from_uid'=>$this->uid,
|
|
'title' => Db::name('FlowType')->where('id',$param['type'])->value('title'),
|
|
'action_id'=>$aid
|
|
];
|
|
$users = $param['check_admin_ids'];
|
|
sendMessage($users, 21, $msg);
|
|
} catch (\Exception $e) {
|
|
$this->apiError($e->getMessage());
|
|
}
|
|
}
|
|
$this->apiSuccess('操作成功');
|
|
}
|
|
|
|
//查看流程
|
|
public function view()
|
|
{
|
|
$this->checkAuth();
|
|
$param = get_params();
|
|
$this->uid = JWT_UID;
|
|
$loginAdmin = Db::name('Admin')->where(['id' => $this->uid])->find();
|
|
$this->did = $loginAdmin['did'];
|
|
$detail = Db::name('Approve')->where('id',$param['id'] ?? 0)->find();
|
|
if (empty($detail)) {
|
|
$this->apiError("审批流程不存在");
|
|
}
|
|
$check_record = [];
|
|
if($detail['start_time']>0){
|
|
$detail['start_time'] = date('Y-m-d H:i',$detail['start_time']);
|
|
}
|
|
if($detail['end_time']>0){
|
|
$detail['end_time'] = date('Y-m-d H:i',$detail['end_time']);
|
|
}
|
|
if($detail['detail_time']>0){
|
|
$detail['detail_time'] = date('Y-m-d',$detail['detail_time']);
|
|
}
|
|
|
|
$detail['days'] = floor($detail['duration']*10/80);
|
|
$detail['hours'] = (($detail['duration']*10)%80)/10;
|
|
$detail['create_time'] = date('Y-m-d H:i:s',$detail['create_time']);
|
|
$detail['update_time'] = date('Y-m-d H:i:s',$detail['update_time']);
|
|
|
|
$detail['create_user'] = Db::name('Admin')->where('id',$detail['admin_id'])->value('name');
|
|
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
|
|
$detail['check_user'] = '-';
|
|
$detail['copy_user'] = '-';
|
|
$check_user_ids = [];
|
|
if($detail['check_status']<2){
|
|
if($flows['flow_type']==1){
|
|
$detail['check_user'] = '部门负责人';
|
|
$check_user_ids = explode(',',$detail['check_admin_ids']);
|
|
}
|
|
else if($flows['flow_type']==2){
|
|
$detail['check_user'] = '上级部门负责人';
|
|
$check_user_ids = explode(',',$detail['check_admin_ids']);
|
|
}
|
|
else if($flows['flow_type']==7){
|
|
$detail['check_user'] = '部门分管领导';
|
|
$check_user_ids = explode(',',$detail['check_admin_ids']);
|
|
}
|
|
else if($flows['flow_type']==6){
|
|
$detail['check_user'] = '上级部门分管领导';
|
|
$check_user_ids = explode(',',$detail['check_admin_ids']);
|
|
}
|
|
else{
|
|
$check_user_ids = explode(',',$flows['flow_uids']);
|
|
$check_user = Db::name('Admin')->where('id','in',$flows['flow_uids'])->column('name');
|
|
$detail['check_user'] = implode(',',$check_user);
|
|
}
|
|
}
|
|
if($detail['copy_uids'] !=''){
|
|
$copy_user = Db::name('Admin')->where('id','in',$detail['copy_uids'])->column('name');
|
|
$detail['copy_user'] = implode(',',$copy_user);
|
|
}
|
|
if($detail['file_ids'] !=''){
|
|
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
|
$detail['fileArray'] = $fileArray;
|
|
}
|
|
|
|
$is_check_admin = 0;
|
|
$is_create_admin = 0;
|
|
if($detail['admin_id'] == $this->uid){
|
|
$is_create_admin = 1;
|
|
}
|
|
if(in_array($this->uid,$check_user_ids)){
|
|
$is_check_admin = 1;
|
|
//当前审核节点详情
|
|
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
|
|
if($step['flow_type'] == 4){
|
|
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>1,'step_id'=>$step['id'],'check_user_id'=>$this->uid])->count();
|
|
if($check_count>0){
|
|
$is_check_admin = 0;
|
|
}
|
|
}
|
|
}
|
|
$check_record = Db::name('FlowRecord')->field('f.*,a.name,a.thumb')
|
|
->alias('f')
|
|
->join('Admin a', 'a.id = f.check_user_id', 'left')
|
|
->where(['f.action_id'=>$detail['id'],'f.type'=>1])
|
|
->order('check_time desc')
|
|
->select()->toArray();
|
|
foreach ($check_record as $kk => &$vv) {
|
|
$vv['check_time_str'] = date('Y-m-d H:i:s', $vv['check_time']);
|
|
$vv['check_time'] = date('Y-m-d H:i:s', $vv['check_time']);
|
|
$vv['status_str'] = '提交';
|
|
if($vv['status'] == 1){
|
|
$vv['status_str'] = '审核通过';
|
|
}
|
|
else if($vv['status'] == 2){
|
|
$vv['status_str'] = '审核拒绝';
|
|
}
|
|
if($vv['status'] == 3){
|
|
$vv['status_str'] = '撤销';
|
|
}
|
|
}
|
|
$detailField = $this->getFlowField($detail['type'], $this->did);
|
|
foreach($detail as $k=>$v) {
|
|
if (!empty($detailField[$k])) {
|
|
$detail[$k . '_title'] = $detailField[$k]['title'] ?? '';
|
|
}
|
|
}
|
|
// is_create_admin 是否为创建人 is_check_admin 是否为审核人
|
|
$this->apiSuccess('获取成功', compact('is_create_admin', 'is_check_admin', 'check_record', 'detail', 'flows'));
|
|
}
|
|
|
|
//发起审批记录
|
|
public function index()
|
|
{
|
|
$this->checkAuth();
|
|
$this->uid = JWT_UID;
|
|
$param = get_params();
|
|
$where = [];
|
|
if (isset($param['status'])) {
|
|
if($param['status'] == 1){
|
|
$where[] = ['check_status','<',2];
|
|
}
|
|
if($param['status'] == 2){
|
|
$where[] = ['check_status','=',2];
|
|
}
|
|
if($param['status'] == 3){
|
|
$where[] = ['check_status','>',2];
|
|
}
|
|
}
|
|
$where[] = ['admin_id','=',$this->uid];
|
|
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
|
$list = Db::name('Approve')
|
|
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
|
|
->alias('f')
|
|
->join('Admin a', 'a.id = f.admin_id', 'left')
|
|
->join('Department d', 'd.id = f.department_id', 'left')
|
|
->join('FlowType t', 't.id = f.type', 'left')
|
|
->where($where)
|
|
->order('f.id desc')
|
|
->paginate(['list_rows' => $rows, 'query' => $param])
|
|
->each(function($item, $key){
|
|
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
|
$item['start_time'] = date('Y-m-d H:i:s', $item['start_time']);
|
|
$item['end_time'] = date('Y-m-d H:i:s', $item['end_time']);
|
|
$item['check_user'] = '-';
|
|
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_user'] = implode(',',$check_user);
|
|
}
|
|
return $item;
|
|
});
|
|
$this->apiSuccess('获取成功', $list);
|
|
}
|
|
|
|
//我处理的审批记录
|
|
public function list()
|
|
{
|
|
$this->checkAuth();
|
|
$this->uid = JWT_UID;
|
|
$param = get_params();
|
|
$status = isset($param['status'])?$param['status']:0;
|
|
$user_id = $this->uid;
|
|
//查询条件
|
|
$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)")];
|
|
|
|
if (!empty($param['type'])) {
|
|
$map1[] = ['f.type', '=', $param['type']];
|
|
$map2[] = ['f.type', '=', $param['type']];
|
|
}
|
|
if (!empty($param['uid'])) {
|
|
$map1[] = ['f.admin_id', '=', $param['uid']];
|
|
$map2[] = ['f.admin_id', '=', $param['uid']];
|
|
}
|
|
//按时间检索
|
|
if (!empty($param['apply_time'])) {
|
|
$apply_time =explode('~', $param['apply_time']);
|
|
$map1[] = ['f.create_time', 'between', [strtotime(urldecode($apply_time[0])),strtotime(urldecode($apply_time[1]))]];
|
|
$map2[] = ['f.create_time', 'between', [strtotime(urldecode($apply_time[0])),strtotime(urldecode($apply_time[1]))]];
|
|
}
|
|
|
|
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
|
|
|
if($status == 0){
|
|
$list = Db::name('Approve')
|
|
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
|
|
->alias('f')
|
|
->join('Admin a', 'a.id = f.admin_id', 'left')
|
|
->join('Department d', 'd.id = f.department_id', 'left')
|
|
->join('FlowType t', 't.id = f.type', 'left')
|
|
->whereOr([$map1,$map2])
|
|
->order('f.id desc')
|
|
->group('f.id')
|
|
->paginate(['list_rows' => $rows, 'query' => $param])
|
|
->each(function($item, $key){
|
|
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
|
$item['start_time'] = date('Y-m-d H:i:s', $item['start_time']);
|
|
$item['end_time'] = date('Y-m-d H:i:s', $item['end_time']);
|
|
$item['check_user'] = '-';
|
|
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_user'] = implode(',',$check_user);
|
|
}
|
|
return $item;
|
|
});
|
|
}
|
|
|
|
if($status == 1){
|
|
$list = Db::name('Approve')
|
|
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
|
|
->alias('f')
|
|
->join('Admin a', 'a.id = f.admin_id', 'left')
|
|
->join('Department d', 'd.id = f.department_id', 'left')
|
|
->join('FlowType t', 't.id = f.type', 'left')
|
|
->where($map1)
|
|
->order('f.id desc')
|
|
->group('f.id')
|
|
->paginate(['list_rows' => $rows, 'query' => $param])
|
|
->each(function($item, $key){
|
|
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
|
$item['start_time'] = date('Y-m-d H:i:s', $item['start_time']);
|
|
$item['end_time'] = date('Y-m-d H:i:s', $item['end_time']);
|
|
$item['check_user'] = '-';
|
|
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_user'] = implode(',',$check_user);
|
|
}
|
|
return $item;
|
|
});
|
|
}
|
|
if($status == 2){
|
|
$list = Db::name('Approve')
|
|
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
|
|
->alias('f')
|
|
->join('Admin a', 'a.id = f.admin_id', 'left')
|
|
->join('Department d', 'd.id = f.department_id', 'left')
|
|
->join('FlowType t', 't.id = f.type', 'left')
|
|
->where($map2)
|
|
->order('f.id desc')
|
|
->group('f.id')
|
|
->paginate(['list_rows' => $rows, 'query' => $param])
|
|
->each(function($item, $key){
|
|
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
|
$item['start_time'] = date('Y-m-d H:i:s', $item['start_time']);
|
|
$item['end_time'] = date('Y-m-d H:i:s', $item['end_time']);
|
|
$item['check_user'] = '-';
|
|
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_user'] = implode(',',$check_user);
|
|
}
|
|
return $item;
|
|
});
|
|
}
|
|
$this->apiSuccess('获取成功', $list);
|
|
|
|
}
|
|
|
|
//抄送给我的审批记录
|
|
public function copy()
|
|
{
|
|
$this->checkAuth();
|
|
$this->uid = JWT_UID;
|
|
$param = get_params();
|
|
$user_id = $this->uid;
|
|
//查询条件
|
|
$map = [];
|
|
$map[] = ['f.check_status', '=', 2];
|
|
$map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',f.copy_uids)")];
|
|
if (!empty($param['type'])) {
|
|
$map[] = ['f.type', '=', $param['type']];
|
|
}
|
|
if (!empty($param['uid'])) {
|
|
$map[] = ['f.admin_id', '=', $param['uid']];
|
|
}
|
|
//按时间检索
|
|
if (!empty($param['apply_time'])) {
|
|
$apply_time =explode('~', $param['apply_time']);
|
|
$map[] = ['f.create_time', 'between', [strtotime(urldecode($apply_time[0])),strtotime(urldecode($apply_time[1]))]];
|
|
}
|
|
|
|
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
|
$list = Db::name('Approve')
|
|
->field('f.*,a.name,d.title as department_name,t.title as flow_type')
|
|
->alias('f')
|
|
->join('Admin a', 'a.id = f.admin_id', 'left')
|
|
->join('Department d', 'd.id = f.department_id', 'left')
|
|
->join('FlowType t', 't.id = f.type', 'left')
|
|
->where($map)
|
|
->order('f.id desc')
|
|
->group('f.id')
|
|
->paginate(['list_rows' => $rows, 'query' => $param])
|
|
->each(function($item, $key){
|
|
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
|
$item['start_time'] = date('Y-m-d H:i:s', $item['start_time']);
|
|
$item['end_time'] = date('Y-m-d H:i:s', $item['end_time']);
|
|
$item['check_user'] = '-';
|
|
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_user'] = implode(',',$check_user);
|
|
}
|
|
return $item;
|
|
});
|
|
$this->apiSuccess('获取成功', $list);
|
|
}
|
|
|
|
private function getFlowField($type, $did)
|
|
{
|
|
// 动态表单展示
|
|
$flows = get_cate_department_flows($type, $did);
|
|
$flowMap = [];
|
|
foreach ($flows as $item) {
|
|
$flowMap[$item['id']] = $item['name'];
|
|
}
|
|
//获取审批字段
|
|
switch ($type)
|
|
{
|
|
case 1:
|
|
//请假
|
|
$field = [
|
|
'detail_type' => [
|
|
'title' => '请假类型',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '事假',
|
|
2 => '年假',
|
|
3 => '调休假',
|
|
4 => '病假',
|
|
5 => '婚假',
|
|
6 => '丧假',
|
|
7 => '产假',
|
|
8 => '陪产假',
|
|
9 => '其他',
|
|
],
|
|
],
|
|
'start_time' => [
|
|
'title' => '开始时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '结束时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'duration' => [
|
|
'title' => '请假工时',
|
|
'required' => false,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '请假事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 2:
|
|
//出差
|
|
$field = [
|
|
'start_time' => [
|
|
'title' => '开始时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '结束时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'address' => [
|
|
'title' => '出差地点',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '出差事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 3:
|
|
//外出
|
|
$field = [
|
|
'address' => [
|
|
'title' => '外出地点',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'start_time' => [
|
|
'title' => '开始时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '结束时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'duration' => [
|
|
'title' => '外出时长',
|
|
'required' => false,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '外出事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 4:
|
|
//加班
|
|
$field = [
|
|
'start_time' => [
|
|
'title' => '开始时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '结束时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '加班事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 5:
|
|
//会议室预定
|
|
$meetingList = oa_meeting_cate_column();
|
|
$field = [
|
|
'detail_type' => [
|
|
'title' => '选择会议室',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $meetingList,
|
|
],
|
|
'start_time' => [
|
|
'title' => '开始时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '结束时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 6:
|
|
//公文流转
|
|
$field = [
|
|
'name' => [
|
|
'title' => '文件名称',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_type' => [
|
|
'title' => '紧急程度',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '普通',
|
|
2 => '紧急',
|
|
3 => '特急',
|
|
],
|
|
],
|
|
'address' => [
|
|
'title' => '来文单位',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '来文日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '文件摘要',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 7:
|
|
//物品维修
|
|
$field = [
|
|
'name' => [
|
|
'title' => '设备名称',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_type' => [
|
|
'title' => '紧急程度',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '普通',
|
|
2 => '紧急',
|
|
3 => '特急',
|
|
],
|
|
],
|
|
'amount' => [
|
|
'title' => '预计维修费用',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '报修日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '故障描述',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 8:
|
|
//资质借用
|
|
$departmentList = get_department_column();
|
|
$field = [
|
|
'name' => [
|
|
'title' => '借用人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'mobile' => [
|
|
'title' => '借用人手机',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'department_type' => [
|
|
'title' => '借用部门',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $departmentList
|
|
],
|
|
'detail_type' => [
|
|
'title' => '借用类型',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '原件',
|
|
2 => '扫描件',
|
|
3 => '复印件',
|
|
]
|
|
],
|
|
'other_type' => [
|
|
'title' => '档案类型',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '公司资质',
|
|
2 => '人员资质',
|
|
3 => '离职/清退人员资质',
|
|
4 => '注册人员执业印章',
|
|
5 => '劳动合同',
|
|
6 => '社保缴费记录',
|
|
7 => '收入证明',
|
|
8 => '其它',
|
|
]
|
|
],
|
|
'content' => [
|
|
'title' => '所借档案用途',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'start_time' => [
|
|
'title' => '借用日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '拟归还日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '借用档案明细',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'remark1' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 9:
|
|
//用章
|
|
$cateList = oa_seal_cate_column();
|
|
$field = [
|
|
'detail_time' => [
|
|
'title' => '用印日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_type' => [
|
|
'title' => '印章类型',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $cateList
|
|
],
|
|
'name' => [
|
|
'title' => '文件名称',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'other_type' => [
|
|
'title' => '文件类型',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '公告类',
|
|
2 => '规则制度类',
|
|
3 => '合同类',
|
|
4 => '资质更新类',
|
|
5 => '员工证明',
|
|
6 => '其他',
|
|
],
|
|
],
|
|
'num' => [
|
|
'title' => '文件份数',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '用印事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 10:
|
|
//用车
|
|
$carList = oa_car_cate_column();
|
|
$field = [
|
|
'start_time' => [
|
|
'title' => '开始时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '结束时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'address' => [
|
|
'title' => '用车目的地',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_type' => [
|
|
'title' => '车辆选择',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $carList
|
|
],
|
|
'content' => [
|
|
'title' => '用车事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 11:
|
|
//用车归还
|
|
$carList = oa_car_cate_column();
|
|
$field = [
|
|
'detail_type' => [
|
|
'title' => '车辆选择',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $carList
|
|
],
|
|
'detail_time' => [
|
|
'title' => '归还时间',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'num' => [
|
|
'title' => '用车前公里数',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'num1' => [
|
|
'title' => '用车后公里数',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 12:
|
|
//借款申请
|
|
$cateList = oa_cost_cate_column();
|
|
$field = [
|
|
'amount' => [
|
|
'title' => '借款金额',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_type' => [
|
|
'title' => '借款类型',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $cateList
|
|
],
|
|
'detail_time' => [
|
|
'title' => '申请日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'name' => [
|
|
'title' => '借款人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'bank' => [
|
|
'title' => '银行账号',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'address' => [
|
|
'title' => '开户行',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '借款事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 13:
|
|
//付款申请
|
|
$field = [
|
|
'amount' => [
|
|
'title' => '付款金额',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_type' => [
|
|
'title' => '付款方式',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '银行卡',
|
|
2 => '现金',
|
|
3 => '汇票',
|
|
4 => '电汇',
|
|
5 => '贷记',
|
|
6 => '支票',
|
|
7 => '其他',
|
|
]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '付款日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'name' => [
|
|
'title' => '收款人全称',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'bank' => [
|
|
'title' => '银行账号',
|
|
'required' => false,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'address' => [
|
|
'title' => '开户行',
|
|
'required' => false,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '付款事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 14:
|
|
//奖励申请
|
|
$field = [
|
|
'amount' => [
|
|
'title' => '奖励金额',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '奖励日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '奖励事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 15:
|
|
//采购申请
|
|
$field = [
|
|
'name' => [
|
|
'title' => '物品名称',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '期望交付日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'num' => [
|
|
'title' => '物品数量',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'amount' => [
|
|
'title' => '采购金额',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '采购事由',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 16:
|
|
//活动经费
|
|
$field = [
|
|
'name' => [
|
|
'title' => '活动名称',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'amount' => [
|
|
'title' => '活动预算',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '活动说明',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'start_time' => [
|
|
'title' => '开始时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '结束时间',
|
|
'required' => true,
|
|
'type' => 'datetime',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 17:
|
|
//入职申请
|
|
$departmentList = get_department_column();
|
|
$positionList = get_position_column();
|
|
$field = [
|
|
'name' => [
|
|
'title' => '员工姓名',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '入职日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'num' => [
|
|
'title' => '手机号码',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'other_type' => [
|
|
'title' => '性别',
|
|
'required' => true,
|
|
'type' => 'radio',
|
|
'item' => [
|
|
1 => '男',
|
|
2 => '女',
|
|
]
|
|
],
|
|
'department_type' => [
|
|
'title' => '入职部门',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $departmentList
|
|
],
|
|
'position_type' => [
|
|
'title' => '担任职务',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $positionList
|
|
],
|
|
'remark' => [
|
|
'title' => '备注',
|
|
'required' => false,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 18:
|
|
//转正申请
|
|
$departmentList = get_department_column();
|
|
$positionList = get_position_column();
|
|
$field = [
|
|
'name' => [
|
|
'title' => '员工姓名',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '转正日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'department_type' => [
|
|
'title' => '所在部门',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $departmentList
|
|
],
|
|
'position_type' => [
|
|
'title' => '担任职务',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $positionList
|
|
],
|
|
'content' => [
|
|
'title' => '试用期评价',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 19:
|
|
//离职申请
|
|
$departmentList = get_department_column();
|
|
$positionList = get_position_column();
|
|
$field = [
|
|
'name' => [
|
|
'title' => '员工姓名',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '入职日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'department_type' => [
|
|
'title' => '所在部门',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $departmentList
|
|
],
|
|
'position_type' => [
|
|
'title' => '担任职务',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $positionList
|
|
],
|
|
'start_time' => [
|
|
'title' => '申请离职日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '预计离职日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '离职原因',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 20:
|
|
//转岗申请
|
|
$departmentList = get_department_column();
|
|
$positionList = get_position_column();
|
|
$field = [
|
|
'name' => [
|
|
'title' => '员工姓名',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_time' => [
|
|
'title' => '入职日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'department_type' => [
|
|
'title' => '所在部门',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $departmentList
|
|
],
|
|
'position_type' => [
|
|
'title' => '担任职务',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $positionList
|
|
],
|
|
'num' => [
|
|
'title' => '转岗后部门',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $departmentList
|
|
],
|
|
'num1' => [
|
|
'title' => '转岗后职务',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $positionList
|
|
],
|
|
'start_time' => [
|
|
'title' => '申请转岗日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'end_time' => [
|
|
'title' => '预计转岗日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '转岗原因',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 21:
|
|
//招聘需求
|
|
$departmentList = get_department_column();
|
|
$positionList = get_position_column();
|
|
$field = [
|
|
'department_type' => [
|
|
'title' => '招聘部门',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $departmentList
|
|
],
|
|
'detail_time' => [
|
|
'title' => '到岗日期',
|
|
'required' => true,
|
|
'type' => 'date',
|
|
'item' => (object)[]
|
|
],
|
|
'position_type' => [
|
|
'title' => '招聘岗位',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $positionList
|
|
],
|
|
'num' => [
|
|
'title' => '招聘人数',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'content' => [
|
|
'title' => '岗位职责',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'remark' => [
|
|
'title' => '任职要求',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
case 22:
|
|
//通用审批
|
|
$field = [
|
|
'name' => [
|
|
'title' => '审批内容',
|
|
'required' => true,
|
|
'type' => 'input',
|
|
'item' => (object)[]
|
|
],
|
|
'detail_type' => [
|
|
'title' => '紧急程度',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => [
|
|
1 => '普通',
|
|
2 => '紧急',
|
|
3 => '特急',
|
|
],
|
|
],
|
|
'content' => [
|
|
'title' => '详细描述',
|
|
'required' => true,
|
|
'type' => 'textarea',
|
|
'item' => (object)[]
|
|
],
|
|
'file_ids' => [
|
|
'title' => '附件',
|
|
'required' => false,
|
|
'type' => 'file',
|
|
'item' => (object)[]
|
|
],
|
|
'flow_id' => [
|
|
'title' => '审批流程',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => $flowMap
|
|
],
|
|
'check_admin_ids' => [
|
|
'title' => '审核人',
|
|
'required' => true,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
'copy_uids' => [
|
|
'title' => '抄送人',
|
|
'required' => false,
|
|
'type' => 'select',
|
|
'item' => (object)[]
|
|
],
|
|
];
|
|
break;
|
|
default:
|
|
$field = [];
|
|
}
|
|
return $field;
|
|
}
|
|
|
|
}
|