index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <ele-split-layout
  5. width="266px"
  6. allow-collapse
  7. :right-style="{ overflow: 'hidden' }"
  8. >
  9. <div>
  10. <div class="ele-border-lighter sys-organization-list">
  11. <AssetTree
  12. @handleNodeClick="handleNodeClick"
  13. @setRootId="setRootId"
  14. :id="rootId"
  15. ref="treeList"
  16. />
  17. </div>
  18. </div>
  19. <template v-slot:content v-if="current">
  20. <dryArea-list
  21. :category-id="current.id"
  22. :root-id="rootId"
  23. ref="listRef"
  24. />
  25. </template>
  26. <template v-slot:content v-else>
  27. <el-empty :image-size="200" description="暂无数据"></el-empty>
  28. </template>
  29. </ele-split-layout>
  30. </el-card>
  31. </div>
  32. </template>
  33. <script>
  34. import AssetTree from '@/components/AssetTree';
  35. import dryAreaList from './components/dryArea-list.vue';
  36. export default {
  37. name: 'dryAreaIndex',
  38. components: {
  39. AssetTree,
  40. dryAreaList
  41. },
  42. data() {
  43. return {
  44. // 加载状态
  45. loading: false,
  46. // 表格选中数据
  47. selection: [],
  48. current: null,
  49. rootId: '11'
  50. };
  51. },
  52. computed: {},
  53. methods: {
  54. handleNodeClick(info) {
  55. this.current = info;
  56. },
  57. // 获取根节点id
  58. setRootId(id) {
  59. if (id) {
  60. this.rootId = id;
  61. }
  62. },
  63. activated() {
  64. this.$nextTick(() => {
  65. if (this.current.id) {
  66. this.$refs.listRef.sucesstion(true);
  67. }
  68. });
  69. }
  70. }
  71. };
  72. </script>
  73. <style lang="scss" scoped>
  74. .sys-organization-list {
  75. height: calc(100vh - 264px);
  76. box-sizing: border-box;
  77. border-width: 1px;
  78. border-style: solid;
  79. overflow: auto;
  80. }
  81. .sys-organization-list :deep(.el-tree-node__content) {
  82. height: 40px;
  83. & > .el-tree-node__expand-icon {
  84. margin-left: 10px;
  85. }
  86. }
  87. </style>