origanizationItem.vue 4.8 KB

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