|
@@ -1,4 +1,3 @@
|
|
|
-
|
|
|
|
|
var list =[]
|
|
var list =[]
|
|
|
function QueryPermission(id) {
|
|
function QueryPermission(id) {
|
|
|
if(uni.getStorageSync("jurisdiction")){
|
|
if(uni.getStorageSync("jurisdiction")){
|
|
@@ -22,6 +21,27 @@ function QueryPermission(id) {
|
|
|
}
|
|
}
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
+function getUserPermission(){
|
|
|
|
|
+ let list = []
|
|
|
|
|
+ if(uni.getStorageSync("jurisdiction")){
|
|
|
|
|
+ list = JSON.parse(uni.getStorageSync("jurisdiction"))
|
|
|
|
|
+ }
|
|
|
|
|
+ return list
|
|
|
|
|
+}
|
|
|
|
|
+function getPermissionById(node = getUserPermission(),id) {
|
|
|
|
|
+ for (const child of node) {
|
|
|
|
|
+ if(id == child.pur_id){
|
|
|
|
|
+ return child.children || []
|
|
|
|
|
+ }
|
|
|
|
|
+ if(child.children){
|
|
|
|
|
+ let result = getPermissionById(child.children,id)
|
|
|
|
|
+ if(result){
|
|
|
|
|
+ return result
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null
|
|
|
|
|
+}
|
|
|
export {
|
|
export {
|
|
|
- QueryPermission
|
|
|
|
|
|
|
+ QueryPermission,getPermissionById,getUserPermission
|
|
|
}
|
|
}
|