Browse Source

处理编辑角色权限控制

yangc 7 years ago
parent
commit
0e991bfeec
1 changed files with 18 additions and 15 deletions
  1. 18 15
      components/mobile/staffManagement/StaffList.vue

+ 18 - 15
components/mobile/staffManagement/StaffList.vue

@@ -203,7 +203,7 @@
       }
       }
     },
     },
     methods: {
     methods: {
-      onRemind: function (str) {
+      setRemindText: function (str) {
         this.remindText = str
         this.remindText = str
         this.timeoutCount++
         this.timeoutCount++
       },
       },
@@ -237,13 +237,13 @@
       openDelete (item) {
       openDelete (item) {
         if (this.isAdmin) {
         if (this.isAdmin) {
           if (item.userUU === this.userInfo.userUU) {
           if (item.userUU === this.userInfo.userUU) {
-            this.onRemind('自己不可修改自己')
+            this.setRemindText('自己不可修改自己')
           } else {
           } else {
             this.currentObject = item
             this.currentObject = item
             this.showDelete = true
             this.showDelete = true
           }
           }
         } else {
         } else {
-          this.onRemind('您不是管理员不可修改')
+          this.setRemindText('您不是管理员不可修改')
         }
         }
       },
       },
       // 员工列表确认删除
       // 员工列表确认删除
@@ -252,13 +252,13 @@
           .then(response => {
           .then(response => {
             // console.log(response)
             // console.log(response)
             this.showDelete = false
             this.showDelete = false
-            this.onRemind('用户' + this.currentObject.userUU + '删除成功')
+            this.setRemindText('用户' + this.currentObject.userUU + '删除成功')
             this.page = 1
             this.page = 1
             this.isChange = true
             this.isChange = true
             this.staffList()
             this.staffList()
           }).catch(data => {
           }).catch(data => {
             this.showDelete = false
             this.showDelete = false
-            this.onRemind(data.response.data)
+            this.setRemindText(data.response.data)
           })
           })
       },
       },
       // 打开选择
       // 打开选择
@@ -305,16 +305,16 @@
       },
       },
       // 员工列表当前选中对象
       // 员工列表当前选中对象
       goEdit (item) {
       goEdit (item) {
-        if (this.isAdmin) {
-          if (item.userUU === this.userInfo.userUU) {
-            this.onRemind('自己不可修改自己')
-          } else {
+        if (item.userUU === this.userInfo.userUU) {
+          this.setRemindText('自己不可修改自己')
+        } else {
+          this.authorityInterceptor('/basic/user/updaterole', () => {
             let currentData = item
             let currentData = item
             this.currentStaff = this.baseUtils.deepCopy(currentData)
             this.currentStaff = this.baseUtils.deepCopy(currentData)
             this.activeTab = 1
             this.activeTab = 1
             for (let j = 0; j < this.rolesList.length; j++) {
             for (let j = 0; j < this.rolesList.length; j++) {
               for (let i = 0; i < this.currentStaff.roles.length; i++) {
               for (let i = 0; i < this.currentStaff.roles.length; i++) {
-                //判断已绑定角色
+                // 判断已绑定角色
                 if (this.currentStaff.roles[i].id === this.rolesList[j].id) {
                 if (this.currentStaff.roles[i].id === this.rolesList[j].id) {
                   this.rolesList[j].checked = true
                   this.rolesList[j].checked = true
                   break
                   break
@@ -323,10 +323,13 @@
                 }
                 }
               }
               }
             }
             }
-          }
-        } else {
-          this.onRemind('您不是管理员不可修改')
+          })
         }
         }
+//        if (this.isAdmin) {
+//
+//        } else {
+//          this.setRemindText('您不是管理员不可修改')
+//        }
       },
       },
       // 员工列表选择角色
       // 员工列表选择角色
       checkRole (role) {
       checkRole (role) {
@@ -346,7 +349,7 @@
         }
         }
         this.$http.put(`/basic/user/updaterole`, this.currentStaff)
         this.$http.put(`/basic/user/updaterole`, this.currentStaff)
           .then(() => {
           .then(() => {
-            this.onRemind('角色编辑成功')
+            this.setRemindText('角色编辑成功')
             this.activeTab = 0
             this.activeTab = 0
             this.page = 1
             this.page = 1
             this.isChange = true
             this.isChange = true
@@ -371,7 +374,7 @@
       agreeEvent (type, flag) {
       agreeEvent (type, flag) {
         this.$http.get(`/basic/enterprise/auditApply?id=${type.id}&status=${Number(flag)}&userUU=${type.userUU}`)
         this.$http.get(`/basic/enterprise/auditApply?id=${type.id}&status=${Number(flag)}&userUU=${type.userUU}`)
           .then(() => {
           .then(() => {
-            this.onRemind('操作成功!')
+            this.setRemindText('操作成功!')
             this.auditSearch = ''
             this.auditSearch = ''
             this.page = 1
             this.page = 1
             this.searchAudit()
             this.searchAudit()