Răsfoiți Sursa

部门列表超级权限改为配置式

sugangqiang 2 ani în urmă
părinte
comite
de805a11de

+ 3 - 3
app/admin/controller/Talent.php

@@ -273,8 +273,8 @@ class Talent extends AdminController {
     public function dept_verify() {
         $enterprises = EnterpriseApi::getSimpleList();
         $companys = CompanyApi::getAll();
-        $deptCode = CompanyApi::getOne($this->user["companyId"])["code"];
-        return view("", ["companys" => $companys, "enterprises" => $enterprises, "deptCode" => $deptCode]);
+        $superpriv = VerifyApi::chkUserInSuperDeptUsers();
+        return view("", ["companys" => $companys, "enterprises" => $enterprises, "superpriv" => $superpriv]);
     }
 
     /**
@@ -1783,7 +1783,7 @@ class Talent extends AdminController {
         $names["deptReject"] = "部门驳回";
         $names["deptWait"] = "部门待审";
         $list = VerifyApi::getExportDatas($process, $params);
-        if ($process == 4 && in_array($company["code"], ["super", "rsj"])) {
+        if ($process == 4 && VerifyApi::chkUserInSuperDeptUsers()) {
             $fields[] = "first_dept_check_time";
             $fields[] = "verifyDepts";
             $fields[] = "deptDescription";

+ 2 - 2
app/admin/view/talent/dept_verify.html

@@ -28,7 +28,7 @@
                         <div class="row">
                             <input type="hidden" id="type" value="${user.type}">
                             <input type="hidden" id="process" value="4">
-                            <input type="hidden" id="deptCode" value="{$deptCode}">
+                            <input type="hidden" id="superpriv" value="{$superpriv}">
                             <input type="hidden" id="title" value="部门审核">
                             <div class="col-sm-3">
                                 <div class="input-group input-group-sm">
@@ -151,7 +151,7 @@
                                     </select>
                                 </div>
                             </div>
-                            {if condition="in_array($deptCode,['super','rsj'])"}
+                            {if condition="$superpriv"}
                             <div class="col-sm-3">
                                 <div class="input-group input-group-sm">
                                     <div class="input-group-btn">

+ 17 - 6
app/common/api/VerifyApi.php

@@ -413,9 +413,7 @@ class VerifyApi {
 
         $process = $params["process"];
         if ($process == 4) {
-            $companyId = session('user')['companyId'];
-            $company_info = CompanyApi::getOne($companyId);
-            if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
+            if (self::chkUserInSuperDeptUsers()) {
                 return self::getFullDeptList($params, $where);
             } else {
                 return self::getDeptList($params, $where);
@@ -745,7 +743,7 @@ class VerifyApi {
                 case 4:
                     $companyId = session('user')['companyId'];
                     $company_info = CompanyApi::getOne($companyId);
-                    if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
+                    if (self::chkUserInSuperDeptUsers()) {
                         switch ($params["checkState"]) {
                             case 1:
                                 $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
@@ -837,7 +835,7 @@ class VerifyApi {
         $fields[] = "tc.companyIds";
         if ($process == 4) {
             $fields[] = "tl2.resubmit";
-            if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
+            if (self::chkUserInSuperDeptUsers()) {
                 $fields[] = "tl3.deptVerifyJsonData";
                 $list = Talent::alias("ti")
                                 ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
@@ -997,7 +995,7 @@ class VerifyApi {
                 $item["checkState"] = TalentState::getStateName($item["state"]);
             }
             if ($process == 4) {
-                if (in_array($company_info["code"], ["super", "rsj"])) {
+                if (self::chkUserInSuperDeptUsers()) {
                     $companys = array_filter(explode(",", $item["companyIds"]));
                     $deptChecklogs = json_decode($item["deptVerifyJsonData"], true);
                     $deptChecklogs = bubbleSort($deptChecklogs, "createTime", "desc");
@@ -1093,4 +1091,17 @@ class VerifyApi {
         return false;
     }
 
+    private static function getSuperPrivsForDeptVerify() {
+        $config = getJsonConfig("../sys_config.json", "super_privs_for_dept_verify");
+        return $config;
+    }
+
+    public static function chkUserInSuperDeptUsers() {
+        $config = self::getSuperPrivsForDeptVerify();
+        $companyId = session("user")["companyId"];
+        $company = getCacheById("Company", $companyId);
+        $account = session("user")["account"];
+        return in_array($company["code"], $config["companys"]) || in_array($account, $config["users"]);
+    }
+
 }

+ 2 - 5
public/static/modular/talentIdentify/talentInfo/talentInfo_base.js

@@ -13,17 +13,14 @@ var TalentInfo = {
  */
 TalentInfo.initColumn = function () {
     var type = $("#type").val();
-    var code = $("#deptCode").val();
+    var superpriv = $("#superpriv").val();
     var process = $("#process").val();
     var isShow = true;
     var isShowVerifyDept = false;
     if (type == 2) {
         isShow = false;
     }
-    var depts = ["super", "rsj"];
-    if (depts.indexOf(code) > -1) {
-        isShowVerifyDept = true;
-    }
+    isShowVerifyDept = process == 4 && superpriv ? true : false;
     return [
         {field: 'selectItem', checkbox: true},
         {title: '申报年度', field: 'apply_year', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},

+ 6 - 2
sys_config.json

@@ -1,5 +1,9 @@
 {
     "super_users_for_enterprise": [
-		"admin","rs08","rs02","rs03","rs04","rs09","rs13"
-	]
+        "admin", "rs08", "rs02", "rs03", "rs04", "rs09", "rs13"
+    ],
+    "super_privs_for_dept_verify": {
+        "companys": ["super", "人社局人才服务科"],
+        "users": []
+    }
 }