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
{
return ProjectCommission::with(['projectInfo'])
return ProjectCommission::with(['projectInfo', 'contract'])
->append(['children'])
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)

View File

@ -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;
}

View File

@ -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'],
]);

View File

@ -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');
}
}