feat: 工作流程状态支持仅限状态负责人修改

This commit is contained in:
kuaifan
2022-01-12 16:16:04 +08:00
parent f2180b22c7
commit f80b9cdca5
9 changed files with 83 additions and 13 deletions

View File

@@ -1618,6 +1618,14 @@ class ProjectController extends AbstractController
$id = intval($item['id']);
$turns = Base::arrayRetainInt($item['turns'] ?: [], true);
$userids = Base::arrayRetainInt($item['userids'] ?: [], true);
$usertype = trim($item['usertype']);
$userlimit = intval($item['userlimit']);
if ($usertype == 'replace' && empty($userids)) {
throw new ApiException("状态[{$item['name']}]设置错误,设置流转模式时必须填写状态负责人");
}
if ($userlimit && empty($userids)) {
throw new ApiException("状态[{$item['name']}]设置错误,设置限制负责人时必须填写状态负责人");
}
$flow = ProjectFlowItem::updateInsert([
'id' => $id,
'project_id' => $project->id,
@@ -1628,7 +1636,8 @@ class ProjectController extends AbstractController
'sort' => intval($item['sort']),
'turns' => $turns,
'userids' => $userids,
'usertype' => $item['usertype'],
'usertype' => trim($item['usertype']),
'userlimit' => $userlimit,
]);
if ($flow) {
$ids[] = $flow->id;