index.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <ele-split-layout width="266px" allow-collapse :right-style="{ overflow: 'hidden' }">
  5. <div>
  6. <div class="ele-border-lighter sys-organization-list">
  7. <AssetTree @handleNodeClick="handleNodeClick" @setRootId="setRootId" :id="rootId" ref="treeList" />
  8. </div>
  9. </div>
  10. <template v-slot:content>
  11. <user-list v-if="current" :category-id="current.id" :root-id="rootId" />
  12. </template>
  13. </ele-split-layout>
  14. </el-card>
  15. </div>
  16. </template>
  17. <script>
  18. import AssetTree from '@/components/AssetTree';
  19. import userList from './components/user-list.vue';
  20. export default {
  21. components: {
  22. AssetTree,
  23. userList
  24. },
  25. data() {
  26. return {
  27. // 加载状态
  28. loading: false,
  29. // 表格选中数据
  30. selection: [],
  31. current: null,
  32. rootId: 12
  33. };
  34. },
  35. computed: {},
  36. methods: {
  37. handleNodeClick(info) {
  38. this.current = info;
  39. },
  40. // 获取根节点id
  41. setRootId(id) {
  42. if (id) {
  43. this.rootId = id;
  44. }
  45. }
  46. }
  47. };
  48. </script>
  49. <style lang="scss" scoped>
  50. .sys-organization-list {
  51. height: calc(100vh - 264px);
  52. box-sizing: border-box;
  53. border-width: 1px;
  54. border-style: solid;
  55. overflow: auto;
  56. }
  57. .sys-organization-list :deep(.el-tree-node__content) {
  58. height: 40px;
  59. &>.el-tree-node__expand-icon {
  60. margin-left: 10px;
  61. }
  62. }
  63. </style>