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.
 
 
 
 
 
 

128 lines
4.0 KiB

<?php
class StartNode extends CommonFlowNode
{
function __construct($param)
{
parent::__construct($param);
}
/**
* 获取退回选项
* @return mixed|null
*/
public function getBackOption()
{
return empty($this->nodeProperty['backOption'])
? null : $this->nodeProperty['backOption'];
}
public function getAssignerList()
{
$strAssigner = $this->getAssigner();
//B4-退回:73376,73502,73396|A4-待评估:73376,73502|
$assignerList = array();
$arr_a = explode('|', $strAssigner);
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]);
$strNextUser = "";
foreach ($arr_c as $key => $value) {
if (empty($value)) {
continue;
}
if ($value == '00000') {
$strNextUser .= "00000" . '-' . "00000,";
} else {
$strNextUser .= AssignerStringParser::process($value);
}
}
array_push($assignerList, array($val[0], $strNextUser));
}
return $assignerList;
}
/**
* @return string
*/
public function getAssignStatus()
{
//B4-退回:73376,73502,73396|A4-待评估:73376,73502|
$strAssigner = $this->getAssigner();
$html = "'<option value=00000 >请选择</option>'";
$arr_a = explode('|', $strAssigner);
foreach ($arr_a as $key => $value) {
if (empty($value)) {
continue;
}
$arr_b = explode(':', $value); //B4-退回:73376,73502,73396
$val = explode('-', $arr_b[0]);
$html .= "<option value=" . $val[0] . ">" . $arr_b[0] . "</option>";
}
return $html;
}
/**
* 获取附加的签核人员
* @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));
return $nextAssigner;
}
/**
* 检查是否满足流转下一关条件
* @param $assignClass
* @param $leadCode
* @return bool
*/
function checkTrust($assignClass, $leadCode)
{
$_flag = false;
switch ($assignClass) {
case 'A': //无需审核
$_flag = true;
break;
case 'B': //审核至科长
$_flag = (in_array($leadCode, array('50', '20', '19', '18', '17', '16', '15', '12', '11', '10')) ? true : false);
break;
case 'C': //审核至经理
$_flag = in_array($leadCode, array('20', '19', '18', '17', '15', '16', '12', '11', '10')) ? true : false;
break;
case 'D': //审核至 协理/厂长/总监
$_flag = in_array($leadCode, array('19', '18', '17', '16', '15', '12', '11', '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(html_entity_decode($this->getAssignClassMethod())));
// var_dump($this->getFormData());
$_assignClass = $method->invokeMethod($this->getFlow(), $this->getFormData());
$_flag = $this->checkTrust($_assignClass, $leadCode);
break;
default:
$_flag = false;
break;
}
return $_flag;
}
}