更新审核机制
This commit is contained in:
parent
c8fb615970
commit
8e861aa10a
|
@ -180,7 +180,7 @@ class FinanceExpense extends ApiController
|
|||
}
|
||||
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
|
||||
if (empty($leader_id)) {
|
||||
$this->apiError('当前部门分管领导不存在');
|
||||
$this->apiError('上一级部门分管领导不存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ class FinanceInvoice extends ApiController
|
|||
}
|
||||
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
|
||||
if (empty($leader_id)) {
|
||||
$this->apiError('当前部门分管领导不存在');
|
||||
$this->apiError('上一级部门分管领导不存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ class OaApprove extends ApiController
|
|||
}
|
||||
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
|
||||
if (empty($leader_id)) {
|
||||
$this->apiError('当前部门分管领导不存在');
|
||||
$this->apiError('上一级部门分管领导不存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ function get_department_son($did = 0, $is_self = 1)
|
|||
return $department_array;
|
||||
}
|
||||
|
||||
//读取员工所在部门的负责人(pid=1,上一级负责人)
|
||||
//读取员工所在部门的分管领导(pid=1,上一级负责人)
|
||||
function get_department_leader($uid=0,$pid=0)
|
||||
{
|
||||
$did = get_admin($uid)['did'];
|
||||
|
@ -228,6 +228,25 @@ function get_department_leader($uid=0,$pid=0)
|
|||
return $leader;
|
||||
}
|
||||
|
||||
//读取员工所在部门的负责人(pid=1,上一级负责人)
|
||||
function get_department_manager($uid=0,$pid=0)
|
||||
{
|
||||
$did = get_admin($uid)['did'];
|
||||
if($pid==0){
|
||||
$manager = Db::name('Department')->where(['id' => $did])->value('manager_id');
|
||||
}
|
||||
else{
|
||||
$pdid = Db::name('Department')->where(['id' => $did])->value('pid');
|
||||
if($pdid == 0){
|
||||
$manager = 0;
|
||||
}
|
||||
else{
|
||||
$manager = Db::name('Department')->where(['id' => $pdid])->value('manager_id');
|
||||
}
|
||||
}
|
||||
return $manager;
|
||||
}
|
||||
|
||||
//读取部门负责人所在部门的数据权限【包括员工所在部门+其子部门】
|
||||
function get_department_role($uid = 0)
|
||||
{
|
||||
|
@ -340,19 +359,39 @@ function set_flow($flow_id,$check_admin_ids,$uid)
|
|||
if ($check_type == 1) {
|
||||
if($flow[0]['flow_type'] == 1){
|
||||
//部门负责人
|
||||
$manager = get_department_manager($uid);
|
||||
if($manager == 0){
|
||||
return to_assign(1,'审批流程设置有问题:当前部门负责人还未设置,请联系HR或者管理员');
|
||||
}
|
||||
else{
|
||||
$check_admin_ids = $manager;
|
||||
}
|
||||
}
|
||||
else if($flow[0]['flow_type'] == 2){
|
||||
//上级部门负责人
|
||||
$manager = get_department_manager($uid,1);
|
||||
if($manager == 0){
|
||||
return to_assign(1,'审批流程设置有问题:上级部门负责人还未设置,请联系HR或者管理员');
|
||||
}
|
||||
else{
|
||||
$check_admin_ids = $manager;
|
||||
}
|
||||
}
|
||||
else if($flow[0]['flow_type'] == 5){
|
||||
//部门分管领导
|
||||
$leader = get_department_leader($uid);
|
||||
if($leader == 0){
|
||||
return to_assign(1,'审批流程设置有问题:当前部门负责人还未设置,请联系HR或者管理员');
|
||||
return to_assign(1,'审批流程设置有问题:部门分管领导还未设置,请联系HR或者管理员');
|
||||
}
|
||||
else{
|
||||
$check_admin_ids = $leader;
|
||||
}
|
||||
}
|
||||
else if($flow[0]['flow_type'] == 2){
|
||||
//上级部门负责人
|
||||
else if($flow[0]['flow_type'] == 6){
|
||||
//上级部门分管领导
|
||||
$leader = get_department_leader($uid,1);
|
||||
if($leader == 0){
|
||||
return to_assign(1,'审批流程设置有问题:上级部门负责人还未设置,请联系HR或者管理员');
|
||||
return to_assign(1,'审批流程设置有问题:上级部门分管领导还未设置,请联系HR或者管理员');
|
||||
}
|
||||
else{
|
||||
$check_admin_ids = $leader;
|
||||
|
@ -385,10 +424,18 @@ function get_flow($uid,$flows)
|
|||
$check_user_ids = [];
|
||||
if($flows['flow_type']==1){
|
||||
$check_user = '部门负责人-';
|
||||
$check_user_ids[]=get_department_leader($uid);
|
||||
$check_user_ids[]=get_department_manager($uid);
|
||||
}
|
||||
else if($flows['flow_type']==2){
|
||||
$check_user = '上级部门负责人-';
|
||||
$check_user_ids[]=get_department_manager($uid,1);
|
||||
}
|
||||
else if($flows['flow_type']==5){
|
||||
$check_user = '部门分管领导-';
|
||||
$check_user_ids[]=get_department_leader($uid);
|
||||
}
|
||||
else if($flows['flow_type']==6){
|
||||
$check_user = '上级部门分管领导-';
|
||||
$check_user_ids[]=get_department_leader($uid,1);
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -187,7 +187,7 @@ class Expense extends BaseController
|
|||
}
|
||||
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
|
||||
if (empty($leader_id)) {
|
||||
return to_assign(1,'当前部门分管领导不存在');
|
||||
return to_assign(1,'上一级部门分管领导不存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ class Invoice extends BaseController
|
|||
}
|
||||
$leader_id = Db::name('department')->where('id', $pid)->value('leader_id');
|
||||
if (empty($leader_id)) {
|
||||
return to_assign(1,'当前部门分管领导不存在');
|
||||
return to_assign(1,'上一级部门分管领导不存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,38 +257,30 @@ class Approve extends BaseController
|
|||
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)) {
|
||||
$manager = get_department_manager($this->uid);
|
||||
if (empty($manager)) {
|
||||
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,'上一级部门负责人不存在');
|
||||
$manager = get_department_manager($this->uid, 1);
|
||||
if (empty($manager)) {
|
||||
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)) {
|
||||
$leader = get_department_leader($this->uid);
|
||||
if (empty($leader)) {
|
||||
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,'当前部门分管领导不存在');
|
||||
$leader = get_department_leader($this->uid, 1);
|
||||
if (empty($leader)) {
|
||||
return to_assign(1,'上级部门分管领导不存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -368,23 +360,23 @@ class Approve extends BaseController
|
|||
if (!isset($param['check_admin_ids'])) {
|
||||
if($flow[0]['flow_type'] == 1){
|
||||
// 部门负责人
|
||||
$leader = get_department_leader($this->uid);
|
||||
if($leader == 0){
|
||||
return to_assign(1,'当前部门负责人还未设置,请联系HR或者管理员');
|
||||
}
|
||||
else{
|
||||
$param['check_admin_ids'] = $leader;
|
||||
}
|
||||
$manager = get_department_manager($this->uid);
|
||||
$param['check_admin_ids'] = $manager;
|
||||
}
|
||||
else if($flow[0]['flow_type'] == 2){
|
||||
// 上级部门负责人
|
||||
$leader = get_department_leader($this->uid,1);
|
||||
if($leader == 0){
|
||||
return to_assign(1,'上级部门负责人还未设置,请联系HR或者管理员');
|
||||
$manager = get_department_manager($this->uid, 1);
|
||||
$param['check_admin_ids'] = $manager;
|
||||
}
|
||||
else{
|
||||
else if($flow[0]['flow_type'] == 5){
|
||||
// 部门分管领导
|
||||
$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'];
|
||||
|
|
Loading…
Reference in New Issue