0%
tree选中笔记
1 2 3 4 5 6 7 8 9 10
| <el-tree :data="permissionForm.treeData" :props="permissionForm.defaultProps" show-checkbox node-key="id" ref="permissionTreeRef" default-expand-all :default-checked-keys="permissionForm.selectedList" > </el-tree>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| const permissionForm = reactive({ preplanId: null, treeData: [], selectedList: [], defaultProps: { children: 'children', label: 'name' } });
async onPermissionAction({ row }) { console.log('设置查看权限'); permissionDialogRef.value.show(); permissionForm.preplanId = row.id; const res = await service.getPermissionById({ id: row.id }); const permissionList = res.data; if (Array.isArray(permissionList)) { if (permissionList.length) { permissionTreeRef.value.setCheckedKeys(permissionList.map(v => v.userId)); } else { permissionTreeRef.value.setCheckedKeys(permissionForm.selectedList); } } },
|