index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="page-wrap">
  3. <view class="pageTabs">
  4. <uni-segmented-control :current="tabIdx" :values="tabs" style-type="text" active-color="#007aff" @clickItem="changeTab" />
  5. </view>
  6. <view class="pageMain">
  7. <view class="teamhead">
  8. <uni-data-select v-model="teamId" class="item-select" @change="changeTeamType":localdata="teamList" :clear="false"></uni-data-select>
  9. <view class="handle-bt" @click="editTeam">
  10. <text>编辑</text>
  11. </view>
  12. </view>
  13. <uni-collapse value="0" ref="collapse" accordion>
  14. <uni-collapse-item :title="teamName">
  15. <view class="teamDuty">
  16. <text>{{teamDuty}}</text>
  17. </view>
  18. </uni-collapse-item>
  19. </uni-collapse>
  20. <view class="item-container">
  21. <view class="teamhead">
  22. <view class="item-select">
  23. <text>成员列表</text>
  24. </view>
  25. <view class="handle-bt" @click="addMember">
  26. <text>新增</text>
  27. </view>
  28. </view>
  29. <view class="item" v-for="item in items" :key="item.memberId">
  30. <view class="avatar">
  31. <image :src="item.memberAvatar" v-if="item.memberAvatar"></image>
  32. <image class="icon" src="/static/images/avatar.png" v-else></image>
  33. </view>
  34. <view class="info">
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import teamApi from '@/api/team.js'
  43. export default {
  44. data() {
  45. return {
  46. tabIdx:0,
  47. tabs:['专业救援队伍','行业救援队伍','综合抢险队伍'],
  48. teamList:[],
  49. teamId:undefined,
  50. teamId:undefined,
  51. teamName:"",
  52. teamDuty:"",
  53. items:[]
  54. }
  55. },
  56. onShow() {
  57. this.getData()
  58. },
  59. methods: {
  60. changeTab({currentIndex}){
  61. if (this.tabIdx !== currentIndex) {
  62. this.tabIdx = currentIndex
  63. this.getData()
  64. }
  65. },
  66. changeTeamType(){
  67. this.getTeamInfo()
  68. },
  69. getData(){
  70. teamApi.getByList({teamType:this.tabIdx+1}).then((res)=>{
  71. if(res.data.length>0){
  72. this.teamList=res.data.map(item=>{
  73. return{
  74. value:item.teamId,
  75. text:item.teamName
  76. }
  77. })
  78. this.teamId=res.data[0].teamId
  79. this.getTeamInfo()
  80. }
  81. })
  82. },
  83. getTeamInfo(){
  84. teamApi.getById(this.teamId).then((result)=>{
  85. this.teamName=result.data.teamName
  86. this.teamDuty=result.data.teamDuty
  87. // #ifdef MP
  88. this.$nextTick(() => {
  89. this.$refs.collapse.resize()
  90. })
  91. // #endif
  92. })
  93. teamApi.getMemberByList({teamId:this.teamId}).then((res)=>{
  94. this.items=res.data
  95. })
  96. },
  97. editTeam(){
  98. },
  99. addMember(){
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .page-wrap{
  106. padding:0 20rpx;
  107. .pageTabs{
  108. background-color: #fff;
  109. }
  110. .pageMain{
  111. margin-top: 20rpx;
  112. background-color: #f5f5f5;
  113. .teamhead{
  114. padding: 20rpx;
  115. background-color: #fff;
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: center;
  119. .item-select{
  120. width: 400rpx;
  121. }
  122. .handle-bt{
  123. padding: 20rpx 30rpx;
  124. font-size: 24rpx;
  125. color: #409eff;
  126. line-height: 1;
  127. flex-shrink: 0;
  128. }
  129. }
  130. .teamDuty{
  131. padding: 20rpx;
  132. line-height: 1.5;
  133. }
  134. .item-container{
  135. margin-top: 20rpx;
  136. padding-bottom: 50rpx;
  137. .item{
  138. &{
  139. display: flex;
  140. justify-content: space-between;
  141. align-items: center;
  142. background-color: #fff;
  143. box-shadow:0 0 2px rgba(0,0,0,0.3) ;
  144. margin-top: 20rpx;
  145. padding: 20rpx;
  146. }
  147. .avatar {
  148. flex-shrink: 0;
  149. width: 60rpx;
  150. height: 60rpx;
  151. overflow: hidden;
  152. border-radius: 50%;
  153. background-color: #ddd;
  154. image{
  155. width: 60rpx;
  156. height: 60rpx;
  157. }
  158. }
  159. }
  160. }
  161. }
  162. }
  163. </style>