sugangqiang há 2 anos atrás
pai
commit
c1a5725277
2 ficheiros alterados com 54 adições e 18 exclusões
  1. 51 15
      app/enterprise/controller/Talent.php
  2. 3 3
      app/enterprise/view/talent/apply.html

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

@@ -53,7 +53,7 @@ class Talent extends EnterpriseController {
         }
         $param = $request->param();
         $id = isset($param["id"]) ? $param["id"] : 0;
-        $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
+        $info = \app\common\api\VerifyApi::getTalentInfoById($id);
         $ep = EnterpriseApi::getOne($this->user["uid"]);
         if (!chkEnterpriseFull($ep))
             return;
@@ -282,13 +282,9 @@ class Talent extends EnterpriseController {
     private function submitToCheck_JJRC() {
         $params = $this->request->param();
         $id = $params["id"];
-        if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
-            $res = ["msg" => "没有对应的人才认定申报信息"];
-            echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
-            exit;
-        }
+        $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
         $checkState = $info["checkState"];
-        if ($checkState == TalentState::SCND_SAVE) {
+        if ($checkState == TalentState::SCND_SAVE || !$id) {
             $field_dict = \app\common\api\DictApi::getTalentFields(4);
 
             $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "county", "talent_type", "experience", "education",
@@ -297,7 +293,6 @@ class Talent extends EnterpriseController {
 
             $where = [];
             $where[] = ["rel", "=", "study_abroad"];
-            $where[] = ["step", "=", 2];
             $where[] = ["project", "=", 1];
             $where[] = ["active", "=", 1];
             $where[] = ["delete", "=", 0];
@@ -308,11 +303,11 @@ class Talent extends EnterpriseController {
             if ($abroad_files)
                 $abroad_file_ids = array_column($abroad_files, "id");
 
-            if (in_array($param["talent_type"], [1, 2])) {
+            if (in_array($params["talent_type"], [1, 2])) {
                 $no_empty[] = "tax_insurance_month";
                 $no_empty[] = "labor_contract_rangetime";
             }
-            if ($param["talent_type"] == 3) {
+            if ($params["talent_type"] == 3) {
                 $no_empty[] = "pre_import_type";
             }
             if ($params["study_abroad"] == 1) {
@@ -370,7 +365,33 @@ class Talent extends EnterpriseController {
             } else {
                 $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
             }
-            $ft_ids = array_column($filetypes, "id");
+            $age = 0;
+            if ($params["birthday"]) {
+                $birthday = $params["birthday"];
+                $birthdayYear = substr($birthday, 0, 4);
+                $currentYear = date("Y");
+                $age = $currentYear - $birthdayYear;
+            }
+            $ft_ids = [];
+            $deletes = [];
+            foreach ($filetypes as $ft) {
+                if ($ft["option"]) {
+                    if ($ft["rel"] == "birthday") {
+                        if ($age < $ft["option"]) {
+                            $deletes[] = $ft["id"];
+                            continue;
+                        }
+                    } else {
+                        $selectVal = $params[$ft["rel"]];
+                        $conditions = array_filter(explode(",", $ft["option"]));
+                        if (!in_array($selectVal, $conditions)) {
+                            $deletes[] = $ft["id"];
+                            continue;
+                        }
+                    }
+                }
+                $ft_ids[] = $ft["id"];
+            }
             if ($params["study_abroad"] == 1) {
                 //选中留学,如果存在留学附件变成必传
                 $ft_ids = array_unique(array_merge($ft_ids, (array) $abroad_file_ids));
@@ -379,8 +400,13 @@ class Talent extends EnterpriseController {
                 $ft_ids = array_diff($ft_ids, (array) $abroad_file_ids);
             }
             $whr = [];
+            if ($id) {
+                $whr[] = ["mainId", "=", $id];
+            } else {
+                if ($params["uploadFiles"])
+                    $whr[] = ["id", "in", $params["uploadFiles"]];
+            }
             $whr[] = ["typeId", "in", $ft_ids];
-            $whr[] = ["mainId", "=", $id];
             $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
             $upload_type_counts = count($distinct_filetypes);
             if ($upload_type_counts != count($ft_ids)) {
@@ -389,7 +415,7 @@ class Talent extends EnterpriseController {
                 exit;
             }
 
-            return $this->save($info, $this->request, TalentState::SCND_SUBMIT);
+            return $this->mixSave($info, $this->request, TalentState::SCND_SUBMIT);
         } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
             $res = ["msg" => "审核失败,不能再提交审核"];
             echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
@@ -739,8 +765,18 @@ class Talent extends EnterpriseController {
                     Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
                 }
             } else if ($checkState == TalentState::SCND_SUBMIT) {
-                $data["new_submit_time"] = date("Y-m-d H:i:s");
-                TalentModel::update($data);
+                if ($data["id"]) {
+                    $data["new_submit_time"] = date("Y-m-d H:i:s");
+                    TalentModel::update($data);
+                } else {
+                    //新增
+                    $data["enterprise_id"] = $this->user["uid"];
+                    $id = TalentModel::insertGetId($data);
+                    $whr = [];
+                    $whr[] = ["fileId", "in", $files];
+                    $upd_checklog["mainId"] = $id;
+                    Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
+                }
                 TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
             } else {
                 throw new ValidateException($error_msg);

+ 3 - 3
app/enterprise/view/talent/apply.html

@@ -378,9 +378,9 @@
                                         <td>
                                             <div class="rowGroup">
                                                 <label class="control-label spacing td-label">是否有留学经历</label>
-                                                <select class="form-control" id="study_abroad" name="study_abroad" onchange="TalentInfoInfoDlg.changeStudyAbroad()" autocomplete='off'>
-                                                    <option value="2" {eq name='row.study_abroad' value='2'}selected="selected"{/eq}>否</option>
-                                                    <option value="1" {eq name='row.study_abroad' value='1'}selected="selected"{/eq}>是</option>
+                                                <select class="form-control" id="study_abroad" name="study_abroad" onchange="TalentInfoInfoDlg.changeStudyAbroad()" autocomplete='off' value="{$row.study_abroad}">
+                                                    <option value="2">否</option>
+                                                    <option value="1">是</option>
                                                 </select>
                                             </div>
                                         </td>