diff --git a/app/adminapi/logic/contract/ProcurementContractChangeLogic.php b/app/adminapi/logic/contract/ProcurementContractChangeLogic.php index 4b748d51f..36c144b47 100644 --- a/app/adminapi/logic/contract/ProcurementContractChangeLogic.php +++ b/app/adminapi/logic/contract/ProcurementContractChangeLogic.php @@ -58,6 +58,7 @@ class ProcurementContractChangeLogic extends BaseLogic 'amount_daxie' => $params['amount_daxie'] ?? '', 'retention_money_rate' => $params['retention_money_rate'] ?? 0, 'retention_money' => $params['retention_money'] ?? 0, + 'pay_plan' => empty($params['pay_plan']) ? [] : json_encode($params['pay_plan']), 'remark' => $params['remark'] ?? 0, 'annex' => $params['annex'] ?? 0, ]); @@ -111,6 +112,7 @@ class ProcurementContractChangeLogic extends BaseLogic 'amount_daxie' => $params['amount_daxie'] ?? '', 'retention_money_rate' => $params['retention_money_rate'] ?? 0, 'retention_money' => $params['retention_money'] ?? 0, + 'pay_plan' => empty($params['pay_plan']) ? [] : json_encode($params['pay_plan']), 'remark' => $params['remark'] ?? 0, 'annex' => $params['annex'] ?? 0, ]); @@ -164,6 +166,7 @@ class ProcurementContractChangeLogic extends BaseLogic if (!empty($procurementContractChange->project->custom_id)) { $procurementContractChange->custom = Custom::findOrEmpty($procurementContractChange->project->custom_id); } + $procurementContractChange->pay_plan = json_decode($procurementContractChange->pay_plan, true); $procurementContractChange->project; $procurementContractChange->material; return $procurementContractChange->toArray(); diff --git a/app/adminapi/logic/contract/ProcurementContractLogic.php b/app/adminapi/logic/contract/ProcurementContractLogic.php index 13a37c1d1..303b7e141 100644 --- a/app/adminapi/logic/contract/ProcurementContractLogic.php +++ b/app/adminapi/logic/contract/ProcurementContractLogic.php @@ -57,6 +57,7 @@ class ProcurementContractLogic extends BaseLogic 'amount_daxie' => $params['amount_daxie'] ?? '', 'retention_money_rate' => $params['retention_money_rate'] ?? '', 'retention_money' => $params['retention_money'] ?? 0, + 'pay_plan' => empty($params['pay_plan']) ? [] : json_encode($params['pay_plan']), 'remark' => $params['remark'] ?? '', 'annex' => $params['annex'] ?? '' ]); @@ -109,6 +110,7 @@ class ProcurementContractLogic extends BaseLogic 'amount_daxie' => $params['amount_daxie'] ?? '', 'retention_money_rate' => $params['retention_money_rate'] ?? '', 'retention_money' => $params['retention_money'] ?? 0, + 'pay_plan' => empty($params['pay_plan']) ? [] : json_encode($params['pay_plan']), 'remark' => $params['remark'] ?? '', 'annex' => $params['annex'] ?? '' ]); @@ -163,6 +165,7 @@ class ProcurementContractLogic extends BaseLogic if (!empty($procurementContract->project->custom_id)) { $procurementContract->custom = Custom::findOrEmpty($procurementContract->project->custom_id); } + $procurementContract->pay_plan = json_decode($procurementContract->pay_plan, true); $procurementContract->project; $procurementContract->material; return $procurementContract->toArray(); diff --git a/app/adminapi/validate/contract/ProcurementContractChangeValidate.php b/app/adminapi/validate/contract/ProcurementContractChangeValidate.php index 57761b127..8b4544371 100644 --- a/app/adminapi/validate/contract/ProcurementContractChangeValidate.php +++ b/app/adminapi/validate/contract/ProcurementContractChangeValidate.php @@ -37,6 +37,7 @@ class ProcurementContractChangeValidate extends BaseValidate 'approve_id' => 'require', 'project_id' => 'require', 'material' => 'require|array|checkMaterial', + 'pay_plan' => 'require|array|checkPlan', ]; @@ -68,7 +69,7 @@ class ProcurementContractChangeValidate extends BaseValidate */ public function sceneEdit() { - return $this->only(['id', 'procurement_contract_id', 'supplier_id', 'approve_id', 'project_id', 'contract_no']); + return $this->only(['id', 'procurement_contract_id', 'supplier_id', 'approve_id', 'project_id', 'material', 'pay_plan']); } @@ -119,4 +120,19 @@ class ProcurementContractChangeValidate extends BaseValidate return true; } + public function checkPlan($value, $rule, $data) + { + $firstData = $value[0] ?? []; + if (empty($firstData['period'])) { + return '付款期次不能为空!'; + } + if (empty($firstData['pay_date'])) { + return '付款日期不能为空!'; + } + if (empty($firstData['pay_amount'])) { + return '付款金额不能为空!'; + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/contract/ProcurementContractValidate.php b/app/adminapi/validate/contract/ProcurementContractValidate.php index c55ced2ca..fb28ae92f 100644 --- a/app/adminapi/validate/contract/ProcurementContractValidate.php +++ b/app/adminapi/validate/contract/ProcurementContractValidate.php @@ -36,6 +36,7 @@ class ProcurementContractValidate extends BaseValidate 'approve_id' => 'require', 'project_id' => 'require', 'material' => 'require|array|checkMaterial', + 'pay_plan' => 'require|array|checkPlan', ]; @@ -68,7 +69,7 @@ class ProcurementContractValidate extends BaseValidate */ public function sceneEdit() { - return $this->only(['id', 'supplier_id', 'approve_id', 'project_id', 'material']); + return $this->only(['id', 'supplier_id', 'approve_id', 'project_id', 'material', 'pay_plan']); } @@ -119,4 +120,19 @@ class ProcurementContractValidate extends BaseValidate return true; } + public function checkPlan($value, $rule, $data) + { + $firstData = $value[0] ?? []; + if (empty($firstData['period'])) { + return '付款期次不能为空!'; + } + if (empty($firstData['pay_date'])) { + return '付款日期不能为空!'; + } + if (empty($firstData['pay_amount'])) { + return '付款金额不能为空!'; + } + return true; + } + } \ No newline at end of file diff --git a/app/adminapi/validate/contract/SubcontractingContractValidate.php b/app/adminapi/validate/contract/SubcontractingContractValidate.php index 517b84d8e..31d25103e 100644 --- a/app/adminapi/validate/contract/SubcontractingContractValidate.php +++ b/app/adminapi/validate/contract/SubcontractingContractValidate.php @@ -70,7 +70,7 @@ class SubcontractingContractValidate extends BaseValidate */ public function sceneEdit() { - return $this->only(['id', 'project_id', 'approve_id', 'supplier_id', 'contract_name', 'pay_plan']); + return $this->only(['id', 'project_id', 'approve_id', 'supplier_id', 'contract_name', 'work', 'pay_plan']); }