浏览代码

总院增加修改驳回字段功能

sugangqiang 1 年之前
父节点
当前提交
237f515de9

+ 79 - 2
app/enterprise/controller/Talent.php

@@ -17,6 +17,7 @@ use app\enterprise\validate\TalentInfo;
 use app\common\state\ProjectState;
 use app\common\api\BatchApi;
 use app\common\state\CommonConst;
+use app\common\api\TalentConditionApi;
 
 // 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
 
@@ -137,7 +138,7 @@ class Talent extends EnterpriseController {
             $info["talent_type_list"] = DictApi::findChildDictByCode("talent_type");
         }
         if ($info["talent_condition"]) {
-            $info["isSalary"] = \app\common\api\TalentConditionApi::getOne($info["talent_condition"])["isSalary"] ?: 0;
+            $info["isSalary"] = TalentConditionApi::getOne($info["talent_condition"])["isSalary"] ?: 0;
         }
         return view($tpl, ["year" => $batch, "checkState" => $checkState, "row" => $info]);
     }
@@ -1772,6 +1773,82 @@ class Talent extends EnterpriseController {
         }
     }
 
+    public function findFieldsAndFiles() {
+        $id = $this->request["id"];
+        $talentInfo = TalentApi::getOne($id);
+        $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
+        $responseObj = new \stdClass();
+        if ($talentInfo["checkState"] == TalentState::FST_SAVE && $lastLog["state"] == TalentState::BASE_REJECT) {
+            $fields = DictApi::getTalentFields_WJ();
+            $field_tmp = [];
+            if ($fields) {
+                foreach ($fields as $key => $field) {
+                    $field_tmp[] = ["key" => $key, "value" => $field];
+                }
+            }
+            $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
+            $where = [];
+            $whr = [];
+            $where[] = ["project", "=", 1];
+            $where[] = ["active", "=", 1];
+            $where[] = ["type", "=", CommonConst::ENTERPRISE_WJ];
+            $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])->order("sn asc")->select();
+            } else {
+                $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->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 = TalentApi::getOne($id);
+        $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
+        $responseObj = new \stdClass();
+        if ($talentInfo["checkState"] == TalentState::FST_SAVE && $lastLog["state"] == TalentState::BASE_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);
+        }
+    }
+
     private function sendMsg($enterprise_id, $description = "") {
         $ep = EnterpriseApi::getOne($enterprise_id);
         if ($ep->agentPhone) {
@@ -1821,7 +1898,7 @@ class Talent extends EnterpriseController {
                     $field_tmp[] = ["key" => $key, "value" => $field];
                 }
             }
-            $condition = \app\common\api\TalentConditionApi::getOne($talent_info["talent_condition"]);
+            $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
             $where = [];
             $whr = [];
             $where[] = ["project", "=", 1];

+ 3 - 0
app/enterprise/view/talent/hospital/examine_center.html

@@ -212,6 +212,9 @@
                             <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.openCheckTalentInfo()">
                                 <i class="fa fa-check"></i>&nbsp;审核
                             </button>
+                            <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.updateFieldsAndFiles()">
+                                <i class="fa fa-edit"></i>&nbsp;修改驳回字段
+                            </button>
                             <button type="button" class="btn btn-sm btn-primary " onclick="TalentInfo.showExportModal(1)">
                                 <i class="fa fa-file-excel-o"></i>&nbsp;导出
                             </button>

+ 110 - 0
public/static/modular/gate/enterprise/talentIdentify/examine_common.js

@@ -153,6 +153,106 @@ TalentInfo.showExportModal = function () {
     $("#commonExportModal").modal("show");
 }
 
+/**
+ * 修改驳回的字段及附件
+ */
+TalentInfo.updateFieldsAndFiles = function () {
+    if (this.check()) {
+        var ajax = new $ax("/enterprise/talent/findFieldsAndFiles?id=" + TalentInfo.seItem.id, function (data) {
+            if (data.code == 200) {
+                layer.open({
+                    type: 1,
+                    id: "neewFieldFormModel",
+                    title: '修改',
+                    area: ['800px', '450px'], //宽高
+                    fix: false, //不固定
+                    shade: 0,
+                    maxmin: true,
+                    content: TalentInfo.creatFieldCheckModal(),
+                    btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
+                    btnAlign: 'c',
+                    zIndex: layer.zIndex,
+                    success: function (layero, index) {
+
+                        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>';
+                            }
+                        }
+
+                        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 (data.select.files != null && data.select.files != '') {
+                            $("#field_file input").each(function () {
+                                if (data.select.files.indexOf($(this).val()) != -1) {
+                                    this.checked = true;
+                                }
+                            });
+                        }
+                    },
+                    yes: function (index, layero) {
+                        TalentInfo.submitFieldsAndFiles(index, data.id);
+                    }
+                });
+            } else {
+                Feng.error(data.msg);
+            }
+        }, function (data) {
+            Feng.error("查询失败!" + data.responseJSON.message + "!");
+        });
+        ajax.start();
+    }
+}
+
+/**
+ * 修改提交
+ * @param index
+ * @param id
+ */
+TalentInfo.submitFieldsAndFiles = function (index, id) {
+    var fields = '';
+    var files = '';
+    $("#firstCheckForm #field_info li input").each(function (index) {
+        if ($(this).is(":checked")) {
+            fields = fields + $(this).val() + ",";
+        }
+    });
+    $("#field_file li input").each(function (index) {
+        if ($(this).is(":checked")) {
+            files = files + $(this).val() + ",";
+        }
+    });
+    if (fields == '' && files == '') {
+        Feng.info("请选择可修改的字段或附件!");
+        return;
+    }
+    var ajax = new $ax("/enterprise/talent/updateFieldsAndFiles", function (data) {
+        if (data.code == 200) {
+            layer.close(index);
+            Feng.success(data.msg);
+        } else {
+            Feng.error(data.msg);
+        }
+    }, function (data) {
+        Feng.error("修改失败!" + data.responseJSON.message + "!");
+    });
+    ajax.setData({"id": id, "fields": fields, "files": files})
+    ajax.start();
+}
+
 /**
  * 导出提交
  */
@@ -282,6 +382,9 @@ TalentInfo.checkAll = function () {
     $("#field_info input").each(function () {
         this.checked = true;
     })
+    $("#field_file input").each(function () {
+        this.checked = true;
+    })
 }
 /**
  * 反选
@@ -294,5 +397,12 @@ TalentInfo.unCheckAll = function () {
             this.checked = true;
         }
     })
+    $("#field_file input").each(function () {
+        if (this.checked) {
+            this.checked = false;
+        } else {
+            this.checked = true;
+        }
+    })
 }