diff --git a/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php b/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php index be4b16170..a7aefa272 100644 --- a/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php +++ b/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php @@ -55,7 +55,6 @@ class TaskHandlingThreeLevelReviewLists extends BaseAdminDataLists implements Li public function lists(): array { return TaskHandlingThreeLevelReview::where($this->searchWhere) - ->field(['id', 'dataid', 'num', 'project', 'project_num', 'task', 'processes', 'rtype', 'zType', 'engineer', 'head', 'examine', 'one', 'two', 'three', 'apptime', 'level', 'area', 'type', 'use', 'construction', 'ask', 'according', 'clbc', 'ssje', 'gcshd', 'hzhj', 'rg', 'xmhd', 'bmhd', 'shbhd', 'kaigong', 'jungong', 'bz']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() diff --git a/app/adminapi/lists/cost_project/CostProjectLists.php b/app/adminapi/lists/cost_project/CostProjectLists.php index eb4ab73fa..376b9a4b0 100644 --- a/app/adminapi/lists/cost_project/CostProjectLists.php +++ b/app/adminapi/lists/cost_project/CostProjectLists.php @@ -55,6 +55,19 @@ class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterfac */ public function lists(): array { + $task_allocation = $this->request->param('task_allocation', 0); + // 筛选出关联了任务类别的项目 + if ($task_allocation == 1) { + return CostProject::alias('p') + ->join('task_type t', 'p.id=t.cost_project_id') + ->where($this->searchWhere) + ->field('p.*') + ->limit($this->limitOffset, $this->limitLength) + ->with(['contract']) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } return CostProject::where($this->searchWhere) ->field(['id', 'project_num', 'project_name', 'contract_id', 'types', 'industry', 'province', 'city', 'address', 'starting', 'endtime', 'jhgq', 'depar', 'principal', 'person', 'invest', 'budget', 'cost', 'approval', 'aunit', 'Acontact', 'acontactnum', 'date', 'generalize', 'note', 'remark', 'annex']) ->limit($this->limitOffset, $this->limitLength) @@ -62,6 +75,7 @@ class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterfac ->order(['id' => 'desc']) ->select() ->toArray(); + } @@ -73,6 +87,11 @@ class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterfac */ public function count(): int { + $task_allocation = $this->request->param('task_allocation', 0); + // 筛选出关联了任务类别的项目 + if ($task_allocation == 1) { + return CostProject::alias('p')->join('task_type t', 'p.id=t.cost_project_id')->where($this->searchWhere)->count(); + } return CostProject::where($this->searchWhere)->count(); } diff --git a/app/adminapi/logic/TaskDetailLogic.php b/app/adminapi/logic/TaskDetailLogic.php index bbdc0298c..a9d2073a0 100644 --- a/app/adminapi/logic/TaskDetailLogic.php +++ b/app/adminapi/logic/TaskDetailLogic.php @@ -41,7 +41,7 @@ class TaskDetailLogic extends BaseLogic Db::startTrans(); try { TaskDetail::create([ - 'task_allocation_id' => $params['task_allocation_dataid'], + 'task_allocation_id' => $params['task_allocation_id'], 'task_type_id' => $params['task_type_id'], 'process' => $params['process'], 'professional_type' => $params['professional_type'], diff --git a/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php b/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php index bb7b78073..451f05324 100644 --- a/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php +++ b/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php @@ -41,10 +41,9 @@ class TaskHandlingThreeLevelReviewLogic extends BaseLogic Db::startTrans(); try { TaskHandlingThreeLevelReview::create([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + 'dataid' => generate_sn(TaskHandlingThreeLevelReview::class, 'dataid'), + 'num' => generate_sn(TaskHandlingThreeLevelReview::class, 'num'), + 'project_id' => $params['project_id'], 'task' => $params['task'], 'processes' => $params['processes'], 'rtype' => $params['rtype'], @@ -102,10 +101,7 @@ class TaskHandlingThreeLevelReviewLogic extends BaseLogic Db::startTrans(); try { TaskHandlingThreeLevelReview::where('id', $params['id'])->update([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + 'project_id' => $params['project_id'], 'task' => $params['task'], 'processes' => $params['processes'], 'rtype' => $params['rtype'], diff --git a/app/adminapi/logic/task/TaskAllocationLogic.php b/app/adminapi/logic/task/TaskAllocationLogic.php index baa195e29..fe9e116b9 100644 --- a/app/adminapi/logic/task/TaskAllocationLogic.php +++ b/app/adminapi/logic/task/TaskAllocationLogic.php @@ -46,6 +46,7 @@ class TaskAllocationLogic extends BaseLogic $taskType = TaskType::where('cost_project_id', $projectId)->findOrEmpty(); if ($taskType->isEmpty()) { self::setError('项目未配置任务类别'); + return false; } Db::startTrans(); try {