Browse Source

修改tree默认选中bug

pixel 5 years ago
parent
commit
8f558cbb98
1 changed files with 4 additions and 1 deletions
  1. 4 1
      QMPlusVuePage/src/view/superAdmin/authority/authority.vue

+ 4 - 1
QMPlusVuePage/src/view/superAdmin/authority/authority.vue

@@ -154,7 +154,10 @@ export default {
       const menus = res1.data.menus
       const menus = res1.data.menus
       const arr = []
       const arr = []
       menus.map(item => {
       menus.map(item => {
-        arr.push(Number(item.menuId))
+        // 防止直接选中父级造成全选
+        if(!menus.some(same=>same.parentId === item.menuId)){
+          arr.push(Number(item.menuId))
+        }
       })
       })
       this.treeIds = arr
       this.treeIds = arr
       const res2 = await getBaseMenuTree()
       const res2 = await getBaseMenuTree()