Bladeren bron

Merge branch 'master' of http://59.57.98.130:3000/jjhc/jucai

linwu 1 jaar geleden
bovenliggende
commit
1c325d2a93

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

@@ -238,7 +238,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' => '备注模块','internship' => '实习专场'])->default(['basic'])->setMustMark();
+            $form->checkbox('forms', '报名表单模块')->options(['basic' => '基础信息模块','expand_special' => '扩展模块-加分','detail' => '详情介绍模块','identification' => '身份证明上传模块','education_certification' => '学历证明上传模块','other_certification' => '其他证明上传模块', 'remark' => '备注模块','chengnuoshu'=>'诚信承诺书','internship' => '实习专场'])->default(['basic'])->setMustMark();
             $form->text('limit_times', '报名次数限制')->rules('required|regex:/^\d+$/', [
                 'required' => '报名限制次数必须填写',
                 'regex' => '次数必须为数字'
@@ -890,6 +890,29 @@ class RecruitController extends Controller
                 $data->other_certification = [];
             }
         }
+        if(in_array('chengnuoshu',$recruit->forms)){
+            if(json_decode($data->chengnuoshu)){
+                $data->chengnuoshu = json_decode($data->chengnuoshu);
+                $photo_data = [];
+                foreach ($data->chengnuoshu as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
+                }
+                $photos['chengnuoshu'] = [
+                    'title' => '诚信承诺书',
+                    'id' => 1,
+                    'start' => 0,
+                    'data' =>$photo_data
+                ];
+            }else{
+                $data->chengnuoshu = [];
+            }
+        }
 
         $html = view('admin.recruit.manageajax_userinfo')->with(['appointinfo' => $data,'recruit' => $recruit,'photos'=>$photos])->render();
         return response()->json(['code' => 1, 'data' => $html]);
@@ -2090,6 +2113,9 @@ class RecruitController extends Controller
             if(in_array('other_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
                 $header[] = '其他证明';
             }
+            if(in_array('chengnuoshu',explode(',', $recruit->forms))){
+                $header[] = '诚信承诺书';
+            }
             $header[] = '审核状态';
             $header[] = '审核意见';
 //            if(in_array('3',explode(',', $recruit->step))){
@@ -2327,6 +2353,19 @@ class RecruitController extends Controller
 
                     array_push($item, implode("\r\n", $other_certifications));
                 }
+                if (in_array('chengnuoshu', explode(',', $recruit->forms))) {
+                    $chengnuoshu = json_decode($v->chengnuoshu, true);
+                    $chengnuoshu = [];
+                    if($chengnuoshu){
+                        foreach ($chengnuoshu as $val){
+                            if(array_key_exists('path', $val['response'])){
+                                array_push($chengnuoshu,"https://www.jucai.gov.cn" . $val['response']['path']);
+                            }
+                        }
+                    }
+
+                    array_push($item, implode("\r\n", $chengnuoshu));
+                }
                 switch (intval($v->audit)){
                     case 1:
                         $item[] = '审核中';

+ 72 - 1
app/Http/Controllers/Web/Recruit/IndexController.php

@@ -444,6 +444,19 @@ class IndexController extends WebBaseController
                 }
                 $user_info['other_certification'] = $other_certification;
 
+                if(json_decode($user_info['chengnuoshu'])){
+                    $chengnuoshu = json_decode($user_info['chengnuoshu'],true);
+                    foreach ($chengnuoshu as $k => $v){
+                        if(array_key_exists('response',$v)){
+                            $chengnuoshu[$k]['url'] = $v['response']['path'];
+                        }
+
+                    }
+                }else{
+                    $chengnuoshu = [];
+                }
+                $user_info['chengnuoshu'] = $chengnuoshu;
+
                 //获取最新的报名审核信息
                 $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
                 if($logs){
@@ -549,6 +562,24 @@ class IndexController extends WebBaseController
                     $user_info['other_certification'] = $other_certification;
                 }
 
+                //如果有承诺书模块
+                if(in_array('chengnuoshu',$forms)){
+                    if(json_decode($user_info['chengnuoshu'])){
+                        $chengnuoshu = json_decode($user_info['chengnuoshu'],true);
+                        foreach ($chengnuoshu as $k => $v){
+                            if(array_key_exists('response',$v)){
+                                if(array_key_exists('path',$v['response'])){
+                                    $chengnuoshu[$k]['url'] = $v['response']['path'];
+                                }
+                            }
+
+                        }
+                    }else{
+                        $chengnuoshu = [];
+                    }
+                    $user_info['chengnuoshu'] = $chengnuoshu;
+                }
+
                 //获取最新的报名审核信息
                 $logs = RecruitAppointLog::where('appoint_id',$user_info->id)->where('step',1)->where('type',2)->orderBy('created_at','desc')->first();
                 if($logs){
@@ -606,7 +637,8 @@ class IndexController extends WebBaseController
                     ],
                     'identification' => [],
                     'education_certification' => [],
-                    'other_certification' => []
+                    'other_certification' => [],
+                    'chengnuoshu' => []
                 ]);
             }else{
                 //如果没有,结合基础数据及模块表单信息,制作数据对象
@@ -641,6 +673,9 @@ class IndexController extends WebBaseController
                 if(in_array('other_certification',$forms)){
                     $user_info['other_certification'] = [];
                 }
+                if(in_array('chengnuoshu',$forms)){
+                    $user_info['chengnuoshu'] = [];
+                }
                 $user_info['recruit_id'] = $id;
                 $user_info['operation'] = 1;
             }
@@ -974,6 +1009,24 @@ class IndexController extends WebBaseController
                             $appoint_info->save();
                         }
                     }
+
+                    //如果有承诺书模块
+                    if(in_array('chengnuoshu',$forms)){
+                        $chengnuoshu = $request->input('chengnuoshu');
+                        if(is_array($chengnuoshu)){
+                            //删除掉没有成功返回路径的图片
+                            foreach ($chengnuoshu as $k => $v){
+                                if(!array_key_exists('response',$v)){
+                                    unset($chengnuoshu[$k]);
+                                }
+                            }
+                        }
+
+                        if($chengnuoshu){
+                            $appoint_info->chengnuoshu = json_encode($chengnuoshu);
+                            $appoint_info->save();
+                        }
+                    }
                     DB::commit();
                     if($operation == 2){
                         $log = [
@@ -1079,6 +1132,24 @@ class IndexController extends WebBaseController
                             $result->save();
                         }
                     }
+
+                    //如果有承诺书模块
+                    if(in_array('chengnuoshu',$forms)){
+                        $chengnuoshu = $request->input('chengnuoshu');
+                        if($chengnuoshu){
+                            if(is_array($chengnuoshu)){
+                                //删除掉没有成功返回路径的图片
+                                foreach ($chengnuoshu as $k => $v){
+                                    if(!array_key_exists('response',$v)){
+                                        unset($chengnuoshu[$k]);
+                                    }
+                                }
+                            }
+
+                            $result->chengnuoshu = json_encode($chengnuoshu);
+                            $result->save();
+                        }
+                    }
                     DB::commit();
                     if($operation == 2){
                         $log = [

File diff suppressed because it is too large
+ 25985 - 0
laravel.log


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

@@ -929,6 +929,29 @@
                             </td>
                         </tr>
                     @endif
+                    @if(in_array('chengnuoshu',$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"
+                                            :data="{_token:'{{csrf_token()}}'}"
+                                            :file-list="user.chengnuoshu"
+                                            :before-upload="beforeImageUpload"
+                                            :on-success="uploadSuccessCNS"
+                                            :multiple="true"
+                                            :on-preview="handlePictureCardPreview"
+                                            :on-remove="removeCNS">
+                                        <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

@@ -1025,6 +1025,31 @@
                             </td>
                         </tr>
                     @endif
+                    @if(in_array('chengnuoshu',$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="chengnuoshu" ref="chengnuoshu">
+                                    <div style="padding: 10px 0">
+                                        <el-upload
+                                                action="{{ route('recruit.api.upload') }}"
+                                                list-type="picture-card"
+                                                :data="{_token:'{{csrf_token()}}'}"
+                                                :file-list="user.chengnuoshu"
+                                                :before-upload="beforeImageUpload"
+                                                :on-success="uploadSuccessCNS"
+                                                :multiple="true"
+                                                :on-preview="handlePictureCardPreview"
+                                                :on-remove="removeCNS">
+                                            <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" >
@@ -1347,6 +1372,13 @@
                             this.$message.error(response.msg);
                         }
                     },
+                    uploadSuccessCNS:function(response, file, fileList){
+                        if(response.status){
+                            this.user.chengnuoshu = fileList
+                        }else{
+                            this.$message.error(response.msg);
+                        }
+                    },
                     removeID:function(file,fileList) {
                         this.user.identification = fileList
                     },
@@ -1359,6 +1391,9 @@
                     removeOther:function(file,fileList) {
                         this.user.other_certification = fileList
                     },
+                    removeCNS:function(file,fileList) {
+                        this.user.chengnuoshu = fileList
+                    },
                     handlePictureCardPreview:function(file){
                         this.dialogImageUrl = file.url;
                         this.dialogVisible = true;
@@ -1679,6 +1714,11 @@
                             {validator:this.validEducertification, trigger: 'change'}
                         ],
                         @endif
+                        @if(in_array('chengnuoshu',$module))
+                        chengnuoshu:[
+                            {validator:this.validCNS, trigger: 'change'}
+                        ],
+                        @endif
                     },
                     init: 0,
                     upload: '',
@@ -1819,6 +1859,13 @@
                         callback();
                     }
                 },
+                validCNS(rule, value, callback){
+                    if(this.user.chengnuoshu.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;
@@ -1866,6 +1913,13 @@
                         this.$message.error(response.msg);
                     }
                 },
+                uploadSuccessCNS:function(response, file, fileList){
+                    if(response.status){
+                        this.user.chengnuoshu = fileList
+                    }else{
+                        this.$message.error(response.msg);
+                    }
+                },
                 removeID(file,fileList) {
                     this.user.identification = fileList
                 },
@@ -1878,6 +1932,9 @@
                 removeOther(file,fileList) {
                     this.user.other_certification = fileList
                 },
+                removeCNS:function(file,fileList) {
+                    this.user.chengnuoshu = fileList
+                },
                 handlePictureCardPreview(file){
                     this.dialogImageUrl = file.url;
                     this.dialogVisible = true;

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

@@ -759,6 +759,23 @@
             </td>
         </tr>
     @endif
+    @if(in_array('chengnuoshu',$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->chengnuoshu as $k => $v)
+                        @if(!empty($v))
+                            <img class="attchment" data-key="{{$k}}" data-name="chengnuoshu"
+                                 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">

Some files were not shown because too many files changed in this diff