generated from liutk/owl-admin-base
新增人口-1
parent
78ff55ca1c
commit
0360a5c93b
|
|
@ -73,7 +73,62 @@ class PersonController extends AdminController
|
|||
public function form(): Form
|
||||
{
|
||||
return $this->baseForm()->body([
|
||||
amis()->Grid()->columns([
|
||||
amis()->Wrapper()->body([
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
amis()->RadiosControl('type', __('admin.persons.type'))->options([
|
||||
'11'=>'出生人口', '12'=>'迁入人口'
|
||||
])->value('11')->required(),
|
||||
]),
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
amis()->TextControl('name', __('admin.persons.name'))->required(),
|
||||
amis()->TextControl('used_name', __('admin.persons.used_name')),
|
||||
]),
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
amis()->TextControl('idcard', __('admin.persons.idcard'))->required()->id('person_idcard')->onEvent([
|
||||
'blur'=>[//自定义JS联动字段填写
|
||||
'actions'=>[
|
||||
[
|
||||
"componentId" => "person_idcard",
|
||||
"actionType"=> "disabled"
|
||||
],
|
||||
[
|
||||
'actionType'=>'custom',
|
||||
'script' => 'var strBirthday="";
|
||||
var idcard=event.data.value;
|
||||
if((/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(idcard))){
|
||||
if(String(idcard).length == 18){
|
||||
strBirthday = idcard.substr(6,4)+"/"+idcard.substr(10,2)+"/"+idcard.substr(12,2);
|
||||
}
|
||||
event.setData({...event.data, "birthday":new Date(strBirthday)})
|
||||
}'
|
||||
],
|
||||
[
|
||||
'actionType'=>'setValue',
|
||||
"componentId" => "person_birthday",
|
||||
"args" => [
|
||||
'value'=>'${birthday}'
|
||||
],
|
||||
],
|
||||
[
|
||||
"componentId" => "person_idcard",
|
||||
"actionType"=> "enabled"
|
||||
],
|
||||
]
|
||||
]
|
||||
]),
|
||||
amis()->RadiosControl('gender', __('admin.persons.gender'))->options([
|
||||
'1'=>'男', '2'=>'女'
|
||||
])->required(),
|
||||
]),
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
amis()->DateControl('birthday', __('admin.persons.birthday'))->valueFormat('YYYY-MM-DD')->required()->id('person_birthday'),
|
||||
]),
|
||||
])->md(6),
|
||||
amis()->Wrapper()->body([
|
||||
|
||||
])->md(6)
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,8 @@ class Person extends Model
|
|||
|
||||
protected $table = 'persons';
|
||||
|
||||
protected $fillable = ['type','name', 'used_name', 'value', 'parent_id', 'parent_key', 'path', 'sort', 'lv', 'oid'];
|
||||
|
||||
protected $appends = ['age', 'now_address'];
|
||||
|
||||
protected function serializeDate(\DateTimeInterface $date)
|
||||
|
|
|
|||
|
|
@ -352,5 +352,7 @@ return [
|
|||
'house_building' => '居住小区',
|
||||
'state' => '人口状态',
|
||||
'birthday'=> '出生日期',
|
||||
'type'=>'人口类别',
|
||||
'used_name'=>'曾用名'
|
||||
],
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue