fix: 任务负责人无法修改子任务的问题

This commit is contained in:
kuaifan
2021-12-23 23:20:04 +08:00
parent 41eb28992e
commit 08234afe4f
2 changed files with 24 additions and 6 deletions

View File

@@ -629,6 +629,24 @@ class ProjectTask extends AbstractModel
return $user->owner ? 2 : 1;
}
/**
* 是否负责人
* @param bool $isParent 是父级任务的负责人也算
* @return bool
*/
public function isOwnerParent($isParent = true) {
if ($this->owner) {
return true;
}
if ($isParent && $this->parent_id > 0) {
$parentTask = self::find($this->parent_id);
if ($parentTask?->owner) {
return true;
}
}
return false;
}
/**
* 标记已完成、未完成
* @param Carbon|null $complete_at 完成时间