origanizationTree - 修改2.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view>
  3. <view class="section" v-for="(item,index) in list" :key="index">
  4. <view class="box">
  5. <view class="item">
  6. <view class="left">
  7. <view class="icon" v-if="item.children && active == index" @click="change_active(index)">
  8. <image src="./icon/close.png" mode=""></image>
  9. </view>
  10. <view class="icon" v-if="item.children && active != index" @click="change_active(index)">
  11. <image src="./icon/open.png" mode=""></image>
  12. </view>
  13. <view class="text">{{item.label}} ({{item.children.length}})</view>
  14. </view>
  15. <view class="right">
  16. <uni-icons type="eye"></uni-icons>
  17. </view>
  18. </view>
  19. <view class="list" v-for="(item_2,index_2) in item.children" :key="index_2" v-if="!item_2.children && active == index">
  20. <!-- 人 -->
  21. <view class="item">
  22. <view class="icon">{{item_2.label.charAt(0)}}</view>
  23. <view class="text">{{item_2.label}} {{item_2.id}}</view>
  24. </view>
  25. </view>
  26. <view class="list" v-for="(item_2,index_2) in item.children" v-if="item_2.children && active == index">
  27. <!-- 部门 -->
  28. <view class="item">
  29. <view class="icon" v-if="item.children && active == index" @click="change_active(index)">
  30. <image src="./icon/close.png" mode=""></image>
  31. </view>
  32. <view class="icon" v-if="item.children && active != index" @click="change_active(index)">
  33. <image src="./icon/open.png" mode=""></image>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="inner">
  39. <origanizationTree :list="list.children"></origanizationTree>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import origanizationTree from "@/components/origanizationTree/origanizationTree.vue"
  46. export default {
  47. name: "origanizationTree",
  48. components: {
  49. origanizationTree
  50. },
  51. props: [
  52. "list"
  53. ],
  54. data() {
  55. return {
  56. active: 99999999
  57. };
  58. },
  59. methods: {
  60. change_active(index) {
  61. if (this.active == index) {
  62. this.active = 99999999
  63. } else {
  64. this.active = index
  65. }
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. .section{
  72. box-sizing: border-box;
  73. padding: 0 20rpx;
  74. .box{
  75. .item{
  76. height: 95rpx;
  77. display: flex;
  78. align-items: center;
  79. justify-content: space-between;
  80. margin-left: 20rpx;
  81. border-bottom: 1rpx solid #F3F8F7;
  82. .left{
  83. display: flex;
  84. align-items: center;
  85. .icon{
  86. line-height: 95rpx;
  87. width: 90rpx;
  88. text-align: center;
  89. image{
  90. width: 24rpx;
  91. height: 24rpx;
  92. }
  93. }
  94. .text{
  95. font-size: 28rpx;
  96. }
  97. }
  98. .right{
  99. line-height: 95rpx;
  100. width: 90rpx;
  101. text-align: center;
  102. }
  103. }
  104. .list{
  105. .item{
  106. height: 95rpx;
  107. display: flex;
  108. justify-content: left;
  109. align-items: center;
  110. margin-left: 108rpx;
  111. border-bottom: 1rpx solid #F3F8F7;
  112. .icon{
  113. width: 35rpx;
  114. text-align: center;
  115. line-height: 35rpx;
  116. border-radius: 50%;
  117. border: 1rpx solid #00A1E9;
  118. font-size: 24rpx;
  119. color: #00A1E9;
  120. }
  121. .text{
  122. margin-left: 18rpx;
  123. font-size: 28rpx;
  124. }
  125. }
  126. }
  127. }
  128. .inner{
  129. }
  130. }
  131. </style>