소스 검색

安全检查权限完善;检查任务列表补全数据

jiawuxian 2 년 전
부모
커밋
06b2c22ea2

+ 0 - 25
src/directive/permission/hasPermiEx.js

@@ -1,25 +0,0 @@
-import store from "@/store";
-
-export function hasPermission(value) {
-  if (!value) {
-    return false;
-  }
-  const permissions = store.getters && store.getters.permissions;
-  if (value instanceof Array) {
-    if (value.length == 0) {
-      return false;
-    }
-    const permissionFlag = value;
-
-    const hasPermissions = permissions.some((permission) => {
-      return (
-        all_permission === permission || permissionFlag.includes(permission)
-      );
-    });
-    return hasPermissions;
-  } else if (typeof value === "string") {
-    return permissions.includes(value);
-  } else {
-    return false;
-  }
-}

+ 1 - 1
src/router/index.js

@@ -209,7 +209,7 @@ export const dynamicRoutes = [
     path: '/core/safetycheck',
     component: Layout,
     hidden: true,
-    permissions: ['core:safetycheck:register'],
+    // permissions: ['core:safetycheck'],
     children: [
       {
         path: 'register/:taskId(\\d+)',

+ 2 - 0
src/store/modules/permission.js

@@ -137,6 +137,8 @@ export function filterDynamicRoutes(routes) {
       if (auth.hasRoleOr(route.roles)) {
         res.push(route)
       }
+    }else{
+      res.push(route)
     }
   })
   return res

+ 6 - 4
src/views/check/task/index.vue

@@ -300,7 +300,7 @@ import OrgTree from "@/components/orgTree";
 import * as api from "@/api/safetycheck/task.js";
 import { getLabel } from "@/views/commonOption.js";
 import OrgTreeSelect from "@/components/orgTreeSelect";
-import {hasPermission} from '@/directive/permission/hasPermiEx.js'
+import { checkPermi } from "@/utils/permission.js";
 export default {
   name: "checkTaskList",
   dicts: ["resumption_plan_cycle", "resumption_status", "safety_check_status"],
@@ -398,9 +398,12 @@ export default {
     showscanRecord(row) {
       this.$refs.scanrecorddialog.show(row.id, row.orgId);
     },
-    showRegisterBtn(row){   
+    showRegisterBtn(row){ 
+      let userRoleId= this.roleList.map(r=>r.id);
+      let taskRoleId=row.roles.map(r=>r.roleId) ;
+      
        return row.status!=3 
-        && ((row.checkOrgId==this.orgId && this.roleList.map(r=>r.id).find(id=>id==row.roleId) && hasPermission(['core:safetycheck:register','core:safetycheck:grant']))
+        && ((row.checkOrgId==this.orgId && userRoleId.find(ur=>taskRoleId.includes(ur)) && checkPermi(['core:safetycheck:register','core:safetycheck:grant']))
         || row.grantUserId===this.userId);
     },
     showRegister(row) {
@@ -469,7 +472,6 @@ export default {
     // },
 
     statusColor(status, isBackground) {
-      console.log(status,"ssss")
       let color = "";
       switch (status) {
         case "1":

+ 6 - 6
src/views/safetycheck/taskManager/components/register.vue

@@ -31,7 +31,7 @@
           v-model="info.checkTeam"
           v-if="isRegister"
         ></el-input>
-        <span>{{ info.checkTeam }}</span>
+        <span v-else>{{ info.checkTeam }}</span>
       </el-descriptions-item>
       <el-descriptions-item label="检查状态"
         >{{ dayjs(info.planStartTime).format("YYYY-MM-DD") }}
@@ -153,7 +153,7 @@
     </div>
 
     <div class="dialog-footer">
-      <el-button @click="dialogVisible = false">取消</el-button>
+      <el-button>关闭</el-button>
       <el-button
         @click="onGrant"
         v-if="showGrantBtn"
@@ -185,7 +185,7 @@ import SelectPoint from "../../ruleManager/dialog.select.point.vue";
 import imgUpload from "@/components/ImageUpload/index.vue";
 import UserSelector from "@/components/userSelector/index.vue";
 import { getLabel } from "@/views/commonOption.js";
-import { hasPermission } from "@/directive/permission/hasPermiEx.js";
+import { checkPermi } from "@/utils/permission.js";
 export default {
   name: "safetyCheckRegister",
   data() {
@@ -210,9 +210,9 @@ export default {
 
     showSaveBtn() {
       return (
-        this.isRegister() &&
+        this.isRegister &&
         this.info.status != 3 &&
-        (hasPermission(["core:safetycheck:register"]) ||
+        (checkPermi(["core:safetycheck:register"]) ||
           this.info.grantUserId == this.userId)
       );
     },
@@ -220,7 +220,7 @@ export default {
       let userRoleIds = this.roleList.map((r) => r.roleId);
       let taskRoleIds = this.info.checkRoles.map((r) => r.id);
       return (
-        this.isRegister() &&
+        this.isRegister &&
         this.info.status != 3 &&
         userRoleIds.find((ur) => taskRoleIds.includes(ur))
       );