商机管理模块完善
This commit is contained in:
parent
9b0aedcb22
commit
c23040a4a8
@ -16,6 +16,7 @@ namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
@ -38,7 +39,8 @@ class ProjectLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['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'],
|
||||
'=' => ['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']
|
||||
];
|
||||
}
|
||||
|
||||
@ -54,11 +56,21 @@ class ProjectLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return Project::where($this->searchWhere)
|
||||
$params = $this->request->param();
|
||||
$condition = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$customIds = Custom::where('name','like','%'.$params['custom_id'].'%')->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'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->select()->each(function($item){
|
||||
$custom = Custom::field('name')->where('id',$item['custom_id'])->findOrEmpty();
|
||||
$item['custom_name'] = $custom->isEmpty() ? '' : $custom['name'];
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
@ -42,6 +43,7 @@ class ProjectLogic extends BaseLogic
|
||||
try {
|
||||
Project::create([
|
||||
'custom_id' => $params['custom_id'],
|
||||
'name' => $params['name'],
|
||||
'project_type' => $params['project_type'],
|
||||
'project_code' => $params['project_code'],
|
||||
'project_content' => $params['project_content'],
|
||||
@ -94,6 +96,7 @@ class ProjectLogic extends BaseLogic
|
||||
try {
|
||||
Project::where('id', $params['id'])->update([
|
||||
'custom_id' => $params['custom_id'],
|
||||
'name' => $params['name'],
|
||||
'project_type' => $params['project_type'],
|
||||
'project_code' => $params['project_code'],
|
||||
'project_content' => $params['project_content'],
|
||||
@ -155,6 +158,9 @@ class ProjectLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return Project::findOrEmpty($params['id'])->toArray();
|
||||
$data = Project::findOrEmpty($params['id'])->toArray();
|
||||
$custom = Custom::field('name')->where('id',$data['custom_id'])->findOrEmpty();
|
||||
$data['custom_name'] = $custom->isEmpty() ? '' : $custom['name'];
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -32,6 +32,10 @@ class ProjectValidate extends BaseValidate
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'custom_id' => 'require',
|
||||
'project_code' => 'require',
|
||||
'project_type' => 'require',
|
||||
'name' => 'require',
|
||||
];
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@ namespace app\common\model\project;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\dict\DictData;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
@ -29,6 +30,14 @@ class Project extends BaseModel
|
||||
use SoftDelete;
|
||||
protected $name = 'project';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
|
||||
public function getStatusAttr($value)
|
||||
{
|
||||
$project_status = DictData::field('name,value')->where('type_id',39)->select();
|
||||
$status = [];
|
||||
foreach ($project_status as $v) {
|
||||
$status[$v['value']] = $v['name'];
|
||||
}
|
||||
return $status[$value];
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user