Pārlūkot izejas kodu

离职申请企业端

sugangqiang 1 gadu atpakaļ
vecāks
revīzija
d78487c085

+ 1 - 1
app/common/api/DictApi.php

@@ -77,7 +77,7 @@ class DictApi {
     public static function getOne($id) {
     public static function getOne($id) {
         $info = Dict::where("id", $id)->findOrEmpty()->toArray();
         $info = Dict::where("id", $id)->findOrEmpty()->toArray();
         if ($info) {
         if ($info) {
-            $items = Dict::where("pid", "=", $id)->select()->toArray();
+            $items = Dict::where("pid", "=", $id)->order("num asc")->select()->toArray();
             $info["children"] = $items;
             $info["children"] = $items;
         }
         }
         return $info;
         return $info;

+ 8 - 3
app/common/api/VerifyApi.php

@@ -79,6 +79,11 @@ class VerifyApi {
             if ($info["highest_degree"]) {
             if ($info["highest_degree"]) {
                 $info["highestDegreeName"] = DictApi::selectByParentCode("highest_degree")[$info["highest_degree"]];
                 $info["highestDegreeName"] = DictApi::selectByParentCode("highest_degree")[$info["highest_degree"]];
             }
             }
+            if ($info["labor_contract_rangetime"]) {
+                list($startTime, $endTime) = explode(" - ", $info["labor_contract_rangetime"]);
+                $info["startTime"] = $startTime;
+                $info["endTime"] = $endTime;
+            }
             if ($info["qz_talent_info"]) {
             if ($info["qz_talent_info"]) {
                 $qz_talent_info = explode(";", $info["qz_talent_info"]);
                 $qz_talent_info = explode(";", $info["qz_talent_info"]);
                 list($tmp1, $timeStart) = explode(":", $qz_talent_info[1]);
                 list($tmp1, $timeStart) = explode(":", $qz_talent_info[1]);
@@ -1108,11 +1113,11 @@ class VerifyApi {
                         if ($log["active"] == 1) {
                         if ($log["active"] == 1) {
                             if ($log["new_state"] == 9) {
                             if ($log["new_state"] == 9) {
                                 $verifyDepts[$k] .= "(审核驳回)";
                                 $verifyDepts[$k] .= "(审核驳回)";
-                                $item["deptReject"] ++;
+                                $item["deptReject"]++;
                             }
                             }
                             if ($log["new_state"] == 12) {
                             if ($log["new_state"] == 12) {
                                 $verifyDepts[$k] .= "(审核通过)";
                                 $verifyDepts[$k] .= "(审核通过)";
-                                $item["deptPass"] ++;
+                                $item["deptPass"]++;
                             }
                             }
                             $deptDescriptions[] = sprintf("%s:%s", $company["name"], $log["description"]);
                             $deptDescriptions[] = sprintf("%s:%s", $company["name"], $log["description"]);
                         } else {
                         } else {
@@ -1121,7 +1126,7 @@ class VerifyApi {
                                 continue;
                                 continue;
                             }
                             }
                             $verifyDepts[$k] .= "(待审核)";
                             $verifyDepts[$k] .= "(待审核)";
-                            $item["deptWait"] ++;
+                            $item["deptWait"]++;
                         }
                         }
                     }
                     }
                     $item["verifyDepts"] = implode(chr(10), $verifyDepts);
                     $item["verifyDepts"] = implode(chr(10), $verifyDepts);

+ 4 - 0
app/common/controller/Api.php

@@ -94,6 +94,8 @@ class Api extends BaseController {
             case 1:
             case 1:
                 $talentInfo = TalentApi::getOne($mainId);
                 $talentInfo = TalentApi::getOne($mainId);
                 $talent_condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
                 $talent_condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
+            case 3:
+            case 4:
             case 6:
             case 6:
             case 19:
             case 19:
             case 20:
             case 20:
@@ -120,6 +122,8 @@ class Api extends BaseController {
                 continue;
                 continue;
             $new_item["description"] = $item["description"];
             $new_item["description"] = $item["description"];
             switch ($item['type']) {
             switch ($item['type']) {
+                case 3:
+                case 4:
                 case 6:
                 case 6:
                 case 19:
                 case 19:
                     $new_item["stateName"] = \app\common\state\LivingAllowanceState::getStepName($item["state"]);
                     $new_item["stateName"] = \app\common\state\LivingAllowanceState::getStepName($item["state"]);

+ 24 - 4
app/enterprise/controller/Talent.php

@@ -1529,21 +1529,21 @@ class Talent extends EnterpriseController {
             $_where = [];
             $_where = [];
             $_where[] = ["checkState", "not in", [3]];
             $_where[] = ["checkState", "not in", [3]];
             $talentIds = Db::table("un_talent_quit")->where($_where)->column("talentId");
             $talentIds = Db::table("un_talent_quit")->where($_where)->column("talentId");
-            $sList[] = array_merge($sList, (array) $talentIds);
+            $sList = array_merge($sList, (array) $talentIds);
             $where[] = ["active", "=", 1];
             $where[] = ["active", "=", 1];
         }
         }
         if ($type == ProjectState::BANKCHANGE) {
         if ($type == ProjectState::BANKCHANGE) {
             $_where = [];
             $_where = [];
             $_where[] = ["checkState", "not in", [3]];
             $_where[] = ["checkState", "not in", [3]];
             $talentIds = Db::table("un_talent_bank_change")->where($_where)->column("talentId");
             $talentIds = Db::table("un_talent_bank_change")->where($_where)->column("talentId");
-            $sList[] = array_merge($sList, (array) $talentIds);
+            $sList = array_merge($sList, (array) $talentIds);
         }
         }
         if ($type == ProjectState::LEVELCHANGE) {
         if ($type == ProjectState::LEVELCHANGE) {
             $_where = [];
             $_where = [];
             $_where[] = ["checkState", "not in", [35, -1]];
             $_where[] = ["checkState", "not in", [35, -1]];
             $_where[] = ["isPublic", "<", 5];
             $_where[] = ["isPublic", "<", 5];
             $talentIds = Db::table("un_talent_type_change")->where($_where)->column("talentId");
             $talentIds = Db::table("un_talent_type_change")->where($_where)->column("talentId");
-            $sList[] = array_merge($sList, (array) $talentIds);
+            $sList = array_merge($sList, (array) $talentIds);
         }
         }
         $where[] = ["enterprise_id", "=", $this->user["uid"]];
         $where[] = ["enterprise_id", "=", $this->user["uid"]];
         $where[] = ["checkState", "=", TalentState::CERTIFICATED];
         $where[] = ["checkState", "=", TalentState::CERTIFICATED];
@@ -1551,8 +1551,28 @@ class Talent extends EnterpriseController {
         if ($sList) {
         if ($sList) {
             $where[] = ["id", "not in", $sList];
             $where[] = ["id", "not in", $sList];
         }
         }
+        $result = TalentModel::where($where)->field("id,name")->select()->toArray();
+        return json($result);
+    }
 
 
-        return TalentModel::where($where)->field("id,name")->select()->toArray();
+    public function findTalentInfoByChangeId() {
+        $where = [];
+        $id = $this->request->param('id');
+        $type = $this->request->param('type');
+        if ($type == ProjectState::QUIT) {
+            $info = Db::table("un_talent_quit")->where("id", $id)->find();
+            $where[] = ["id", "=", $info["talentId"]];
+        }
+        if ($type == ProjectState::LEVELCHANGE) {
+            $info = Db::table("un_talent_type_change")->where("id", $id)->find();
+            $where[] = ["id", "=", $info["talentId"]];
+        }
+        if ($type == ProjectState::BANKCHANGE) {
+            $info = Db::table("un_talent_bank_change")->where("id", $id)->find();
+            $where[] = ["id", "=", $info["talentId"]];
+        }
+        $result = TalentModel::where($where)->field("id,name")->select()->toArray();
+        return json($result);
     }
     }
 
 
     /**
     /**

+ 157 - 2
app/enterprise/controller/TalentQuit.php

@@ -4,6 +4,10 @@ namespace app\enterprise\controller;
 
 
 use app\enterprise\common\EnterpriseController;
 use app\enterprise\common\EnterpriseController;
 use app\common\model\TalentQuit as TqModel;
 use app\common\model\TalentQuit as TqModel;
+use app\common\api\TalentLogApi;
+use app\common\state\ProjectState;
+use app\common\model\TalentLog;
+use think\facade\Db;
 
 
 /**
 /**
  * Description of TalentQuit
  * Description of TalentQuit
@@ -24,6 +28,7 @@ class TalentQuit extends EnterpriseController {
         $limit = $params["limit"] ?: 10;
         $limit = $params["limit"] ?: 10;
         $where = [];
         $where = [];
         $where[] = ["enterpriseId", "=", $this->user["uid"]];
         $where[] = ["enterpriseId", "=", $this->user["uid"]];
+        $where[] = ["delete", "=", 0];
         if ($params["talentName"]) {
         if ($params["talentName"]) {
             $where[] = ["talentName", "like", "%" . $params["talentName"] . "%"];
             $where[] = ["talentName", "like", "%" . $params["talentName"] . "%"];
         }
         }
@@ -47,11 +52,161 @@ class TalentQuit extends EnterpriseController {
     }
     }
 
 
     public function apply() {
     public function apply() {
-        return view();
+        $request = $this->request;
+        $id = isset($request["id"]) ? $request["id"] : 0;
+        $info = TqModel::where("id", $id)->find();
+        if ($this->request->isPost()) {
+            $response = new \stdClass();
+            $response->code = 500;
+            $data = $request->param();
+            $check = $this->dataCheck($data);
+            if ($check->code == 500) {
+                return $check;
+            }
+            $talentInfo = \app\common\api\VerifyApi::getTalentInfoById($request["talentId"]);
+            if ($data["id"]) {
+                $data["updateUser"] = $this->user["uid"];
+                $data["updateTime"] = date("Y-m-d H:i:s");
+                TqModel::update($data);
+                $response->code = 200;
+                $response->msg = "修改成功";
+                return $response;
+            } else {
+                $data["id"] = getStringId();
+                $data["identifyGetTime"] = $talentInfo["identifyGetTime"];
+                $data["talentType"] = $talentInfo["enterpriseTag"];
+                $data["checkState"] = 1;
+                $data["createUser"] = $this->user["uid"];
+                $data["createTime"] = date("Y-m-d H:i:s");
+                $data["post"] = $talentInfo["position"];
+                TqModel::create($data);
+
+                $user = $this->user;
+                $log["id"] = getStringId();
+                $log["active"] = 1;
+                $log["state"] = 1;
+                $log["step"] = 0;
+                $log["stateChange"] = "<span class='label label-success'>待审核</span>";
+                $log["type"] = ProjectState::QUIT;
+                $log["mainId"] = $id;
+                $log["description"] = "添加离职申报";
+                $log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
+                $log["createTime"] = date("Y-m-d H:i:s");
+                TalentLog::create($log);
+                $response->code = 200;
+                $response->msg = "添加成功";
+                $response->obj = $data;
+                return $response;
+            }
+        }
+        return view("", ["type" => $this->user["type"], "year" => $request["year"], "row" => $info]);
     }
     }
 
 
     public function view() {
     public function view() {
-        return view();
+        $id = $this->request["id"];
+        $info = TqModel::where("id", $id)->find();
+        return view("", ["row" => $info]);
+    }
+
+    public function submitToCheck() {
+        $response = new \stdClass();
+        $response->code = 500;
+        $id = $this->request["id"];
+        $info = TqModel::where("id", $id)->find();
+        if (!$info) {
+            $response->msg = "提交审核失败,请先填写基础信息";
+            return $response;
+        }
+        if ($info["checkState"] != -1 && $info["checkState"] != 2) {
+            $response->msg = "不能重复提交审核";
+            return $response;
+        }
+        $where = [];
+        $where[] = ["type", "=", $info["type"]];
+        $where[] = ["project", "=", ProjectState::QUIT];
+        $where[] = ["active", "=", 1];
+        $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
+        foreach ($filetypes as $filetype) {
+            $sb = [];
+            $sb[] = "以下为必传附件:";
+            if ($filetype["must"] == 1) {
+                $where = [];
+                $where[] = ["mainId", "=", $id];
+                $where[] = ["typeId", "=", $filetype["id"]];
+                $count = Db::table("new_talent_common_file")->where($where)->count();
+                if ($count == 0) {
+                    $sb[] = $filetype["name"] . ";";
+                }
+            }
+        }
+        if (count($sb) > 1) {
+            $response->msg = implode("<br>", $sb);
+            return $response;
+        }
+        $data["id"] = $id;
+        $data["checkState"] = $info["checkState"] == 2 ? 9 : 1;
+        TqModel::update($data);
+        $user = $this->user;
+        $log["id"] = getStringId();
+        $log["active"] = 1;
+        $log["state"] = 1;
+        $log["step"] = 0;
+        $log["stateChange"] = "<span class='label'>待提交</span>-><span class='label label-success'>待审核</span>";
+        $log["type"] = ProjectState::QUIT;
+        $log["mainId"] = $id;
+        $log["description"] = "确认提交审核";
+        $log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
+        $log["createTime"] = date("Y-m-d H:i:s");
+        TalentLog::create($log);
+        $response->code = 200;
+        $response->msg = "提交审核成功";
+        $response->obj = 1;
+        return $response;
+    }
+
+    public function delete() {
+        $response = new \stdClass();
+        $response->code = 500;
+        $info = TqModel::where("id", $this->request["id"])->find();
+        if ($info["checkState"] != -1) {
+            $response->msg = "已提交审核,无法删除";
+            return $response;
+        }
+        $data["id"] = $info["id"];
+        $data["delete"] = 1;
+        $data["deleteTime"] = date("Y-m-d H:i:s");
+        $response->code = 200;
+        $response->msg = "删除成功";
+        return $response;
+    }
+
+    private function dataCheck($data) {
+        $response = new \stdClass();
+        $response->code = 500;
+        if (\StrUtil::isEmpOrNull($data["starttime"])) {
+            $response->msg = "合同开始时间不能为空";
+            return $response;
+        }
+        if (\StrUtil::isEmpOrNull($data["endtime"])) {
+            $response->msg = "合同结束时间不能为空";
+            return $response;
+        }
+        if (\StrUtil::isEmpOrNull($data["phone"])) {
+            $response->msg = "手机号码不能为空";
+            return $response;
+        }
+        if (\StrUtil::isEmpOrNull($data["quitTime"])) {
+            $response->msg = "离职时间不能为空";
+            return $response;
+        }
+        if ($data["type"] == 1) {
+            if (\StrUtil::isEmpOrNull($data["quitReason"])) {
+                $response->msg = "离职原因不能为空";
+                return $response;
+            }
+        }
+        $response->code = 200;
+        return $response;
     }
     }
 
 
 }
 }

+ 2 - 2
app/enterprise/view/talent_quit/apply.html

@@ -39,11 +39,11 @@
                                         <form id="talentQuitForm">
                                         <form id="talentQuitForm">
                                             <div class="col-sm-12 form-group-sm">
                                             <div class="col-sm-12 form-group-sm">
                                                 <input type="hidden" id="id" name="id" value="{$row.id}"/>
                                                 <input type="hidden" id="id" name="id" value="{$row.id}"/>
-                                                <input type="hidden" id="type" name="type" value="{$row.type}"/>
+                                                <input type="hidden" id="type" name="type" value="{$type}"/>
                                                 <input type="hidden" id="checkState" name="checkState" value="{$row.checkState}"/>
                                                 <input type="hidden" id="checkState" name="checkState" value="{$row.checkState}"/>
                                                 <input type="hidden" id="enterpriseId" name="enterpriseId" value="{$row.enterpriseId}"/>
                                                 <input type="hidden" id="enterpriseId" name="enterpriseId" value="{$row.enterpriseId}"/>
                                                 <input type="hidden" id="talentName" name="talentName" value="{$row.talentName}"/>
                                                 <input type="hidden" id="talentName" name="talentName" value="{$row.talentName}"/>
-                                                <input type="hidden" id="year" name="year" value="{$row.year}">
+                                                <input type="hidden" id="year" name="year" value="{$year}">
                                                 <div class="rowGroup">
                                                 <div class="rowGroup">
                                                     <label class="col-sm-2 control-label spacing">离职对象</label>
                                                     <label class="col-sm-2 control-label spacing">离职对象</label>
                                                     <div class="col-sm-4 spacing">
                                                     <div class="col-sm-4 spacing">

+ 1 - 1
public/static/modular/gate/talentLibrary/talentQuit/talentQuit.js

@@ -84,7 +84,7 @@ TalentQuit.openAddTalentQuit = function () {
                 area: 'auto', //宽高
                 area: 'auto', //宽高
                 fix: false, //不固定
                 fix: false, //不固定
                 maxmin: true,
                 maxmin: true,
-                content: Feng.ctxPath + '/enterprise/talent_quit/apply?year=' + data.obj,
+                content: Feng.ctxPath + '/enterprise/talent_quit/apply?year=' + data.batch,
                 btn: ['<i class="fa fa-eye"></i>&nbsp;&nbsp;保存未提交', '<i class="fa fa-check layui-bg-green"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
                 btn: ['<i class="fa fa-eye"></i>&nbsp;&nbsp;保存未提交', '<i class="fa fa-check layui-bg-green"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
                 btnAlign: 'c',
                 btnAlign: 'c',
                 btn1: function (index, layero) {
                 btn1: function (index, layero) {

+ 3 - 3
public/static/modular/gate/talentLibrary/talentQuit/talentQuit_info.js

@@ -174,7 +174,7 @@ TalentQuitInfoDlg.editSubmit = function (type) {
 TalentQuitInfoDlg.talentInfoDetail = function () {
 TalentQuitInfoDlg.talentInfoDetail = function () {
     var talentId = $("#talentId").val();
     var talentId = $("#talentId").val();
     var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/getInfoById/id/" + talentId, function (data) {
     var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/getInfoById/id/" + talentId, function (data) {
-        $("#type").val(data.type);
+        $("#type").val(data.enterpriseType);
         $("#enterpriseId").val(data.enterprise_id);
         $("#enterpriseId").val(data.enterprise_id);
         $("#talentName").val(data.name);
         $("#talentName").val(data.name);
         $("#idCard").val(data.card_number);
         $("#idCard").val(data.card_number);
@@ -184,7 +184,7 @@ TalentQuitInfoDlg.talentInfoDetail = function () {
         $("#talentTypeName").val(data.talentTypeName);
         $("#talentTypeName").val(data.talentTypeName);
         $("#starttime").val(data.startTime);
         $("#starttime").val(data.startTime);
         $("#endtime").val(data.endTime);
         $("#endtime").val(data.endTime);
-        $("#entryTime").val(data.entryTime);
+        $("#entryTime").val(data.cur_entry_time);
         $("#phone").val(data.phone);
         $("#phone").val(data.phone);
     }, function (data) {
     }, function (data) {
         Feng.error("查询失败!" + data.responseJSON.message + "!");
         Feng.error("查询失败!" + data.responseJSON.message + "!");
@@ -198,7 +198,7 @@ TalentQuitInfoDlg.initFileTable = function () {
     queryData['project'] = CONFIG.project_quit;
     queryData['project'] = CONFIG.project_quit;
     queryData['type'] = $("#type").val();
     queryData['type'] = $("#type").val();
     $("#fileTable").bootstrapTable({
     $("#fileTable").bootstrapTable({
-        url: Feng.ctxPath + "/common/api/findUnCommonFileType",
+        url: Feng.ctxPath + "/common/api/findCommonFileType",
         method: 'POST',
         method: 'POST',
         contentType: "application/x-www-form-urlencoded; charset=UTF-8",
         contentType: "application/x-www-form-urlencoded; charset=UTF-8",
         search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
         search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端

+ 1 - 1
public/static/modular/gate/talentLibrary/talentQuit/talentQuit_select.js

@@ -178,7 +178,7 @@ TalentQuitInfoDlg.initFileTable = function () {
     queryData['project'] = CONFIG.project_quit;
     queryData['project'] = CONFIG.project_quit;
     queryData['type'] = $("#type").val();
     queryData['type'] = $("#type").val();
     $("#fileTable").bootstrapTable({
     $("#fileTable").bootstrapTable({
-        url: Feng.ctxPath + "/common/api/findUnCommonFileType",
+        url: Feng.ctxPath + "/common/api/findCommonFileType",
         method: 'POST',
         method: 'POST',
         contentType: "application/x-www-form-urlencoded; charset=UTF-8",
         contentType: "application/x-www-form-urlencoded; charset=UTF-8",
         search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
         search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端