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.
199 lines
5.1 KiB
199 lines
5.1 KiB
<?php
|
|
|
|
class CounterSignTask extends Node
|
|
{
|
|
private $flow;
|
|
private $formData;
|
|
|
|
public function __construct($param)
|
|
{
|
|
parent::__construct($param);
|
|
}
|
|
|
|
/**
|
|
* 指派属性
|
|
*/
|
|
public function getPropertyAllowAssign()
|
|
{
|
|
return $this->nodeProperty['allowAssign'];
|
|
}
|
|
|
|
/**
|
|
* 转交属性
|
|
*/
|
|
public function getPropertyAllowPassTo()
|
|
{
|
|
return $this->nodeProperty['allowPassTo'];
|
|
}
|
|
|
|
public function getFlowCode()
|
|
{
|
|
return $this->nodeProperty['flowCode'];
|
|
}
|
|
|
|
public function getAssigner()
|
|
{
|
|
return $this->nodeProperty['assigner'];
|
|
}
|
|
|
|
public function getMergeOption()
|
|
{
|
|
return $this->nodeProperty['mergeOption'];
|
|
}
|
|
|
|
public function getBackOption()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* 1.获取拆分人员
|
|
* @return array
|
|
*/
|
|
|
|
function getSplitMemers($workFlowParser)
|
|
{
|
|
$strAssign = $this->getAssigner();
|
|
$assignEmps = array();
|
|
$arr_a = explode('|', $strAssign);
|
|
foreach ($arr_a as $key => $value) {
|
|
if (empty($value)) {
|
|
continue;
|
|
}
|
|
$arr_b = explode(':', $value);
|
|
$val = explode('-', $arr_b[0]);
|
|
$arr_c = explode(',', $arr_b[1]);
|
|
$str_next_user = "";
|
|
foreach ($arr_c as $key => $value) {
|
|
if (empty($value)) {
|
|
continue;
|
|
}
|
|
$str_next_user .= AssignerStringParser::process($value);
|
|
}
|
|
array_push($assignEmps, array(
|
|
$val[0], //assign_status
|
|
$str_next_user
|
|
));
|
|
}
|
|
return $assignEmps;
|
|
}
|
|
|
|
/**
|
|
* 获取签核类别
|
|
*/
|
|
public function getAssignClass()
|
|
{
|
|
$childFlow = SubflowManager::getChildNode($this->flow->formKey);
|
|
$leadCode = Employee::lead_code($childFlow['leader_no']);
|
|
if ($leadCode >= '80') return 'A';
|
|
if (in_array($leadCode, array('50', '20', '19', '18', '17', '16', '12', '10'))) return 'B';
|
|
if (in_array($leadCode, array('20', '19', '18', '17', '16', '12', '10'))) return 'C';
|
|
if (in_array($leadCode, array('19', '18', '17', '16', '12', '10'))) return 'D';
|
|
if (in_array($leadCode, array('12', '10'))) return 'E';
|
|
if (substr($leadCode, 0, 2) == '10') return 'F';
|
|
}
|
|
|
|
/**
|
|
* 检查是否满足流转下一关条件
|
|
* @param $assignClass
|
|
* @param $leadCode
|
|
* @return bool
|
|
*/
|
|
function checkTrust($assignClass, $leadCode)
|
|
{
|
|
|
|
# 默认不可签回
|
|
$flowContext = unserialize($_SESSION['flowContext']);
|
|
$_flag = false;
|
|
$assignStatus = $flowContext->getAssignStatus();
|
|
#如果签核节点assign_status 在定义的同层签核节点当中则不可签回
|
|
if (in_array($assignStatus, AssignStatus::$same_level_status)) {
|
|
return $_flag;
|
|
}
|
|
#获取当前签核者字符串
|
|
$childFlow = SubflowManager::getChildNode($this->flow->formKey);
|
|
$currentAssigner = Subflow::getCurrentUser($this->flow->formKey);
|
|
if ($currentAssigner == $childFlow['leader_no']) {
|
|
#当前人员是被会签人员,可签回
|
|
$_flag = true;
|
|
} elseif ($leadCode < Employee::lead_code($currentAssigner)) {
|
|
#当前人员的岗位比被会签人员职位高,可签回
|
|
$_flag = true;
|
|
}
|
|
|
|
return $_flag;
|
|
}
|
|
|
|
public function getAssignerList(WorkFlowParser $fc)
|
|
{
|
|
$str_next_user = "00000-各部门,";
|
|
$assigner = array();
|
|
array_push($assigner, array(
|
|
"X3", //assign_status
|
|
$str_next_user
|
|
));
|
|
return $assigner;
|
|
}
|
|
|
|
/**
|
|
* 获取部门的签核人员
|
|
* @param $userId
|
|
* @return array
|
|
*/
|
|
public function getDepartmentalAssignerList($userId)
|
|
{
|
|
|
|
$leader = Employee::leader($userId);
|
|
|
|
$nextAssignerStr = Employee::get_employee($leader, $format = "employee_no-name");
|
|
$nextAssigner = array(0 => array(0 => "F6", 1 => $nextAssignerStr));
|
|
|
|
$subordinates = Employee::subordinates($userId);
|
|
|
|
if (count($subordinates) > 0) {
|
|
$nextAssignerStr = "";
|
|
foreach ($subordinates as $empl) {
|
|
$nextAssignerStr .= Employee::get_employee($empl, $format = "employee_no-name") . ',';
|
|
}
|
|
array_push($nextAssigner, array(0 => 'FH', 1 => $nextAssignerStr));
|
|
}
|
|
return $nextAssigner;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getFlow()
|
|
{
|
|
return $this->flow;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $flow
|
|
* @return CounterSignTask
|
|
*/
|
|
public function setFlow($flow)
|
|
{
|
|
$this->flow = $flow;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getFormData()
|
|
{
|
|
return $this->formData;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $formData
|
|
* @return CounterSignTask
|
|
*/
|
|
public function setFormData($formData)
|
|
{
|
|
$this->formData = $formData;
|
|
|
|
return $this;
|
|
}
|
|
}
|
|
|