项目立项完善

This commit is contained in:
weiz 2023-12-09 10:22:56 +08:00
parent 7fe37f2b98
commit bfc7e8d20b
4 changed files with 30 additions and 13 deletions

View File

@ -39,8 +39,8 @@ class ProjectLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array
{
return [
'=' => ['project_type', 'project_content', 'project_estimation', 'estimated_construction', 'bidding_time', 'bidding_method', 'contacts', 'position', 'telephone', 'department', 'person', 'relationship', 'discovery_time', 'information_sources', 'competitor', 'construction_funds_sources', 'construction_payment_method', 'construction_financial_status', 'construction_recognition', 'my_construction_recognition', 'strategic_significance', 'industry', 'unit_nature', 'annex', 'status'],
'%like%' => ['project_code','project_address']
'=' => ['status','project_type','strategic_significance','industry','unit_nature','bidding_method','information_sources'],
'%like%' => ['project_code','name','project_address','person']
];
}
@ -58,12 +58,12 @@ class ProjectLists extends BaseAdminDataLists implements ListsSearchInterface
{
$params = $this->request->param();
$condition = [];
if(isset($params['custom_id']) && $params['custom_id'] != ''){
$customIds = Custom::where('name','like','%'.$params['custom_id'].'%')->column('id');
if(isset($params['custom_name']) && $params['custom_name'] != ''){
$customIds = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
$condition[] = ['custom_id','in',$customIds];
}
return Project::where($this->searchWhere)->where($condition)
->field(['id', 'custom_id', 'project_type', 'project_code', 'project_content', 'project_estimation', 'project_address', 'estimated_construction', 'bidding_time', 'bidding_method', 'contacts', 'position', 'telephone', 'department', 'person', 'relationship', 'discovery_time', 'information_sources', 'competitor', 'construction_funds_sources', 'construction_payment_method', 'construction_financial_status', 'construction_recognition', 'my_construction_recognition', 'strategic_significance', 'industry', 'unit_nature', 'annex', 'status'])
->field(['id','custom_id','project_code','name','status','project_address','project_type','strategic_significance','industry','unit_nature','bidding_method','information_sources','person'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($item){

View File

@ -45,7 +45,7 @@ class ProjectLogic extends BaseLogic
'custom_id' => $params['custom_id'],
'name' => $params['name'],
'project_type' => $params['project_type'],
'project_code' => $params['project_code'],
'project_code' => project_code(),
'project_content' => $params['project_content'],
'project_estimation' => $params['project_estimation'],
'project_address' => $params['project_address'],
@ -70,7 +70,7 @@ class ProjectLogic extends BaseLogic
'industry' => $params['industry'],
'unit_nature' => $params['unit_nature'],
'annex' => $params['annex'],
'status' => $params['status']
'status' => 0
]);
Db::commit();
@ -98,7 +98,6 @@ class ProjectLogic extends BaseLogic
'custom_id' => $params['custom_id'],
'name' => $params['name'],
'project_type' => $params['project_type'],
'project_code' => $params['project_code'],
'project_content' => $params['project_content'],
'project_estimation' => $params['project_estimation'],
'project_address' => $params['project_address'],
@ -123,7 +122,6 @@ class ProjectLogic extends BaseLogic
'industry' => $params['industry'],
'unit_nature' => $params['unit_nature'],
'annex' => $params['annex'],
'status' => $params['status']
]);
Db::commit();

View File

@ -32,11 +32,24 @@ class ProjectValidate extends BaseValidate
*/
protected $rule = [
'id' => 'require',
'custom_id' => 'require',
'project_code' => 'require',
'project_type' => 'require',
'custom_id' => 'require|integer',
'project_type' => 'require|integer',
'name' => 'require',
'discovery_time' => 'require',
'information_sources' => 'require|integer'
];
protected $message = [
'id.require' => '缺少数据主键',
'custom_id.require' => '请选择客户',
'custom_id.integer' => '客户数据格式错误',
'project_type.require' => '请选择工程类型',
'project_type.integer' => '工程类型据格式错误',
'name.require' => '请填写工程名称',
'discovery_time.require' => '请选择发现时间',
'information_sources.require' => '请选择信息来源',
'information_sources.integer' => '信息来源据格式错误',
];
/**
@ -68,7 +81,7 @@ class ProjectValidate extends BaseValidate
*/
public function sceneEdit()
{
return $this->only(['id']);
return $this->append(['id']);
}

View File

@ -297,3 +297,9 @@ function format_amount($float)
}
return $float;
}
//生成项目编码
function project_code(): string
{
return 'P'.date('Ymd',time()).'-'.mt_rand(100000, 999999);
}