Browse Source

更新报考声明书

sandm 1 năm trước cách đây
mục cha
commit
f85c643c6a

+ 40 - 1
app/Admin/Controllers/Recruit/RecruitController.php

@@ -250,7 +250,7 @@ class RecruitController extends Controller
             $form->number('ordid', '排序')->default(0);
             $form->multipleFile('addFile', '附件')->move('storage/app/public/recruit/' . time());
         })->tab('报名表单与条件', function ($form) {
-            $form->checkbox('forms', '报名表单模块')->options(['basic' => '基础信息模块','expand_special' => '扩展模块-加分','detail' => '详情介绍模块','identification' => '身份证明上传模块','education_certification' => '学历证明上传模块','other_certification' => '其他证明上传模块', 'remark' => '备注模块','chengnuoshu'=>'诚信承诺书','shixin'=>'失信被执行人查询信息页扫描件','internship' => '实习专场'])->default(['basic'])->setMustMark();
+            $form->checkbox('forms', '报名表单模块')->options(['basic' => '基础信息模块','expand_special' => '扩展模块-加分','detail' => '详情介绍模块','identification' => '身份证明上传模块','education_certification' => '学历证明上传模块','other_certification' => '其他证明上传模块', 'remark' => '备注模块','chengnuoshu'=>'诚信承诺书','shixin'=>'失信被执行人查询信息页扫描件','baokaoshengming' => '报考声明书','internship' => '实习专场'])->default(['basic'])->setMustMark();
             $str = "let num = $(\"#forms\").find(\".checked\").length;
             if(num == 0){
                 alert(\"未选中报名表单模块\");
@@ -976,6 +976,29 @@ class RecruitController extends Controller
                 $data->shixin = [];
             }
         }
+        if(in_array('baokaoshengming',$recruit->forms)){
+            if(json_decode($data->baokaoshengming)){
+                $data->baokaoshengming = json_decode($data->baokaoshengming);
+                $photo_data = [];
+                foreach ($data->baokaoshengming as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
+                }
+                $photos['baokaoshengming'] = [
+                    'title' => '报考声明书',
+                    'id' => 1,
+                    'start' => 0,
+                    'data' =>$photo_data
+                ];
+            }else{
+                $data->baokaoshengming = [];
+            }
+        }
 
         $html = view('admin.recruit.manageajax_userinfo')->with(['appointinfo' => $data,'recruit' => $recruit,'photos'=>$photos])->render();
         return response()->json(['code' => 1, 'data' => $html]);
@@ -2193,6 +2216,9 @@ class RecruitController extends Controller
             if(in_array('shixin',explode(',', $recruit->forms))){
                 $header[] = '失信被执行人查询信息页扫描件';
             }
+            if(in_array('baokaoshengming',explode(',', $recruit->forms))){
+                $header[] = '报考声明书';
+            }
             $header[] = '审核状态';
             $header[] = '审核意见';
 //            if(in_array('3',explode(',', $recruit->step))){
@@ -2456,6 +2482,19 @@ class RecruitController extends Controller
 
                     array_push($item, implode("\r\n", $shixin));
                 }
+                if (in_array('baokaoshengming', explode(',', $recruit->forms))) {
+                    $baokaoshengming = json_decode($v->baokaoshengming, true);
+                    $baokaoshengming = [];
+                    if($baokaoshengming){
+                        foreach ($baokaoshengming as $val){
+                            if(array_key_exists('path', $val['response'])){
+                                array_push($baokaoshengming,"https://www.jucai.gov.cn" . $val['response']['path']);
+                            }
+                        }
+                    }
+
+                    array_push($item, implode("\r\n", $baokaoshengming));
+                }
                 switch (intval($v->audit)){
                     case 1:
                         $item[] = '审核中';

+ 71 - 0
app/Http/Controllers/Web/Recruit/IndexController.php

@@ -470,6 +470,19 @@ class IndexController extends WebBaseController
                 }
                 $user_info['shixin'] = $shixin;
 
+                if(json_decode($user_info['baokaoshengming'])){
+                    $baokaoshengming = json_decode($user_info['baokaoshengming'],true);
+                    foreach ($baokaoshengming as $k => $v){
+                        if(array_key_exists('response',$v)){
+                            $baokaoshengming[$k]['url'] = $v['response']['path'];
+                        }
+
+                    }
+                }else{
+                    $baokaoshengming = [];
+                }
+                $user_info['baokaoshengming'] = $baokaoshengming;
+
                 //获取最新的报名审核信息
                 $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
                 if($logs){
@@ -611,6 +624,24 @@ class IndexController extends WebBaseController
                     $user_info['shixin'] = $shixin;
                 }
 
+                //如果有声明书模块
+                if(in_array('baokaoshengming',$forms)){
+                    if(json_decode($user_info['baokaoshengming'])){
+                        $baokaoshengming = json_decode($user_info['baokaoshengming'],true);
+                        foreach ($baokaoshengming as $k => $v){
+                            if(array_key_exists('response',$v)){
+                                if(array_key_exists('path',$v['response'])){
+                                    $baokaoshengming[$k]['url'] = $v['response']['path'];
+                                }
+                            }
+
+                        }
+                    }else{
+                        $baokaoshengming = [];
+                    }
+                    $user_info['baokaoshengming'] = $baokaoshengming;
+                }
+
                 //获取最新的报名审核信息
                 $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
                 if($logs){
@@ -670,6 +701,7 @@ class IndexController extends WebBaseController
                     'education_certification' => [],
                     'other_certification' => [],
                     'chengnuoshu' => [],
+                    'baokaoshengming' => [],
                     'shixin' => []
                 ]);
             }else{
@@ -711,6 +743,9 @@ class IndexController extends WebBaseController
                 if(in_array('shixin',$forms)){
                     $user_info['shixin'] = [];
                 }
+                if(in_array('baokaoshengming',$forms)){
+                    $user_info['baokaoshengming'] = [];
+                }
                 $user_info['recruit_id'] = $id;
                 $user_info['operation'] = 1;
             }
@@ -1088,6 +1123,24 @@ class IndexController extends WebBaseController
                             $appoint_info->save();
                         }
                     }
+
+                    //如果有声明书模块
+                    if(in_array('baokaoshengming',$forms)){
+                        $baokaoshengming = $request->input('baokaoshengming');
+                        if(is_array($baokaoshengming)){
+                            //删除掉没有成功返回路径的图片
+                            foreach ($baokaoshengming as $k => $v){
+                                if(!array_key_exists('response',$v)){
+                                    unset($baokaoshengming[$k]);
+                                }
+                            }
+                        }
+
+                        if($baokaoshengming){
+                            $appoint_info->baokaoshengming = json_encode($baokaoshengming);
+                            $appoint_info->save();
+                        }
+                    }
                     DB::commit();
                     if($operation == 2){
                         $log = [
@@ -1229,6 +1282,24 @@ class IndexController extends WebBaseController
                             $result->save();
                         }
                     }
+
+                    //如果有声明书模块
+                    if(in_array('baokaoshengming',$forms)){
+                        $baokaoshengming = $request->input('baokaoshengming');
+                        if($baokaoshengming){
+                            if(is_array($baokaoshengming)){
+                                //删除掉没有成功返回路径的图片
+                                foreach ($baokaoshengming as $k => $v){
+                                    if(!array_key_exists('response',$v)){
+                                        unset($baokaoshengming[$k]);
+                                    }
+                                }
+                            }
+
+                            $result->baokaoshengming = json_encode($baokaoshengming);
+                            $result->save();
+                        }
+                    }
                     DB::commit();
                     if($operation == 2){
                         $log = [

+ 17 - 0
public/themes/default/views/app/recruit/preview.blade.php

@@ -963,6 +963,23 @@
                             </td>
                         </tr>
                     @endif
+                    @if(in_array('baokaoshengming',$module))
+                        <tr style="height:52px;page-break-inside:avoid">
+                            <td valign="center" >
+                                报考声明书
+                            </td>
+                            <td valign="center" colspan="11">
+                                <div style="padding: 10px 0">
+                                    <el-upload
+                                            action="{{ route('recruit.api.upload') }}"
+                                            list-type="picture-card"
+                                            :multiple="true">
+                                        <i class="el-icon-plus"></i>
+                                    </el-upload>
+                                </div>
+                            </td>
+                        </tr>
+                    @endif
                     @if(in_array('remark',$module))
                         <tr style="height:52px;page-break-inside:avoid">
                             <td valign="center" >

+ 57 - 0
public/themes/default/views/app/recruit/sign_up.blade.php

@@ -1075,6 +1075,31 @@
                             </td>
                         </tr>
                     @endif
+                    @if(in_array('baokaoshengming',$module))
+                        <tr style="height:52px;page-break-inside:avoid">
+                            <td valign="center" >
+                                <span class="require">*</span>报考声明书
+                            </td>
+                            <td valign="center" colspan="11">
+                                <el-form-item prop="baokaoshengming" ref="baokaoshengming">
+                                    <div style="padding: 10px 0">
+                                        <el-upload
+                                                action="{{ route('recruit.api.upload') }}"
+                                                list-type="picture-card"
+                                                :data="{_token:'{{csrf_token()}}'}"
+                                                :file-list="user.baokaoshengming"
+                                                :before-upload="beforeImageUpload"
+                                                :on-success="uploadSuccessSMS"
+                                                :multiple="true"
+                                                :on-preview="handlePictureCardPreview"
+                                                :on-remove="removeSMS">
+                                            <i class="el-icon-plus"></i>
+                                        </el-upload>
+                                    </div>
+                                </el-form-item>
+                            </td>
+                        </tr>
+                    @endif
                     @if(in_array('remark',$module))
                         <tr style="height:52px;page-break-inside:avoid">
                             <td valign="center" >
@@ -1413,6 +1438,13 @@
                             this.$message.error(response.msg);
                         }
                     },
+                    uploadSuccessSMS:function(response, file, fileList){
+                        if(response.status){
+                            this.user.baokaoshengming = fileList
+                        }else{
+                            this.$message.error(response.msg);
+                        }
+                    },
                     removeID:function(file,fileList) {
                         this.user.identification = fileList
                     },
@@ -1428,6 +1460,9 @@
                     removeCNS:function(file,fileList) {
                         this.user.chengnuoshu = fileList
                     },
+                    removeSMS:function(file,fileList) {
+                        this.user.baokaoshengming = fileList
+                    },
                     removeSX:function(file,fileList) {
                         this.user.shixin = fileList
                     },
@@ -1761,6 +1796,11 @@
                             {validator:this.validSX, trigger: 'change'}
                         ],
                         @endif
+                        @if(in_array('baokaoshengming',$module))
+                        baokaoshengming:[
+                            {validator:this.validSMS, trigger: 'change'}
+                        ],
+                        @endif
                     },
                     init: 0,
                     upload: '',
@@ -1916,6 +1956,13 @@
                         callback();
                     }
                 },
+                validSMS(rule, value, callback){
+                    if(this.user.baokaoshengming.length == 0){
+                        callback(new Error('请上传报考声明书'));
+                    }else{
+                        callback();
+                    }
+                },
                 beforeImageUpload(file) {
                     const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png');
                     const isLt2M = file.size / 1024 / 1024 < 2;
@@ -1977,6 +2024,13 @@
                         this.$message.error(response.msg);
                     }
                 },
+                uploadSuccessSMS:function(response, file, fileList){
+                    if(response.status){
+                        this.user.baokaoshengming = fileList
+                    }else{
+                        this.$message.error(response.msg);
+                    }
+                },
                 removeID(file,fileList) {
                     this.user.identification = fileList
                 },
@@ -1995,6 +2049,9 @@
                 removeSX:function(file,fileList) {
                     this.user.shixin = fileList
                 },
+                removeSMS:function(file,fileList) {
+                    this.user.baokaoshengming = fileList
+                },
                 handlePictureCardPreview(file){
                     this.dialogImageUrl = file.url;
                     this.dialogVisible = true;

+ 17 - 0
resources/views/admin/recruit/manageajax_userinfo.blade.php

@@ -793,6 +793,23 @@
             </td>
         </tr>
     @endif
+    @if(in_array('baokaoshengming',$recruit->forms))
+        <tr style="height:52px;page-break-inside:avoid">
+            <td valign="center">
+                报考声明书
+            </td>
+            <td valign="center" colspan="11">
+                <div style="padding: 10px 0">
+                    @foreach($appointinfo->baokaoshengming as $k => $v)
+                        @if(!empty($v))
+                            <img class="attchment" data-key="{{$k}}" data-name="baokaoshengming"
+                                 src="{{ $v->response->path }}?v=1"/>
+                        @endif
+                    @endforeach
+                </div>
+            </td>
+        </tr>
+    @endif
     @if(in_array('remark',$recruit->forms))
         <tr style="height:52px;page-break-inside:avoid">
             <td valign="center">