Browse Source

Fix:角色的数据权限显示的问题

chris 2 years ago
parent
commit
416898518f

+ 0 - 1
src/views/modules/common/org-component.vue

@@ -56,7 +56,6 @@
     },
     methods: {
       async init () {
-        // let that = this
         this.$http({
           url: this.$http.adornUrl(`/user-service/org/queryTree`),
           method: 'get'

+ 36 - 30
src/views/modules/sys/role-add-or-update.vue

@@ -90,6 +90,7 @@
         this.dataForm.id = id || 0
         this.menuList = []
         this.orgList = []
+        this.visible = true
         this.$http({
           url: this.$http.adornUrl('/user-service/menu/tree'),
           method: 'get',
@@ -107,6 +108,41 @@
             if (data.code === '200') {
               this.orgList = data.data
             }
+            this.$nextTick(() => {
+              this.$refs['dataForm'].resetFields()
+              this.$refs.menuListTree.setCheckedKeys([])
+              this.$refs.orgListData.setCheckedKeys([])
+            })
+          }).then(() => {
+            if (this.dataForm.id) {
+              this.$http({
+                url: this.$http.adornUrl(`/user-service/role/info/${this.dataForm.id}`),
+                method: 'get',
+                params: this.$http.adornParams()
+              }).then(({data}) => {
+                if (data && data.code === '200') {
+                  this.dataForm.roleName = data.data.roleName
+                  this.dataForm.remark = data.data.remark
+                  this.dataForm.orgId = data.data.orgId
+                  if (data.data.menuIdList) {
+                    data.data.menuIdList.forEach(i => {
+                      const node = this.$refs.menuListTree.getNode(i)
+                      if (node && node.isLeaf) {
+                        this.$refs.menuListTree.setChecked(node, true)
+                      }
+                    })
+                  }
+                  if (data.data.orgIdList) {
+                    data.data.orgIdList.forEach(i => {
+                      const node = this.$refs.orgListData.getNode(i)
+                      if (node && node.isLeaf) {
+                        this.$refs.orgListData.setChecked(node, true, false)
+                      }
+                    })
+                  }
+                }
+              })
+            }
           })
         }).then(() => {
           this.visible = true
@@ -115,36 +151,6 @@
             this.$refs.menuListTree.setCheckedKeys([])
             this.$refs.orgListData.setCheckedKeys([])
           })
-        }).then(() => {
-          if (this.dataForm.id) {
-            this.$http({
-              url: this.$http.adornUrl(`/user-service/role/info/${this.dataForm.id}`),
-              method: 'get',
-              params: this.$http.adornParams()
-            }).then(({data}) => {
-              if (data && data.code === '200') {
-                this.dataForm.roleName = data.data.roleName
-                this.dataForm.remark = data.data.remark
-                this.dataForm.orgId = data.data.orgId
-                if (data.data.menuIdList) {
-                  data.data.menuIdList.forEach(i => {
-                    const node = this.$refs.menuListTree.getNode(i)
-                    if (node && node.isLeaf) {
-                      this.$refs.menuListTree.setChecked(node, true)
-                    }
-                  })
-                }
-                if (data.data.orgIdList) {
-                  data.data.orgIdList.forEach(i => {
-                    const node = this.$refs.orgListData.getNode(i)
-                    if (node && node.isLeaf) {
-                      this.$refs.orgListData.setChecked(node, true, false)
-                    }
-                  })
-                }
-              }
-            })
-          }
         })
       },
       onChose () {

+ 1 - 1
src/views/modules/sys/role.vue

@@ -96,7 +96,7 @@
         },
         dataList: [],
         pageIndex: 1,
-        pageSize: 100,
+        pageSize: 10,
         totalPage: 0,
         dataListLoading: false,
         dataListSelections: [],