index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div>
  3. <div class="flex-align-stretch menber__panel">
  4. <div class="flex-align-center menber__item flex-between" :class="showSelelctIcon(item)?'active_menber__item':''" style="flex:1 0 auto" v-for="item in tableData" :key="item.index" @click="clickMenber(item)">
  5. <div class="flex-align-center">
  6. <div class="avatar inline-16">
  7. <img class="avatar__image" v-if="item.headpic" :src="item.headpic" alt="">
  8. <p v-else>{{item.name.substr(0, 1)}}</p>
  9. </div>
  10. <div @click="onSelect(item)">
  11. <p>{{ item.name }}</p>
  12. <small style="color:#999999ad;margin-top:10px">{{$t(`账号`)}}:{{ item.accountno?item.accountno:$t("未知账户") }}&emsp;{{$t(`手机号`)}}:{{ item.phonenumber?item.phonenumber:$t("未知") }}</small>
  13. </div>
  14. </div>
  15. <i class="el-icon-check iconCheck" v-if="showSelelctIcon(item)"></i>
  16. </div>
  17. </div>
  18. <el-empty v-if="tableData.length === 0" :description="$t('暂无数据')" :image-size="40"></el-empty>
  19. </div>
  20. </template>
  21. <script>
  22. export default {
  23. props:['param','radio','checked','implement'],
  24. data () {
  25. return {
  26. tableData: [],
  27. total:0,
  28. currentPage:0,
  29. selected:[]
  30. }
  31. },
  32. components:{
  33. },
  34. methods:{
  35. async listData (callback) {
  36. const res = await this.$api.requested(this.param)
  37. if (!this.radio) {
  38. res.data = res.data.filter(e=>{
  39. if (e.isteamleader !== 1 && e.userid !== this.implement)
  40. return e
  41. })
  42. }
  43. this.tableData = res.data
  44. console.log(this.implement)
  45. if (this.implement !== undefined && this.implement !== ''){
  46. this.total = res.total -1
  47. }else {
  48. this.total = res.total
  49. }
  50. callback && this.tableData.length && callback()
  51. this.currentPage = res.pageNumber
  52. },
  53. onSelect (data) {
  54. console.log(data,'111');
  55. this.$emit('onSelect',data)
  56. },
  57. clickMenber (item) {
  58. if (this.radio) {
  59. this.selected = []
  60. }
  61. let _isSame = this.selected.some(m=>item.userid === m.userid)
  62. if (!_isSame) {
  63. this.selected.push(item)
  64. } else {
  65. this.selected = this.selected.filter(e=>{
  66. return e.userid !== item.userid
  67. })
  68. }
  69. },
  70. showSelelctIcon (item) {
  71. let _isSame = this.selected.some(m=>item.userid === m.userid)
  72. return _isSame
  73. },
  74. closeTag (item) {
  75. this.selected = this.selected.filter(e=>{
  76. return e.userid !== item.userid
  77. })
  78. },
  79. onCancel () {
  80. this.$emit('onCancel')
  81. }
  82. },
  83. mounted () {
  84. this.listData()
  85. }
  86. }
  87. </script>
  88. <style>
  89. </style>
  90. <style scoped>
  91. .search_input{
  92. display: flex;
  93. align-items: center;
  94. flex-wrap: wrap;
  95. padding: 8px 8px 0 8px;
  96. border: 1px solid #f1f2f3;
  97. border-radius: 5px;
  98. }
  99. .input_panel{
  100. flex: 1;
  101. min-width: 100px;
  102. border:none;
  103. outline: none;
  104. margin-bottom: 8px;
  105. color:#666
  106. }
  107. .menber__item{
  108. width: calc(100% - 20px);
  109. padding:5px 10px;
  110. border-radius: 5px;
  111. cursor: pointer;
  112. color:#666;
  113. margin-bottom: 5px;
  114. transition: .2s linear;
  115. }
  116. .menber__item:hover{
  117. background: #b5e4ff6e;
  118. }
  119. .active_menber__item{
  120. background: #b5e4ff6e;
  121. }
  122. .menber__panel {
  123. max-height: 300px;
  124. overflow-y:scroll ;
  125. }
  126. .avatar{
  127. position: relative;
  128. height:30px;
  129. width: 30px;
  130. border-radius: 100%;
  131. text-align: center;
  132. line-height: 30px;
  133. color:#fff;
  134. font-weight: 500;
  135. background: #3874F6;
  136. cursor: pointer;
  137. overflow: hidden;
  138. }
  139. .avatar__image{
  140. height: 100%;
  141. width: 100%;
  142. }
  143. .avatar-mini{
  144. position: relative;
  145. height:20px;
  146. width: 20px;
  147. line-height: 20px;
  148. text-align: center;
  149. margin-right: 5px;
  150. color:#fff;
  151. font-size: 12px;
  152. font-weight: 500;
  153. border-radius: 100%;
  154. background: #3874F6;
  155. }
  156. .iconCheck{
  157. font-weight: bold;
  158. color:#3874F6
  159. }
  160. .tag{
  161. font-size: 12px;
  162. color:#666;
  163. padding: 5px;
  164. border-radius: 3px;
  165. margin:0 5px 8px 0;
  166. background: #b5e4ff6e;
  167. cursor: pointer;
  168. }
  169. </style>