Browse Source

用户权限优化

haha_sir 1 year ago
parent
commit
31db9c091c
2 changed files with 18 additions and 11 deletions
  1. 17 10
      src/utils/user.js
  2. 1 1
      src/views/home/cpns/UnderWater.vue

+ 17 - 10
src/utils/user.js

@@ -16,19 +16,22 @@ import { GetUserLimit } from "@/apis/user";
  * @params nameList-按钮列表
  */
 export function GetUserPrivilege(nameList) {
-    const router = useRoute()
+    // const router = useRoute()
     let userData = useRoute().query
-    userData.type = userData.digitalTwainType
-    userData.sysType = "MA=="
-    delete userData.digitalTwainType
-    // console.log(userData)
+    console.log(userData)
+    if(userData.digitalTwainType){
+        userData.type = userData.digitalTwainType
+        delete userData.digitalTwainType
+    }
     GetUserLimit(userData).then((res) => {
-        // console.log(res)
+        console.log(res)
         let parentId = []
         let limitArr = []
         res.data.Rows.forEach((item) => {
-            if (item.name.includes('数字孪生业务版') || item.name.includes('数字孪生演示版')) {
-                res.data.Rows.forEach((item) => {
+            // if (item.name.includes('数字孪生')) {
+                if (item.name.includes('数字孪生业务版') || item.name.includes('数字孪生演示版')) {
+                    res.data.Rows.forEach((item) => {
+                    // console.log(item)
                     parentId.push(item.id)
                 })
                 // console.log(parentId)
@@ -39,10 +42,14 @@ export function GetUserPrivilege(nameList) {
             }
 
         })
-        nameList.data = nameList.data.filter((item) => {
-            if (limitArr.includes(item.name)) {
+        // console.log(nameList.data)
+                console.log(limitArr)
+
+        nameList.data = nameList.data.filter((i) => {
+            if (limitArr.includes(i.name)) {
                 return true
             }
         })
+        // console.log(nameList.data)
     })
 }

+ 1 - 1
src/views/home/cpns/UnderWater.vue

@@ -80,7 +80,7 @@ const currentYear = useDateFormat(useNow(), 'YYYY').value
 function GetUserPrivilege() {
   let userData = useRoute().query
   userData.type = userData.digitalTwainType
-  userData.sysType = "MA=="
+  // userData.sysType = "MA=="
   delete userData.digitalTwainType
   // console.log(userData)
   GetUserLimit(userData).then((res) => {