From d29c9705c87b84d2d50161dff99694e5605b880c Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Tue, 19 Mar 2024 17:56:29 +0800 Subject: [PATCH] update --- .../lists/custom/CustomerDemandLists.php | 2 -- app/adminapi/lists/project/ProjectLists.php | 6 ---- .../logic/custom/CustomerDemandLogic.php | 10 ------- app/adminapi/logic/project/ProjectLogic.php | 8 ------ .../custom/CustomerDemandValidate.php | 28 ------------------- .../validate/project/ProjectValidate.php | 25 ----------------- app/common/model/custom/CustomerDemand.php | 5 ---- 7 files changed, 84 deletions(-) diff --git a/app/adminapi/lists/custom/CustomerDemandLists.php b/app/adminapi/lists/custom/CustomerDemandLists.php index a6ed88ade..13884d98d 100644 --- a/app/adminapi/lists/custom/CustomerDemandLists.php +++ b/app/adminapi/lists/custom/CustomerDemandLists.php @@ -20,8 +20,6 @@ use app\common\lists\ListsExcelInterface; use app\common\model\custom\Custom; use app\common\model\custom\CustomerDemand; use app\common\lists\ListsSearchInterface; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; use app\common\model\project\Project; diff --git a/app/adminapi/lists/project/ProjectLists.php b/app/adminapi/lists/project/ProjectLists.php index 8cb855350..d1bc5192a 100644 --- a/app/adminapi/lists/project/ProjectLists.php +++ b/app/adminapi/lists/project/ProjectLists.php @@ -18,8 +18,6 @@ namespace app\adminapi\lists\project; use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsExcelInterface; use app\common\model\custom\Custom; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; use app\common\model\project\Project; use app\common\lists\ListsSearchInterface; use app\common\model\project\ProjectTypeSet; @@ -64,12 +62,8 @@ class ProjectLists extends BaseAdminDataLists implements ListsSearchInterface,Li ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ - $org = Orgs::field('name')->where('id',$item['org_id'])->findOrEmpty(); - $dept = Dept::field('name')->where('id',$item['dept_id'])->findOrEmpty(); $projectType = ProjectTypeSet::where('id',$item['project_type'])->findOrEmpty(); $custom = Custom::field('name,master_name,master_phone')->where('id',$item['custom_id'])->findOrEmpty(); - $item['org_name'] = $org['name']; - $item['dept_name'] = $dept['name']; $item['custom_name'] = $custom['name']; $item['custom_master_name'] = $custom['master_name']; $item['custom_master_phone'] = $custom['master_phone']; diff --git a/app/adminapi/logic/custom/CustomerDemandLogic.php b/app/adminapi/logic/custom/CustomerDemandLogic.php index bf3a13a88..52f57a487 100644 --- a/app/adminapi/logic/custom/CustomerDemandLogic.php +++ b/app/adminapi/logic/custom/CustomerDemandLogic.php @@ -19,8 +19,6 @@ use app\common\model\auth\Admin; use app\common\model\custom\Custom; use app\common\model\custom\CustomerDemand; use app\common\logic\BaseLogic; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; use app\common\model\project\Project; use think\facade\Db; @@ -46,8 +44,6 @@ class CustomerDemandLogic extends BaseLogic Db::startTrans(); try { CustomerDemand::create([ - 'org_id' => $params['org_id'], - 'dept_id' => $params['dept_id'], 'project_id' => $params['project_id'], 'theme' => $params['theme'], 'supplier' => $params['supplier'] ?? '', @@ -81,8 +77,6 @@ class CustomerDemandLogic extends BaseLogic Db::startTrans(); try { CustomerDemand::where('id', $params['id'])->update([ - 'org_id' => $params['org_id'], - 'dept_id' => $params['dept_id'], 'project_id' => $params['project_id'], 'theme' => $params['theme'], 'supplier' => $params['supplier'] ?? '', @@ -127,13 +121,9 @@ class CustomerDemandLogic extends BaseLogic public static function detail($params): array { $data = CustomerDemand::field('id,org_id,dept_id,project_id,theme,supplier,supplier_contacts,importance,recording_time,demand_content,annex,add_user,update_user,create_time,update_time')->findOrEmpty($params['id']); - $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); - $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); $project = Project::field('name,project_code,custom_id')->where('id',$data['project_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); $admin = Admin::where('id','in',[$data['add_user'],$data['update_user']])->column('name','id'); - $data['org_name'] = $org['name']; - $data['dept_name'] = $dept['name']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['custom_name'] = $custom['name']; diff --git a/app/adminapi/logic/project/ProjectLogic.php b/app/adminapi/logic/project/ProjectLogic.php index 4a99cbddc..0baa5e96e 100644 --- a/app/adminapi/logic/project/ProjectLogic.php +++ b/app/adminapi/logic/project/ProjectLogic.php @@ -45,8 +45,6 @@ class ProjectLogic extends BaseLogic Db::startTrans(); try { Project::create([ - 'org_id' => $params['org_id'], - 'dept_id' => $params['dept_id'], 'custom_id' => $params['custom_id'], 'name' => $params['name'], 'project_type' => $params['project_type'], @@ -101,8 +99,6 @@ class ProjectLogic extends BaseLogic Db::startTrans(); try { Project::where('id', $params['id'])->update([ - 'org_id' => $params['org_id'], - 'dept_id' => $params['dept_id'], 'custom_id' => $params['custom_id'], 'name' => $params['name'], 'project_type' => $params['project_type'], @@ -166,12 +162,8 @@ class ProjectLogic extends BaseLogic public static function detail($params): array { $data = Project::findOrEmpty($params['id']); - $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); - $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); $projectType = ProjectTypeSet::field('name')->where('id',$data['project_type'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$data['custom_id'])->findOrEmpty(); - $data['org_name'] = $org['name']; - $data['dept_name'] = $dept['name']; $data['custom_name'] = $custom['name']; $data['project_type_name'] = $projectType['name']; $data['status_text'] = $data->status_text; diff --git a/app/adminapi/validate/custom/CustomerDemandValidate.php b/app/adminapi/validate/custom/CustomerDemandValidate.php index 0c3ea9a15..8156a3bc2 100644 --- a/app/adminapi/validate/custom/CustomerDemandValidate.php +++ b/app/adminapi/validate/custom/CustomerDemandValidate.php @@ -14,9 +14,6 @@ namespace app\adminapi\validate\custom; - -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; use app\common\model\dict\DictData; use app\common\model\project\Project; use app\common\validate\BaseValidate; @@ -36,8 +33,6 @@ class CustomerDemandValidate extends BaseValidate */ protected $rule = [ 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', 'project_id' => 'require|checkProject', 'theme' => 'require', 'importance' => 'require|checkImportance', @@ -47,8 +42,6 @@ class CustomerDemandValidate extends BaseValidate protected $message = [ 'id.require' => '缺少必要参数', - 'org_id.require' => '请选择组织', - 'dept_id.require' => '请选择部门', 'project_id.require' => '请选择项目', 'theme.require' => '请填写需求主题', 'importance.require' => '请选择重要程度', @@ -101,27 +94,6 @@ class CustomerDemandValidate extends BaseValidate return $this->only(['id']); } - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()) { - return '组织不存在'; - } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; - } - if($dept['org_id'] != $data['org_id']){ - return '当前部门不属于所选择的组织'; - } - return true; - } - public function checkProject($value): bool|string { $project = Project::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectValidate.php b/app/adminapi/validate/project/ProjectValidate.php index 13cbd12a5..1fd3b7402 100644 --- a/app/adminapi/validate/project/ProjectValidate.php +++ b/app/adminapi/validate/project/ProjectValidate.php @@ -16,8 +16,6 @@ namespace app\adminapi\validate\project; use app\common\model\custom\Custom; -use app\common\model\dept\Dept; -use app\common\model\dept\Orgs; use app\common\model\dict\DictData; use app\common\model\project\ProjectTypeSet; use app\common\validate\BaseValidate; @@ -37,8 +35,6 @@ class ProjectValidate extends BaseValidate */ protected $rule = [ 'id' => 'require', - 'org_id' => 'require|checkOrg', - 'dept_id' => 'require|checkDept', 'custom_id' => 'require|checkCustom', 'project_type' => 'require|checkProjectType', 'name' => 'require', @@ -113,27 +109,6 @@ class ProjectValidate extends BaseValidate return $this->only(['id']); } - public function checkOrg($value): bool|string - { - $org = Orgs::where('id',$value)->findOrEmpty(); - if($org->isEmpty()){ - return '组织不存在'; - } - return true; - } - - public function checkDept($value,$rule,$data): bool|string - { - $dept = Dept::where('id',$value)->findOrEmpty(); - if($dept->isEmpty()){ - return '部门不存在'; - } - if($dept['org_id'] != $data['org_id']){ - return '部门无效'; - } - return true; - } - public function checkCustom($value): bool|string { $custom = Custom::where('id',$value)->findOrEmpty(); diff --git a/app/common/model/custom/CustomerDemand.php b/app/common/model/custom/CustomerDemand.php index 935733145..2115a5a4a 100644 --- a/app/common/model/custom/CustomerDemand.php +++ b/app/common/model/custom/CustomerDemand.php @@ -41,9 +41,4 @@ class CustomerDemand extends BaseModel { return empty($value) ? '' : date('Y-m-d', $value); } - - public function getAnnexAttr($value) - { - return !empty($value) ? json_decode($value,true) : ''; - } } \ No newline at end of file