This commit is contained in:
weiz 2024-03-22 16:39:31 +08:00
parent 85be542474
commit 6a3fc45e04
4 changed files with 268 additions and 262 deletions

View File

@ -12,22 +12,22 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\project;
namespace app\adminapi\logic\project;
use app\common\model\project\ProjectCostTempSet;
use app\common\logic\BaseLogic;
use app\common\model\project\ProjectTypeSet;
use think\facade\Db;
use app\common\logic\BaseLogic;
use app\common\model\project\ProjectCostTempSet;
use app\common\model\project\ProjectTypeSet;
use think\facade\Db;
/**
/**
* 项目费用模板逻辑
* Class ProjectCostTempSetLogic
* @package app\adminapi\logic\project
*/
class ProjectCostTempSetLogic extends BaseLogic
{
class ProjectCostTempSetLogic extends BaseLogic
{
/**
@ -112,9 +112,10 @@ class ProjectCostTempSetLogic extends BaseLogic
*/
public static function detail($params): array
{
$data = ProjectCostTempSet::field('id,project_type_id,subject_code,first_level_subject,second_level_subject,third_level_subject,unit,is_travel')->findOrEmpty($params['id'])->toArray();
$projectType = ProjectTypeSet::field('name')->where('id',$data['project_type_id'])->findOrEmpty();
$data = ProjectCostTempSet::field('id,project_type_id,subject_code,first_level_subject,second_level_subject,third_level_subject,unit,is_travel')->findOrEmpty($params['id']);
$projectType = ProjectTypeSet::field('name')->where('id', $data['project_type_id'])->findOrEmpty();
$data['project_type_name'] = $projectType['name'];
return $data;
$data['is_travel_text'] = $data->is_travel_text;
return $data->toArray();
}
}
}

View File

@ -12,22 +12,22 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\project;
namespace app\adminapi\logic\project;
use app\common\model\project\ProjectDocumentSet;
use app\common\logic\BaseLogic;
use app\common\model\project\ProjectTypeSet;
use think\facade\Db;
use app\common\logic\BaseLogic;
use app\common\model\project\ProjectDocumentSet;
use app\common\model\project\ProjectTypeSet;
use think\facade\Db;
/**
/**
* 项目文档设置逻辑
* Class ProjectDocumentSetLogic
* @package app\adminapi\logic\project
*/
class ProjectDocumentSetLogic extends BaseLogic
{
class ProjectDocumentSetLogic extends BaseLogic
{
/**
@ -114,9 +114,10 @@ class ProjectDocumentSetLogic extends BaseLogic
*/
public static function detail($params): array
{
$data = ProjectDocumentSet::field('id,project_type_id,large_category,middle_category,small_category,name,describe,is_upload,sort')->findOrEmpty($params['id'])->toArray();
$projectType = ProjectTypeSet::field('name')->where('id',$data['project_type_id'])->findOrEmpty();
$data = ProjectDocumentSet::field('id,project_type_id,large_category,middle_category,small_category,name,describe,is_upload,sort')->findOrEmpty($params['id']);
$projectType = ProjectTypeSet::field('name')->where('id', $data['project_type_id'])->findOrEmpty();
$data['project_type_name'] = $projectType['name'];
return $data;
$data['is_upload_text'] = $data->is_upload_text;
return $data->toArray();
}
}
}

View File

@ -12,27 +12,26 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\project;
namespace app\common\model\project;
use app\common\model\BaseModel;
use app\common\model\BaseModel;
/**
/**
* 项目费用模板模型
* Class ProjectCostTempSet
* @package app\common\model\project
*/
class ProjectCostTempSet extends BaseModel
{
class ProjectCostTempSet extends BaseModel
{
protected $name = 'project_cost_temp_set';
public function getIsTravelTextAttr($value,$data): string
public function getIsTravelTextAttr($value, $data): string
{
$arr = [1=>'是', 2=>'否'];
return $arr[$data['is_travel']];
$arr = [1 => '是', 2 => '否'];
return !empty($data['is_travel']) ? $arr[$data['is_travel']] : '';
}
}
}

View File

@ -12,23 +12,28 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\project;
namespace app\common\model\project;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
/**
* 项目文档设置模型
* Class ProjectDocumentSet
* @package app\common\model\project
*/
class ProjectDocumentSet extends BaseModel
{
class ProjectDocumentSet extends BaseModel
{
use SoftDelete;
protected $name = 'project_document_set';
protected $deleteTime = 'delete_time';
}
public function getIsUploadTextAttr($value, $data): string
{
$arr = [1 => '是', 2 => '否'];
return !empty($data['is_upload']) ? $arr[$data['is_upload']] : '';
}
}