DESKTOP-MINPJAU\Administrator hace 3 años
padre
commit
3dfb2d69da
Se han modificado 1 ficheros con 6 adiciones y 6 borrados
  1. 6 6
      src/utils/public.js

+ 6 - 6
src/utils/public.js

@@ -2,9 +2,9 @@ import store from '@/store'
 
 export function noNeedRule(val) {
     const userRoles = store.state.user.info.roles
-    for (const item in val) {
-        if (userRoles.indexOf(item) > -1) {
-            return false;
+    for (let i = 0; i < val.length; i++) {
+        if (userRoles.includes(val[i])) {
+            return false
         }
     }
     return true;
@@ -12,9 +12,9 @@ export function noNeedRule(val) {
 
 export function needRule(val) {
     const userRoles = store.state.user.info.roles
-    for (const item in val) {
-        if (userRoles.indexOf(item) > -1) {
-            return true;
+    for (let i = 0; i < val.length; i++) {
+        if (userRoles.includes(val[i])) {
+            return true
         }
     }
     return false;