This commit is contained in:
weiz 2024-03-19 14:39:31 +08:00
parent 1261d49889
commit 92e95c2b74
2 changed files with 33 additions and 2 deletions

View File

@ -16,6 +16,8 @@ namespace app\adminapi\logic\project_process_management;
use app\common\model\cost_project\CostApprovedProject; use app\common\model\cost_project\CostApprovedProject;
use app\common\model\dept\Dept;
use app\common\model\dept\Orgs;
use app\common\model\project_process_management\ApplyWithSeal; use app\common\model\project_process_management\ApplyWithSeal;
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use think\facade\Db; use think\facade\Db;
@ -144,9 +146,17 @@ class ApplyWithSealLogic extends BaseLogic
*/ */
public static function detail($params): array public static function detail($params): array
{ {
$data = ApplyWithSeal::with(['projectInfo'])->findOrEmpty($params['id'])->toArray(); $data = ApplyWithSeal::with(['projectInfo'])->findOrEmpty($params['id']);
$contract = CostApprovedProject::field('project_director')->where('id',$data['projectInfo']['contract_id'])->findOrEmpty(); $contract = CostApprovedProject::field('project_director')->where('id',$data['projectInfo']['contract_id'])->findOrEmpty();
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id',$data['depar'])->findOrEmpty();
$data['project_director'] = $contract['project_director']; $data['project_director'] = $contract['project_director'];
return $data; $data['org_name'] = $org['name'];
$data['dept_name'] = $dept['name'];
$data['types_text'] = $data->types_text;
$data['ridingseam_text'] = $data->ridingseam_text;
$data['filetype_text'] = $data->filetype_text;
$data['loan_text'] = $data->loan_text;
return $data->toArray();
} }
} }

View File

@ -18,6 +18,7 @@ namespace app\common\model\project_process_management;
use app\common\model\BaseModel; use app\common\model\BaseModel;
use app\common\model\cost_project\CostProject; use app\common\model\cost_project\CostProject;
use app\common\model\dept\Dept; use app\common\model\dept\Dept;
use app\common\model\dict\DictData;
use think\model\concern\SoftDelete; use think\model\concern\SoftDelete;
@ -41,4 +42,24 @@ class ApplyWithSeal extends BaseModel
{ {
return $this->hasOne(Dept::class, 'id', 'depar'); return $this->hasOne(Dept::class, 'id', 'depar');
} }
public function getTypesTextAttr($value,$data){
$dict = DictData::where('type_value','apply_with_seal_type')->column('name','value');
return !empty($data['types']) ? $dict[$data['types']] : '';
}
public function getRidingseamTextAttr($value,$data){
$dict = DictData::where('type_value','isqfgz')->column('name','value');
return !empty($data['ridingseam']) ? $dict[$data['ridingseam']] : '';
}
public function getFiletypeTextAttr($value,$data){
$dict = DictData::where('type_value','apply_with_seal_file_type')->column('name','value');
return !empty($data['filetype']) ? $dict[$data['filetype']] : '';
}
public function getLoanTextAttr($value,$data){
$arr = [0=>'否', 1=>'是'];
return $arr[$data['loan']];
}
} }