diff --git a/app/adminapi/lists/ProjectCommissionLists.php b/app/adminapi/lists/ProjectCommissionLists.php index 0acd8da11..55c741a92 100644 --- a/app/adminapi/lists/ProjectCommissionLists.php +++ b/app/adminapi/lists/ProjectCommissionLists.php @@ -56,7 +56,7 @@ class ProjectCommissionLists extends BaseAdminDataLists implements ListsSearchIn */ public function lists(): array { - return ProjectCommission::with(['projectInfo']) + return ProjectCommission::with(['projectInfo', 'contract']) ->append(['children']) ->where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) diff --git a/app/adminapi/logic/ProjectCommissionLogic.php b/app/adminapi/logic/ProjectCommissionLogic.php index 2b415f6d5..7e74eea2c 100644 --- a/app/adminapi/logic/ProjectCommissionLogic.php +++ b/app/adminapi/logic/ProjectCommissionLogic.php @@ -128,7 +128,7 @@ class ProjectCommissionLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectCommission::with(['projectInfo'])->findOrEmpty($params['id'])->toArray(); + $data = ProjectCommission::with(['projectInfo', 'contract'])->findOrEmpty($params['id'])->toArray(); $data['project_commission_detail'] = ProjectCommissionDetail::where('project_commission_id', $params['id'])->select()->toArray(); return $data; } diff --git a/app/adminapi/logic/project_process_management/ProjectChangeVisaLogic.php b/app/adminapi/logic/project_process_management/ProjectChangeVisaLogic.php index 28ab51f81..bed0fbd32 100644 --- a/app/adminapi/logic/project_process_management/ProjectChangeVisaLogic.php +++ b/app/adminapi/logic/project_process_management/ProjectChangeVisaLogic.php @@ -40,15 +40,17 @@ class ProjectChangeVisaLogic extends BaseLogic { Db::startTrans(); try { - ProjectChangeVisa::create([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + $projectChangeVisa = ProjectChangeVisa::create([ + 'dataid' => generate_sn(ProjectChangeVisa::class, 'dataid'), + 'num' => generate_sn(ProjectChangeVisa::class, 'num'), + 'project_id' => $params['project_id'], 'djr' => $params['djr'], 'djrq' => $params['djrq'], ]); - + foreach ($params['project_change_visa_content'] as $item) { + $item['project_change_visa_id'] = $projectChangeVisa->id; + ProjectChangeVisaContentLogic::add($item); + } Db::commit(); return true; } catch (\Exception $e) { @@ -71,10 +73,7 @@ class ProjectChangeVisaLogic extends BaseLogic Db::startTrans(); try { ProjectChangeVisa::where('id', $params['id'])->update([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + 'project_id' => $params['project_id'], 'djr' => $params['djr'], 'djrq' => $params['djrq'], ]); diff --git a/app/common/model/ProjectCommission.php b/app/common/model/ProjectCommission.php index 456aa4a71..e4f51a741 100644 --- a/app/common/model/ProjectCommission.php +++ b/app/common/model/ProjectCommission.php @@ -16,6 +16,7 @@ namespace app\common\model; use app\common\model\BaseModel; +use app\common\model\cost_project\CostApprovedProject; use app\common\model\cost_project\CostProject; use think\model\concern\SoftDelete; @@ -35,4 +36,8 @@ class ProjectCommission extends BaseModel { return $this->hasOne(CostProject::class, 'id', 'project_id'); } + public function contract() + { + return $this->hasOne(CostApprovedProject::class, 'id','affcontract'); + } } \ No newline at end of file