treeDetail.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="project-item-tree-select">
  3. <el-collapse v-model="active">
  4. <el-collapse-item :name="index" v-for="(item,index) in options" :key="item.id">
  5. <template slot="title">
  6. <i class="iconfont huifont-shuzhuangcaidantubiao"></i>
  7. <span class="el-collapse-name">{{item.name}}</span>
  8. </template>
  9. <div>
  10. <el-tree :ref="'houseTree' + item.id" :data="item.children" :props="defaultProps"
  11. default-expand-all>
  12. </el-tree>
  13. </div>
  14. </el-collapse-item>
  15. </el-collapse>
  16. </div>
  17. </template>
  18. <script>
  19. import {
  20. getHouseTree,
  21. } from '@/httpApi/space'
  22. import {
  23. roomCheckedList
  24. } from '@/uitls'
  25. export default {
  26. props: ['ids'],
  27. data() {
  28. return {
  29. options: [],
  30. defaultProps: {
  31. children: 'children',
  32. label: 'optionName'
  33. },
  34. idsBox: [],
  35. active: []
  36. }
  37. },
  38. created() {
  39. this.idsBox = this.ids.split(',');
  40. this.init();
  41. },
  42. methods: {
  43. init() {
  44. getHouseTree(this.$store.getters.project.id).then(res => {
  45. if (res.state) {
  46. this.options = roomCheckedList(res.data.projectItemList || [], this.idsBox);
  47. for (let i = 0; i < this.options.length; i++) {
  48. this.active.push(i)
  49. }
  50. }
  51. })
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .project-item-tree-select {
  58. flex: 1;
  59. height: 0;
  60. overflow-y: auto;
  61. .el-tree {
  62. .el-tree-node__label {
  63. left: 5px;
  64. }
  65. }
  66. .el-collapse {
  67. border: none;
  68. .el-collapse-item__header {
  69. background: #1E2430;
  70. color: $--color-common !important;
  71. border-color: $--color-border;
  72. height: 32px;
  73. line-height: 32px;
  74. font-size: 12px;
  75. padding: 0 14px;
  76. .el-collapse-name {
  77. flex: 1;
  78. width: 0;
  79. overflow: hidden;
  80. }
  81. .iconfont {
  82. color: $--color-common !important;
  83. margin-right: 6px;
  84. }
  85. .huifont-bumen {
  86. font-size: 16px;
  87. }
  88. .huifont-shuzhuangcaidantubiao,
  89. .huifont-moxingguanli {
  90. font-size: 18px;
  91. }
  92. }
  93. .el-collapse-item__wrap {
  94. background: #151c26;
  95. border: none;
  96. }
  97. .el-collapse-item__header.is-active,
  98. .el-collapse-item__header:hover,
  99. .el-collapse-item__header:focus {
  100. color: $--color-common;
  101. background: #262C38;
  102. }
  103. .el-icon-arrow-right {
  104. font-family: 'iconfont' !important;
  105. font-size: 9px;
  106. margin: 0;
  107. }
  108. .el-icon-arrow-right::before {
  109. content: '\e738';
  110. }
  111. .el-collapse-item__content {
  112. padding-bottom: 0;
  113. color: $--color-common;
  114. font-size: 12px;
  115. }
  116. }
  117. }
  118. </style>