generated from liutk/owl-admin-base
新增变动筛选
parent
caa22815f8
commit
8f6d2dbd7c
|
|
@ -9,6 +9,7 @@ use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||||
use App\Admin\Components;
|
use App\Admin\Components;
|
||||||
use App\Services\Admin\PersonChangeService;
|
use App\Services\Admin\PersonChangeService;
|
||||||
|
use App\Models\Keyword;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人口变动
|
* 人口变动
|
||||||
|
|
@ -26,15 +27,21 @@ class PersonChangeController extends AdminController
|
||||||
amis('filter-toggler')->align('right'),
|
amis('filter-toggler')->align('right'),
|
||||||
])
|
])
|
||||||
->filter($this->baseFilter()->labelWidth('80px')->body([
|
->filter($this->baseFilter()->labelWidth('80px')->body([
|
||||||
|
amis()->GroupControl()->mode('horizontal')->body([
|
||||||
|
amis()->YearControl('year', __('admin.year'))->valueFormat('YYYY')->columnRatio(3),
|
||||||
|
amis()->SelectControl('person.organized_body_id', __('admin.persons.organized_body'))->options(Keyword::where('parent_key', 'organized_body')->pluck('name', 'id')->toArray())->columnRatio(3)->clearable(true),
|
||||||
|
// amis()->TextControl('person.name', __('admin.persons.name'))->placeholder(__('admin.persons.name'))->columnRatio(3),
|
||||||
|
amis()->SelectControl('type', __('admin.person_changes.type'))->options(PersonChange::typeMap())->columnRatio(3)->clearable(true),
|
||||||
|
]),
|
||||||
]))
|
]))
|
||||||
->columns([
|
->columns([
|
||||||
amis()->TableColumn('person.organized_body.name', __('admin.persons.organized_body'))->width('100px'),
|
amis()->TableColumn('person.organized_body.name', __('admin.persons.organized_body'))->width('100px'),
|
||||||
amis()->TableColumn('changed_at', __('admin.person_changes.changed_at'))->width('100px'),
|
amis()->TableColumn('changed_at', __('admin.person_changes.changed_at'))->width('100px'),
|
||||||
amis()->TableColumn('type', __('admin.person_changes.type'))->type('mapping')->map(PersonChange::typeMap()),
|
amis()->TableColumn('type', __('admin.person_changes.type'))->type('mapping')->map(PersonChange::typeMap()),
|
||||||
amis()->TableColumn('person.name', __('admin.persons.name'))->width('100px')->copyable(),
|
amis()->TableColumn('person.name', __('admin.persons.name'))->width('100px')->copyable()->searchable(),
|
||||||
amis()->TableColumn('extends_mark', __('admin.person_changes.extends_mark')),
|
amis()->TableColumn('extends_mark', __('admin.person_changes.extends_mark')),
|
||||||
amis()->TableColumn('phone', __('admin.person_changes.phone')),
|
amis()->TableColumn('phone', __('admin.person_changes.phone')),
|
||||||
|
amis()->TableColumn('remark', __('admin.person_changes.remark')),
|
||||||
amis()->TableColumn('created_at', __('admin.person_changes.created_at'))->type('datetime')->sortable(true),
|
amis()->TableColumn('created_at', __('admin.person_changes.created_at'))->type('datetime')->sortable(true),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ class PersonController extends AdminController
|
||||||
amis()->SelectControl('organized_body', __('admin.persons.organized_body'))->options(Keyword::where('parent_key', 'organized_body')->pluck('name', 'id')->toArray())
|
amis()->SelectControl('organized_body', __('admin.persons.organized_body'))->options(Keyword::where('parent_key', 'organized_body')->pluck('name', 'id')->toArray())
|
||||||
->columnRatio(3)->clearable(true),
|
->columnRatio(3)->clearable(true),
|
||||||
amis()->NestedSelectControl('house_building', __('admin.persons.house_building'))->source(admin_url('api/keywords/tree-list?parent_name=housing_estate&has_owner=0'))->labelField('name')->valueField('id')->columnRatio(6)->clearable(true),
|
amis()->NestedSelectControl('house_building', __('admin.persons.house_building'))->source(admin_url('api/keywords/tree-list?parent_name=housing_estate&has_owner=0'))->labelField('name')->valueField('id')->columnRatio(6)->clearable(true),
|
||||||
|
amis()->SelectControl('is_master', __('admin.persons.is_master'))->options([
|
||||||
|
'1'=>'仅户主','0'=>'非户主'
|
||||||
|
])->columnRatio(3)->clearable(true),
|
||||||
]),
|
]),
|
||||||
amis()->GroupControl()->mode('horizontal')->body([
|
amis()->GroupControl()->mode('horizontal')->body([
|
||||||
amis()->SelectControl('state', __('admin.persons.state'))->options([
|
amis()->SelectControl('state', __('admin.persons.state'))->options([
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,22 @@ use App\Models\Keyword;
|
||||||
|
|
||||||
class PersonChangeFilter extends ModelFilter
|
class PersonChangeFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
|
public function year($year)
|
||||||
|
{
|
||||||
|
return $this->whereYear('changed_at', $year);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function person($person)
|
||||||
|
{
|
||||||
|
return $this->whereHas('person', function(Builder $q) use ($person){
|
||||||
|
foreach($person as $key => $value){
|
||||||
|
$q->where($key, $value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function type($type)
|
||||||
|
{
|
||||||
|
return $this->where('type', $type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class PersonFilter extends ModelFilter
|
||||||
*/
|
*/
|
||||||
public function organizedBody($organizedBody)
|
public function organizedBody($organizedBody)
|
||||||
{
|
{
|
||||||
return $this->where('organized_body', $organizedBody);
|
return $this->where('organized_body_id', $organizedBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -66,9 +66,9 @@ class PersonFilter extends ModelFilter
|
||||||
{
|
{
|
||||||
if(Keyword::where('id', $houseBuilding)->value('lv') == 3)
|
if(Keyword::where('id', $houseBuilding)->value('lv') == 3)
|
||||||
{
|
{
|
||||||
return $this->where('building', $houseBuilding);
|
return $this->where('building_id', $houseBuilding);
|
||||||
}else{
|
}else{
|
||||||
return $this->where('housing_estate', $houseBuilding);
|
return $this->where('housing_estate_id', $houseBuilding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ return [
|
||||||
'please_login' => '请先登录',
|
'please_login' => '请先登录',
|
||||||
'unauthorized' => '无权访问',
|
'unauthorized' => '无权访问',
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
|
'year' => '年份',
|
||||||
|
|
||||||
'components' => [
|
'components' => [
|
||||||
'content' => '内容',
|
'content' => '内容',
|
||||||
|
|
@ -375,6 +376,7 @@ return [
|
||||||
'health' => '身体状况',
|
'health' => '身体状况',
|
||||||
'phone' => '联系方式',
|
'phone' => '联系方式',
|
||||||
'remark' => '备注',
|
'remark' => '备注',
|
||||||
|
'is_master'=>'是否户主',
|
||||||
|
|
||||||
//分户操作
|
//分户操作
|
||||||
'split_master' => '分户',
|
'split_master' => '分户',
|
||||||
|
|
@ -382,8 +384,9 @@ return [
|
||||||
'person_changes'=>[
|
'person_changes'=>[
|
||||||
'changed_at' => '变动日期',
|
'changed_at' => '变动日期',
|
||||||
'extends_mark'=>'变动明细',
|
'extends_mark'=>'变动明细',
|
||||||
'type' => '类别',
|
'type' => '变动类别',
|
||||||
'phone'=>'联系方式',
|
'phone'=>'联系方式',
|
||||||
'created_at' => '操作时间'
|
'created_at' => '操作时间',
|
||||||
|
'remark' => '备注'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue