You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
3.7 KiB
157 lines
3.7 KiB
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: user
|
|
* Date: 2019/2/22
|
|
* Time: 23:23
|
|
*/
|
|
require_once 'Node.php';
|
|
class CommonFlowNode extends Node
|
|
{
|
|
private $flow;
|
|
private $formData;
|
|
|
|
function __construct($param)
|
|
{
|
|
parent::__construct($param);
|
|
}
|
|
|
|
/**
|
|
* 获取节点内的FlowCode
|
|
* @return mixed
|
|
*/
|
|
public function getFlowCode()
|
|
{
|
|
return $this->nodeProperty['flowCode'];
|
|
}
|
|
|
|
/**
|
|
* 获取节点内设置的签核人员列表
|
|
* @return mixed
|
|
*/
|
|
public function getAssigner()
|
|
{
|
|
return $this->nodeProperty['assigner'];
|
|
}
|
|
|
|
/**
|
|
* 获取代理人设置
|
|
* @return mixed
|
|
*/
|
|
public function getAgentSetting()
|
|
{
|
|
return $this->nodeProperty['agentSetting'];
|
|
}
|
|
|
|
/**
|
|
* 获取签核类别
|
|
* @return mixed
|
|
*/
|
|
public function getAssignClass()
|
|
{
|
|
return $this->nodeProperty['assignClass'];
|
|
}
|
|
|
|
public function getAssignClassMethod()
|
|
{
|
|
return $this->nodeProperty['assignClassMethod'];
|
|
}
|
|
|
|
/**
|
|
* 获取退回选项
|
|
* @return mixed
|
|
*/
|
|
public function getBackOption()
|
|
{
|
|
return $this->nodeProperty['backOption'];
|
|
}
|
|
|
|
/**
|
|
* 获取流程实例
|
|
* @return mixed
|
|
*/
|
|
public function getFlow()
|
|
{
|
|
return $this->flow;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $flow
|
|
* @return CommonFlowNode
|
|
*/
|
|
public function setFlow($flow)
|
|
{
|
|
$this->flow = $flow;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* 设置FLow实例
|
|
* @return mixed
|
|
*/
|
|
public function getFormData()
|
|
{
|
|
return $this->formData;
|
|
}
|
|
|
|
/**
|
|
* 设置表单数据
|
|
* @param mixed $formData
|
|
* @return CommonFlowNode
|
|
*/
|
|
public function setFormData($formData)
|
|
{
|
|
$this->formData = $formData;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* 检查是否满足流转下一关条件
|
|
* @param $assignClass
|
|
* @param $leadCode
|
|
* @return bool
|
|
*/
|
|
function checkTrust($assignClass, $leadCode)
|
|
{
|
|
$_flag = false;
|
|
$flowContext = unserialize($_SESSION['flowContext']);
|
|
$assignStatus = $flowContext->getAssignStatus();
|
|
#如果签核节点assign_status 在定义的同层签核节点当中则不可签回
|
|
if (in_array($assignStatus, AssignStatus::$same_level_status)) {
|
|
return $_flag;
|
|
}
|
|
switch ($assignClass) {
|
|
case 'A': //无需审核
|
|
$_flag = true;
|
|
break;
|
|
case 'B': //审核至科长
|
|
$_flag = (in_array($leadCode, array('50', '20', '19', '18', '17', '16', '12', '10')) ? true : false);
|
|
|
|
break;
|
|
case 'C': //审核至经理
|
|
$_flag = in_array($leadCode, array('20', '19', '18', '17', '16', '12', '10')) ? true : false;
|
|
break;
|
|
case 'D': //审核至 协理/厂长/总监
|
|
$_flag = in_array($leadCode, array('19', '18', '17', '16', '12', '10')) ? true : false;
|
|
break;
|
|
case 'E': //审核至副总
|
|
$_flag = in_array($leadCode, array('12', '10')) ? true : false;
|
|
break;
|
|
case 'F': //审核至总经理
|
|
$_flag = substr($leadCode, 0, 2) == '10' ? true : false;
|
|
break;
|
|
case 'X':
|
|
$method = MethodLoader::getInstanceByMethodString(strip_tags($this->getAssignClassMethod()));
|
|
$_assignClass = $method->invokeMethod($this->getFlow(), $this->getFormData());
|
|
$_flag = $this->checkTrust($_assignClass, $leadCode);
|
|
break;
|
|
default:
|
|
$_flag = false;
|
|
break;
|
|
}
|
|
|
|
|
|
return $_flag;
|
|
}
|
|
}
|
|
|