diff --git a/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php b/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php index a7aefa272..d042ad117 100644 --- a/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php +++ b/app/adminapi/lists/TaskHandlingThreeLevelReviewLists.php @@ -55,6 +55,7 @@ class TaskHandlingThreeLevelReviewLists extends BaseAdminDataLists implements Li public function lists(): array { return TaskHandlingThreeLevelReview::where($this->searchWhere) + ->with(['projectInfo']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() diff --git a/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php b/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php index 451f05324..608a5d75c 100644 --- a/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php +++ b/app/adminapi/logic/TaskHandlingThreeLevelReviewLogic.php @@ -38,6 +38,7 @@ class TaskHandlingThreeLevelReviewLogic extends BaseLogic */ public static function add(array $params): bool { + Db::startTrans(); try { TaskHandlingThreeLevelReview::create([ @@ -73,10 +74,10 @@ class TaskHandlingThreeLevelReviewLogic extends BaseLogic 'kaigong' => $params['kaigong'], 'jungong' => $params['jungong'], 'bz' => $params['bz'], - 'result_file' => $params['result_file'], - 'master_annex' => $params['master_annex'], - 'bm_annex' => $params['bm_annex'], - 'shb_annex' => $params['shb_annex'], + 'result_file' => json_encode($params['result_file']), + 'master_annex' => json_encode($params['master_annex']), + 'bm_annex' => json_encode($params['bm_annex']), + 'shb_annex' => json_encode($params['shb_annex']) ]); Db::commit(); @@ -131,10 +132,10 @@ class TaskHandlingThreeLevelReviewLogic extends BaseLogic 'kaigong' => $params['kaigong'], 'jungong' => $params['jungong'], 'bz' => $params['bz'], - 'result_file' => $params['result_file'], - 'master_annex' => $params['master_annex'], - 'bm_annex' => $params['bm_annex'], - 'shb_annex' => $params['shb_annex'], + 'result_file' => json_encode($params['result_file']), + 'master_annex' => json_encode($params['master_annex']), + 'bm_annex' => json_encode($params['bm_annex']), + 'shb_annex' => json_encode($params['shb_annex']) ]); Db::commit(); @@ -169,6 +170,6 @@ class TaskHandlingThreeLevelReviewLogic extends BaseLogic */ public static function detail($params): array { - return TaskHandlingThreeLevelReview::findOrEmpty($params['id'])->toArray(); + return TaskHandlingThreeLevelReview::with(['projectInfo'])->findOrEmpty($params['id'])->toArray(); } } \ No newline at end of file diff --git a/app/adminapi/logic/task/TaskAllocationLogic.php b/app/adminapi/logic/task/TaskAllocationLogic.php index fe9e116b9..40137aad6 100644 --- a/app/adminapi/logic/task/TaskAllocationLogic.php +++ b/app/adminapi/logic/task/TaskAllocationLogic.php @@ -57,7 +57,7 @@ class TaskAllocationLogic extends BaseLogic 'task_type_id' => $taskType['id'], // 任务类别id 'cost_project_id' => $taskType['cost_project_id'], // 项目id 'apptime' => $params['apptime'], - 'annex' => $params['annex'], + 'annex' => json_encode($params['annex']), ]); // 任务明细 $taskDetail = $params['task_detail']; @@ -98,7 +98,7 @@ class TaskAllocationLogic extends BaseLogic 'task_type_id' => $taskType['id'], // 任务类别id 'cost_project_id' => $taskType['cost_project_id'], // 项目id 'apptime' => $params['apptime'], - 'annex' => $params['annex'], + 'annex' => json_encode($params['annex']), ]); Db::commit(); return true; diff --git a/app/common/model/TaskHandlingThreeLevelReview.php b/app/common/model/TaskHandlingThreeLevelReview.php index 4e9dbd011..814253b24 100644 --- a/app/common/model/TaskHandlingThreeLevelReview.php +++ b/app/common/model/TaskHandlingThreeLevelReview.php @@ -16,6 +16,7 @@ namespace app\common\model; use app\common\model\BaseModel; +use app\common\model\cost_project\CostProject; use think\model\concern\SoftDelete; @@ -30,5 +31,8 @@ class TaskHandlingThreeLevelReview extends BaseModel protected $name = 'task_handling_three_level_review'; protected $deleteTime = 'delete_time'; - + public function projectInfo() + { + return $this->hasOne(CostProject::class, 'id', 'project_id'); + } } \ No newline at end of file