sugangqiang 2 жил өмнө
parent
commit
ae95381677

+ 152 - 51
app/admin/controller/Talent.php

@@ -145,6 +145,40 @@ class Talent extends AdminController {
         return json(["code" => 200, "obj" => VerifyApi::getPublicList($params)]);
     }
 
+    /**
+     * 预备人才库-核查征信
+     * @auth {{/talentInfo/prepareHczx}}
+     */
+    public function prepareHczx() {
+        $ids = $this->request->param("ids");
+        $ids_arr = array_filter(explode(",", $ids));
+        if (!$ids_arr) {
+            $res = ["code" => 500, "msg" => "没有选择导出的名单"];
+            echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
+        }
+        $where[] = ["ti.id", "in", $ids_arr];
+        $list = TalentModel::alias("ti")->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")->field("ti.name,ti.card_type,ti.card_number,e.name as enterpriseName,e.description")->where($where)->select();
+        if (!$list) {
+            $res = ["code" => 500, "msg" => "没有可以导出的内容"];
+            echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
+        }
+        $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "备注"];
+        $rows = [];
+        $i = 1;
+        $card_types = DictApi::selectByParentCode("card_type");
+        foreach ($list as $item) {
+            $row = [
+                $i, $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], $item["description"]
+            ];
+            $rows[] = $row;
+            $i++;
+        }
+        $filename = "优秀人才核查征信名单导出";
+        if ($rows) {
+            export($columns, $rows, $filename);
+        }
+    }
+
     /**
      * 预备人才库-征信通过
      * @auth {{/talentInfo/hczxPass}}
@@ -172,7 +206,7 @@ class Talent extends AdminController {
                 $error++;
             }
         }
-        return json(["code" => 200, "msg" => sprintf("核查征信成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
+        return json(["code" => 200, "msg" => sprintf("核查征信成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
     }
 
     /**
@@ -191,8 +225,10 @@ class Talent extends AdminController {
         if ($talent_info["checkState"] != TalentState::REVERIFY_PASS) {
             return json(["msg" => "当前记录不是待核查征信状态,无法核查"]);
         }
-        VerifyApi::setPublic($id, $state, $msg);
-        return json(["code" => 200, "msg" => "已设置征信失信"]);
+        if (VerifyApi::setPublic($id, $state, $msg)) {
+            return json(["code" => 200, "msg" => "已设置征信失信"]);
+        }
+        return json(["msg" => "设置征信失信失败"]);
     }
 
     /**
@@ -212,8 +248,9 @@ class Talent extends AdminController {
             foreach ($list as $item) {
                 $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
                 $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
+                $checkLog = TalentLogApi::getLastLog($item["id"], 1);
                 $row = [
-                    $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == 11 ? "审核通过" : "审核不通过", $enterprise["description"]
+                    $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::ZX_PASS ? "审核通过" : "审核不通过", $checkLog["description"]
                 ];
                 $rows[] = $row;
                 $i++;
@@ -282,8 +319,10 @@ class Talent extends AdminController {
         if ($talent_info["checkState"] != TalentState::ANNOUNCED) {
             return json(["msg" => "当前记录不是公示状态,无法审核"]);
         }
-        VerifyApi::setPublic($id, $state, $msg);
-        return json(["code" => 200, "msg" => "公示再审核完成"]);
+        if (VerifyApi::setPublic($id, $state, $msg)) {
+            return json(["code" => 200, "msg" => "公示再审核完成"]);
+        }
+        return json(["msg" => "公示再审核失败"]);
     }
 
     /**
@@ -312,15 +351,119 @@ class Talent extends AdminController {
                 $error++;
             }
         }
-        return json(["code" => 200, "msg" => sprintf("公示完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
+        return json(["code" => 200, "msg" => sprintf("公示再审核完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
+    }
+
+    /**
+     * 预备人才库-公布预览
+     * @auth {{/talentInfo/publishExportBefore}}
+     */
+    public function publishExportBefore() {
+        $params = $this->request->param();
+        $ids = $params["ids"];
+        $ids = array_filter(explode(",", $ids));
+        if ($ids) {
+            $where[] = ["id", "in", $ids];
+            $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
+            $rows = [];
+            $i = 1;
+            $talentArranges = DictApi::selectByParentCode("talent_arrange");
+            foreach ($list as $item) {
+                $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
+                $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
+                $checkLog = TalentLogApi::getLastLog($item["id"], 1);
+                $row = [
+                    $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::ANNOUNCED_REVERIFY_PASS ? "审核通过" : "审核不通过", $checkLog["description"]
+                ];
+                $rows[] = $row;
+                $i++;
+            }
+        }
+        $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "认定人才层次", "审核状态", "备注"];
+        $filename = "优秀人才" . date("Ym") . "公布名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
+        if ($rows) {
+            export($columns, $rows, $filename);
+        }
     }
 
     /**
      * 预备人才库-公布
+     * @auth {{/talentInfo/publish}}
+     */
+    public function publish() {
+        $params = $this->request->param();
+        $id = $params["id"];
+        $msg = $params["checkMsg"];
+        $checkState = $params["checkState"];
+        $batch = $params["batch"];
+        if ($checkState == 1) {
+            $state = TalentState::PUBLISH_PASS;
+            $msg = "公布审核通过:" . $msg;
+        } else {
+            $state = TalentState::PUBLISH_FAIL;
+            $msg = "公布审核不通过:" . $msg;
+        }
+        if (!$batch || !strtotime($batch))
+            return json(["msg" => "公布批次时间错误"]);
+        if (!$msg)
+            return json(["msg" => "请填写审核意见"]);
+        $state = TalentState::PUBLISH_PASS; //公示再审核通过
+        $batch = $params["batch"];
+        if (!strtotime($batch))
+            return json(["msg" => "公布批次时间错误"]);
+        $talent_info = VerifyApi::getOne($id);
+        if ($talent_info["checkState"] != TalentState::ANNOUNCED_REVERIFY_PASS) {
+            return json(["msg" => "当前记录不是公示再审核通过状态,无法审核"]);
+        }
+        if (VerifyApi::setPublic($id, $state, $msg, $batch)) {
+            return json(["code" => 200, "msg" => "公布审核完成"]);
+        }
+        return json(["msg" => "公布审核失败"]);
+    }
+
+    /**
+     * 预备人才库-批量公布通过
      * @auth {{/talentInfo/preparePublish}}
      */
-    public function pre_publish() {
-        
+    public function preparePublish() {
+        $params = $this->request->param();
+        $ids = $params["ids"];
+        $ids = array_filter(explode(",", $ids));
+        $msg = "批量公布";
+        $state = TalentState::PUBLISH_PASS; //公示再审核通过
+        $batch = $params["batch"];
+        if (!strtotime($batch))
+            return json(["msg" => "公布批次时间错误"]);
+        $total = count($ids);
+        $error = 0;
+        $success = 0;
+        foreach ($ids as $id) {
+            $talent_info = VerifyApi::getOne($id);
+            if ($talent_info["checkState"] != TalentState::ANNOUNCED_REVERIFY_PASS) {
+                $error++;
+                continue;
+            }
+            if (VerifyApi::setPublic($id, $state, $msg, $batch)) {
+                $success++;
+            } else {
+                $error++;
+            }
+        }
+        return json(["code" => 200, "msg" => sprintf("公布完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
+    }
+
+    public function sendCard() {
+        //查询所有待发证的数据
+        $params = $this->request->param();
+        $ids = array_filter(explode(",", $params["ids"]));
+        $talent_list = VerifyApi::getListByIds($ids);
+        //晋江市优秀人才证书:当前年份+层次+四位递增数字
+        //集成电路优秀人才证书:IC+当前年份+递增四位数,如IC20190001
+        $year = date("Y");
+        foreach ($talent_list as $talent_info) {
+            $no_prefix = $year . $talent_info["talent_arrange"];
+        }
+        return new ResponseObj(ResponseObj . SUCCESS, "发证成功");
     }
 
     /**
@@ -347,14 +490,6 @@ class Talent extends AdminController {
         
     }
 
-    /**
-     * 预备人才库-公布预览
-     * @auth {{/talentInfo/publishExportBefore}}
-     */
-    public function pre_publish_preview() {
-        
-    }
-
     /**
      * 基本条件审核-提交未保存
      * @param \think\Request $request
@@ -764,40 +899,6 @@ class Talent extends AdminController {
         
     }
 
-    /**
-     * 预备人才库-核查征信
-     * @auth {{/talentInfo/prepareHczx}}
-     */
-    public function exportHczx() {
-        $ids = $this->request->param("ids");
-        $ids_arr = array_filter(explode(",", $ids));
-        if (!$ids_arr) {
-            $res = ["code" => 500, "msg" => "没有选择导出的名单"];
-            echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
-        }
-        $where[] = ["ti.id", "in", $ids_arr];
-        $list = TalentModel::alias("ti")->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")->field("ti.name,ti.card_type,ti.card_number,e.name as enterpriseName,e.description")->where($where)->select();
-        if (!$list) {
-            $res = ["code" => 500, "msg" => "没有可以导出的内容"];
-            echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
-        }
-        $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "备注"];
-        $rows = [];
-        $i = 1;
-        $card_types = DictApi::selectByParentCode("card_type");
-        foreach ($list as $item) {
-            $row = [
-                $i, $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], $item["description"]
-            ];
-            $rows[] = $row;
-            $i++;
-        }
-        $filename = "优秀人才核查征信名单导出";
-        if ($rows) {
-            export($columns, $rows, $filename);
-        }
-    }
-
     public function commonExport() {
         $params = $this->request->param();
         $fields = $params["export"];

+ 51 - 7
app/admin/view/talent/pre_list.html

@@ -374,9 +374,14 @@
                                 <i class="fa fa-television"></i>&nbsp;公布预览
                             </button>
                             {/if}
+                            {if condition="chkCommission('/admin/talent/publish','/talentInfo/publish')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="TalentInfo.singlePublish()">
+                                <i class="fa fa-check-square-o"></i>&nbsp;公布审核
+                            </button>
+                            {/if}
                             {if condition="chkCommission('/admin/talent/preparePublish','/talentInfo/preparePublish')"}
                             <button type="button" class="btn btn-sm btn-danger" onclick="TalentInfo.showDataCheckModal(5)">
-                                <i class="fa fa-television"></i>&nbsp;公布
+                                <i class="fa fa-television"></i>&nbsp;批量公布通过
                             </button>
                             {/if}
                             {if condition="chkCommission('/admin/talent/preparePublishExport','/talentInfo/preparePublishExport')"}
@@ -384,11 +389,6 @@
                                 <i class="fa fa-file-excel-o"></i>&nbsp;公布导出
                             </button>
                             {/if}
-                            {if condition="chkCommission('/admin/talent/prepareCanclePublish','/talentInfo/prepareCanclePublish')"}
-                            <button type="button" class="btn btn-sm btn-primary" onclick="TalentInfo.canclePublish()">
-                                <i class="fa fa-reply"></i>&nbsp;撤销公布
-                            </button>
-                            {/if}
                             {if condition="chkCommission('/admin/talent/prepareCertification','/talentInfo/prepareCertification')"}
                             <button type="button" class="btn btn-sm btn-primary" onclick="TalentInfo.showDataCheckModal(6)">
                                 <i class="fa fa-newspaper-o"></i>&nbsp;发证
@@ -502,6 +502,50 @@
         </div>
     </div>
 </div>
+<!--公布审核模态框-->
+<div class="modal fade " id="publishModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
+    <div class="modal-dialog" role="document" >
+        <div class="modal-content animated flipInY">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                <h4 class="modal-title" id="rejectModalLabel">公布审核</h4>
+            </div>
+            <div class="modal-body">
+                <form id="checkForm" class="form-horizontal">
+                    <input type="hidden" id="mainId" name="id">
+                    <div class="form-group">
+                        <div class="row" style="margin-bottom: 10px;">
+                            <label class="col-sm-2 control-label">审核状态</label>
+                            <div class="col-sm-10">
+                                <select id="checkStatePublish" name="checkState" class="form-control" onchange="TalentInfo.publishStateChange();">
+                                    <option value="">请选择</option>
+                                    <option value="1">审核通过</option>
+                                    <option value="2">审核不通过</option>
+                                </select>
+                            </div>
+                        </div>
+                        <div class="row" style="display:none;margin-bottom:10px;">
+                            <label class="col-sm-2 control-label">公布批次</label>
+                            <div class="col-sm-10">
+                                <input type="text" id="publishBatch" class="form-control" placeholder='请输入公布日期(公布入选月份)'>
+                            </div>
+                        </div>
+                        <div class="row">
+                            <label class="col-sm-2 control-label">审核意见</label>
+                            <div class="col-sm-10">
+                                <textarea id="publishMsg" name="msg" class="form-control"></textarea>
+                            </div>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-primary" onclick="TalentInfo.singlePublishSubmit()">提交</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+            </div>
+        </div>
+    </div>
+</div>
 <!--需要核查征信的名单-->
 <div class="modal fade " id="exportCommonModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
     <div class="modal-dialog modal-lg" role="document" style="min-width: 1200px;">
@@ -687,7 +731,7 @@
         </div>
     </div>
 </div>
-{iframe id="hiddenIframe" name="hiddenIframe" style="display: none;"></iframe>
+<iframe id="hiddenIframe" name="hiddenIframe" style="display: none;"></iframe>
 <!--<script src="${ctxPath}/static/modular/talentIdentify/talentInfo/talentInfo_prepare.js"></script>-->
 <!--<script src="${ctxPath}/static/modular/talentIdentify/talentInfo/talentInfo_common.js"></script>-->
 <script type="text/javascript">

+ 14 - 4
app/common/api/VerifyApi.php

@@ -145,12 +145,10 @@ class VerifyApi {
                 break;
             case 5:
             case 8:             //公布预览
-                $where[] = ["ti.isPublic", "=", 4];
-                $where[] = ["ti.checkState", "in", [11, 13]];
+                $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED_REVERIFY_PASS];
                 break;
             case 6:
-                $where[] = ["ti.isPublic", "=", 5];
-                $where[] = ["ti.checkState", "in", [11, 13]];
+                $where[] = ["ti.checkState", "=", TalentState::PUBLISH_PASS];
                 break;
         }
         $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
@@ -166,6 +164,10 @@ class VerifyApi {
         return ["total" => $count, "rows" => $list];
     }
 
+    public static function getListByIds($ids) {
+        return Talent::where(["id", "in", $ids])->select()->toArray();
+    }
+
     public static function getList($request) {
         $where = [];
         $order = trim($request->param("order")) ?: "desc";
@@ -312,6 +314,14 @@ class VerifyApi {
             case TalentState::ANNOUNCED_REVERIFY_FAIL:
                 $data["isPublic"] = 3;
                 break;
+            case TalentState::PUBLISH_PASS:
+                $data["isPublic"] = 4;
+                $data["certificateGetTime"] = $batch;
+                $data["certificateExpireTime"] = date("Y-m-d", strtotime(sprintf("%s +6 years", $batch)));
+                break;
+            case TalentState::PUBLISH_FAIL:
+                $data["isPublic"] = 4;
+                break;
         }
         if (Talent::update($data)) {
             TalentLogApi::write($type, $mainId, $state, $msg, 1);

+ 78 - 7
public/static/modular/talentIdentify/talentInfo/talentInfo_prepare.js

@@ -255,7 +255,7 @@ TalentInfo.checkExport = function () {
     for (var i = 0; i < selected.length; i++) {
         ids = ids + selected[i].id + ",";
     }
-    window.location.href = Feng.ctxPath + "/admin/talent/exportHczx?ids=" + ids;
+    window.location.href = Feng.ctxPath + "/admin/talent/prepareHczx?ids=" + ids;
 }
 
 /**
@@ -294,7 +294,7 @@ TalentInfo.hczxPass = function () {
  */
 TalentInfo.showHczxRejectModal = function () {
     if (this.check()) {
-        if (TalentInfo.seItem.isPublic != 1) {
+        if (TalentInfo.seItem.checkState != 11) {
             Feng.info("当前记录不是待核查征信状态,无法核查");
             return;
         }
@@ -548,7 +548,7 @@ TalentInfo.publicExport = function (type) {
  */
 TalentInfo.afterCheck = function () {
     if (this.check()) {
-        if (TalentInfo.seItem.isPublic != 3) {
+        if (TalentInfo.seItem.checkState != 23) {
             Feng.info("当前记录不是公示中状态,无法审核");
             return;
         }
@@ -650,14 +650,85 @@ TalentInfo.publishExportBefore = function () {
     }
     var operation = function () {
         $("#exportCommonModal").modal("hide");
-        window.location.href = Feng.ctxPath + "/talentInfo/publishExportBefore?ids=" + ids;
+        window.location.href = "/admin/talent/publishExportBefore?ids=" + ids;
     }
     Feng.confirm("确定要导出吗?", operation);
 }
 
+/**
+ * 公布审核
+ */
+TalentInfo.singlePublish = function () {
+    if (this.check()) {
+        if (TalentInfo.seItem.checkState != 24) {
+            Feng.info("当前记录不是公示再审核通过状态,无法审核");
+            return;
+        }
+        /*if (TalentInfo.seItem.checkState == 13) {
+         var html = '<option value="">请选择</option>\n' +
+         '       <option value="2">驳回/恢复</option>';
+         $("#checkStateAfter").empty().append(html);
+         }
+         if (TalentInfo.seItem.checkState == 11) {
+         var html = '<option value="">请选择</option>\n' +
+         '       <option value="-1">审核不通过</option>' +
+         '       <option value="2">驳回</option>';
+         $("#checkStateAfter").empty().append(html);
+         }*/
+        $("#checkForm")[0].reset();
+        $("#mainId").val(TalentInfo.seItem.id);
+        $("#publishModal").modal("show");
+        laydate.render({elem: "#publishBatch", type: 'date', trigger: 'click', format: "yyyy-MM-dd"});
+    }
+}
+TalentInfo.publishStateChange = function () {
+    var state = $("#checkStatePublish").val();
+    if (state == 1) {
+        $("#checkStatePublish").parents(".row").next(".row").css("display", "block");
+    } else {
+        $("#checkStatePublish").parents(".row").next(".row").css("display", "none");
+    }
+}
+
+/**
+ * 公示后审核提交
+ */
+TalentInfo.singlePublishSubmit = function () {
+    var checkState = $("#checkStatePublish").val();
+    var msg = $("#publishMsg").val();
+    var month = $("#publishBatch").val();
+    if (checkState == null || checkState == '') {
+        Feng.info("请选择审核状态");
+        return;
+    }
+    if (Feng.isEmptyStr(month)) {
+        Feng.info("请填写公布批次");
+        return;
+    }
+    if (msg == null || msg == '') {
+        Feng.info("请填写审核意见");
+        return;
+    }
+    var operation = function () {
+        var ajax = new $ax("/admin/talent/publish", function (data) {
+            if (data.code == 200) {
+                Feng.success(data.msg);
+                TalentInfo.table.refresh();
+                $("#publishModal").modal("hide");
+            } else {
+                Feng.error(data.msg);
+            }
+        }, function (data) {
+            Feng.error("审核失败!" + data.responseJSON.message + "!");
+        });
+        ajax.setData({"id": $("#mainId").val(), "checkState": checkState, "checkMsg": msg, batch: month});
+        ajax.start();
+    }
+    Feng.confirm("一旦提交无法修改,确定提交吗?", operation);
+}
 
 /**
- * 公布
+ * 批量公布
  */
 TalentInfo.publish = function () {
     var selected = $('#dataTable').bootstrapTable('getSelections');
@@ -689,7 +760,7 @@ TalentInfo.publish = function () {
                     return;
                 }
                 layer.close(index);
-                var ajax = new $ax(Feng.ctxPath + "/talentInfo/publish", function (data) {
+                var ajax = new $ax(Feng.ctxPath + "/admin/talent/preparePublish", function (data) {
                     if (data.code == 200) {
                         Feng.success(data.msg);
                         TalentInfo.table.refresh();
@@ -743,7 +814,7 @@ TalentInfo.sendCard = function () {
         ids = ids + selected[i].id + ",";
     }
     var operation = function () {
-        var ajax = new $ax(Feng.ctxPath + "/talentInfo/sendCard", function (data) {
+        var ajax = new $ax("/admin/talent/sendCard", function (data) {
             if (data.code == 200) {
                 Feng.success(data.msg);
                 TalentInfo.table.refresh();