From 79f11f34546a394ab1c16ba427c31e9b59d05523 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Sat, 09 Jan 2021 10:40:57 +0800
Subject: [PATCH] gx

---
 hive-app/common/jssdk/utils.js |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/hive-app/common/jssdk/utils.js b/hive-app/common/jssdk/utils.js
index f370c9e..bb9b196 100644
--- a/hive-app/common/jssdk/utils.js
+++ b/hive-app/common/jssdk/utils.js
@@ -1,7 +1,7 @@
 /**
  * Utils 工具类
  * */
- 
+ import StorageUtil from './storageUtils.js'
  const Utils = {
 	/**
 	* 只能输入正整数
@@ -134,5 +134,30 @@
 	      return val;
 	    }
 	},
+	/**
+	 * code 1.无符号分隔表示单个功能,2.逗号分隔表示多个功能 3. 点分隔表示上下级关系,只支持2级
+	 * */
+	hasPermission(code){
+		let rolesInfo = StorageUtil.getStorage('userInfo','userFunction');
+		let arr = [];
+		if(!rolesInfo){
+			return false
+		}
+		if(code.indexOf(',')>-1){
+			arr = code.split(',').filter((item) => {
+				item = item.trim();
+				return rolesInfo[item]
+			})
+			return arr.length;
+		}else if(code.indexOf('.')>-1){
+			arr = code.split('.');
+			let children = rolesInfo[arr[0]]['sysFnBtnRel'].filter((item) => {
+				return item.btnValue == arr[1]
+			});
+			return rolesInfo[arr[0]] && children.length
+		}else{
+			return rolesInfo[code];
+		}
+	}
  }
  export default Utils;
\ No newline at end of file

--
Gitblit v1.9.1