Kaynağa Gözat

高权限角色判断

zhonghuizhen 1 yıl önce
ebeveyn
işleme
8895e316ea

+ 17 - 2
src/views/business/​scheduleManage/adjust.vue

@@ -109,13 +109,28 @@ export default {
                 this.loading = false
             })
         },
+        /**
+         * 判断当前用户是否为超级管理员和高权限角色
+         */
+        isRoleFilter () {
+            const highRoles = this.$store.getters.userInfo.highRoles || [] // 高权限角色
+            const userRole = this.$store.getters.userInfo.role || [] // 用户权限角色
+            let isHighRole = false
+            userRole.forEach(el => {
+                const roleAlias = el.alias
+                if (highRoles.includes(roleAlias)) {
+                    isHighRole = true
+                }
+            })
+            return this.$store.getters.isSuper || isHighRole
+        },
         /**
          * 获取格式化参数
          */
         getSearchFormData () {
             debugger
-            let paramjson = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
-            if (this.$store.getters.isSuper) { // 超级管理员不做申请人过滤
+            const paramjson = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+            if (this.isRoleFilter()) { // 超级管理员和高权限角色不做申请人过滤
             } else {
                 const { userId } = this.$store.getters || ''
                 if (userId) {

+ 24 - 1
src/views/business/​scheduleManage/adjustVerify.vue

@@ -119,13 +119,36 @@ export default {
                 this.loading = false
             })
         },
-
+        /**
+         * 判断当前用户是否为超级管理员和高权限角色
+         */
+        isRoleFilter () {
+            const highRoles = this.$store.getters.userInfo.highRoles || [] // 高权限角色
+            const userRole = this.$store.getters.userInfo.role || [] // 用户权限角色
+            let isHighRole = false
+            userRole.forEach(el => {
+                const roleAlias = el.alias
+                if (highRoles.includes(roleAlias)) {
+                    isHighRole = true
+                }
+            })
+            return this.$store.getters.isSuper || isHighRole
+        },
         /**
          * 获取格式化参数
          */
         getSearchFormData () {
             let paramjson = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
             paramjson['Q^status^NE'] = '已暂存'
+            if (this.isRoleFilter()) { // 超级管理员和高权限角色不做审批人过滤
+            } else {
+                /* 审批人过滤
+                const { userId } = this.$store.getters || ''
+                if (userId) {
+                    paramjson['Q^executor_^S'] = userId
+                }
+                */
+            }
             return ActionUtils.formatParams(
                 // this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
                 paramjson,