origanizationTree - 副本.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view>
  3. <view class="section" v-for="(item,index) in list" :key="index">
  4. <view class="box">
  5. <view class="box_item">
  6. <view class="box_item_left">
  7. <view class="box_item_icon" v-if="active == index" @click="change_active(index)">
  8. <image src="./icon/close.png" mode=""></image>
  9. </view>
  10. <view class="box_item_icon" v-if="active != index" @click="change_active(index)">
  11. <image src="./icon/open.png" mode=""></image>
  12. </view>
  13. <view class="box_item_text">{{item.label}} ({{item.children.length}})</view>
  14. </view>
  15. <view class="box_item_right">
  16. <uni-icons type="eye"></uni-icons>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="inner_list" v-if="active == index">
  21. <!-- <view class="inner_item" v-for="(item_2,index_2) in item.children">
  22. <view v-if="item_2.children">
  23. <view class="box_item_icon" v-if="active_2 == index_2" @click="change_active_2(index_2)">
  24. <image src="./icon/close.png" mode=""></image>
  25. </view>
  26. <view class="box_item_icon" v-if="active_2 != index_2" @click="change_active_2(index_2)">
  27. <image src="./icon/open.png" mode=""></image>
  28. </view>
  29. </view>
  30. <view v-if="!item_2.children">
  31. <view class="inner_icon">{{item_2.label.charAt(0)}}</view>
  32. <view class="inner_text">{{item_2.label}} {{item_2.id}}</view>
  33. </view>
  34. </view>
  35. <view class="inner_box">
  36. <origanizationTree :list="list.children"></origanizationTree>
  37. </view> -->
  38. <view>
  39. <view class="inner_item" v-for="(item_2,index_2) in item.children" v-if="item_2.children">
  40. <view class="box_item_icon" v-if="active_2 == index_2" @click="change_active_2(index_2)">
  41. <image src="./icon/close.png" mode=""></image>
  42. </view>
  43. <view class="box_item_icon" v-if="active_2 != index_2" @click="change_active_2(index_2)">
  44. <image src="./icon/open.png" mode=""></image>
  45. </view>
  46. <view class="inner_box">
  47. <origanizationTree :list="list.children"></origanizationTree>
  48. </view>
  49. </view>
  50. </view>
  51. <view>
  52. <view class="inner_item" v-for="(item_2,index_2) in item.children" v-if="!item_2.children">
  53. <view class="inner_icon">{{item_2.label.charAt(0)}}</view>
  54. <view class="inner_text">{{item_2.label}} {{item_2.id}}</view>
  55. <view class="inner_box">
  56. <origanizationTree :list="list.children"></origanizationTree>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- <view class="inner_item" v-for="(item_2,index_2) in item.children">
  61. <view class="inner_icon">{{item_2.label.charAt(0)}}</view>
  62. <view class="inner_text">{{item_2.label}} {{item_2.id}}</view>
  63. </view>
  64. <view class="inner_box">
  65. <origanizationTree :list="list.children"></origanizationTree>
  66. </view> -->
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import origanizationTree from "@/components/origanizationTree/origanizationTree.vue"
  73. export default {
  74. name: "origanizationTree",
  75. components: {
  76. origanizationTree
  77. },
  78. props: [
  79. "list"
  80. ],
  81. data() {
  82. return {
  83. active: 99999999,
  84. active_2: 99999999
  85. };
  86. },
  87. methods: {
  88. change_active(index) {
  89. if (this.active == index) {
  90. this.active = 99999999
  91. } else {
  92. this.active = index
  93. }
  94. },
  95. change_active_2(index_2) {
  96. if (this.active_2 == index_2) {
  97. this.active_2 = 99999999
  98. } else {
  99. this.active_2 = index_2
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. .section {
  107. box-sizing: border-box;
  108. padding: 0 20rpx;
  109. .box {
  110. .box_item {
  111. height: 95rpx;
  112. display: flex;
  113. align-items: center;
  114. justify-content: space-between;
  115. margin-left: 20rpx;
  116. border-bottom: 1rpx solid #F3F8F7;
  117. .box_item_left {
  118. display: flex;
  119. align-items: center;
  120. .box_item_icon {
  121. line-height: 95rpx;
  122. width: 90rpx;
  123. text-align: center;
  124. image {
  125. width: 24rpx;
  126. height: 24rpx;
  127. }
  128. }
  129. .box_item_text {
  130. font-size: 28rpx;
  131. }
  132. }
  133. .box_item_right {
  134. line-height: 95rpx;
  135. width: 90rpx;
  136. text-align: center;
  137. }
  138. }
  139. }
  140. .inner_list {
  141. .inner_item {
  142. height: 95rpx;
  143. display: flex;
  144. align-items: center;
  145. margin-left: 108rpx;
  146. border-bottom: 1rpx solid #F3F8F7;
  147. .box_item_icon {
  148. line-height: 95rpx;
  149. width: 90rpx;
  150. text-align: center;
  151. image {
  152. width: 24rpx;
  153. height: 24rpx;
  154. }
  155. }
  156. .inner_icon {
  157. width: 35rpx;
  158. text-align: center;
  159. line-height: 35rpx;
  160. border-radius: 50%;
  161. border: 1rpx solid #00A1E9;
  162. font-size: 24rpx;
  163. color: #00A1E9;
  164. }
  165. .inner_text {
  166. margin-left: 18rpx;
  167. font-size: 28rpx;
  168. }
  169. }
  170. .inner_box {
  171. padding-left: 20rpx;
  172. .section {
  173. box-sizing: border-box;
  174. padding-right: 0rpx;
  175. .box {
  176. .box_item {
  177. height: 95rpx;
  178. display: flex;
  179. align-items: center;
  180. justify-content: space-between;
  181. margin-left: 20rpx;
  182. border-bottom: 1rpx solid #F3F8F7;
  183. .box_item_left {
  184. display: flex;
  185. align-items: center;
  186. .box_item_icon {
  187. line-height: 95rpx;
  188. width: 90rpx;
  189. text-align: center;
  190. image {
  191. width: 24rpx;
  192. height: 24rpx;
  193. }
  194. }
  195. .box_item_text {
  196. font-size: 28rpx;
  197. }
  198. }
  199. .box_item_right {
  200. line-height: 95rpx;
  201. width: 90rpx;
  202. text-align: center;
  203. }
  204. }
  205. }
  206. .inner_list {
  207. .inner_item {
  208. height: 95rpx;
  209. display: flex;
  210. align-items: center;
  211. margin-left: 108rpx;
  212. border-bottom: 1rpx solid #F3F8F7;
  213. .box_item_icon {
  214. line-height: 95rpx;
  215. width: 90rpx;
  216. text-align: center;
  217. image {
  218. width: 24rpx;
  219. height: 24rpx;
  220. }
  221. }
  222. .inner_icon {
  223. width: 35rpx;
  224. text-align: center;
  225. line-height: 35rpx;
  226. border-radius: 50%;
  227. border: 1rpx solid #00A1E9;
  228. font-size: 24rpx;
  229. color: #00A1E9;
  230. }
  231. .inner_text {
  232. margin-left: 18rpx;
  233. font-size: 28rpx;
  234. }
  235. }
  236. .inner_box {}
  237. }
  238. }
  239. }
  240. }
  241. }
  242. </style>