This commit is contained in:
weiz 2024-03-12 15:08:18 +08:00
parent 259ab6db3b
commit 87da2cc5b0
3 changed files with 187 additions and 2 deletions

View File

@ -86,8 +86,11 @@ class ConsultSubdirectoryController extends BaseAdminController
public function delete()
{
$params = (new ConsultSubdirectoryValidate())->post()->goCheck('delete');
ConsultSubdirectoryLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
$result = ConsultSubdirectoryLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(ConsultSubdirectoryLogic::getError());
}

View File

@ -17,6 +17,19 @@ namespace app\adminapi\logic\consult_basic;
use app\common\model\consult_basic\ConsultProject;
use app\common\logic\BaseLogic;
use app\common\model\consult_build\ConsultAccept;
use app\common\model\consult_build\ConsultSceneExecute;
use app\common\model\consult_build\ConsultSceneOrg;
use app\common\model\consult_build\ConsultScenePrepare;
use app\common\model\consult_strategy\ConsultContract;
use app\common\model\consult_strategy\ConsultCost;
use app\common\model\consult_strategy\ConsultDeclare;
use app\common\model\consult_strategy\ConsultDesign;
use app\common\model\consult_strategy\ConsultProcure;
use app\common\model\consult_target\ConsultControl;
use app\common\model\consult_target\ConsultDecision;
use app\common\model\consult_target\ConsultDemand;
use app\common\model\consult_target\ConsultReceive;
use think\facade\Db;
@ -147,6 +160,84 @@ class ConsultProjectLogic extends BaseLogic
*/
public static function delete(array $params): bool
{
//决策管理信息
$decision = ConsultDecision::where('project_id','in',$params['id'])->findOrEmpty();
if($decision->isEmpty()){
self::setError('此数据关联了决策管理信息,需删除决策管理信息');
return false;
}
//需求研究及管理
$demand = ConsultDemand::where('project_id','in',$params['id'])->findOrEmpty();
if($demand->isEmpty()){
self::setError('此数据关联了需求研究管理信息,需删除需求研究管理信息');
return false;
}
//总控管理
$control = ConsultControl::where('project_id','in',$params['id'])->findOrEmpty();
if($control->isEmpty()){
self::setError('此数据关联了总控管理信息,需删除总控管理信息');
return false;
}
//接收管理
$receive = ConsultReceive::where('project_id','in',$params['id'])->findOrEmpty();
if($receive->isEmpty()){
self::setError('此数据关联了接收管理信息,需删除接收管理信息');
return false;
}
//报建管理
$declare = ConsultDeclare::where('project_id','in',$params['id'])->findOrEmpty();
if($declare->isEmpty()){
self::setError('此数据关联了报建管理信息,需删除报建管理信息');
return false;
}
//招采管理
$procure = ConsultProcure::where('project_id','in',$params['id'])->findOrEmpty();
if($procure->isEmpty()){
self::setError('此数据关联了招采管理信息,需删除招采管理信息');
return false;
}
//合同管理
$contract = ConsultContract::where('project_id','in',$params['id'])->findOrEmpty();
if($contract->isEmpty()){
self::setError('此数据关联了合同管理信息,需删除合同管理信息');
return false;
}
//造价管理
$cost = ConsultCost::where('project_id','in',$params['id'])->findOrEmpty();
if($cost->isEmpty()){
self::setError('此数据关联了造价管理信息,需删除造价管理信息');
return false;
}
//设计管理
$design = ConsultDesign::where('project_id','in',$params['id'])->findOrEmpty();
if($design->isEmpty()){
self::setError('此数据关联了设计管理信息,需删除设计管理信息');
return false;
}
//现场准备
$scene_prepare = ConsultScenePrepare::where('project_id','in',$params['id'])->findOrEmpty();
if($scene_prepare->isEmpty()){
self::setError('此数据关联了现场准备信息,需删除现场准备信息');
return false;
}
//现场组织建设
$scene_org = ConsultSceneOrg::where('project_id','in',$params['id'])->findOrEmpty();
if($scene_org->isEmpty()){
self::setError('此数据关联了现场组织建设信息,需删除现场组织建设信息');
return false;
}
//现场实施管理
$scene_execute = ConsultSceneExecute::where('project_id','in',$params['id'])->findOrEmpty();
if($scene_execute->isEmpty()){
self::setError('此数据关联了现场实施管理信息,需删除现场实施管理信息');
return false;
}
//验收管理
$accept = ConsultAccept::where('project_id','in',$params['id'])->findOrEmpty();
if($accept->isEmpty()){
self::setError('此数据关联了验收管理信息,需删除验收管理信息');
return false;
}
return ConsultProject::destroy($params['id']);
}

View File

@ -15,9 +15,22 @@
namespace app\adminapi\logic\consult_catalog;
use app\common\model\consult_build\ConsultAccept;
use app\common\model\consult_build\ConsultSceneExecute;
use app\common\model\consult_build\ConsultSceneOrg;
use app\common\model\consult_build\ConsultScenePrepare;
use app\common\model\consult_catalog\ConsultDirectory;
use app\common\model\consult_catalog\ConsultSubdirectory;
use app\common\logic\BaseLogic;
use app\common\model\consult_strategy\ConsultContract;
use app\common\model\consult_strategy\ConsultCost;
use app\common\model\consult_strategy\ConsultDeclare;
use app\common\model\consult_strategy\ConsultDesign;
use app\common\model\consult_strategy\ConsultProcure;
use app\common\model\consult_target\ConsultControl;
use app\common\model\consult_target\ConsultDecision;
use app\common\model\consult_target\ConsultDemand;
use app\common\model\consult_target\ConsultReceive;
use think\facade\Db;
@ -89,6 +102,84 @@ class ConsultSubdirectoryLogic extends BaseLogic
*/
public static function delete(array $params): bool
{
//决策管理信息
$decision = ConsultDecision::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($decision->isEmpty()){
self::setError('此数据关联了决策管理信息,需删除决策管理信息');
return false;
}
//需求研究及管理
$demand = ConsultDemand::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($demand->isEmpty()){
self::setError('此数据关联了需求研究管理信息,需删除需求研究管理信息');
return false;
}
//总控管理
$control = ConsultControl::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($control->isEmpty()){
self::setError('此数据关联了总控管理信息,需删除总控管理信息');
return false;
}
//接收管理
$receive = ConsultReceive::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($receive->isEmpty()){
self::setError('此数据关联了接收管理信息,需删除接收管理信息');
return false;
}
//报建管理
$declare = ConsultDeclare::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($declare->isEmpty()){
self::setError('此数据关联了报建管理信息,需删除报建管理信息');
return false;
}
//招采管理
$procure = ConsultProcure::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($procure->isEmpty()){
self::setError('此数据关联了招采管理信息,需删除招采管理信息');
return false;
}
//合同管理
$contract = ConsultContract::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($contract->isEmpty()){
self::setError('此数据关联了合同管理信息,需删除合同管理信息');
return false;
}
//造价管理
$cost = ConsultCost::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($cost->isEmpty()){
self::setError('此数据关联了造价管理信息,需删除造价管理信息');
return false;
}
//设计管理
$design = ConsultDesign::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($design->isEmpty()){
self::setError('此数据关联了设计管理信息,需删除设计管理信息');
return false;
}
//现场准备
$scene_prepare = ConsultScenePrepare::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($scene_prepare->isEmpty()){
self::setError('此数据关联了现场准备信息,需删除现场准备信息');
return false;
}
//现场组织建设
$scene_org = ConsultSceneOrg::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($scene_org->isEmpty()){
self::setError('此数据关联了现场组织建设信息,需删除现场组织建设信息');
return false;
}
//现场实施管理
$scene_execute = ConsultSceneExecute::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($scene_execute->isEmpty()){
self::setError('此数据关联了现场实施管理信息,需删除现场实施管理信息');
return false;
}
//验收管理
$accept = ConsultAccept::where('subdirectory_id','in',$params['id'])->findOrEmpty();
if($accept->isEmpty()){
self::setError('此数据关联了验收管理信息,需删除验收管理信息');
return false;
}
return ConsultSubdirectory::destroy($params['id']);
}