This commit is contained in:
chenbo 2024-02-28 09:58:40 +08:00
parent 03b4955c5a
commit 2a19b1ade3
4 changed files with 16 additions and 12 deletions

View File

@ -56,7 +56,7 @@ class ProjectCommissionLists extends BaseAdminDataLists implements ListsSearchIn
*/ */
public function lists(): array public function lists(): array
{ {
return ProjectCommission::with(['projectInfo']) return ProjectCommission::with(['projectInfo', 'contract'])
->append(['children']) ->append(['children'])
->where($this->searchWhere) ->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)

View File

@ -128,7 +128,7 @@ class ProjectCommissionLogic extends BaseLogic
*/ */
public static function detail($params): array 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(); $data['project_commission_detail'] = ProjectCommissionDetail::where('project_commission_id', $params['id'])->select()->toArray();
return $data; return $data;
} }

View File

@ -40,15 +40,17 @@ class ProjectChangeVisaLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
ProjectChangeVisa::create([ $projectChangeVisa = ProjectChangeVisa::create([
'dataid' => $params['dataid'], 'dataid' => generate_sn(ProjectChangeVisa::class, 'dataid'),
'num' => $params['num'], 'num' => generate_sn(ProjectChangeVisa::class, 'num'),
'project' => $params['project'], 'project_id' => $params['project_id'],
'project_num' => $params['project_num'],
'djr' => $params['djr'], 'djr' => $params['djr'],
'djrq' => $params['djrq'], 'djrq' => $params['djrq'],
]); ]);
foreach ($params['project_change_visa_content'] as $item) {
$item['project_change_visa_id'] = $projectChangeVisa->id;
ProjectChangeVisaContentLogic::add($item);
}
Db::commit(); Db::commit();
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
@ -71,10 +73,7 @@ class ProjectChangeVisaLogic extends BaseLogic
Db::startTrans(); Db::startTrans();
try { try {
ProjectChangeVisa::where('id', $params['id'])->update([ ProjectChangeVisa::where('id', $params['id'])->update([
'dataid' => $params['dataid'], 'project_id' => $params['project_id'],
'num' => $params['num'],
'project' => $params['project'],
'project_num' => $params['project_num'],
'djr' => $params['djr'], 'djr' => $params['djr'],
'djrq' => $params['djrq'], 'djrq' => $params['djrq'],
]); ]);

View File

@ -16,6 +16,7 @@ namespace app\common\model;
use app\common\model\BaseModel; use app\common\model\BaseModel;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject; use app\common\model\cost_project\CostProject;
use think\model\concern\SoftDelete; use think\model\concern\SoftDelete;
@ -35,4 +36,8 @@ class ProjectCommission extends BaseModel
{ {
return $this->hasOne(CostProject::class, 'id', 'project_id'); return $this->hasOne(CostProject::class, 'id', 'project_id');
} }
public function contract()
{
return $this->hasOne(CostApprovedProject::class, 'id','affcontract');
}
} }