This commit is contained in:
weiz 2024-03-18 11:36:59 +08:00
parent 23b121d499
commit 9a86b8d49a
2 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,7 @@ namespace app\adminapi\lists\task;
use app\adminapi\lists\BaseAdminDataLists; use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface; use app\common\lists\ListsExcelInterface;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\task\TaskAllocation; use app\common\model\task\TaskAllocation;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
@ -40,7 +41,6 @@ class TaskAllocationLists extends BaseAdminDataLists implements ListsSearchInter
{ {
return [ return [
'=' => ['cost_project_id'], '=' => ['cost_project_id'],
]; ];
} }
@ -59,7 +59,10 @@ class TaskAllocationLists extends BaseAdminDataLists implements ListsSearchInter
return TaskAllocation::where($this->searchWhere)->with(['taskTypeInfo', 'projectInfo']) return TaskAllocation::where($this->searchWhere)->with(['taskTypeInfo', 'projectInfo'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select() ->select()->each(function($data){
$contract = CostApprovedProject::field('project_director')->where('id',$data['projectInfo']['contract_id'])->findOrEmpty();
$data['project_director'] = $contract['project_director'];
})
->toArray(); ->toArray();
} }

View File

@ -16,6 +16,7 @@ namespace app\adminapi\logic\task;
use app\adminapi\logic\TaskDetailLogic; use app\adminapi\logic\TaskDetailLogic;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\task\TaskAllocation; use app\common\model\task\TaskAllocation;
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use app\common\model\task\TaskType; use app\common\model\task\TaskType;
@ -139,6 +140,8 @@ class TaskAllocationLogic extends BaseLogic
public static function detail($params): array public static function detail($params): array
{ {
$data = TaskAllocation::with(['taskTypeInfo', 'projectInfo'])->findOrEmpty($params['id'])->toArray(); $data = TaskAllocation::with(['taskTypeInfo', 'projectInfo'])->findOrEmpty($params['id'])->toArray();
$contract = CostApprovedProject::field('project_director')->where('id',$data['projectInfo']['contract_id'])->findOrEmpty();
$data['project_director'] = $contract['project_director'];
$data['task_detail'] = TaskDetail::where('task_allocation_id', $data['id'])->select()->each(function ($item){ $data['task_detail'] = TaskDetail::where('task_allocation_id', $data['id'])->select()->each(function ($item){
$taskTypeInfo = TaskType::findOrEmpty($item['task_type_id'])->toArray(); $taskTypeInfo = TaskType::findOrEmpty($item['task_type_id'])->toArray();
$item['task_name'] = $taskTypeInfo['name']; $item['task_name'] = $taskTypeInfo['name'];