getRequestUri(); $params = explode('?', $url); $indexUrl = "/admin/activity/create"; $thirdOpenid = Admin::user()->third_openid; $menuResult = RemoteSsoFacade::getUserMenuWebsiteData($thirdOpenid); // var_dump($menuResult);exit; // if (isset($menuResult["menu"])){ // foreach ($menuResult["menu"] as &$val){ // if($val["id"]==1000000000000016){ // $val["menu_url"]=admin_url("activities"); // } // } // } return view('admin/sso/index', ['menuResult' => $menuResult,"indexUrl"=>$indexUrl, "paramUrl" => $params[1]]); } /** * Make a grid builder. * * @return Grid */ protected function grid() { $user = Admin::user(); $grid = new Grid(new FourActivity()); //权限 $grid->actions(function ($actions) use ($user) { // 没有`delete-image`权限的角色不显示删除按钮 if (!$user->can('delete-activite')) { $actions->disableDelete(); } }); $grid->model()->where(function(Builder $query) use ($user){ if ($user->username != "admin"){ // $query->where("creator","=",$user->getAuthIdentifier()); $result = RemoteSsoFacade::getChildWorksation($user->workstation_id); if($result){ $ocIdArr = array_column($result,'open_oc_id'); array_push($ocIdArr, $user->workstation_id); $query->whereIn('workstation_id',$ocIdArr); } } } ); $grid->filter(function($filter){ $filter->disableIdFilter(); // $filter->where(function($query){ // $query->where('activity_range_id=' . $_GET['activity_range_id']); // },'hidden'); // 在这里添加字段过滤器 $filter->like('title', '主题'); $filter->equal('type', '活动类型')->select( FourActivity::TYPE_MAP ); $filter->equal('activities_type', '四进类型')->select( FourActivity::ACTIVITIES_TYPE_MAP ); $filter->expand(); }); $grid->column('id', __('ID')); $grid->column('title', __('主题')); $grid->column('type', __('活动类型'))->using( FourActivity::TYPE_MAP ); $grid->column('activities_type', __('四进类型'))->using( FourActivity::ACTIVITIES_TYPE_MAP ); $grid->column('active_time', __('活动时间')); $grid->column('place', __('活动地点')); $grid->column('audit_status', __('审核状态'))->display(function($vaule){ switch ($vaule) { case FourActivity::AUDIT_STATUS_PENDING: $str = "待审核"; break; case FourActivity::AUDIT_STATUS_PASS: $str = "已通过 "; break; case FourActivity::AUDIT_STATUS_REJECT: $str = "已驳回"; break; default: $str = "待审核"; break; } return $str; }); // $grid->column('content', __('活动内容')); // $grid->column('ext', __('附件资料')); // $grid->column('creater', __('创建者')); // $grid->column('updater', __('修改者')); $grid->column('created_at', __('创建时间')); $grid->column('updated_at', __('修改时间')); $grid->actions(function ($actions) { $row = $actions->row; if($row->audit_status == FourActivity::AUDIT_STATUS_PENDING) { $actions->add(new ReportAudit); } }); $grid->disableCreateButton(); $grid->disableExport(); $grid->disableColumnSelector(); $grid->tools(function (Grid\Tools $tools) { $tools->append(new Report); }); return $grid; } /** * Make a show builder. * * @param mixed $id * @return Show */ protected function detail($id) { $show = new Show(FourActivity::findOrFail($id)); $show->field('id', __('Id')); $show->field('title', __('主题')); $show->field('type', __('活动类型'))->using(FourActivity::TYPE_MAP); $show->field('activities_type', __('四进类型'))->using(FourActivity::ACTIVITIES_TYPE_MAP); $show->field('active_time', __('活动时间')); $show->field('content', __('活动内容')); $show->field('place', __('活动地点')); $show->field('audience_crowd', __('受众人群'))->using(FourActivity::AUDIENCE_CROWD_MAP); $show->field('mode', __('方式'))->using(FourActivity::MODE_MAP); $show->field('anchor', __('讲者/主持')); $show->field('educational_materials', __('发放宣教材料(份)')); $show->field('publicity_board', __('宣传栏(期)')); $show->field('filling_people', __('填表人')); $show->field('filling_time', __('填表时间')); $show->field('member_num', __('受宣人次数')); $show->field('planned_number', __('计划人数')); $show->field('actual_number', __('实到人数')); $show->field('audit_status', __('审核状态'))->using(FourActivity::AUDIT_STATUS_MAP); $show->field('audit_not_reason', __('驳回原因')); return $show; } /** * Make a form builder. * * @return Form */ protected function form(HttpRequest $request) { var_dump($request->all());exit; $form = new Form(new FourActivity()); $form->setTitle('工作上报'); $form->hidden('workstation_id')->value(Admin::user()->workstation_id); $form->hidden('workstation_name')->value(Admin::user()->workstation_name); $form->radio("type","活动类型") ->options(FourActivity::TYPE_MAP) ->default(FourActivity::TYPE_SCIENCE_POPULARIZATION_BASE) ->when("=",FourActivity::TYPE_SCIENCE_POPULARIZATION_BASE,function (Form $form) { $form->select('activities_type', __('四进类型'))->options(function(){ return FourActivity::ACTIVITIES_TYPE_MAP; }); $form->datetime('active_time', __('活动时间')); $form->text('place', __('活动地点')); $form->select('audience_crowd', __('受众人群'))->options(function(){ return FourActivity::AUDIENCE_CROWD_MAP; }); $form->text('title', __('主题')); $form->text('anchor', __('讲者/主持')); $form->text('educational_materials', __('发放宣教材料(份)')); $form->text('publicity_board', __('宣传栏(期)')); $form->text('member_num', __('受宣人次数')); $form->text('planned_number', __('计划人数')); $form->text('actual_number', __('实到人数')); $form->text('filling_people', __('填表人')); $form->datetime('filling_time', __('填表时间')); $form->select('mode', __('方式'))->options(function(){ return FourActivity::MODE_MAP; })->when("in",array( FourActivity::MODE_HEALTH_EDUCATION_LECTURE, FourActivity::MODE_TRAIN, FourActivity::MODE_GROUP_DISCUSSION_AND_DISCUSSION ),function (Form $form) { //开展讲座、培训,需同步提交通知、课件、签到表及现场照片 $form->html("

备注:需同步提交通知、课件、签到表及现场照片

"); })->when("in",array( FourActivity::MODE_HEALTH_PROMOTION_ACTIVITIES, ),function (Form $form) { //开展健康宣传活动,需同步提交活动照片、活动总结 $form->html("

备注:需同步提交活动照片、活动总结

"); })->when("in",array_values(array_diff(array_keys(FourActivity::MODE_MAP),array( FourActivity::MODE_HEALTH_EDUCATION_LECTURE, FourActivity::MODE_TRAIN, FourActivity::MODE_GROUP_DISCUSSION_AND_DISCUSSION, FourActivity::MODE_HEALTH_PROMOTION_ACTIVITIES ) )),function (Form $form) { //其它形式活动根据实际情况提交影像资料 $form->html("

备注:需要根据实际情况提交影像资料

"); }); //多文件 $form->multipleFile('ext', __('附件资料'))->removable(); $form->textarea('content', __('活动内容')); $form->html('

1.开展讲座、培训,需同步提交通知、课件、签到表及现场照片;

2.开展宣传活动,需同步提交活动照片、活动总结;

3.其它形式活动根据实际情况提交影像资料。

','注意事项'); }) ->when("=",FourActivity::TYPE_PROMOTION_ACTIVITIES,function (Form $form) { $form->select('activities_type', __('四进类型'))->options(function(){ return FourActivity::ACTIVITIES_TYPE_MAP; }); $form->datetime('active_time', __('活动时间')); $form->text('place', __('活动地点')); $form->select('audience_crowd', __('受众人群'))->options(function(){ return FourActivity::AUDIENCE_CROWD_MAP; }); $form->text('title', __('主题')); $form->text('anchor', __('讲者/主持')); $form->text('educational_materials', __('发放宣教材料(份)')); $form->text('publicity_board', __('宣传栏(期)')); $form->text('member_num', __('受宣人次数')); $form->text('planned_number', __('计划人数')); $form->text('actual_number', __('实到人数')); $form->text('filling_people', __('填表人')); $form->datetime('filling_time', __('填表时间')); $form->select('mode', __('方式'))->options(function(){ return FourActivity::MODE_MAP; })->when("in",array( FourActivity::MODE_HEALTH_EDUCATION_LECTURE, FourActivity::MODE_TRAIN, FourActivity::MODE_GROUP_DISCUSSION_AND_DISCUSSION ),function (Form $form) { //开展讲座、培训,需同步提交通知、课件、签到表及现场照片 $form->html("

备注:需同步提交通知、课件、签到表及现场照片

"); })->when("in",array( FourActivity::MODE_HEALTH_PROMOTION_ACTIVITIES, ),function (Form $form) { //开展健康宣传活动,需同步提交活动照片、活动总结 $form->html("

备注:需同步提交活动照片、活动总结

"); })->when("in",array_values(array_diff(array_keys(FourActivity::MODE_MAP),array( FourActivity::MODE_HEALTH_EDUCATION_LECTURE, FourActivity::MODE_TRAIN, FourActivity::MODE_GROUP_DISCUSSION_AND_DISCUSSION, FourActivity::MODE_HEALTH_PROMOTION_ACTIVITIES ) )),function (Form $form) { //其它形式活动根据实际情况提交影像资料 $form->html("

备注:需要根据实际情况提交影像资料

"); }); //多文件 $form->multipleFile('ext', __('附件资料'))->removable(); $form->textarea('content', __('活动内容')); $form->html('

1.开展讲座、培训,需同步提交通知、课件、签到表及现场照片;

2.开展宣传活动,需同步提交活动照片、活动总结;

3.其它形式活动根据实际情况提交影像资料。

','注意事项'); }) ->when("=",FourActivity::TYPE_FEATURED_SERVICES,function (Form $form){ $form->text('title', __('项目名称')); // $form->text('place', __('活动地点')); //申报书、任务书、结题报告书和其他 $form->file('declaration_form', __('申报书'))->removable(); $form->html(""); $form->file('task_book', __('任务书'))->removable(); $form->html(""); $form->file('final_report', __('结题报告书'))->removable(); $form->html(""); $form->multipleFile('ext', __('其他'))->removable(); $form->html('

1.开展讲座、培训,需同步提交通知、课件、签到表及现场照片;

2.开展宣传活动,需同步提交活动照片、活动总结;

3.其它形式活动根据实际情况提交影像资料。

','注意事项'); }) ->when("=",FourActivity::TYPE_FEATURED_REPORT_RECEIPT,function (Form $form){ $form->text('title', __('回执名称')); // $form->text('place', __('活动地点')); $form->file('return_receipt', __('回执单'))->removable(); $form->html(""); $form->multipleFile('ext', __('其他'))->removable(); $form->html('

1.开展讲座、培训,需同步提交通知、课件、签到表及现场照片;

2.开展宣传活动,需同步提交活动照片、活动总结;

3.其它形式活动根据实际情况提交影像资料。

','注意事项'); }) ->required(); $form->tools(function (Form\Tools $tools) { // 去掉`列表`按钮 $tools->disableList(); $tools->add('  查看上报'); // // 去掉`删除`按钮 // $tools->disableDelete(); // // 去掉`查看`按钮 // $tools->disableView(); }); return $form; } }