origanizationSection - 懒加载接口测试.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view>
  3. <view class="section" v-for="(item,index) in data" :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)">
  8. <image src="./icon/close.png" mode=""></image>
  9. </view>
  10. <view class="icon" v-if="active != index" @click.stop="change_active(index,item)">
  11. <image src="./icon/open.png" mode=""></image>
  12. </view>
  13. <view class="text" v-if="item.children.length == 0">{{item.title}} ({{item.user_num}})</view>
  14. <view class="text" v-if="item.children != 0">{{item.title}}</view>
  15. </view>
  16. <view class="right" @click="go_record(item.page_id)">
  17. <uni-icons type="eye"></uni-icons>
  18. </view>
  19. </view>
  20. <view class="children" v-show="active == index">
  21. <origanizationSection :data="item.children" :mine_code="mine_code"></origanizationSection>
  22. <view class="list" v-show="item.children == 0">
  23. <view class="item" v-for="(item_2,index_2) in user_list" :key="index_2"
  24. @click="go_user_info(item_2.staff_num)">
  25. <view class="left">
  26. <view class="icon">{{item_2.name.charAt(0)}}</view>
  27. <!-- #ifdef APP-PLUS -->
  28. <view class="text">{{item_2.name}} {{item_2.position_name}}</view>
  29. <!-- #endif -->
  30. <!-- #ifdef H5 -->
  31. <view class="text">{{item_2.name}} {{item_2.position_name}} {{item_2.mobile}}</view>
  32. <!-- #endif -->
  33. </view>
  34. <!-- #ifdef APP-PLUS -->
  35. <view class="right" @click.stop="phone(item_2.mobile)">
  36. <uni-icons type="phone"></uni-icons>
  37. </view>
  38. <!-- #endif -->
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. name: "origanizationSection",
  49. props: [
  50. "data",
  51. "mine_code"
  52. ],
  53. data() {
  54. return {
  55. // 当前展开部门
  56. active: 99999999,
  57. user_list: [],
  58. children: [],
  59. t:null
  60. };
  61. },
  62. methods: {
  63. // 获取部门列表
  64. get_section_getGroupList(section_id) {
  65. uni.showLoading({
  66. mask: true
  67. })
  68. this.$api.section_get_tree_structure({
  69. section_id:section_id
  70. }).then((res) => {
  71. uni.hideLoading()
  72. console.log(res.data.content.data.children)
  73. if(this.mine_code == 'ningmeijituan'){
  74. this.list = res.data.content.data.children
  75. }else{
  76. this.list = res.data.content.data
  77. }
  78. })
  79. },
  80. // 获取当前部门人员
  81. get_user_list(id) {
  82. this.user_list = []
  83. uni.showLoading({
  84. mask: true
  85. })
  86. this.$api.user_get_org_users({
  87. section_id: id
  88. }).then((res) => {
  89. uni.hideLoading()
  90. this.user_list = res.data.content.data
  91. })
  92. },
  93. change_active(index, item) {
  94. if (this.active == index) {
  95. this.active = 99999999
  96. } else {
  97. this.active = index
  98. this.children = item.children
  99. this.get_section_getGroupList(item.id)
  100. }
  101. },
  102. go_record(page_id) {
  103. console.log(page_id)
  104. if (page_id == null) {
  105. uni.showToast({
  106. icon: "none",
  107. title: "该部门还未关联二维码"
  108. })
  109. } else {
  110. console.log(page_id)
  111. uni.navigateTo({
  112. url: "../../../index/record/record?pageId=" + page_id + "&mine_code=" + uni.getStorageSync(
  113. 'mine_code'),
  114. })
  115. }
  116. },
  117. phone(mobile) {
  118. console.log(mobile)
  119. if (mobile != null) {
  120. uni.makePhoneCall({
  121. phoneNumber: mobile
  122. });
  123. } else {
  124. uni.showToast({
  125. icon: "none",
  126. title: "未绑定手机号"
  127. })
  128. }
  129. },
  130. go_user_info(staff_num) {
  131. uni.navigateTo({
  132. url: "./personal_information/personal_information?staff_num=" + staff_num
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. .section {
  140. box-sizing: border-box;
  141. // padding: 0 20rpx;
  142. .box {
  143. .item {
  144. min-height: 100rpx;
  145. padding: 10rpx 0;
  146. display: flex;
  147. align-items: center;
  148. justify-content: space-between;
  149. margin-left: 20rpx;
  150. border-bottom: 1rpx solid #F3F8F7;
  151. .left {
  152. display: flex;
  153. align-items: center;
  154. .icon {
  155. width: 90rpx;
  156. text-align: center;
  157. image {
  158. width: 24rpx;
  159. height: 24rpx;
  160. }
  161. }
  162. .text {
  163. width: 470rpx;
  164. font-size: 32rpx;
  165. }
  166. }
  167. .right {
  168. width: 90rpx;
  169. text-align: center;
  170. }
  171. }
  172. .children {
  173. margin-left: 20rpx;
  174. }
  175. .list {
  176. .item {
  177. height: 110rpx;
  178. display: flex;
  179. justify-content: space-between;
  180. align-items: center;
  181. margin-left: 108rpx;
  182. border-bottom: 1rpx solid #F3F8F7;
  183. .left {
  184. width: 500rpx;
  185. .icon {
  186. width: 35rpx;
  187. text-align: center;
  188. line-height: 35rpx;
  189. border-radius: 50%;
  190. border: 1rpx solid #00A1E9;
  191. font-size: 24rpx;
  192. color: #00A1E9;
  193. }
  194. .text {
  195. width: 350rpx;
  196. margin-left: 18rpx;
  197. font-size: 30rpx;
  198. }
  199. }
  200. .right {
  201. line-height: 110rpx;
  202. width: 90rpx;
  203. text-align: center;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. </style>