update
This commit is contained in:
parent
6ea7d4469b
commit
80202c29f6
@ -43,7 +43,7 @@
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['business_nature', 'industry_nature', 'fund_sources', 'const_area', 'status'],
|
'=' => ['business_nature', 'industry_nature', 'fund_sources', 'const_area', 'status'],
|
||||||
'%like%' => ['contract_name', 'contract_num', 'part_a', 'part_b'],
|
'%like%' => ['contract_name', 'contract_code', 'part_a', 'part_b'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,40 +12,38 @@
|
|||||||
// | author: likeadminTeam
|
// | author: likeadminTeam
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\adminapi\logic\cost_project;
|
namespace app\adminapi\logic\cost_project;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\ApprovalIssuanceAchievementDocuments;
|
use app\common\logic\BaseLogic;
|
||||||
use app\common\model\cost_project\CostProject;
|
use app\common\model\ApprovalIssuanceAchievementDocuments;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\model\cost_project\CostApprovedProject;
|
||||||
use app\common\model\auth\Admin;
|
use app\common\model\cost_project\CostProject;
|
||||||
use app\common\model\cost_project\CostApprovedProject;
|
use app\common\model\cost_project\CostProjectPerson;
|
||||||
use app\common\model\cost_project\CostProjectPerson;
|
use app\common\model\DataReception;
|
||||||
use app\common\model\DataReception;
|
use app\common\model\dept\Dept;
|
||||||
use app\common\model\dept\Dept;
|
use app\common\model\GeoCity;
|
||||||
use app\common\model\dept\Orgs;
|
use app\common\model\GeoProvince;
|
||||||
use app\common\model\GeoCity;
|
use app\common\model\project_process_management\ApplyWithSeal;
|
||||||
use app\common\model\GeoProvince;
|
use app\common\model\project_process_management\JianliProjectProgressReport;
|
||||||
use app\common\model\project_process_management\ApplyWithSeal;
|
use app\common\model\project_process_management\ProjectChangeVisa;
|
||||||
use app\common\model\project_process_management\JianliProjectProgressReport;
|
use app\common\model\project_process_management\ProjectProgressPayment;
|
||||||
use app\common\model\project_process_management\ProjectChangeVisa;
|
use app\common\model\project_process_management\ProjectRectification;
|
||||||
use app\common\model\project_process_management\ProjectProgressPayment;
|
use app\common\model\project_process_management\ProjectSurveySignature;
|
||||||
use app\common\model\project_process_management\ProjectRectification;
|
use app\common\model\ProjectCommission;
|
||||||
use app\common\model\project_process_management\ProjectSurveySignature;
|
use app\common\model\task\TaskAllocation;
|
||||||
use app\common\model\ProjectCommission;
|
use app\common\model\task\TaskType;
|
||||||
use app\common\model\task\TaskAllocation;
|
use app\common\model\TaskHandlingThreeLevelReview;
|
||||||
use app\common\model\task\TaskType;
|
use think\facade\Db;
|
||||||
use app\common\model\TaskHandlingThreeLevelReview;
|
|
||||||
use think\facade\Db;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 造价项目台账逻辑
|
* 造价项目台账逻辑
|
||||||
* Class CostProjectLogic
|
* Class CostProjectLogic
|
||||||
* @package app\adminapi\logic\cost_project
|
* @package app\adminapi\logic\cost_project
|
||||||
*/
|
*/
|
||||||
class CostProjectLogic extends BaseLogic
|
class CostProjectLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,7 +69,6 @@ class CostProjectLogic extends BaseLogic
|
|||||||
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
||||||
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
||||||
'jhgq' => $params['jhgq'],
|
'jhgq' => $params['jhgq'],
|
||||||
'org_id' => $params['org_id'],
|
|
||||||
'depar' => $params['depar'],
|
'depar' => $params['depar'],
|
||||||
'principal' => $params['principal'],
|
'principal' => $params['principal'],
|
||||||
'person' => $params['person'] ? json_encode($params['person']) : null,
|
'person' => $params['person'] ? json_encode($params['person']) : null,
|
||||||
@ -89,8 +86,8 @@ class CostProjectLogic extends BaseLogic
|
|||||||
'remark' => $params['remark'],
|
'remark' => $params['remark'],
|
||||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||||
]);
|
]);
|
||||||
if($params['contract_id']>0){
|
if ($params['contract_id'] > 0) {
|
||||||
CostApprovedProject::where('id',$params['contract_id'])->update(['status'=>2]);
|
CostApprovedProject::where('id', $params['contract_id'])->update(['status' => 2]);
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
@ -125,7 +122,6 @@ class CostProjectLogic extends BaseLogic
|
|||||||
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
||||||
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
||||||
'jhgq' => $params['jhgq'],
|
'jhgq' => $params['jhgq'],
|
||||||
'org_id' => $params['org_id'],
|
|
||||||
'depar' => $params['depar'],
|
'depar' => $params['depar'],
|
||||||
'principal' => $params['principal'],
|
'principal' => $params['principal'],
|
||||||
'person' => $params['person'] ? json_encode($params['person']) : null,
|
'person' => $params['person'] ? json_encode($params['person']) : null,
|
||||||
@ -152,92 +148,6 @@ class CostProjectLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 删除造价项目台账
|
|
||||||
* @param array $params
|
|
||||||
* @return bool
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/02/21 09:23
|
|
||||||
*/
|
|
||||||
public static function delete(array $params): bool
|
|
||||||
{
|
|
||||||
//任务类别
|
|
||||||
$task_type = TaskType::where('cost_project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$task_type->isEmpty()){
|
|
||||||
self::setError('此数据关联了任务类别信息,须删除任务类别信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//任务分配
|
|
||||||
$task_allocation = TaskAllocation::where('cost_project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$task_allocation->isEmpty()){
|
|
||||||
self::setError('此数据关联了任务分配信息,须删除任务分配信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//任务办理与三级审核
|
|
||||||
$task_handling_three_level_review = TaskHandlingThreeLevelReview::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$task_handling_three_level_review->isEmpty()){
|
|
||||||
self::setError('此数据关联了任务办理与三级审核信息,须删除任务办理与三级审核信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//成果文件审定、签发列表
|
|
||||||
$approval_issuance_achievement_documents = ApprovalIssuanceAchievementDocuments::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$approval_issuance_achievement_documents->isEmpty()){
|
|
||||||
self::setError('此数据关联了成果文件审定签发信息,须删除成果文件审定签发信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//资料接收
|
|
||||||
$data_reception = DataReception::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$data_reception->isEmpty()){
|
|
||||||
self::setError('此数据关联了资料接收信息,须删除资料接收信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//项目提成
|
|
||||||
$project_commission = ProjectCommission::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$project_commission->isEmpty()){
|
|
||||||
self::setError('此数据关联了项目提成信息,须删除项目提成信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//项目变更签证
|
|
||||||
$project_change_visa = ProjectChangeVisa::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$project_change_visa->isEmpty()){
|
|
||||||
self::setError('此数据关联了项目变更签证信息,须删除项目变更签证信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//项目踏勘会签
|
|
||||||
$project_survey_signature = ProjectSurveySignature::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$project_survey_signature->isEmpty()){
|
|
||||||
self::setError('此数据关联了项目踏勘会签信息,须删除项目踏勘会签信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//项目整改
|
|
||||||
$project_rectification = ProjectRectification::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$project_rectification->isEmpty()){
|
|
||||||
self::setError('此数据关联了项目整改信息,须删除项目整改信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//项目进度汇报
|
|
||||||
$jianli_project_progress_report = JianliProjectProgressReport::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$jianli_project_progress_report->isEmpty()){
|
|
||||||
self::setError('此数据关联了项目进度汇报信息,须删除项目进度汇报信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//项目进度款
|
|
||||||
$project_progress_payment = ProjectProgressPayment::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$project_progress_payment->isEmpty()){
|
|
||||||
self::setError('此数据关联了项目进度款信息,须删除项目进度款信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//用章申请
|
|
||||||
$apply_with_seal = ApplyWithSeal::where('project_id','in',$params['id'])->findOrEmpty();
|
|
||||||
if(!$apply_with_seal->isEmpty()){
|
|
||||||
self::setError('此数据关联了用章申请信息,须删除用章申请信息');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return CostProject::destroy($params['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 获取造价项目台账详情
|
* @notes 获取造价项目台账详情
|
||||||
* @param $params
|
* @param $params
|
||||||
@ -247,17 +157,15 @@ class CostProjectLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function detail($params): array
|
public static function detail($params): array
|
||||||
{
|
{
|
||||||
$res= CostProject::with(['contract'])->findOrEmpty($params['id']);
|
$res = CostProject::with(['contract'])->findOrEmpty($params['id']);
|
||||||
$res['person_text'] = $res->person_text;
|
$res['person_text'] = $res->person_text;
|
||||||
$res['types_text'] = $res->types_text;
|
$res['types_text'] = $res->types_text;
|
||||||
$res['industry_nature_text'] = $res['contract']->industry_nature_text;
|
$res['industry_nature_text'] = $res['contract']->industry_nature_text;
|
||||||
$province = GeoProvince::field('province_name')->where('province_code',$res['province'])->findOrEmpty();
|
$province = GeoProvince::field('province_name')->where('province_code', $res['province'])->findOrEmpty();
|
||||||
$city = GeoCity::field('city_name')->where('city_code',$res['city'])->findOrEmpty();
|
$city = GeoCity::field('city_name')->where('city_code', $res['city'])->findOrEmpty();
|
||||||
$org = Orgs::field('name')->where('id',$res['org_id'])->findOrEmpty();
|
$dept = Dept::field('name')->where('id', $res['depar'])->findOrEmpty();
|
||||||
$dept = Dept::field('name')->where('id',$res['depar'])->findOrEmpty();
|
|
||||||
$res['province_name'] = $province['province_name'];
|
$res['province_name'] = $province['province_name'];
|
||||||
$res['city_name'] = $city['city_name'];
|
$res['city_name'] = $city['city_name'];
|
||||||
$res['org_name'] = $org['name'];
|
|
||||||
$res['dept_name'] = $dept['name'];
|
$res['dept_name'] = $dept['name'];
|
||||||
return $res->toArray();
|
return $res->toArray();
|
||||||
}
|
}
|
||||||
@ -324,4 +232,88 @@ class CostProjectLogic extends BaseLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* @notes 删除造价项目台账
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/02/21 09:23
|
||||||
|
*/
|
||||||
|
public static function delete(array $params): bool
|
||||||
|
{
|
||||||
|
//任务类别
|
||||||
|
$task_type = TaskType::where('cost_project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$task_type->isEmpty()) {
|
||||||
|
self::setError('此数据关联了任务类别信息,须删除任务类别信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//任务分配
|
||||||
|
$task_allocation = TaskAllocation::where('cost_project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$task_allocation->isEmpty()) {
|
||||||
|
self::setError('此数据关联了任务分配信息,须删除任务分配信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//任务办理与三级审核
|
||||||
|
$task_handling_three_level_review = TaskHandlingThreeLevelReview::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$task_handling_three_level_review->isEmpty()) {
|
||||||
|
self::setError('此数据关联了任务办理与三级审核信息,须删除任务办理与三级审核信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//成果文件审定、签发列表
|
||||||
|
$approval_issuance_achievement_documents = ApprovalIssuanceAchievementDocuments::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$approval_issuance_achievement_documents->isEmpty()) {
|
||||||
|
self::setError('此数据关联了成果文件审定签发信息,须删除成果文件审定签发信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//资料接收
|
||||||
|
$data_reception = DataReception::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$data_reception->isEmpty()) {
|
||||||
|
self::setError('此数据关联了资料接收信息,须删除资料接收信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//项目提成
|
||||||
|
$project_commission = ProjectCommission::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$project_commission->isEmpty()) {
|
||||||
|
self::setError('此数据关联了项目提成信息,须删除项目提成信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//项目变更签证
|
||||||
|
$project_change_visa = ProjectChangeVisa::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$project_change_visa->isEmpty()) {
|
||||||
|
self::setError('此数据关联了项目变更签证信息,须删除项目变更签证信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//项目踏勘会签
|
||||||
|
$project_survey_signature = ProjectSurveySignature::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$project_survey_signature->isEmpty()) {
|
||||||
|
self::setError('此数据关联了项目踏勘会签信息,须删除项目踏勘会签信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//项目整改
|
||||||
|
$project_rectification = ProjectRectification::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$project_rectification->isEmpty()) {
|
||||||
|
self::setError('此数据关联了项目整改信息,须删除项目整改信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//项目进度汇报
|
||||||
|
$jianli_project_progress_report = JianliProjectProgressReport::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$jianli_project_progress_report->isEmpty()) {
|
||||||
|
self::setError('此数据关联了项目进度汇报信息,须删除项目进度汇报信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//项目进度款
|
||||||
|
$project_progress_payment = ProjectProgressPayment::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$project_progress_payment->isEmpty()) {
|
||||||
|
self::setError('此数据关联了项目进度款信息,须删除项目进度款信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//用章申请
|
||||||
|
$apply_with_seal = ApplyWithSeal::where('project_id', 'in', $params['id'])->findOrEmpty();
|
||||||
|
if (!$apply_with_seal->isEmpty()) {
|
||||||
|
self::setError('此数据关联了用章申请信息,须删除用章申请信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return CostProject::destroy($params['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -12,60 +12,67 @@
|
|||||||
// | author: likeadminTeam
|
// | author: likeadminTeam
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\common\model\cost_project;
|
namespace app\common\model\cost_project;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\auth\Admin;
|
use app\common\model\auth\Admin;
|
||||||
use app\common\model\BaseModel;
|
use app\common\model\BaseModel;
|
||||||
use app\common\model\dict\DictData;
|
use app\common\model\dict\DictData;
|
||||||
use think\model\concern\SoftDelete;
|
use app\common\model\marketing\MarketingContract;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 造价项目台账模型
|
* 造价项目台账模型
|
||||||
* Class CostProject
|
* Class CostProject
|
||||||
* @package app\common\model\cost_project
|
* @package app\common\model\cost_project
|
||||||
*/
|
*/
|
||||||
class CostProject extends BaseModel
|
class CostProject extends BaseModel
|
||||||
{
|
{
|
||||||
use SoftDelete;
|
use SoftDelete;
|
||||||
|
|
||||||
protected $name = 'cost_project';
|
protected $name = 'cost_project';
|
||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
public function contract()
|
public function contract()
|
||||||
{
|
{
|
||||||
return $this->hasOne(CostApprovedProject::class, 'id','contract_id');
|
return $this->hasOne(MarketingContract::class, 'id', 'contract_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CostProjectContract()
|
public function CostProjectContract()
|
||||||
{
|
{
|
||||||
return $this->hasOne(CostProjectContract::class, 'id','contract_id');
|
return $this->hasOne(MarketingContract::class, 'id', 'contract_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypesTextAttr($value,$data){
|
public function getTypesTextAttr($value, $data)
|
||||||
$dict = DictData::where('type_value','consultation_type')->column('name','value');
|
{
|
||||||
|
$dict = DictData::where('type_value', 'consultation_type')->column('name', 'value');
|
||||||
return !empty($data['types']) ? $dict[$data['types']] : '';
|
return !empty($data['types']) ? $dict[$data['types']] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPersonAttr($value){
|
public function getPersonAttr($value)
|
||||||
return !empty($value) ? json_decode($value,true) : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getStartingAttr($value){
|
|
||||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEndtimeAttr($value){
|
|
||||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDateAttr($value){
|
|
||||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPersonTextAttr($value,$data): string
|
|
||||||
{
|
{
|
||||||
$person = Admin::where('id','in',json_decode($data['person'],true))->column('name');
|
return !empty($value) ? json_decode($value, true) : '';
|
||||||
return !empty($person) ? implode(',',$person) : '';
|
}
|
||||||
|
|
||||||
|
public function getStartingAttr($value)
|
||||||
|
{
|
||||||
|
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEndtimeAttr($value)
|
||||||
|
{
|
||||||
|
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateAttr($value)
|
||||||
|
{
|
||||||
|
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonTextAttr($value, $data): string
|
||||||
|
{
|
||||||
|
$person = Admin::where('id', 'in', json_decode($data['person'], true))->column('name');
|
||||||
|
return !empty($person) ? implode(',', $person) : '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user