origanizationSection.vue 5.1 KB

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