update
This commit is contained in:
parent
1b89cef9a9
commit
449c6bed6e
@ -41,7 +41,8 @@ class SupervisionMaterialEntryLists extends BaseAdminDataLists implements ListsS
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name', 'model'],
|
||||
'=' => ['project_id','enter_result','parallel_test'],
|
||||
'%like%' => ['theme', 'code'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -57,36 +58,16 @@ class SupervisionMaterialEntryLists extends BaseAdminDataLists implements ListsS
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['project_id']) && $params['project_id'] != ''){
|
||||
$material_entry_ids = SupervisionMaterialEntry::where('project_id','=',$params['project_id'])->column('id');
|
||||
$where[] = ['material_entry_id','in',$material_entry_ids];
|
||||
}
|
||||
if(isset($params['theme']) && $params['theme'] != ''){
|
||||
$material_entry_ids = SupervisionMaterialEntry::where('theme','like','%'.$params['theme'].'%')->column('id');
|
||||
$where[] = ['material_entry_id','in',$material_entry_ids];
|
||||
}
|
||||
if(isset($params['code']) && $params['code'] != ''){
|
||||
$material_entry_ids = SupervisionMaterialEntry::where('code','like','%'.$params['code'].'%')->column('id');
|
||||
$where[] = ['material_entry_id','in',$material_entry_ids];
|
||||
}
|
||||
return SupervisionMaterialEntryDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)->where($where)
|
||||
return SupervisionMaterialEntry::withoutField('create_user,create_time,update_time,delete_time')->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$material_entry = SupervisionMaterialEntry::field('project_id,company_id,code,theme,enter_time,enter_result,parallel_test')->where('id',$data['material_entry_id'])->findOrEmpty();
|
||||
$project = SupervisionProject::field('project_name')->where('id',$material_entry['project_id'])->findOrEmpty();
|
||||
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$material_entry['company_id'])->findOrEmpty();
|
||||
$data['contract_brand_text'] = $data->contract_brand_text;
|
||||
$data['code'] = $material_entry['code'];
|
||||
$data['theme'] = $material_entry['theme'];
|
||||
$data['enter_result'] = $material_entry->enter_result_text;
|
||||
$data['parallel_test'] = $material_entry['parallel_test'];
|
||||
$data['parallel_test_text'] = $material_entry->parallel_test_text;
|
||||
$data['enter_time'] = $material_entry['enter_time'];
|
||||
$project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['company_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['project_name'];
|
||||
$data['company_name'] = $company['unit_name'];
|
||||
$data['enter_result_text'] = $data->enter_result_text;
|
||||
$data['parallel_test_text'] = $data->parallel_test_text;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
@ -100,21 +81,7 @@ class SupervisionMaterialEntryLists extends BaseAdminDataLists implements ListsS
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['project_id']) && $params['project_id'] != ''){
|
||||
$material_entry_ids = SupervisionMaterialEntry::where('project_id','=',$params['project_id'])->column('id');
|
||||
$where[] = ['material_entry_id','in',$material_entry_ids];
|
||||
}
|
||||
if(isset($params['theme']) && $params['theme'] != ''){
|
||||
$material_entry_ids = SupervisionMaterialEntry::where('theme','like','%'.$params['theme'].'%')->column('id');
|
||||
$where[] = ['material_entry_id','in',$material_entry_ids];
|
||||
}
|
||||
if(isset($params['code']) && $params['code'] != ''){
|
||||
$material_entry_ids = SupervisionMaterialEntry::where('code','like','%'.$params['code'].'%')->column('id');
|
||||
$where[] = ['material_entry_id','in',$material_entry_ids];
|
||||
}
|
||||
return SupervisionMaterialEntryDetail::where($this->searchWhere)->where($where)->count();
|
||||
return SupervisionMaterialEntry::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -16,6 +16,8 @@ namespace app\adminapi\logic\supervision_work;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\supervision_project\SupervisionParticipatingUnits;
|
||||
use app\common\model\supervision_project\SupervisionProject;
|
||||
use app\common\model\supervision_work\SupervisionMaterialEntry;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\supervision_work\SupervisionMaterialEntryDetail;
|
||||
@ -163,7 +165,11 @@ class SupervisionMaterialEntryLogic extends BaseLogic
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = SupervisionMaterialEntry::withoutField('update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['company_id'])->findOrEmpty();
|
||||
$create_user = Admin::field('name')->where('id',$data['create_user'])->findOrEmpty();
|
||||
$data['project_name'] = $project['project_name'];
|
||||
$data['company_name'] = $company['unit_name'];
|
||||
$data['create_user_name'] = $create_user['name'];
|
||||
$data['enter_result_text'] = $data->enter_result_text;
|
||||
$data['parallel_test_text'] = $data->parallel_test_text;
|
||||
|
Loading…
x
Reference in New Issue
Block a user