This commit is contained in:
weiz 2024-03-13 09:39:16 +08:00
parent 0a6afaee68
commit d44e65536c
5 changed files with 6 additions and 20 deletions

View File

@ -62,7 +62,7 @@ class ProjectDocumentLists extends BaseAdminDataLists implements ListsSearchInte
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($item){
$item['annex'] = json_decode($item['annex'],true);
// $item['annex'] = json_decode($item['annex'],true);
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
$doc = ProjectDocumentSet::field('large_category,middle_category')->where('id',$item['classify_id'])->findOrEmpty();
$item['project_name'] = $project['name'];

View File

@ -69,7 +69,7 @@ class CostProjectLogic extends BaseLogic
'generalize' => $params['generalize'],
'note' => $params['note'],
'remark' => $params['remark'],
'annex' => $params['annex']
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]);
if ($params['person_id']) {
$arr = [];
@ -127,7 +127,7 @@ class CostProjectLogic extends BaseLogic
'generalize' => $params['generalize'],
'note' => $params['note'],
'remark' => $params['remark'],
'annex' => $params['annex']
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
]);
if ($params['person_id']) {
$arr = [];

View File

@ -213,15 +213,5 @@ class CostApprovedProjectValidate extends BaseValidate
}
return true;
}
public function checkAnnex($value): bool|string
{
if(!empty($value) && $value != ''){
if(!is_array($value)){
return '附件格式错误';
}
}
return true;
}
}

View File

@ -42,6 +42,7 @@ class CostProjectValidate extends BaseValidate
'principal' => 'require',
'invest' => 'require',
'aunit' => 'require',
'annex' => 'checkAnnex'
];
@ -71,7 +72,7 @@ class CostProjectValidate extends BaseValidate
*/
public function sceneAdd()
{
return $this->only(['project_num','project_name','contract_id','starting','endtime','jhgq','principal','invest','aunit']);
return $this->only(['project_num','project_name','contract_id','starting','endtime','jhgq','principal','invest','aunit','annex']);
}
@ -83,7 +84,7 @@ class CostProjectValidate extends BaseValidate
*/
public function sceneEdit()
{
return $this->only(['id','project_num','project_name','contract_id','starting','endtime','jhgq','principal','invest','aunit']);
return $this->only(['id','project_num','project_name','contract_id','starting','endtime','jhgq','principal','invest','aunit','annex']);
}

View File

@ -102,9 +102,4 @@ class CostApprovedProject extends BaseModel
{
return !empty($value) ? date('Y-m-d', $value) : '';
}
public function getAnnexAttr($value)
{
return !empty($value) ? json_decode($value,true) : '';
}
}