增加专家删除和查看

main
liutk 2024-03-13 13:51:56 +08:00
parent d82f8bec23
commit a3ebeb10a7
2 changed files with 175 additions and 6 deletions

View File

@ -7,6 +7,7 @@ use Slowlyo\OwlAdmin\Renderers\Form;
use Slowlyo\OwlAdmin\Controllers\AdminController;
use App\Services\Admin\ManageService;
use App\Admin\Components;
use App\Traits\CustomActionTrait;
/**
* 专家管理
@ -15,6 +16,7 @@ use App\Admin\Components;
*/
class ManageController extends AdminController
{
use CustomActionTrait;
protected string $serviceName = ManageService::class;
public function list(): Page
@ -46,7 +48,12 @@ class ManageController extends AdminController
amis()->TableColumn('work_phone', '电话'),
amis()->TableColumn('mobile_phone', '移动电话'),
amis()->TableColumn('email', '邮箱'),
$this->rowActions()
amisMake()->Operation()->label(__('admin.actions'))->buttons([
$this->rowShowTypeButton('drawer', 'xl'),
$this->rowEditButton(),
$this->rowDeleteButton(),
])
]);
return $this->baseList($crud);
@ -324,10 +331,135 @@ class ManageController extends AdminController
]);
}
public function detail(): Form
public function detail()
{
return $this->baseDetail()->body([
$form = amisMake()->form()->title('')->panelClassName('border-r border-t-0 border-b-0 border-l-0')->mode('horizontal')
->static(true)->actions([])
->body([
amis()->FieldSetControl()->title('基本信息')->body([
amis()->GroupControl()->body([
amis()->Image()->type('static-image')->name('avatar')->label('寸照')->height('80px')->width('80px')->thumbMode('cover'),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('name', '姓名')->copyable(['content'=>'${name}']),
amis()->RadiosControl('gender', '性别')->options([
'1'=>'男', '2'=>'女'
]),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('birthday', '出生年月'),
amis()->StaticExactControl('political_face', '政治面貌'),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('educational_level', '学历学位'),
amis()->StaticExactControl('company', '工作单位'),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('strative_position', '行政职务'),
amis()->StaticExactControl('technical_position', '专业技术职务'),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('subject', '学科门类'),
amis()->StaticExactControl('research_direction', '研究方向'),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('address', '通讯地址(邮编)'),
amis()->StaticExactControl('email', '个人邮箱'),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('work_phone', '办公电话'),
amis()->StaticExactControl('mobile_phone', '移动电话'),
]),
amis()->GroupControl()->body([
amis()->StaticExactControl('others', '其他注意事项'),
]),
]),
]);
return amisMake()->Grid()->columns([
amis()->Column()->body($form)->md(6),
amis()->Column()->body([
amis()->FieldSetControl()->title('个人简历')->body([
amis()->TableControl('jobs', '')->columnsTogglable(false)->columns([
amis()->DateControl('start_at', '开始时间')->valueFormat('YYYY-MM-DD'),
amis()->DateControl('end_at', '截止时间')->valueFormat('YYYY-MM-DD'),
amis()->TextControl('company', '工作单位以及所在部门'),
amis()->TextControl('job_name', '职务、职称'),
])->needConfirm(false)->static()
]),
amis()->FieldSetControl()->title('获奖情况')->body([
amis()->TableControl('ranks', '')->columnsTogglable(false)->columns([
amis()->TextControl('rank_name', '获奖名称'),
amis()->TextControl('rank_cate', '获奖类别(等级)'),
amis()->TextControl('rank_company', '授予单位'),
amis()->DateControl('rank_at', '获奖时间')->valueFormat('YYYY-MM-DD'),
amis()->TextControl('rank_lv', '本人排名'),
])->needConfirm(false)->static()
]),
amis()->FieldSetControl()->title('科研项目情况')->body([
amis()->TableControl('projects', '')->columnsTogglable(false)->columns([
amis()->TextControl('project_name', '项目名称')->required(true),
amis()->TextControl('project_source', '项目来源')->required(true),
amis()->SelectControl('join_type', '主持或者参加')->options([
'1'=>'主持', '2'=>'参加'
])->required(true),
amis()->DateControl('start_at', '开始时间')->valueFormat('YYYY-MM-DD')->required(true),
amis()->DateControl('end_at', '截止时间')->valueFormat('YYYY-MM-DD')->required(true),
amis()->TextControl('result_name', '成果名称')->required(true),
amis()->TextControl('result_use', '成果转化')->required(true),
])->needConfirm(false)->static()
]),
amis()->FieldSetControl()->title('论著发表出版情况')->body([
amis()->TableControl('articles', '')->columnsTogglable(false)->columns([
amis()->TextControl('artcile_name', '论文或著作名称')->required(true),
amis()->TextControl('press_name', '出版社/期刊/报纸')->required(true),
amis()->YearControl('year', '年份')->valueFormat('YYYY')->required(true),
amis()->TextControl('source_page', '期/卷/版/页')->required(true),
amis()->TextControl('author_rank', '作者名次')->required(true),
])->needConfirm(false)->static()
]),
amis()->FieldSetControl()->title('决策咨询情况')->body([
amis()->TableControl('consults', '')->columnsTogglable(false)->columns([
amis()->TextControl('consult_title', '决策咨询报告题目')->required(true),
amis()->TextControl('consult_channel', '报送渠道')->required(true),
amis()->SelectControl('join_type', '主持或者参加')->options([
'1'=>'主持', '2'=>'参加'
])->required(true),
amis()->TextControl('leader_instruction', '领导批示')->required(true),
amis()->DateControl('consult_at', '日期')->valueFormat('YYYY-MM-DD')->required(true),
amis()->TextControl('result_use', '成果转化')->required(true),
])->needConfirm(false)->static()
]),
amis()->FieldSetControl()->title('学术交流情况')->body([
amis()->TableControl('meetings', '')->columnsTogglable(false)->columns([
amis()->TextControl('meeting_name', '学术活动名称')->required(true),
amis()->TextControl('meeting_company', '主办单位')->required(true),
amis()->TextControl('meeting_cate', '类型')->required(true),
amis()->DateControl('meeting_at', '日期')->valueFormat('YYYY-MM-DD')->required(true),
amis()->TextControl('result_name', '成果名称')->required(true),
amis()->TextControl('result_use', '成果转化')->required(true),
])->needConfirm(false)->static()
]),
amis()->FieldSetControl()->title('社科普及项目情况')->body([
amis()->TableControl('socials', '')->columnsTogglable(false)->columns([
amis()->TextControl('social_name', '社科普及项目名称')->required(true),
amis()->TextControl('social_company', '主办单位')->required(true),
amis()->TextControl('social_cate', '类型')->required(true),
amis()->DateControl('social_at', '日期')->valueFormat('YYYY-MM-DD')->required(true),
amis()->TextControl('result_name', '成果名称')->required(true),
amis()->TextControl('result_use', '成果转化')->required(true),
])->needConfirm(false)->static()
]),
])->md(6),
]);
}
public function detailActions()
{
return [
//返回
amis()->Button()->actionType('cancel')->label(__('admin.back'))->primary()
];
}
}

View File

@ -2,7 +2,7 @@
namespace App\Services\Admin;
use App\Models\Manage;
use App\Models\{Manage,ManageSocial,ManageJob,ManageRank,ManageArticle,ManageProject,ManageConsult,ManageMeeting};
use App\Models\Filters\ManageFilter;
use App\Traits\UploadTrait;
use Illuminate\Support\Arr;
@ -52,7 +52,7 @@ class ManageService extends BaseService
}catch(\Throwable $th){
DB::rollBack();
report($th);
return false;
return $this->setError('系统错误,请刷新后重试');
}
return true;
}
@ -95,11 +95,48 @@ class ManageService extends BaseService
DB::commit();
}catch(\Throwable $th){
dd($th);
DB::rollBack();
report($th);
return $this->setError('系统错误,请刷新后重试');
}
return true;
}
/**
* 删除
*
* @param string $ids
*
* @return mixed
*/
public function delete(string $ids): mixed
{
$result = $this->query()->whereIn($this->primaryKey(), explode(',', $ids))->delete();
if ($result) {
$this->deleted($ids);
}
return $result;
}
/**
* 删除钩子
*
* @param string $ids
*
* @return mixed
*/
public function deleted(string $ids)
{
ManageJob::whereIn('manage_id', explode(',', $ids))->delete();
ManageRank::whereIn('manage_id', explode(',', $ids))->delete();
ManageProject::whereIn('manage_id', explode(',', $ids))->delete();
ManageArticle::whereIn('manage_id', explode(',', $ids))->delete();
ManageConsult::whereIn('manage_id', explode(',', $ids))->delete();
ManageMeeting::whereIn('manage_id', explode(',', $ids))->delete();
ManageSocial::whereIn('manage_id', explode(',', $ids))->delete();
return true;
}
}