This commit is contained in:
weiz 2024-03-19 17:56:29 +08:00
parent 7d1cd69b1a
commit d29c9705c8
7 changed files with 0 additions and 84 deletions

View File

@ -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;

View File

@ -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'];

View File

@ -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'];

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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) : '';
}
}