index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="work-container">
  3. <u-collapse
  4. @change="change"
  5. @close="close"
  6. @open="open"
  7. >
  8. <u-collapse-item v-if="item.parentId != 0" v-for="item in deptList"
  9. :title="item.deptName"
  10. :name="item.deptId"
  11. >
  12. <text class="u-collapse-content" v-for="subitem in item.list">
  13. {{ subitem.nickName }} {{ subitem.phonenumber }} {{ subitem.createTime }}
  14. </text>
  15. </u-collapse-item>
  16. </u-collapse>
  17. </view>
  18. </template>
  19. <script>
  20. import authObj from '@/plugins/auth.js';
  21. import {getDeptList,getUserListByDept} from '@/api/user/user';
  22. export default {
  23. data() {
  24. return {
  25. current: 0,
  26. swiperDotIndex: 0,
  27. deptList:[],
  28. deptMap :{}
  29. }
  30. },
  31. onLoad(){
  32. this.getDeptList();
  33. },
  34. methods: {
  35. change(item){
  36. console.log(item)
  37. },
  38. getUser(dept){
  39. let id = dept.deptId;
  40. getUserListByDept(id).then(res=>{
  41. debugger;
  42. dept.list = res.rows;
  43. });
  44. },
  45. getDeptList(){
  46. getDeptList().then(res=>{
  47. this.deptList = res.data;
  48. for (let i = 0; i < this.deptList.length; i++) {
  49. let dept = this.deptList[i];
  50. this.deptMap[dept.deptId] = dept;
  51. }
  52. });
  53. },
  54. open(deptId){
  55. let dept = this.deptMap[deptId]
  56. if(dept.list == null){
  57. this.getUser(dept);
  58. }
  59. },
  60. close(item){
  61. },
  62. }
  63. }
  64. </script>
  65. <style lang="scss">
  66. /* #ifndef APP-NVUE */
  67. page {
  68. display: flex;
  69. flex-direction: column;
  70. box-sizing: border-box;
  71. background-color: #fff;
  72. min-height: 100%;
  73. height: auto;
  74. }
  75. view {
  76. font-size: 14px;
  77. line-height: inherit;
  78. }
  79. /* #endif */
  80. .text {
  81. text-align: center;
  82. font-size: 26rpx;
  83. margin-top: 10rpx;
  84. }
  85. .grid-item-box {
  86. flex: 1;
  87. /* #ifndef APP-NVUE */
  88. display: flex;
  89. /* #endif */
  90. flex-direction: column;
  91. align-items: center;
  92. justify-content: center;
  93. padding: 15px 0;
  94. }
  95. .uni-margin-wrap {
  96. width: 690rpx;
  97. width: 100%;
  98. ;
  99. }
  100. .swiper {
  101. height: 300rpx;
  102. }
  103. .swiper-box {
  104. height: 150px;
  105. }
  106. .swiper-item {
  107. /* #ifndef APP-NVUE */
  108. display: flex;
  109. /* #endif */
  110. flex-direction: column;
  111. justify-content: center;
  112. align-items: center;
  113. color: #fff;
  114. height: 300rpx;
  115. line-height: 300rpx;
  116. }
  117. @media screen and (min-width: 500px) {
  118. .uni-swiper-dot-box {
  119. width: 400px;
  120. /* #ifndef APP-NVUE */
  121. margin: 0 auto;
  122. /* #endif */
  123. margin-top: 8px;
  124. }
  125. .image {
  126. width: 100%;
  127. }
  128. }
  129. </style>