From d7652ed93d30d47a387e0f808e365cd70dffd8a4 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Tue, 27 Feb 2024 15:25:11 +0800 Subject: [PATCH] update --- ...rovalIssuanceAchievementDocumentsLists.php | 153 +++++++++--------- ...rovalIssuanceAchievementDocumentsLogic.php | 12 +- .../ApprovalIssuanceAchievementDocuments.php | 6 +- 3 files changed, 86 insertions(+), 85 deletions(-) diff --git a/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php b/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php index cf7f50d32..2bc9179b2 100644 --- a/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php +++ b/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php @@ -1,77 +1,78 @@ - ['project', 'project_num'], - ]; - } - - - /** - * @notes 获取列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function lists(): array - { - return ApprovalIssuanceAchievementDocuments::where($this->searchWhere) - ->field(['id', 'dataid', 'num', 'project', 'project_num', 'task', 'processes', 'number', 'apptime', 'person', 'tips', 'fd_1', 'fd_2', 'fd_3']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取数量 - * @return int - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function count(): int - { - return ApprovalIssuanceAchievementDocuments::where($this->searchWhere)->count(); - } - + ['project', 'project_num'], + + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function lists(): array + { + return ApprovalIssuanceAchievementDocuments::where($this->searchWhere) + ->with(['projectInfo']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function count(): int + { + return ApprovalIssuanceAchievementDocuments::where($this->searchWhere)->count(); + } + } \ No newline at end of file diff --git a/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php b/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php index 0206a90f1..41a1d0b08 100644 --- a/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php +++ b/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php @@ -41,10 +41,9 @@ class ApprovalIssuanceAchievementDocumentsLogic extends BaseLogic Db::startTrans(); try { ApprovalIssuanceAchievementDocuments::create([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + 'dataid' => generate_sn(ApprovalIssuanceAchievementDocuments::class, 'dataid'), + 'num' => generate_sn(ApprovalIssuanceAchievementDocuments::class, 'num'), + 'project_id' => $params['project'], 'task' => $params['task'], 'processes' => $params['processes'], 'number' => $params['number'], @@ -78,10 +77,7 @@ class ApprovalIssuanceAchievementDocumentsLogic extends BaseLogic Db::startTrans(); try { ApprovalIssuanceAchievementDocuments::where('id', $params['id'])->update([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + 'project_id' => $params['project'], 'task' => $params['task'], 'processes' => $params['processes'], 'number' => $params['number'], diff --git a/app/common/model/ApprovalIssuanceAchievementDocuments.php b/app/common/model/ApprovalIssuanceAchievementDocuments.php index aec1bcd24..82c7c083f 100644 --- a/app/common/model/ApprovalIssuanceAchievementDocuments.php +++ b/app/common/model/ApprovalIssuanceAchievementDocuments.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 ApprovalIssuanceAchievementDocuments extends BaseModel protected $name = 'approval_issuance_achievement_documents'; protected $deleteTime = 'delete_time'; - + public function projectInfo() + { + return $this->hasOne(CostProject::class, 'id', 'project_id'); + } } \ No newline at end of file