Browse Source

企业端生活补贴申请

sugangqiang 1 year ago
parent
commit
1f4ca24186

+ 12 - 3
app/common/api/LivingAllowanceApi.php

@@ -2,7 +2,8 @@
 
 namespace app\common\api;
 
-use app\common\model\LivingAllowance as laModel;
+use app\common\model\LivingAllowance as LaModel;
+use app\common\state\LivingAllowanceState as LaState;
 
 /**
  * Description of LivingAllowanceApi
@@ -12,11 +13,19 @@ use app\common\model\LivingAllowance as laModel;
 class LivingAllowanceApi {
 
     public static function getList($where = []) {
-        return laModel::where($where)->select()->toArray();
+        return LaModel::where($where)->select()->toArray();
     }
 
     public static function getInfoById($id) {
-        return laModel::where("id", $id)->find();
+        return LaModel::findOrEmpty($id)->toArray();
+    }
+
+    public static function getApplyCountByIdCard($idCard) {
+        $where = [];
+        $where[] = ["idCard", "=", $idCard];
+        $where[] = ["checkState", "<>", LaState::LA_NOTPASS];
+        $list = LaModel::where($where)->distinct(true)->field("substr(year,1,4)")->select();
+        return count($list);
     }
 
 }

+ 12 - 5
app/common/api/MenuApi.php

@@ -212,7 +212,7 @@ class MenuApi {
         //$menus[] = ["type" => [1, 2], "code" => "rcrdsb", "pcode" => "rcrd", "name" => "人才认定申报", "url" => "/enterprise/talent", "icon" => "fa-thumbs-up", "status" => 1];
         $menus[] = ["type" => [1, 2], "code" => "rcrdsbnew", "pcode" => "rcrd", "name" => "人才认定申报(新)", "url" => "/enterprise/talent/index/isMix/1", "icon" => "fa-thumbs-up", "status" => 1];
         //$menus[] = ["type" => [1, 2], "code" => "rczrzlbc", "pcode" => "rcrd", "name" => "人才直认资料补充", "url" => "/enterprise/talent/zrIndex", "icon" => "fa-thumbs-up", "status" => 1];
-        $menus[] = ["type" => [2], "code" => "yxrck", "pcode" => "rcrd", "name" => "优秀人才库", "url" => "/enterprise/talent_library/index", "icon" => "fa-thumbs-up", "status" => 1];
+        $menus[] = ["type" => [1, 2], "code" => "yxrck", "pcode" => "rcrd", "name" => "优秀人才库", "url" => "/enterprise/talent_library/index", "icon" => "fa-thumbs-up", "status" => 1];
         $menus[] = ["type" => [2], "code" => "jfsb", "pcode" => "rcrd", "name" => "积分申报", "url" => "/enterprise/integral/index", "icon" => "fa-credit-card", "status" => 1];
         $menus[] = ["type" => [1, 2], "code" => "yxrck", "pcode" => "rcrd", "name" => "优秀人才库", "url" => "", "icon" => "fa-thumbs-up", "status" => 1];
         $menus[] = ["type" => [1, 2], "code" => "lzsb", "pcode" => "rcrd", "name" => "离职申报", "url" => "", "icon" => "fa-thumbs-up", "status" => 1];
@@ -237,15 +237,22 @@ class MenuApi {
         $menus[] = ["type" => [2], "code" => "fzbz", "pcode" => "zfbz", "name" => "房租补助", "url" => "", "icon" => "fa-money", "status" => 1];
         $menus[] = ["type" => [2], "code" => "gfsq", "pcode" => "zfbz", "name" => "购房申请", "url" => "", "icon" => "fa-envira", "status" => 1];
         $menus[] = ["type" => [2], "code" => "gfbz", "pcode" => "zfbz", "name" => "购房补助", "url" => "", "icon" => "fa-envira", "status" => 1];
-        $menus[] = ["type" => [1], "code" => "sbrc", "pcode" => "0", "name" => "硕博人才", "url" => "", "icon" => "fa-graduation-cap", "status" => 0];
-        $menus[] = ["type" => [1], "code" => "shbt", "pcode" => "sbrc", "name" => "生活补贴", "url" => "", "icon" => "fa-graduation-cap", "status" => 1];
+        $menus[] = ["type" => [1, 2], "code" => "sbrc", "pcode" => "0", "name" => "硕博人才", "url" => "", "icon" => "fa-graduation-cap", "status" => 1];
+        $menus[] = ["type" => [1, 2], "code" => "shbt", "pcode" => "sbrc", "name" => "生活补贴", "url" => "/enterprise/living_allowance", "icon" => "fa-graduation-cap", "status" => 1];
         $menus[] = ["type" => [3], "code" => "hxjh", "pcode" => "0", "name" => "海峡计划", "url" => "", "icon" => "fa-plane", "status" => 1];
         $menus[] = ["type" => [3], "code" => "hxjhsb", "pcode" => "hxjh", "name" => "海峡计划申报", "url" => "", "icon" => "fa-pencil", "status" => 1];
         foreach ($menus as $key => $menu) {
-            if (!in_array($type, $menu["type"]) || ($menu["pcode"]) != "0" && $menu["url"] == "" || $menu["status"] == 0)
+            if (!in_array($type, $menu["type"]) || (($menu["pcode"]) != "0" && $menu["url"] == "") || $menu["status"] == 0)
                 unset($menus[$key]);
         }
-        return self::buildMenu($menus);
+        $menus = self::buildMenu($menus);
+        for ($i = 0; $i < count($menus); $i++) {
+            $menu_items_count = count($menus[$i]["children"]);
+            if ($menu_items_count > 0 || ($menu_items_count == 0 && $menus[$i]["url"] != ""))
+                $tmp[] = $menus[$i];
+        }
+
+        return $tmp;
     }
 
     public static function getPersonMenuList($type) {

+ 15 - 6
app/common/controller/Api.php

@@ -89,16 +89,12 @@ class Api extends BaseController {
         $mainId = $params["mainId"];
         $enterpriseId = $params["enterpriseId"];
         $type = $params["type"];
-        /* $talentInfo = TalentApi::getOne($mainId);
-          $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
-          $needDeptVerify = false;
-          if ($condition["companyIds"] && $talentInfo["pass_dept_check"] != 1)
-          $needDeptVerify = true; */
         $list = [];
         switch ($type) {
             case 1:
                 $talentInfo = TalentApi::getOne($mainId);
                 $talent_condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
+            case 19:
             case 20:
                 $list = TalentLogApi::getList($type, $mainId);
                 break;
@@ -123,6 +119,11 @@ class Api extends BaseController {
                 continue;
             $new_item["description"] = $item["description"];
             switch ($item['type']) {
+                case 19:
+                    $new_item["stateName"] = \app\common\state\LivingAllowanceState::getStepName($item["state"]);
+                    $new_item["stepName"] = \app\common\state\LivingAllowanceState::getStepName($item["step"]);
+                    $new_item["stateChange"] = $item["stateChange"];
+                    break;
                 case 20:
                     $new_item["stepName"] = IntegralState::getLogStepName($item["state"]);
                     $new_item["stateName"] = IntegralState::getLogStateName($item["state"], $item["last_state"]);
@@ -445,7 +446,7 @@ class Api extends BaseController {
         $data["orignName"] = $file->getOriginalName();
         $data["url"] = $filestd->filepath;
         $data["sn"] = $index;
-        $data["createTime"] = time();
+        $data["createTime"] = date("Y-m-d H:i:s");
         if ($fileId) {
             Db::table("new_talent_file")->save($data);
         } else {
@@ -614,6 +615,14 @@ class Api extends BaseController {
                         return true;
                 }
                 break;
+            case ProjectState::LIVINGALLOWANCE:
+                if ($this->user["usertype"] == 2) {
+                    $user_id = $this->user["uid"];
+                    $record = Db::table("md_living_allowance_info")->findOrEmpty($mainId);
+                    if ($user_id == $record["enterpriseId"])
+                        return true;
+                }
+                break;
             case ProjectState::INTEGRAL:
                 if ($this->user["usertype"] == 2) {
                     $user_id = $this->user["uid"];

+ 133 - 3
app/common/state/LivingAllowanceState.php

@@ -4,8 +4,138 @@ namespace app\common\state;
 
 class LivingAllowanceState {
 
-    public const TALENT = 1; //人才认定
-    public const LIVINGALLOWANCE = 19; //生活补贴
-    public const INTEGRAL = 20; //积分申报
+//保存
+    public const LA_SAVE = 1;
+//待审核
+    public const LA_NEED_CHECK = 3;
+//部门初审驳回
+    public const LA_BEFORE_REJECT = 5;
+//审核不通过
+    public const LA_NOTPASS = -1;
+//待初审
+    public const LA_NEED_FIRST_CHECK = 7;
+//初审驳回
+    public const LA_FIRST_REJECT = 10;
+//待部门审核
+    public const LA_NEED_DEP_CHECK = 15;
+//部门审核驳回
+    public const LA_DEP_REJECT = 20;
+//待复核
+    public const LA_NEED_THIRD = 25;
+//复核驳回
+    public const LA_THIRD_REJECT = 30;
+//审核通过-待公示
+    public const LA_PASS = 35;
+
+    public static function getStateDesc($checkState) {
+        switch ($checkState) {
+            case -1:
+                return "<span class='label label-danger'>审核不通过</span>";
+            case 1:
+                return "<span class='label'>待提交</span>";
+            case 3:
+                return "<span class='label label-success'>待审核</span>";
+            case 5:
+                return "<span class='label label-danger'>部门初审驳回</span>";
+            case 7:
+                return"<span class='label label-success'>待初审</span>";
+            case 10:
+                return "<span class='label label-danger'>初审驳回</span>";
+            case 15:
+                return "<span class='label label-success'>待部门审核</span>";
+            case 20:
+                return "<span class='label label-danger'>部门驳回</span>";
+            case 25:
+                return "<span class='label label-success'>待复核</span>";
+            case 30:
+                return "<span class='label label-danger'>复核驳回</span>";
+            case 35:
+                return "<span class='label label-primary'>复核通过</span>";
+            case 40:
+                return "<span class='label label-info'>公示</span>";
+            case 45:
+                return "<span class='label label-danger'>审核不通过</span>";
+            case 50:
+                return "<span class='label label-warning'>待发证</span>";
+            case 55:
+                return "<span class='label label-primary'>已发证</span>";
+        }
+    }
+
+    public static function getStateName($state) {
+        switch ($state) {
+            case -2:
+                return "<span class='label label-success'>待提交</span>";
+            case -1:
+                return"<span class='label label-success'>审核不通过</span>";
+            case 1:
+                return "<span class='label label-success'>待审核</span>";
+            case 2:
+                return "<span class='label label-danger'>审核驳回</span>";
+            case 3:
+                return"<span class='label label-primary'>审核通过</span>";
+            case 4:
+                return "<span class='label label-warm'>上级驳回</span>";
+            case 10:
+                return "<span class='label label-default'>冻结</span>";
+            case 8:
+                return "<span class='label label-primary'>提交审核</span>";
+            case 11:
+                return "<span class='label label-primary'>撤销审核</span>";
+            case 9:
+                return "<span class='label label-primary'>重新提交</span>";
+        }
+    }
+
+    public static function getStepName($step) {
+        switch ($step) {
+            case -1:
+                return "<span class='label label-primary'>部门初审</span>";
+            case 0:
+                return "<span class='label'>用户操作</span>";
+            case 1:
+                return"<span class='label label-primary'>初级审核</span>";
+            case 2:
+                return"<span class='label label-success'>部门审核</span>";
+            case 3:
+                return"<span class='label label-danger'>复核</span>";
+            case 4:
+                return"<span class='label label-warning'>核查征信</span>";
+            case 5:
+                return"<span class='label label-warning'>公示</span>";
+            case 6:
+                return"<span class='label label-success'>公示再审核</span>";
+            case 7:
+                return"<span class='label label-warning'>公布</span>";
+            case 8:
+                return"<span class='label label-info'>发证</span>";
+            case 11:
+                return"<span class='label label-danger'>审核</span>";
+            case 12:
+                return"<span class='label label-primary'>撤回审核</span>";
+            case 20:
+                return"<span class='label label-success'>人才层次变更</span>";
+            case 21:
+                return"<span class='label label-success'>工作单位变更</span>";
+            case 22:
+                return"<span class='label label-success'>离职变更</span>";
+            case 23:
+                return"<span class='label label-success'>银行账号变更</span>";
+            case 24:
+                return"<span class='label label-success'>基础信息变更</span>";
+            case 50:
+                return"<span class='label label-primary'>兑现</span>";
+            case 55:
+                return"<span class='label label-primary'>撤销公布</span>";
+            case 60:
+                return"<span class='label label-primary'>取消优秀人才</span>";
+            case 65:
+                return"<span class='label label-primary'>恢复优秀人才</span>";
+            case 70:
+                return"<span class='label label-danger'>设置审核不通过</span>";
+            case 80:
+                return"<span class='label label-danger'>审批</span>";
+        }
+    }
 
 }

+ 1 - 1
app/enterprise/api/LivingAllowanceApi.php

@@ -33,7 +33,7 @@ class LivingAllowanceApi {
     }
 
     public static function getOne($id) {
-        return laModel::where("id", $id)->find();
+        return laModel::findOrEmpty($id)->toArray();
     }
 
     public static function getList($request) {

+ 226 - 177
app/enterprise/controller/LivingAllowance.php

@@ -6,14 +6,16 @@ use app\enterprise\common\EnterpriseController;
 use think\facade\Db;
 use think\facade\Log;
 use app\common\api\EnterpriseApi;
-use app\common\api\DictApi;
 use app\common\api\TalentLogApi;
 use think\exception\ValidateException;
 use app\enterprise\validate\LivingAllowance as LivingAllowanceValidator;
 use app\common\state\ProjectState;
+use app\common\state\LivingAllowanceState as LaState;
 use app\common\api\BatchApi;
 use app\enterprise\api\LivingAllowanceApi as EnterpriseLaApi;
-use app\common\api\LivingAllowanceApi;
+use app\common\api\LivingAllowanceApi as CommonLaApi;
+use app\common\model\LivingAllowance as LaModel;
+use app\common\model\TalentLog;
 
 /**
  * Description of LivingAllowance
@@ -32,129 +34,234 @@ class LivingAllowance extends EnterpriseController {
     }
 
     /**
-     * 新人才申报企业端统一申报入口,混合基础信息及人才信息
+     * 申请
      */
     public function apply(\think\Request $request) {
         $type = $this->user["type"];
         $param = $request->param();
         $id = isset($param["id"]) ? $param["id"] : 0;
-        $info = LivingAllowanceApi::getInfoById($id);
+        $info = CommonLaApi::getInfoById($id);
         $ep = EnterpriseApi::getOne($this->user["uid"]);
         if (!chkEnterpriseFull($ep))
             return;
-        if ($info && in_array($info["checkState"], [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS, TalentState::REVERIFY_PASS, TalentState::REVERIFY_FAIL])) {
-            return $this->view($request);
-            exit();
-        }
+        /* if ($info && !in_array($info["checkState"], [LaState::LA_SAVE, LaState::LA_FIRST_REJECT])) {
+          return view("", ["row" => $info, "enterprise" => $ep, "hand" => "select"]);
+          } */
         if ($request->isPost()) {
-            $checkState = $info["checkState"] ?: 0;
-            if ($checkState == TalentState::SCND_SAVE || $checkState == 0) {
-                $this->save($info, $request, TalentState::SCND_SAVE);
-            } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
-                $res = ["msg" => "审核不通过,不能再保存"];
-                echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
-                exit;
-            }
-            $res = ["msg" => "已提交审核,请耐心等待"];
-            echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
-            exit;
+            return $this->save($info, $request);
         }
         $hand = $info ? "update" : "add";
         $batch = $info["year"] ?: BatchApi::getValidBatch(ProjectState::LIVINGALLOWANCE, $this->user["type"])["batch"];
         return view("", ["year" => $batch, "row" => $info, "enterprise" => $ep, "hand" => $hand]);
     }
 
-    public function view(\think\Request $request) {
-        switch ($this->user["type"]) {
-            case 1:
-                $tpl = "view"; //晋江人才
-                break;
-            case 2:
-                $tpl = "ic_view"; //集成电路
-                break;
+    public function detail(\think\Request $request) {
+        $param = $request->param();
+        $id = $param["id"];
+        $info = CommonLaApi::getInfoById($id);
+        $ep = EnterpriseApi::getOne($this->user["uid"]);
+        if (!chkEnterpriseFull($ep))
+            return;
+        return view("apply", ["row" => $info, "enterprise" => $ep, "hand" => "select"]);
+    }
+
+    private function other_validate($info) {
+        $responseObj = new \stdClass();
+
+        /* 校验姓名是否与人才库一致 */
+        $where = [];
+        $where[] = ["checkState", ">=", \app\common\api\TalentState::REVERIFY_PASS];
+        $where[] = ["checkState", "not in", [\app\common\api\TalentState::REVERIFY_REJECT, \app\common\api\TalentState::REVERIFY_FAIL]];
+        $where[] = ["card_number", "=", $info["idCard"]];
+        $talentInfo = Db::table("new_talent_info")->where($where)->order("createTime desc")->find();
+        if ($talentInfo && $talentInfo["name"] != $info["name"]) {
+            $responseObj->msg = "该证件号码的姓名与人才库姓名不匹配!";
+            return $responseObj;
         }
-        $id = $request->param("id");
-        $info = \app\common\api\VerifyApi::getTalentInfoById($id);
-        if ($info["isImport"]) {
-            //$tpl = "no_file_view";
+        /* 查询当前批次审核通过的数量以及当前批次未审核完成的数量 */
+        $where = [];
+        $where[] = ["year", "=", $info["year"]];
+        $where[] = ["idCard", "=", $info["idCard"]];
+        $where[] = ["checkState", "<>", LaState::LA_NOTPASS];
+        if ($info["id"]) {
+            $where[] = ["id", "<>", $info["id"]];
+        }
+        $nowYearApplyCount = LaModel::where($where)->count();
+        if ($nowYearApplyCount > 0) {
+            $responseObj->msg = "不能重复申报";
+            return $responseObj;
+        }
+        if (!$info["id"]) {
+            $where = [];
+            $where[] = ["idCard", "=", $info["idCard"]];
+            $where[] = ["checkState", "=", LaState::LA_PASS];
+            $totalApplyCount = LaModel::where($where)->count();
+            if ($totalApplyCount >= 3) {
+                return $responseObj->msg = "一个人最多享受三次!";
+            }
+        }
+        $responseObj->code = 200;
+        return $responseObj;
+    }
+
+    private function validateIsEdit($checkState) {
+        $responseObj = new \stdClass();
+        if ($checkState != LaState::LA_SAVE && $checkState != LaState::LA_BEFORE_REJECT && $checkState != LaState::LA_FIRST_REJECT) {
+            if ($checkState == LaState::LA_NOTPASS) {
+                $responseObj->msg = "您的申报审核不通过,无法操作";
+            } else if ($checkState >= LaState::LA_PASS) {
+                $responseObj->msg = "您的申报已审核通过,无法操作";
+            } else {
+                $responseObj->msg = "您的申报正在审核中,请耐心等待";
+            }
+            $responseObj->code = 500;
+            return $responseObj;
         }
-        return view($tpl, ["row" => $info]);
+        $responseObj->code = 200;
+        return $responseObj;
     }
 
     /**
      * 提交表单
      */
     public function submitToCheck() {
-        $params = $this->request->param();
-        $id = $params["id"];
-        if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
-            return json(["msg" => "没有对应的人才认定申报信息"]);
-        }
-        if ($info) {
-            $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
-        }
-        $checkState = $info["checkState"];
-        if ($checkState == TalentState::SCND_SAVE) {
-            $field_dict = \app\common\api\DictApi::getTalentFields_IC();
-
-            $no_empty = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "nation", "politics", "break_faith",
-                "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad", "position", "cur_entry_time", "labor_contract_rangetime",
-                "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime",
-                "bank", "bank_branch_name", "bank_account", "experience", "education"];
-
-            $no_empty = array_filter($no_empty);
-            $return = [];
-            foreach ($no_empty as $key) {
-                if (!$info[$key]) {
-                    $return[] = sprintf("请填写“%s”", $field_dict[$key]);
-                }
+        try {
+            $id = $this->request["id"];
+            $info = CommonLaApi::getInfoById($id);
+            if (!$info) {
+                throw new ValidateException("提交审核失败,请先填写基础信息");
             }
-            if (count($return) > 0) {
-                return json(["msg" => implode("<br>", $return)]);
+            if ($info["enterpriseId"] != $this->user["uid"]) {
+                throw new ValidateException("没有对应的人才认定申报信息");
             }
+            $batch = BatchApi::checkBatchValid(["type" => ProjectState::LIVINGALLOWANCE, "year" => $info["year"], "first_submit_time" => $info["firstSubmitTime"]], $this->user["type"]);
+            if ($batch["code"] != 200) {
+                throw new ValidateException($batch["msg"]);
+            }
+            $response = $this->validateIsEdit($info["checkState"]);
+            if ($response->code != 200) {
+                throw new ValidateException($response->msg);
+            }
+            validate(LivingAllowanceValidator::class)->check($info);
+            $response = $this->other_validate($info);
+            if ($response->code != 200) {
+                throw new ValidateException($response->msg);
+            }
+
+            $where = [];
+            $where[] = ["mainId", "=", $id];
+            $where[] = ["type", "=", ProjectState::LIVINGALLOWANCE];
+            $uploadedFileTypes = Db::table("new_talent_file")->where($where)->column("distinct typeId");
 
             $where = [];
-            $where[] = ["project", "=", 1];
+            $where[] = ["project", "=", ProjectState::LIVINGALLOWANCE];
             $where[] = ["type", "=", $this->user["type"]];
             $where[] = ["must", "=", 1];
             $where[] = ["active", "=", 1];
             $where[] = ["delete", "=", 0];
-            $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
-            $ft_ids = array_column($filetypes, "id");
-            $whr = [];
-            $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)) {
-                return json(["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"]);
+            $where[] = ["id", "not in", $uploadedFileTypes];
+            $unUploadfiletypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
+            if ($unUploadfiletypes) {
+                $msg = "以下附件为必传:<br>";
+                foreach ($unUploadfiletypes as $ft) {
+                    $msg .= "<span style='color:red;'>*</span>" . $ft["name"] . "<br>";
+                }
+                throw new ValidateException($msg);
+            }
+            $data["id"] = $id;
+            $data["checkState"] = LaState::LA_NEED_FIRST_CHECK;
+            if (!$info["firstSubmitTime"]) {
+                $data["firstSubmitTime"] = date("Y-m-d H:i:s");
             }
+            $data["newSubmitTime"] = date("Y-m-d H:i:s");
+            $data["checkMsg"] = "";
+            $data["files"] = "";
+            $data["fields"] = "";
+            $res = LaModel::update($data);
 
-            return $this->icSave($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])) {
-            return json(["msg" => "审核不通过,不能再提交审核", "code" => 500]);
+            if ($res) {
+                $user = session("user");
+                $log["id"] = getStringId();
+                $log["active"] = 1;
+                $log["state"] = 1;
+                $log["step"] = 0;
+                $log["stateChange"] = LaState::getStateDesc($info["checkState"]) . "->" . LaState::getStateDesc($data["checkState"]);
+                $log["type"] = ProjectState::LIVINGALLOWANCE;
+                $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);
+                return json(["code" => 200, "msg" => "提交审核成功"]);
+            }
+            throw new ValidateException("提交审核失败");
+        } catch (ValidateException $e) {
+            $responseObj = new \stdClass();
+            $responseObj->code = 500;
+            $responseObj->msg = $e->getMessage();
+            return json($responseObj);
+        } catch (\think\Exception $e) {
+            $res = ["code" => 500, "msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
+            $logInfo = [
+                "enterprise_id" => $this->user["uid"],
+                "data" => $data,
+                "controller" => $this->request->controller(),
+                "action" => $this->request->action(),
+                "errCode" => $e->getCode(),
+                "errMsg" => $e->getMessage()
+            ];
+            Log::write($logInfo, "error");
+            return json($res);
         }
-        return json(["msg" => "已提交审核,请耐心等待", "code" => 500]);
     }
 
-    public function save($info, \think\Request $request, $checkState) {
+    public function save($info, \think\Request $request) {
         try {
-            $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
+            $batch = BatchApi::checkBatchValid(["type" => ProjectState::LIVINGALLOWANCE, "year" => $info["year"], "first_submit_time" => $info["firstSubmitTime"]], $this->user["type"]);
+
             if ($batch["code"] != 200) {
                 throw new ValidateException($batch["msg"]);
             }
-            $param = $request->param();
-            validate(TalentInfo::class)->check($param);
-            $id = $param["id"];
+            if ($info) {
+                $response = $this->validateIsEdit($info["checkState"]);
+                if ($response->code != 200) {
+                    throw new ValidateException($response->msg);
+                }
+            }
+            $data = $request->param();
+            $data["year"] = $batch["batch"];
+            validate(LivingAllowanceValidator::class)->check($data);
+
+            $response = $this->other_validate($data);
+            if ($response->code != 200) {
+                throw new ValidateException($response->msg);
+            }
+
+            $id = $data["id"];
             if ($id) {
-                if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
+                if (!$info || $info["id"] != $id || $info["enterpriseId"] != $this->user["uid"]) {
                     throw new ValidateException("没有对应的人才认定申报信息");
                 }
+                $data["checkState"] = $info["checkState"];
+            } else {
+                $data["id"] = getStringId();
+                $data["active"] = 1;
+                $data["checkState"] = LaState::LA_SAVE;
+                $data["isPublic"] = 1;
+                $data["recommendIsPay"] = 0;
+                $data["isPay"] = 0;
+                $data["createTime"] = date("Y-m-d H:i:s");
+                $data["createUser"] = $this->user["uid"];
+                $data["creditStatus"] = 1;
+                $count = CommonLaApi::getApplyCountByIdCard($data["idCard"]);
+                $data["applyCount"] = $count + 1;
+                if ($data["applyCount"] > 1 && !$data["personalTax"]) {
+                    throw new ValidateException("非首年申报必须填写个税缴交情况!");
+                }
             }
-            $files = $param["uploadFiles"];
-            $data["headimgurl"] = $info["headimgurl"];
+            $data["photo"] = $info["photo"];
             if ($request->file()) {
-                $headimg = $request->file("photo");
+                $headimg = $request->file("file");
                 $upload = new \app\common\api\UploadApi();
                 $result = $upload->uploadOne($headimg, "image", "talent/photo");
                 $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
@@ -162,91 +269,46 @@ class LivingAllowance extends EnterpriseController {
                 $height = imagesy($file);
                 //免冠二寸照长宽413:579
                 if ($width * 579 != $height * 413) {
-                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件                    
+                    @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
                     throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
                 }
-                if ($info && $info["headimgurl"]) {
+                if ($info && $info["photo"]) {
                     //如果新照片符合像素要求,则删除旧照片
-                    $old_head_url = "storage/" . $info["headimgurl"];
+                    $old_head_url = "storage/" . $info["photo"];
                     if (file_exists($old_head_url))
                         @unlink($old_head_url);
                 }
-                $data["headimgurl"] = $result->filepath;
+                $data["photo"] = $result->filepath;
             }
-            if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
+            if (!$data["photo"])
                 throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
 
-            $data["apply_year"] = $batch["batch"];
-
-            $all_valid_keys = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "experience", "education", "break_faith",
-                "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad",
-                "position", "cur_entry_time", "labor_contract_rangetime",
-                "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime", "title", "pro_qua",
-                "bank", "bank_branch_name", "bank_account", "description"];
-            foreach ($all_valid_keys as $key) {
-                $value = trim($param[$key]);
-                if ($value) {
-                    $data[$key] = $value;
-                }
-            }
 
-            if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
-                //真实状态11是驳回,需要判断什么字段可以提交                
-                $modify_fields = array_filter(explode(",", $info["modify_fields"]));
+            if ($info["checkState"] == LaState::LA_FIRST_REJECT) {
+                //驳回,需要判断什么字段可以提交                
+                $modify_fields = array_filter(explode(",", $info["fields"]));
                 $tmp_data = $data;
                 $data = [];
                 foreach ($modify_fields as $field) {
                     $data[$field] = $tmp_data[$field];
                 }
             }
-            $data["checkState"] = $checkState;
-            $data["id"] = $id;
-            $success_msg = "提交成功";
-            $error_msg = "提交失败";
-            if ($checkState == TalentState::SCND_SAVE) {
-                $success_msg = "保存成功";
-                if ($data["id"]) {
-                    //编辑
-                    TalentModel::update($data);
-                    $last_log = TalentLogApi::getLastLog($data["id"], 1);
-                    if ($last_log["new_state"] != TalentState::SCND_SAVE) {
-                        TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
-                    } else {
-                        if (!$last_log["companyId"]) {
-                            TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
-                        }
-                    }
-                } else {
-                    //新增
-                    $data["enterprise_id"] = $this->user["uid"];
-                    $id = TalentModel::insertGetId($data);
-                    TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
-                    $whr = [];
-                    $whr[] = ["fileId", "in", $files];
-                    $upd_checklog["mainId"] = $id;
-                    Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
-                }
-                $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
-                echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
-                exit();
-            } else if ($checkState == TalentState::SCND_SUBMIT) {
-                $data["new_submit_time"] = date("Y-m-d H:i:s");
-                TalentModel::update($data);
-                TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
-                return json(["msg" => $success_msg, "code" => 200]);
+            if ($id) {
+                $res = LaModel::update($data);
             } else {
-                throw new ValidateException($error_msg);
+                $res = LaModel::insertGetId($data);
             }
-        } catch (ValidateException $e) {
-            if ($checkState == TalentState::SCND_SAVE) {
-                $res = ["msg" => $e->getMessage()];
-                echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
-                exit();
-            } else {
-                return json(["msg" => $e->getMessage()]);
+            if ($res) {
+                return json(["code" => 200, "msg" => "保存成功", "obj" => ["id" => $data["id"], "checkState" => $data["checkState"]]]);
             }
+            throw new ValidateException("保存失败");
+        } catch (ValidateException $e) {
+            $responseObj = new \stdClass();
+            $responseObj->code = 500;
+            $responseObj->msg = $e->getMessage();
+            return json($responseObj);
         } catch (\think\Exception $e) {
-            $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
+            $res = ["code" => 500, "msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
             $logInfo = [
                 "enterprise_id" => $this->user["uid"],
                 "data" => $data,
@@ -256,48 +318,35 @@ class LivingAllowance extends EnterpriseController {
                 "errMsg" => $e->getMessage()
             ];
             Log::write($logInfo, "error");
-            if ($checkState == TalentState::SCND_SAVE) {
-                echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
-                exit();
-            } else {
-                return json($res);
-            }
+            return json($res);
         }
     }
 
     public function delete() {
-        $id = $this->request->param("talentInfoId");
-        $info = Talent::chkIsOwner($id, $this->user["uid"]);
-        if (!$info) {
+        $id = $this->request->param("id");
+        $info = CommonLaApi::getInfoById($id);
+        if (!$info || $info["enterpriseId"] != $this->user["uid"]) {
             return json(["msg" => "操作失败"]);
         }
         $checkState = $info["checkState"];
-        if (in_array($checkState, [0, 1])) {
-            $log = TalentLogApi::getLastLog($id, 1);
-            if ($log["state"] > 1) {
-                //有提交审核记录
-                return json(["msg" => "该申报已提交审核,无法删除"]);
+        if ($checkState != LaState::LA_SAVE) {
+            return json(["msg" => "该申报已提交审核,无法删除"]);
+        }
+        TalentModel::delete($id);
+
+        $where = [["mainId", "=", $id], ["type", "=", ProjectState::LIVINGALLOWANCE]];
+        $list = Db::table("new_talent_file")->where($where)->select()->toArray();
+        foreach ($list as $key => $file) {
+            if (!empty($file["url"])) {
+                $filepath = "storage/" . $file["url"];
+                if (file_exists($filepath)) {
+                    @unlink($filepath);
+                }
             }
+
+            Db::table("new_talent_file")->delete($file["id"]);
         }
-        $data["id"] = $id;
-        $data["delete"] = 1;
-        TalentModel::update($data);
         return json(["msg" => "删除成功"]);
     }
 
-//    public function mixDelete() {
-//        $id = $this->request->param("talentInfoId");
-//        $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
-//        if (!$info) {
-//            return json(["msg" => "操作失败"]);
-//        }
-//        $checkState = $info["checkState"];
-//        if (in_array($checkState, [0, TalentState::SCND_SAVE])) {
-//            $data["id"] = $id;
-//            $data["delete"] = 1;
-//            TalentModel::update($data);
-//            return json(["msg" => "删除成功"]);
-//        }
-//        return json(["msg" => "该申报已提交审核,无法删除"]);
-//    }
 }

+ 92 - 112
app/enterprise/validate/LivingAllowance.php

@@ -11,124 +11,80 @@ use think\Validate;
 class LivingAllowance extends Validate {
 
     protected $rule = [
-        //"name" => "regex:/^[\x{4e00}-\x{9fa5}A-Za-z ]+$/u",
-        "nation" => "checkInSelect:nation,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57",
-        "card_type" => "between:1,3",
-        "card_number" => "checkCardNumber|checkUnique:new_talent_info",
-        "sex" => "between:1,2",
-        "politics" => "checkInSelect:politics,01,02,03,04,05,06,07,08,09,10,11,12,13,14",
-        "birthday" => "dateFormat:Y-m-d",
-        "nationality" => "checkInSelect:nationality,cn,cn_hk,cn_mc,cn_tw,us,en,jp,co,nl,sg,other",
-        "talent_type" => "between:1,3",
-        "tax_insurance_month" => "checkRangeDate:tax_insurance_month",
-        "labor_contract_rangetime" => "checkRangeDate:labor_contract_rangetime",
-        "fst_work_time" => "dateFormat:Y-m-d",
-        "pre_import_type" => "between:1,2",
-        "return" => "between:0,2",
-        "salary_pay_way" => "between:1,2",
-        "salary_pay_month" => "checkRangeDate:salary_pay_month",
-        "experience" => "max:1000",
-        "education" => "max:1000",
-        "phone" => "mobile",
-        "email" => "email",
-        "highest_degree" => "checkInSelect:highest_degree,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21",
-        "study_abroad" => "between:1,2",
-        "import_way" => "between:1,3",
-        "cur_entry_time" => "dateFormat:Y-m-d",
-        "source" => "between:1,5",
-        "fujian_highcert_pubtime" => "dateFormat:Y-m-d",
-        "fujian_highcert_exptime" => "dateFormat:Y-m-d",
-        "quanzhou_highcert_pubtime" => "dateFormat:Y-m-d",
-        "quanzhou_highcert_exptime" => "dateFormat:Y-m-d",
-        "talent_arrange" => "between:1,7",
-        "bank" => "regex:/^[\x{4e00}-\x{9fa5}]+银行$/u",
-        "bank_number" => "regex:/^\d+$/",
-        "bank_branch_name" => "regex:/^[\x{4e00}-\x{9fa5}]+银行[\x{4e00}-\x{9fa5}]+省?[\x{4e00}-\x{9fa5}]+市[\x{4e00}-\x{9fa5}]+$/u",
-        "bank_account" => "regex:/^\d+$/",
-        "break_faith" => "between:1,2",
-        "identifyGetTime" => "dateFormat:Y-m-d"
+        "type" => "require",
+        "idCard" => "require|checkCardNumber",
+        "cardType" => "require",
+        "name" => "require",
+        "sex" => "require",
+        "nation" => "require",
+        "nationality" => "require",
+        "provinceCode" => "require",
+        "cityCode" => "require",
+        "birthday" => "require",
+        "address" => "require",
+        "politics" => "require",
+        "highEducation" => "require",
+        "major" => "require",
+        "post" => "require|regex:/^[\x{4e00}-\x{9fa5}]+$/u",
+        "phone" => "require|mobile",
+        "email" => "require|email",
+        "bank" => "require|regex:/^[\x{4e00}-\x{9fa5}]*银行$/u",
+        "bankNetwork" => "require|regex:/^[\x{4e00}-\x{9fa5}]*银行[\x{4e00}-\x{9fa5}]*省?[\x{4e00}-\x{9fa5}]+市[\x{4e00}-\x{9fa5}]*$/u",
+        "bankAccount" => "require|regex:/^\d+$/",
+        "entryTime" => "require",
+        "startTime" => "require",
+        "endTime" => "require",
+        "mainHonours" => "require",
+        "educationAndResume" => "require",
+        "bankNumber" => "require|regex:/^\d+$/",
+        "introductionMethod" => "require|checkInJJTime",
+        "industryFieldNew" => "checkIndustryFieldNew",
+        "industryField" => "checkIndustryField",
+        "socialSecurity" => "require"
     ];
     protected $message = [
-        //"name.regex" => "姓名允许中文、英文、或者空格,不能含有其它字符",
-        "card_type.between" => "不存在的证件类型,请在列表中选择",
-        "card_number.checkUnique" => "身份证已经存在",
-        "sex.between" => "性别只能在预设列表中选择",
-        "politics.between" => "政治面貌只能在预设列表中选择",
-        "birthday.dateFormat" => "生日必需是有效日期格式[yyyy-MM-dd]",
-        "talent_type.between" => "不存在的人才类型,请在列表中选择",
-        "fst_work_time.dateFormat" => "来晋工作时间必需是有效的日期格式[yyyy-MM-dd]",
-        "pre_import_type.between" => "预引进类型只能在预设列表中选择",
-        "return.between" => "是否流出晋江满3年后又返回晋江的选项只能在预设列表中选择",
-        "salary_pay_way.between" => "工资发放渠道只能在预设列表中选择",
-        "experience.max" => "工作经历不能超过200个字符,请简明扼要的描述您的工作经历",
-        "education.max" => "教育背景不能超过200个字符,请简明扼要的描述您的教育背景",
-        "phone.mobile" => "请填写正确的手机号",
-        "email.email" => "电子邮箱格式错误",
-        "highest_degree.between" => "最高学历只能在预设列表中选择",
-        "study_abroad.between" => "留学经历只能选择是与否",
-        "import_way.between" => "不存在的引进方式,请在列表中选择",
-        "cur_entry_time.dateFormat" => "本单位入职时间必需是有效的日期格式[yyyy-MM-dd]",
-        "source.between" => "不存在的申报来源,请在列表中选择",
-        "fujian_highcert_pubtime.dateFormat" => "福建省高层次人才证书发证日期必需是有效的日期格式[yyyy-MM-dd]",
-        "fujian_highcert_exptime.dateFormat" => "福建省高层次人才证书有效期必需是有效的日期格式[yyyy-MM-dd]",
-        "quanzhou_highcert_pubtime.dateFormat" => "泉州高层次人才证书发证日期必需是有效的日期格式[yyyy-MM-dd]",
-        "quanzhou_highcert_exptime.dateFormat" => "泉州高层次人才证书有效期必需是有效的日期格式[yyyy-MM-dd]",
-        "talent_arrange" => "不存在的人才层次,请在列表中选择",
-        "bank.regex" => "开户银行格式应为[XX银行]",
-        "bank_number.regex" => "银行行号只能是数字",
-        "bank_branch_name.regex" => "开户银行网点格式应为[XX银行XX省XX市XX行/处]",
-        "bank_account.regex" => "银行账号只能是数字",
-        "break_faith.between" => "是否曾被相关主管部门列为失信个人只能在预设列表中选择",
-        "identifyGetTime.dateFormat" => "认定条件取得时间必需是有效的日期格式[yyyy-MM-dd]",
+        "type.require" => "人才类别不能为空",
+        "idCard.require" => "证件号码不能为空",
+        "cardType.require" => "证件类型不能为空",
+        "name.require" => "姓名不能为空",
+        "sex.require" => "性别不能为空",
+        "nation.require" => "民族不能为空",
+        "nationality.require" => "国籍/地区不能为空",
+        "provinceCode.require" => "籍贯-省不能为空",
+        "cityCode.require" => "籍贯-市不能为空",
+        "birthday.require" => "出生日期不能为空",
+        "address.require" => "现居地址不能为空",
+        "politics.require" => "政治面貌不能为空",
+        "highEducation.require" => "最高学历不能为空",
+        "major.require" => "专业不能为空",
+        "post.require" => "职务不能为空",
+        "post.regex" => "职务必须为汉字",
+        "phone.require" => "手机号码不能为空",
+        "phone.mobile" => "手机号格式不正确",
+        "email.require" => "电子邮箱不能为空",
+        "email.email" => "电子邮箱格式不正确",
+        "bank.require" => "开户银行不能为空",
+        "bank.regex" => "开户银行格式不正确",
+        "bankNetwork.require" => "开户银行网点不能为空",
+        "bankNetwor.regex" => "开户银行网点格式不正确",
+        "bankAccount.require" => "银行账号不能为空",
+        "bacnkAccount.regex" => "银行账户格式不合法",
+        "entryTime.require" => "入职时间不能为空",
+        "startTime.require" => "工作合同开始时间不能为空",
+        "endTime.require" => "工作合同结束时间不能为空",
+        "mainHonours.require" => "主要业绩及取得的荣誉不能为空",
+        "educationAndResume.require" => "教育背景及工作简历不能为空",
+        "bankNumber.require" => "银行行号不能为空",
+        "bankNumber.regex" => "银行行号格式不合法",
+        "introductionMethod.require" => "引进方式不能为空",
+        "socialSecurity.require" => "社保缴交情况不能为空"
     ];
 
-    protected function checkUnique($value, $rule, $data = [], $field) {
-        $db = $this->db->name($rule);
-        $pk = $db->getPk();
-        $map = [];
-        $map[] = [$field, "=", $data[$field]];
-        $map[] = ["delete", "=", 0];
-        $map[] = ["checkState", "not in", [TalentState::SCND_SAVE, 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]];
-        if ($data[$pk]) {
-            $info = $db->where("id", $data[$pk])->field($pk)->find();
-            $map[] = [$pk, "<>", $data[$pk]];
-            $map[] = ["apply_year", "=", $info["apply_year"]];
-        } else {
-            $batch = \app\common\api\BatchApi::getValidBatch(\app\common\state\ProjectState::TALENT, session("user")["type"])["batch"];
-            $map[] = ["apply_year", "=", $batch];
-        }
-        if ($db->where($map)->field($pk)->find()) {
-            return false;
-        }
-        return true;
-    }
-
-    protected function checkInSelect($value, $rule, $data = []) {
-        $title = "";
-        $select = explode(",", $rule);
-        $type = array_shift($select);
-        switch ($type) {
-            case "nation":
-                $title = "民族";
-                break;
-            case "politics":
-                $title = "政治面貌";
-                break;
-            case "nationality":
-                $title = "国籍/地区";
-                break;
-            case "highest_degree":
-                $title = "最高学历";
-                break;
-        }
-        return in_array($value, $select) ?: "{$title}只能在预设列表中选择";
-    }
-
     protected function checkCardNumber($value, $rule, $data = []) {
-        if (!$data["card_type"]) {
+        if (!$data["cardType"]) {
             return "填写证件号码前请先选择证件类型";
         }
-        if ($data["card_type"] == 1) {
+        if ($data["cardType"] == 1) {
             $num = strlen($value);
             switch ($num) {
                 case 15:
@@ -140,7 +96,7 @@ class LivingAllowance extends Validate {
                     break;
             }
             return "身份证号码不合法";
-        } else if ($data["card_type"] == 2) {
+        } else if ($data["cardType"] == 2) {
             if (preg_match("/^[a-zA-Z0-9]{6,10}$/", $value) || preg_match("/^([0-9]{8}|[0-9]{10})$/", $value)) {
                 return true;
             }
@@ -153,6 +109,30 @@ class LivingAllowance extends Validate {
         }
     }
 
+    protected function checkInJJTime($value, $rule, $data = []) {
+        if ($value == 1 && !$data["firstInJJTime"]) {
+            return "首次来晋时间不能为空";
+        }
+        if ($value == 2 && !$data["backJJBusinessTime"]) {
+            return "返晋创业时间不能为空";
+        }
+        return true;
+    }
+
+    protected function checkIndustryFieldNew($value, $rule, $data = []) {
+        if ($data["type"] == 1 && !$value) {
+            return "产业领域不能为空";
+        }
+        return true;
+    }
+
+    protected function checkIndustryField($value, $rule, $data = []) {
+        if ($data["type"] == 1 && !$value) {
+            return "行业领域不能为空";
+        }
+        return true;
+    }
+
     protected function checkRangeDate($value, $rule, $data = []) {
         $title = "";
         $format = "[yyyy-MM-dd - yyyy-MM-dd]";

+ 6 - 2
app/enterprise/view/living_allowance/apply.html

@@ -92,7 +92,11 @@
                                                 <input type="hidden" name="provinceName" id="provinceName" value="{$row.provinceName}">
                                                 <input type="hidden" name="cityName" id="cityName" value="{$row.cityName}">
                                                 <input type="hidden" name="countyName" id="countyName" value="{$row.countyName}">
-                                                <input type="hidden" name="industry_field_type" id="industry_field_type" value="{if condition='$row[industryFieldNew]'}{$row.industryFieldNew}_field{else/}{$enterprise.industryFieldNew}_field{/if}">
+                                                {if condition="$row && $row['industryFieldNew']"}
+                                                <input type="hidden" name="industry_field_type" id="industry_field_type" value="{$row.industryFieldNew}_field">
+                                                {else/}
+                                                <input type="hidden" name="industry_field_type" id="industry_field_type" value="{$enterprise.industryFieldNew}_field">
+                                                {/if}
                                                 <input type="hidden" name="hand" id="hand" value="{$hand}">
                                                 <input type="hidden" name="fields" id="fields" value="{$row.fields}">
                                                 <input type="hidden" name="files" id="files" value="{$row.files}">
@@ -318,7 +322,7 @@
                                                         </div>
                                                     </div>
                                                     <div class="col-sm-1">
-                                                        <img id="photoImg" src="{$row.photo|default='/static/img/photo.png'}" onclick="$('#photo').click()" style="height: 110px;width: 76px;padding-bottom: 5px;">
+                                                        <img id="photoImg" {if condition="$row['photo']"} src="{$row.photo|getStoragePath}" {else/} src="/static/img/photo.png" {/if} onclick="$('#photo').click()" style="height: 110px;width: 76px;padding-bottom: 5px;">
                                                     </div>
                                                 </div>
                                                 <div class="bs-callout bs-callout-success" >

+ 6 - 6
public/static/modular/common/upload.js

@@ -2,7 +2,7 @@ function initFileTable(project,tableName){
     var queryData = {"project":project,"type":$("#type").val()};
     $("#"+tableName).bootstrapTable("destroy",{});
     $("#"+tableName).bootstrapTable({
-        url: Feng.ctxPath + "/api/talentInfo/findUnCommonFileType",
+        url: Feng.ctxPath + "/common/api/findCommonFileType",
         method: 'POST',
         contentType: "application/x-www-form-urlencoded; charset=UTF-8",
         search: false,					// 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
@@ -35,7 +35,7 @@ function initFileTable(project,tableName){
             $("#fileTable").bootstrapTable('expandAllRows');
         },
         onExpandRow: function (index, row, $detail) {
-            var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/listTalentFile", function (data) {
+            var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
                 if(data==null||data.length==0){
                     return;
                 }
@@ -145,7 +145,7 @@ function upload(fileTypeId,fileId){
 function deleteFile (id,type){
     if(!validateIsEdit())return;
     var operation = function() {
-        var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/deleteFile", function (data) {
+        var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
             if(data.code=200){
                 Feng.success(data.msg);
                 $("#fileTable").bootstrapTable("refresh", {});
@@ -168,7 +168,7 @@ function deleteFile (id,type){
  * @param type
  */
 function downloadFile(id,type) {
-    window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type="+type;
+    window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type="+type;
 }
 
 //回调
@@ -187,7 +187,7 @@ function callBack (data){
 function initNoBtnFileTable(project,tableName){
     var queryData = {"project":project,"type":$("#type").val()};
     $("#"+tableName).bootstrapTable({
-        url: Feng.ctxPath + "/api/talentInfo/findUnCommonFileType",
+        url: Feng.ctxPath + "/common/api/findCommonFileType",
         method: 'POST',
         contentType: "application/x-www-form-urlencoded; charset=UTF-8",
         search: false,					// 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
@@ -220,7 +220,7 @@ function initNoBtnFileTable(project,tableName){
             $("#fileTable").bootstrapTable('expandAllRows');
         },
         onExpandRow: function (index, row, $detail) {
-            var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/listTalentFile", function (data) {
+            var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
                 if(data==null||data.length==0){
                     return;
                 }

+ 1 - 1
public/static/modular/gate/integral/integralInfo.js

@@ -460,7 +460,7 @@ IntegralInfoDlg.deleteFile = function (id, state) {
             Feng.error("删除失败!" + data.responseJSON.message + "!");
         });
         ajax.set("id", id);
-        ajax.set("type", 1);
+        ajax.set("type", 20);
         ajax.start();
     }
     Feng.confirm("删除后无法恢复,确认删除吗?", operation);

+ 2 - 2
public/static/modular/gate/master/livingAllowanceInfo/livingAllowanceInfo.js

@@ -299,7 +299,7 @@ LivingAllowanceInfo.openLivingAllowanceInfoDetail = function () {
         });
         ajax.set("type", CONFIG.project_master_living_allowance);
         ajax.set("year", LivingAllowanceInfo.seItem.year);
-        ajax.set("first_submit_time", TalentInfo.seItem.firstSubmitTime);
+        ajax.set("first_submit_time", LivingAllowanceInfo.seItem.firstSubmitTime);
         ajax.start();
     }
 };
@@ -315,7 +315,7 @@ LivingAllowanceInfo.openLivingAllowanceInfoSelect = function () {
             area: ['800px', '420px'], //宽高
             fix: false, //不固定
             maxmin: true,
-            content: Feng.ctxPath + '/enterprise/living_allowance/view/id/' + LivingAllowanceInfo.seItem.id,
+            content: Feng.ctxPath + '/enterprise/living_allowance/detail/id/' + LivingAllowanceInfo.seItem.id,
             btn: ['<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
             btnAlign: 'c',
         });

+ 2 - 1
public/static/modular/gate/master/livingAllowanceInfo/livingAllowanceInfo_info.js

@@ -202,6 +202,7 @@ LivingAllowanceInfoInfoDlg.collectData = function () {
             .set('mainHonours')
             .set('firstInJJTime')
             // .set('isIntroduction')
+            .set('industryFieldNew')
             .set('industryField')
             .set('title')
             .set('professionalQualifications')
@@ -569,7 +570,7 @@ $(function () {
     Feng.initValidatorTip("talentInfoForm", LivingAllowanceInfoInfoDlg.validateFields);
     var id = $("#id").val();
     var industry_field_type = $("#industry_field_type").val();
-    if ($("#industryFieldNew").attr("value") != "") {
+    if ($("#industryFieldNew").attr("value") == "") {
         industry_field_type = "un_industryField";//兼容查看旧申报时候,没有产业信息,就显示旧的行业领域信息
     }
     //批量加载字典表数据