origanizationTree.vue 2.9 KB

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