소스 검색

修改tree默认选中bug

pixel 5 년 전
부모
커밋
8f558cbb98
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  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 arr = []
       menus.map(item => {
-        arr.push(Number(item.menuId))
+        // 防止直接选中父级造成全选
+        if(!menus.some(same=>same.parentId === item.menuId)){
+          arr.push(Number(item.menuId))
+        }
       })
       this.treeIds = arr
       const res2 = await getBaseMenuTree()