更新审核机制

This commit is contained in:
yaooo 2023-11-18 13:50:58 +08:00
parent 4821d3728a
commit 95793298c9
7 changed files with 182 additions and 10 deletions

View File

@ -561,6 +561,25 @@ class Common extends ApiController
if(!empty($flowData)){ if(!empty($flowData)){
foreach ($flowData as $key => &$val) { foreach ($flowData as $key => &$val) {
$val['user_id_info'] = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray(); $val['user_id_info'] = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray();
$val['flow_type_txt'] = '';
if($val['flow_type'] == 1){
$val['flow_type_txt'] = '当前部门负责人';
}
if($val['flow_type'] == 2){
$val['flow_type_txt'] = '上级部门负责人';
}
if($val['flow_type'] == 3){
$val['flow_type_txt'] = '指定人员或签';
}
if($val['flow_type'] == 4){
$val['flow_type_txt'] = '指定人员会签';
}
if($val['flow_type'] == 5){
$val['flow_type_txt'] = '当前部门分管领导';
}
if($val['flow_type'] == 6){
$val['flow_type_txt'] = '上级部门分管领导';
}
} }
} }
$data['copy_uids'] = $flow['copy_uids']; $data['copy_uids'] = $flow['copy_uids'];

View File

@ -146,6 +146,45 @@ class FinanceExpense extends ApiController
$flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list'); $flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list');
$flow = unserialize($flow_list); $flow = unserialize($flow_list);
if (!isset($param['check_admin_ids'])) { if (!isset($param['check_admin_ids'])) {
foreach($flow as $item) {
// 当前部门负责人
if ($item['flow_type'] == 1) {
$manager_id = Db::name('department')->where('id', $this->did)->value('manager_id');
if (empty($manager_id)) {
$this->apiError('当前部门负责人不存在');
}
}
// 上一级部门负责人
if ($item['flow_type'] == 2) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
$this->apiError('上一级部门不存在');
}
$manager_id = Db::name('department')->where('id', $pid)->value('manager_id');
if (empty($manager_id)) {
$this->apiError('上一级部门负责人不存在');
}
}
// 当前部门分管领导
if ($item['flow_type'] == 5) {
$leader_id = Db::name('department')->where('id', $this->did)->value('leader_id');
if (empty($leader_id)) {
$this->apiError('当前部门分管领导不存在');
}
}
// 上一级部门分管领导
if ($item['flow_type'] == 6) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
$this->apiError('上一级部门不存在');
}
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
if (empty($leader_id)) {
$this->apiError('当前部门分管领导不存在');
}
}
}
/*
if($flow[0]['flow_type'] == 1){ if($flow[0]['flow_type'] == 1){
//部门负责人 //部门负责人
$leader = get_department_leader($admin_id); $leader = get_department_leader($admin_id);
@ -160,6 +199,7 @@ class FinanceExpense extends ApiController
$this->apiError('审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员'); $this->apiError('审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员');
} }
} }
*/
} }
$dbRes = false; $dbRes = false;

View File

@ -173,6 +173,44 @@ class FinanceInvoice extends ApiController
$this->apiError("银行地址不能为空"); $this->apiError("银行地址不能为空");
} }
} }
foreach($flow as $item) {
// 当前部门负责人
if ($item['flow_type'] == 1) {
$manager_id = Db::name('department')->where('id', $this->did)->value('manager_id');
if (empty($manager_id)) {
$this->apiError('当前部门负责人不存在');
}
}
// 上一级部门负责人
if ($item['flow_type'] == 2) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
$this->apiError('上一级部门不存在');
}
$manager_id = Db::name('department')->where('id', $pid)->value('manager_id');
if (empty($manager_id)) {
$this->apiError('上一级部门负责人不存在');
}
}
// 当前部门分管领导
if ($item['flow_type'] == 5) {
$leader_id = Db::name('department')->where('id', $this->did)->value('leader_id');
if (empty($leader_id)) {
$this->apiError('当前部门分管领导不存在');
}
}
// 上一级部门分管领导
if ($item['flow_type'] == 6) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
$this->apiError('上一级部门不存在');
}
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
if (empty($leader_id)) {
$this->apiError('当前部门分管领导不存在');
}
}
}
if (!empty($param['id']) && $param['id'] > 0) { if (!empty($param['id']) && $param['id'] > 0) {
try { try {
validate(InvoiceCheck::class)->scene('edit')->check($param); validate(InvoiceCheck::class)->scene('edit')->check($param);

View File

@ -152,41 +152,39 @@ class OaApprove extends ApiController
if ($item['flow_type'] == 1) { if ($item['flow_type'] == 1) {
$manager_id = Db::name('department')->where('id', $this->did)->value('manager_id'); $manager_id = Db::name('department')->where('id', $this->did)->value('manager_id');
if (empty($manager_id)) { if (empty($manager_id)) {
return to_assign(1,'当前部门负责人不存在'); $this->apiError('当前部门负责人不存在');
} }
} }
// 上一级部门负责人 // 上一级部门负责人
if ($item['flow_type'] == 2) { if ($item['flow_type'] == 2) {
$pid = Db::name('department')->where('id', $this->did)->value('pid'); $pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) { if (empty($pid)) {
return to_assign(1,'上一级部门不存在'); $this->apiError('上一级部门不存在');
} }
$manager_id = Db::name('department')->where('id', $pid)->value('manager_id'); $manager_id = Db::name('department')->where('id', $pid)->value('manager_id');
if (empty($manager_id)) { if (empty($manager_id)) {
return to_assign(1,'上一级部门负责人不存在'); $this->apiError('上一级部门负责人不存在');
} }
} }
// 当前部门分管领导 // 当前部门分管领导
if ($item['flow_type'] == 5) { if ($item['flow_type'] == 5) {
$leader_id = Db::name('department')->where('id', $this->did)->value('leader_id'); $leader_id = Db::name('department')->where('id', $this->did)->value('leader_id');
if (empty($leader_id)) { if (empty($leader_id)) {
return to_assign(1,'当前部门分管领导不存在'); $this->apiError('当前部门分管领导不存在');
} }
} }
// 上一级部门分管领导 // 上一级部门分管领导
if ($item['flow_type'] == 6) { if ($item['flow_type'] == 6) {
$pid = Db::name('department')->where('id', $this->did)->value('pid'); $pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) { if (empty($pid)) {
return to_assign(1,'上一级部门不存在'); $this->apiError('上一级部门不存在');
} }
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id'); $leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
if (empty($leader_id)) { if (empty($leader_id)) {
return to_assign(1,'当前部门分管领导不存在'); $this->apiError('当前部门分管领导不存在');
} }
} }
} }
if (!empty($param['id']) && $param['id'] > 0) { if (!empty($param['id']) && $param['id'] > 0) {
$param['update_time'] = time(); $param['update_time'] = time();
$param['check_status'] = 0; $param['check_status'] = 0;

View File

@ -152,7 +152,47 @@ class Expense extends BaseController
$flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list'); $flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list');
$flow = unserialize($flow_list); $flow = unserialize($flow_list);
halt($flow);
if (!isset($param['check_admin_ids'])) { if (!isset($param['check_admin_ids'])) {
foreach($flow as $item) {
// 当前部门负责人
if ($item['flow_type'] == 1) {
$manager_id = Db::name('department')->where('id', $this->did)->value('manager_id');
if (empty($manager_id)) {
return to_assign(1,'当前部门负责人不存在');
}
}
// 上一级部门负责人
if ($item['flow_type'] == 2) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
return to_assign(1,'上一级部门不存在');
}
$manager_id = Db::name('department')->where('id', $pid)->value('manager_id');
if (empty($manager_id)) {
return to_assign(1,'上一级部门负责人不存在');
}
}
// 当前部门分管领导
if ($item['flow_type'] == 5) {
$leader_id = Db::name('department')->where('id', $this->did)->value('leader_id');
if (empty($leader_id)) {
return to_assign(1,'当前部门分管领导不存在');
}
}
// 上一级部门分管领导
if ($item['flow_type'] == 6) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
return to_assign(1,'上一级部门不存在');
}
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
if (empty($leader_id)) {
return to_assign(1,'当前部门分管领导不存在');
}
}
}
/*
if($flow[0]['flow_type'] == 1){ if($flow[0]['flow_type'] == 1){
//部门负责人 //部门负责人
$leader = get_department_leader($admin_id); $leader = get_department_leader($admin_id);
@ -167,6 +207,7 @@ class Expense extends BaseController
return to_assign(1,'审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员'); return to_assign(1,'审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员');
} }
} }
*/
} }
$dbRes = false; $dbRes = false;

View File

@ -152,6 +152,44 @@ class Invoice extends BaseController
return to_assign(1, '银行地址不能为空'); return to_assign(1, '银行地址不能为空');
} }
} }
foreach($flow as $item) {
// 当前部门负责人
if ($item['flow_type'] == 1) {
$manager_id = Db::name('department')->where('id', $this->did)->value('manager_id');
if (empty($manager_id)) {
return to_assign(1,'当前部门负责人不存在');
}
}
// 上一级部门负责人
if ($item['flow_type'] == 2) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
return to_assign(1,'上一级部门不存在');
}
$manager_id = Db::name('department')->where('id', $pid)->value('manager_id');
if (empty($manager_id)) {
return to_assign(1,'上一级部门负责人不存在');
}
}
// 当前部门分管领导
if ($item['flow_type'] == 5) {
$leader_id = Db::name('department')->where('id', $this->did)->value('leader_id');
if (empty($leader_id)) {
return to_assign(1,'当前部门分管领导不存在');
}
}
// 上一级部门分管领导
if ($item['flow_type'] == 6) {
$pid = Db::name('department')->where('id', $this->did)->value('pid');
if (empty($pid)) {
return to_assign(1,'上一级部门不存在');
}
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
if (empty($leader_id)) {
return to_assign(1,'当前部门分管领导不存在');
}
}
}
if (!empty($param['id']) && $param['id'] > 0) { if (!empty($param['id']) && $param['id'] > 0) {
try { try {
validate(InvoiceCheck::class)->scene('edit')->check($param); validate(InvoiceCheck::class)->scene('edit')->check($param);

View File

@ -291,9 +291,7 @@ class Approve extends BaseController
return to_assign(1,'当前部门分管领导不存在'); return to_assign(1,'当前部门分管领导不存在');
} }
} }
} }
if ($param['id'] > 0) { if ($param['id'] > 0) {
$param['update_time'] = time(); $param['update_time'] = time();
$param['check_status'] = 0; $param['check_status'] = 0;