selected-box.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="alreadySelect">
  3. <view class="alreadySelect__box u-flex-col">
  4. <view class="alreadySelect_hd u-flex u-p-l-32 u-p-r-32">
  5. <view>{{$t('component.jnpf.common.selected')}}</view>
  6. <view v-if="clearable" @click="clean('all')" style="color: #2979ff;">
  7. {{$t('component.jnpf.common.clearAll')}}</view>
  8. </view>
  9. <view class="select__box u-flex-col" id="box">
  10. <scroll-view scroll-y="true" style="max-height: 240rpx;">
  11. <view class="u-flex select__list">
  12. <view class="u-selectTag u-flex" v-for="(item,index) in list" :key="index">
  13. <view class="avatar">
  14. <u-avatar :src="baseURL+item.headIcon" mode="circle" size="mini"
  15. v-if="item.type==='user'">
  16. </u-avatar>
  17. <div class="selected-item-icon" v-else>{{item.fullName.substring(0,1)}}</div>
  18. </view>
  19. <view class="u-font-24 select__content">
  20. <view class="nameSty u-flex">
  21. <view class="nameUp">{{item.fullName}}</view>
  22. <u-icon name="close" class="close" @click='clean(index)'></u-icon>
  23. </view>
  24. <view class="organizeSty">{{item.organize}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. props: {
  36. clearable: {
  37. type: Boolean,
  38. default: false
  39. },
  40. selectList: {
  41. type: Array,
  42. default () {
  43. return [];
  44. }
  45. },
  46. },
  47. data() {
  48. return {
  49. list: []
  50. }
  51. },
  52. watch: {
  53. selectList(val) {
  54. this.list = val
  55. }
  56. },
  57. computed: {
  58. baseURL() {
  59. return this.define.baseURL
  60. }
  61. },
  62. methods: {
  63. clean(e) {
  64. if (e === 'all') {
  65. this.list = [];
  66. } else {
  67. this.list.splice(e, 1);
  68. }
  69. this.$emit('setSelectList', this.list)
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. .alreadySelect {
  76. width: 100%;
  77. .alreadySelect__box {
  78. .alreadySelect_hd {
  79. width: 100%;
  80. height: 60rpx;
  81. justify-content: space-between;
  82. }
  83. .select__box {
  84. width: 100%;
  85. justify-content: center;
  86. padding: 0 10px;
  87. .select__list {
  88. justify-content: flex-start;
  89. flex-wrap: wrap;
  90. border-bottom: 1rpx solid #c0c4cc;
  91. .avatar {
  92. margin-top: 8rpx;
  93. }
  94. .selected-item-icon {
  95. height: 70rpx;
  96. width: 70rpx;
  97. background: linear-gradient(193deg, #A7D6FF 0%, #1990FA 100%);
  98. border-radius: 50%;
  99. line-height: 70rpx;
  100. color: #FFFFFF;
  101. font-size: 28rpx;
  102. text-align: center;
  103. margin-bottom: 8rpx;
  104. }
  105. .u-selectTag {
  106. width: calc(50% - 20rpx);
  107. border: 1px solid #2194fa;
  108. background-color: #e8f4fe;
  109. line-height: 40rpx;
  110. margin: 10rpx;
  111. padding-left: 10rpx;
  112. align-items: center;
  113. border-radius: 8rpx;
  114. .select__content {
  115. width: 74%;
  116. margin-left: 10rpx;
  117. .nameSty {
  118. color: #353535;
  119. .nameUp {
  120. white-space: nowrap;
  121. overflow: hidden; //超出的文本隐藏
  122. text-overflow: ellipsis;
  123. }
  124. .close {
  125. width: 26px;
  126. justify-content: flex-end;
  127. color: #2194fa;
  128. margin-right: 8rpx;
  129. flex: 1;
  130. }
  131. }
  132. .organizeSty {
  133. height: 40rpx;
  134. color: #a0a1a1;
  135. white-space: nowrap;
  136. overflow: hidden; //超出的文本隐藏
  137. text-overflow: ellipsis
  138. }
  139. }
  140. }
  141. .u-size-default {
  142. padding: 6rpx 12rpx;
  143. }
  144. }
  145. }
  146. }
  147. }
  148. </style>