Browse Source

初审独立驳回字段及批次相关修改

sugangqiang 2 years ago
parent
commit
3c85ba5350

+ 82 - 11
app/admin/controller/Talent.php

@@ -18,6 +18,7 @@ use app\common\api\MenuApi;
 use app\admin\model\Menu;
 use app\admin\model\SysRelation;
 use app\common\api\CompanyApi;
+use app\common\state\ProjectState;
 
 /**
  * Description of Talent
@@ -34,9 +35,9 @@ class Talent extends AdminController {
         if (in_array($info["checkState"], [TalentState::BASE_VERIFY_FAIL, TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_REJECT, TalentState::BASE_REVERIFY_FAIL])) {
             return view("talentInfo_base_check", ["info" => $info]);
         } else {
-            $last_log = TalentLogApi::getLastLog($id, \app\common\state\ProjectState::TALENT, 0, ["active", "=", 0]);
+            $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, 0, ["active", "=", 0]);
             if ($last_log["step"] == 3 && $last_log["companyId"] != $this->user["companyId"]) {
-                $last_log = TalentLogApi::getLastLog($id, \app\common\state\ProjectState::TALENT, $this->user["companyId"], ["active", "=", 0]);
+                $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, $this->user["companyId"], ["active", "=", 0]);
             }
             if ($last_log["state"] == 10 && $last_log["new_state"] == 10) {
                 
@@ -143,14 +144,6 @@ class Talent extends AdminController {
         
     }
 
-    /**
-     * 初审-修改驳回字段
-     * @auth {{/talentInfo/updateFieldsAndFiles}}
-     */
-    public function updateFieldsAndFiles() {
-        
-    }
-
     /**
      * 初审-审核不通过
      * @auth {{/talentInfo/setNotPass}}
@@ -1447,7 +1440,85 @@ class Talent extends AdminController {
     }
 
     public function findFieldsAndFiles() {
-        
+        $id = $this->request["id"];
+        $talentInfo = VerifyApi::getOne($id);
+        $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
+        $responseObj = new \stdClass();
+        if ($talentInfo["checkState"] == TalentState::SCND_SAVE && $lastLog["state"] == TalentState::FST_VERIFY_REJECT) {
+            if (session("user")["type"] == 2) {
+                $fields = DictApi::getTalentFields_IC();
+            } else {
+                $fields = DictApi::getTalentFields(4, $talent_info["isImport"]);
+            }
+
+            $field_tmp = [];
+            if ($fields) {
+                foreach ($fields as $key => $field) {
+                    $field_tmp[] = ["key" => $key, "value" => $field];
+                }
+            }
+            $enterprise = \app\common\model\Enterprise::findOrEmpty($talentInfo["enterprise_id"]);
+            $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
+            $where = [];
+            $whr = [];
+            $where[] = ["project", "=", 1];
+            $where[] = ["active", "=", 1];
+            $where[] = ["type", "=", $enterprise["type"]];
+            $where[] = ["isConditionFile", "<>", 1];
+            $where[] = ["delete", "=", 0];
+            if ($condition && $condition["bindFileTypes"]) {
+                $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
+                $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->select();
+            } else {
+                $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
+            }
+            $responseObj->code = 200;
+            $responseObj->id = $id;
+            $responseObj->fileList = $files;
+            $responseObj->fieldList = $field_tmp;
+            $responseObj->select = [
+                "files" => array_filter(explode(",", $talentInfo["modify_files"])),
+                "fields" => array_filter(explode(",", $talentInfo["modify_fields"]))
+            ];
+        } else {
+            $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
+        }
+        return json($responseObj);
+    }
+
+    /**
+     * 初审-修改驳回字段
+     * @auth {{/talentInfo/updateFieldsAndFiles}}
+     */
+    public function updateFieldsAndFiles() {
+        $id = $this->request["id"];
+        $fields = array_filter(explode(",", $this->request["fields"]));
+        $files = array_filter(explode(",", $this->request["files"]));
+
+        $talentInfo = VerifyApi::getOne($id);
+        $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
+        $responseObj = new \stdClass();
+        if ($talentInfo["checkState"] == TalentState::SCND_SAVE && $lastLog["state"] == TalentState::FST_VERIFY_REJECT) {
+            if (!$fields && !$files) {
+                $responseObj->msg = "请选择可修改的字段或附件!";
+                return json($responseObj);
+            }
+            try {
+                $data["id"] = $id;
+                $data["modify_fields"] = $fields ? implode(",", $fields) : null;
+                $data["modify_files"] = $files ? implode(",", $files) : null;
+                TalentModel::update($data);
+                $responseObj->code = 200;
+                $responseObj->msg = "驳回字段修改成功";
+                return json($responseObj);
+            } catch (\think\db\exception\DbException $e) {
+                $responseObj->msg = $e->getMessage();
+                return json($responseObj);
+            }
+        } else {
+            $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
+            return json($responseObj);
+        }
     }
 
     public function baseVerifyListExport() {

+ 35 - 35
app/admin/view/talent/fst_verify.html

@@ -291,41 +291,41 @@
                             </div>
                         </div>
                         <div class="hidden-xs" id="TalentInfoTableToolbar" role="group">
-                            <if condition="chkCommission('/admin/talent/base_verify','')">
-                                <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.openCheckTalentInfo()" id="">
-                                    <i class="fa fa-check"></i>&nbsp;审核
-                                </button>
-                            </if>
-                            <if condition="chkCommission('/admin/talent/base_export','')">
-                                <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.showExportModal(1)" id="">
-                                    <i class="fa fa-file-excel-o"></i>&nbsp;导出
-                                </button>
-                            </if>
-                            <if condition="chkCommission('/admin/talent/base_download','')">
-                                <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.download()" id="">
-                                    <i class="fa fa-download"></i>&nbsp;下载
-                                </button>
-                            </if>
-                            <!--<if condition="chkCommission('/admin/talent/modify_reject_fields','')">
-                                <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.updateFieldsAndFiles()" id="">
-                                    <i class="fa fa-edit"></i>&nbsp;修改驳回字段
-                                </button>
-                            </if>-->
-                            <if condition="chkCommission('/admin/talent/setNotPass','')">
-                                <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.setNotPass()" id="">
-                                    <i class="fa fa-mobile"></i>&nbsp;审核不通过
-                                </button>
-                            </if>
-                            <if condition="chkCommission('/admin/talent/getPhones','')">
-                                <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.getPhones()" id="">
-                                    <i class="fa fa-mobile"></i>&nbsp;获取人才手机号
-                                </button>
-                            </if>
-                            <if condition="chkCommission('/admin/talent/getEnterprisePhones','')">
-                                <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.getEnterprisePhones()" id="">
-                                    <i class="fa fa-phone"></i>&nbsp;获取人才联络员手机号
-                                </button>
-                            </if>
+                            {if condition="chkCommission('/admin/talent/fst_check','/talentInfo/firstCheck')"}
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.openCheckTalentInfo()" id="">
+                                <i class="fa fa-check"></i>&nbsp;审核
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/talent/fstVerifyListExport','/talentInfo/firstExport')"}
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.showExportModal(1)" id="">
+                                <i class="fa fa-file-excel-o"></i>&nbsp;导出
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('','/talentInfo/firstDownload')"}
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.download()" id="">
+                                <i class="fa fa-download"></i>&nbsp;下载
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/talent/updateFieldsAndFiles','/talentInfo/updateFieldsAndFiles')"}
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.updateFieldsAndFiles()" id="">
+                                <i class="fa fa-edit"></i>&nbsp;修改驳回字段
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/talent/dis_pass','/talentInfo/setNotPass')"}
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.setNotPass()" id="">
+                                <i class="fa fa-mobile"></i>&nbsp;审核不通过
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/talent/getPhones','')"}
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.getPhones()" id="">
+                                <i class="fa fa-mobile"></i>&nbsp;获取人才手机号
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/talent/getEnterprisePhones','')"}
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.getEnterprisePhones()" id="">
+                                <i class="fa fa-phone"></i>&nbsp;获取人才联络员手机号
+                            </button>
+                            {/if}
                         </div>
                         <table id="TalentInfoTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
                             <thead>

+ 23 - 10
app/common/api/BatchApi.php

@@ -167,21 +167,30 @@ class BatchApi {
     public static function checkBatchValid($params, $talentType) {
         $now = time();
         $where = [];
-        $where[] = ["active", "=", 1];
         $where[] = ["source", "=", $talentType];
         if ($params["type"]) {
             $where[] = ["type", "=", $params["type"]];
         }
         if ($params["year"]) {
+            //检查指定批次是否存在,再比对时间
             $where[] = ["batch", "=", $params["year"]];
+            $batch = Batch::where($where)->order("startTime desc")->order("endTime desc")->find();
+            if (!$batch)
+                return ["msg" => "不存在该申报批次"];
+            if (strtotime($batch["startTime"]) > $now)
+                return ["msg" => sprintf("申报还未开始,日期为:%s - %s", $batch["startTime"], $batch["endTime"])];
+            if ($batch["submitEndTime"] && strtotime($batch["submitEndTime"]) < $now)
+                return ["msg" => "提交时间已截止,无法操作"];
+        } else {
+            $where[] = ["active", "=", 1];
+            $batch = Batch::where($where)->order("startTime desc")->order("endTime desc")->find();
+            if (!$batch)
+                return ["msg" => "该申报未启动"];
+            if (strtotime($batch["startTime"]) > $now)
+                return ["msg" => sprintf("申报还未开始,日期为:%s - %s", $batch["startTime"], $batch["endTime"])];
+            if (strtotime($batch["endTime"]) < $now)
+                return ["msg" => "申报已结束,无法申报"];
         }
-        $batch = Batch::where($where)->order("startTime desc")->order("endTime desc")->find();
-        if (!$batch)
-            return ["msg" => "该申报未启动"];
-        if (strtotime($batch["startTime"]) > $now)
-            return ["msg" => sprintf("申报还未开始,日期为:%s - %s", $batch["startTime"], $batch["endTime"])];
-        if (strtotime($batch["endTime"]) < $now)
-            return ["msg" => "申报已结束,无法申报"];
         return ["code" => 200, "batch" => $batch["batch"]];
     }
 
@@ -191,10 +200,14 @@ class BatchApi {
      * @param type $talentType 人才类型
      * @return type
      */
-    public static function getValidBatch($type, $talentType) {
+    public static function getValidBatch($type, $talentType, $batch = "") {
         $now = date("Y-m-d H:i:s");
         $where = [];
-        $where[] = ["active", "=", 1];
+        if ($batch) {
+            $where[] = ["batch", "=", $batch];
+        } else {
+            $where[] = ["active", "=", 1];
+        }
         $where[] = ["type", "=", $type];
         $where[] = ["source", "=", $talentType];
         $where[] = ["startTime", "<", $now];

+ 15 - 13
app/enterprise/controller/Talent.php

@@ -13,6 +13,8 @@ use app\common\api\TalentLogApi;
 use app\common\api\TalentState;
 use think\exception\ValidateException;
 use app\enterprise\validate\TalentInfo;
+use app\common\state\ProjectState;
+use app\common\api\BatchApi;
 
 // 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
 
@@ -102,13 +104,13 @@ class Talent extends EnterpriseController {
         }
         $checkState = $info["checkState"] ?: 0;
 
-        $batch = \app\common\api\BatchApi::getValidBatch(\app\common\state\ProjectState::TALENT, $this->user["type"]);
+        $batch = $info["apply_year"] ?: BatchApi::getValidBatch(ProjectState::TALENT, $this->user["type"])["batch"];
         $info["enterprise"] = $ep;
         $info["talent_type_list"] = DictApi::findChildDictByCode("talent_type");
         if ($info["talent_condition"]) {
             $info["isSalary"] = \app\common\api\TalentConditionApi::getOne($info["talent_condition"])["isSalary"] ?: 0;
         }
-        return view($tpl, ["year" => $batch["batch"], "checkState" => $checkState, "row" => $info]);
+        return view($tpl, ["year" => $batch, "checkState" => $checkState, "row" => $info]);
     }
 
     /**
@@ -144,8 +146,8 @@ class Talent extends EnterpriseController {
         }
         $enterprise_info = \app\common\model\Enterprise::find($this->user["uid"]);
         $info["enterprise"] = $enterprise_info;
-        $batch = \app\common\api\BatchApi::getValidBatch(1, $enterprise_info["type"]);
-        return view("second", ["year" => $info["apply_year"] ?: $batch["batch"], "row" => $info]);
+        $batch = $info["apply_year"] ?: BatchApi::getValidBatch(ProjectState::TALENT, $enterprise_info["type"])["batch"];
+        return view("second", ["year" => $batch, "row" => $info]);
     }
 
     public function view(\think\Request $request) {
@@ -510,9 +512,9 @@ class Talent extends EnterpriseController {
      */
     private function save($info, \think\Request $request, $checkState) {
         try {
-            $batch = \app\common\api\BatchApi::getValidBatch(1, $this->user["type"]);
-            if (!$batch) {
-                throw new ValidateException("不在人才认定申报申请时间内");
+            $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"]], $this->user["type"]);
+            if ($batch["code"] != 200) {
+                throw new ValidateException($batch["msg"]);
             }
             $param = $request->param();
             validate(TalentInfo::class)->check($param);
@@ -614,9 +616,9 @@ class Talent extends EnterpriseController {
      */
     private function mixSave($info, \think\Request $request, $checkState) {
         try {
-            $batch = \app\common\api\BatchApi::getValidBatch(1, $this->user["type"]);
-            if (!$batch) {
-                throw new ValidateException("不在人才认定申报申请时间内");
+            $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"]], $this->user["type"]);
+            if ($batch["code"] != 200) {
+                throw new ValidateException($batch["msg"]);
             }
             $param = $request->param();
             validate(TalentInfo::class)->check($param);
@@ -872,9 +874,9 @@ class Talent extends EnterpriseController {
 
     private function icSave($info, \think\Request $request, $checkState) {
         try {
-            $batch = \app\common\api\BatchApi::getValidBatch(1, $this->user["type"]);
-            if (!$batch) {
-                throw new ValidateException("不在人才认定申报申请时间内");
+            $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"]], $this->user["type"]);
+            if ($batch["code"] != 200) {
+                throw new ValidateException($batch["msg"]);
             }
             $param = $request->param();
             validate(TalentInfo::class)->check($param);

+ 1 - 1
public/static/modular/gate/talentInfo/new_talentInfo.js

@@ -289,7 +289,7 @@ TalentInfo.editTalentInfo = function () {
             Feng.error("校验失败!" + data.responseJSON.message + "!");
         });
         ajax.set("type", CONFIG.project_rcrd);
-        ajax.set("year", TalentInfo.seItem.year);
+        ajax.set("year", TalentInfo.seItem.apply_year);
         ajax.start();
     }
 };

+ 22 - 17
public/static/modular/talentIdentify/talentInfo/talentInfo_base.js

@@ -202,7 +202,6 @@ TalentInfo.openTalentInfoDetail = function () {
 TalentInfo.updateFieldsAndFiles = function () {
     if (this.check()) {
         var ajax = new $ax("/admin/talent/findFieldsAndFiles?id=" + TalentInfo.seItem.id, function (data) {
-            var obj = data.obj.obj;
             if (data.code == 200) {
                 layer.open({
                     type: 1,
@@ -217,32 +216,38 @@ TalentInfo.updateFieldsAndFiles = function () {
                     btnAlign: 'c',
                     zIndex: layer.zIndex,
                     success: function (layero, index) {
-                        var fileList = data.obj.fileList;
-                        var html = '';
-                        for (var key in fileList) {
-                            html = html + '<ul><li style="width: 100%"><input type="checkbox" value="' + fileList[key].id + '"><span>' + fileList[key].name + '</span></li></ul>';
+
+                        var html1 = '';
+                        if (typeof data.fieldList != "undefined" && data.fieldList.length > 0) {
+                            for (var key in data.fieldList) {
+                                html1 += '<li style="float:left;margin:0 10px 10px 0;"><input type="checkbox" value="' + data.fieldList[key]["key"] + '"><span>' + data.fieldList[key]["value"] + '</span></li>';
+                            }
                         }
-                        $("#field_file").empty().append(html);
-                        if (obj.fields != null && obj.fields != '') {
-                            $("#field_info input").each(function () {
-                                var arr = obj.fields.split(",");
-                                for (var key in arr) {
-                                    if ($(this).val() == arr[key]) {
-                                        this.checked = true;
-                                    }
+
+                        var html2 = '';
+                        for (var key in data.fileList) {
+                            html2 = html2 + '<ul><li style="width: 100%"><input type="checkbox" value="' + data.fileList[key].id + '"><span>' + data.fileList[key].name + '</span></li></ul>';
+                        }
+                        $("#firstCheckForm #field_info ul").css("overflow", "hidden").html(html1);
+                        $("#field_file").css("overflow", "hidden").empty().append(html2);
+                        //$("#field_file").empty().append(html);
+                        if (data.select.fields != null && data.select.fields != '') {
+                            $("#firstCheckForm #field_info li input").each(function () {
+                                if (data.select.fields.indexOf($(this).val()) != -1) {
+                                    this.checked = true;
                                 }
                             });
                         }
-                        if (obj.files != null && obj.files != '') {
+                        if (data.select.files != null && data.select.files != '') {
                             $("#field_file input").each(function () {
-                                if (obj.files.indexOf($(this).val()) != -1) {
+                                if (data.select.files.indexOf($(this).val()) != -1) {
                                     this.checked = true;
                                 }
                             });
                         }
                     },
                     yes: function (index, layero) {
-                        TalentInfo.submitFieldsAndFiles(index, obj.id);
+                        TalentInfo.submitFieldsAndFiles(index, data.id);
                     }
                 });
             } else {
@@ -263,7 +268,7 @@ TalentInfo.updateFieldsAndFiles = function () {
 TalentInfo.submitFieldsAndFiles = function (index, id) {
     var fields = '';
     var files = '';
-    $("#field_info li input").each(function (index) {
+    $("#firstCheckForm #field_info li input").each(function (index) {
         if ($(this).is(":checked")) {
             fields = fields + $(this).val() + ",";
         }